@alivault/pico 0.10.2 → 0.10.3
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-CEN6xdm0.js → index-DZbiiE6N.js} +2 -2
- package/.output/public/assets/{routes-YDDOri73.js → routes-Cov4KirM.js} +2 -2
- package/.output/server/_ssr/{router-CphHgwo2.mjs → router-qUSM3V8V.mjs} +2 -2
- package/.output/server/_ssr/{routes-CHNxptm_.mjs → routes-DMdIR42g.mjs} +2 -2
- package/.output/server/_ssr/{routes-CELGJtcT.mjs → routes-Ia1sMc23.mjs} +9 -2
- package/.output/server/_ssr/ssr.mjs +2 -2
- package/.output/server/{_tanstack-start-manifest_v-CIqGA3U0.mjs → _tanstack-start-manifest_v-PFy5bdx9.mjs} +4 -4
- package/.output/server/index.mjs +477 -477
- 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,$r as a,$t as o,A as s,An as c,Ar as l,At as u,B as d,Bn as f,Br as p,Bt as m,C as h,Ci as g,Cn as _,Cr as v,Ct as y,D as b,Dn as x,Dr as S,Dt as C,E as w,En as T,Et as E,F as D,Fn as O,Fr as k,Ft as A,G as j,Gn as M,Gr as N,Gt as P,H as F,Hn as I,Hr as L,Ht as R,I as z,In as B,Ir as V,It as H,J as U,Jn as ee,Jr as te,Jt as ne,K as re,Kn as W,Kr as ie,Kt as ae,L as oe,Ln as se,Lr as ce,Lt as le,M as ue,Mn as de,Mr as fe,Mt as pe,N as me,Nn as he,Nr as ge,Nt as _e,O as ve,On as ye,Or as be,Ot as G,P as xe,Pn as Se,Pr as Ce,Pt as we,Q as Te,Qn as Ee,Qr as De,Qt as Oe,R as ke,Rn as Ae,Rr as je,Rt as Me,S as Ne,Si as Pe,Sn as Fe,Sr as Ie,St as Le,T as Re,Tn as ze,Tr as Be,Tt as Ve,U as He,Un as Ue,Ur as We,Ut as Ge,V as Ke,Vn as qe,Vr as Je,Vt as Ye,W as Xe,Wn as Ze,Wr as Qe,Wt as $e,X as et,Xn as tt,Xr as nt,Xt as rt,Y as it,Yn as at,Yr as ot,Yt as st,Z as ct,Zn as lt,Zr as ut,Zt as dt,_ as ft,_i as pt,_n as mt,_r as ht,_t as gt,a as _t,ai as vt,an as yt,ar as bt,at as xt,b as St,bi as Ct,bn as wt,br as Tt,bt as Et,c as Dt,ci as Ot,cn as kt,cr as At,ct as jt,d as Mt,di as Nt,dn as Pt,dr as Ft,dt as It,ei as Lt,en as Rt,er as zt,et as Bt,f as Vt,fi as Ht,fn as Ut,fr as Wt,ft as Gt,g as Kt,gi as qt,gn as Jt,gr as Yt,gt as Xt,h as Zt,hi as Qt,hn as $t,hr as en,ht as tn,i as nn,ii as rn,in as an,ir as on,it as sn,j as cn,jn as ln,jr as un,jt as dn,k as fn,kn as pn,kr as mn,kt as hn,l as gn,li as _n,ln as vn,lr as yn,lt as bn,m as xn,mi as Sn,mn as Cn,mr as wn,mt as Tn,n as K,ni as En,nn as Dn,nr as On,nt as kn,o as An,oi as jn,on as Mn,or as Nn,ot as Pn,p as eee,pi as Fn,pn as In,pr as Ln,pt as Rn,q as zn,qn as Bn,qr as Vn,qt as Hn,r as Un,ri as Wn,rn as Gn,rr as Kn,rt as qn,s as Jn,si as Yn,sn as Xn,sr as Zn,st as Qn,t as $n,ti as er,tn as tr,tr as nr,tt as rr,u as ir,ui as ar,un as or,ur as sr,ut as cr,v as lr,vi as ur,vn as dr,vt as fr,w as pr,wn as mr,wt as hr,x as gr,xi as _r,xn as vr,xr as yr,xt as br,y as xr,yi as Sr,yn as Cr,yr as wr,yt as Tr,z as Er,zn as Dr,zr as Or,zt as kr}from"./index-CEN6xdm0.js";var Ar=class extends _r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Yn(),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),Mr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Nr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Nr(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 Sn(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&&!qt(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Pr(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Sn(this.options.enabled,this.#t)!==Sn(t.enabled,this.#t)||Qt(this.options.staleTime,this.#t)!==Qt(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Sn(this.options.enabled,this.#t)!==Sn(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 Ir(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(Nt)),t}#g(){this.#b();let e=Qt(this.options.staleTime,this.#t);if(Ot.isServer()||this.#r.isStale||!ar(e))return;let t=ur(this.#r.dataUpdatedAt,e)+1;this.#d=Sr.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,!(Ot.isServer()||Sn(this.options.enabled,this.#t)===!1||!ar(this.#p)||this.#p===0)&&(this.#f=Sr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ct.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Sr.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Sr.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&&Mr(e,t),o=i&&Pr(e,n,t,r);(a||o)&&(l={...l,...vt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Ht(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Ht(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Fr(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Sn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Yn())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}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),!qt(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){jn.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function jr(e,t){return Sn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Mr(e,t){return jr(e,t)||e.state.data!==void 0&&Nr(e,t,t.refetchOnMount)}function Nr(e,t,n){if(Sn(t.enabled,e)!==!1&&Qt(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Fr(e,t)}return!1}function Pr(e,t,n,r){return(e!==t||Sn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Fr(e,n)}function Fr(e,t){return Sn(t.enabled,e)!==!1&&e.isStaleByTime(Qt(t.staleTime,e))}function Ir(e,t){return!qt(e.getCurrentResult(),t)}var Lr=class extends _r{#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),qt(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&_n(t.mutationKey)!==_n(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??rn();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){jn.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)})})}},q=t(g(),1),Rr=q.createContext(!1),zr=()=>q.useContext(Rr);Rr.Provider;var J=Wn();function Br(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Vr=q.createContext(Br()),Hr=()=>q.useContext(Vr),Ur=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?pt(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Wr=e=>{q.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||pt(n,[e.error,r])),Kr=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))}},qr=(e,t)=>e.isLoading&&e.isFetching&&!t,Jr=(e,t)=>e?.suspense&&t.isPending,Yr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Xr(e,t,n){let r=zr(),i=Hr(),a=En(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,Kr(o),Ur(o,i,s),Wr(i);let c=!a.getQueryCache().get(o.queryHash),[l]=q.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(q.useSyncExternalStore(q.useCallback(e=>{let t=d?l.subscribe(jn.batchCalls(e)):Nt;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),q.useEffect(()=>{l.setOptions(o)},[o,l]),Jr(o,u))throw Yr(o,l,i);if(Gr({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Ot.isServer()&&qr(u,r)&&(c?Yr(o,l,i):s?.promise)?.catch(Nt).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function Zr(e,t){return Xr(e,Ar,t)}function Qr(e,t){let n=En(t),r=n.getQueryCache();return q.useSyncExternalStore(q.useCallback(e=>r.subscribe(jn.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function $r(e,t){let n=En(t);return ti({filters:{...e,status:`pending`}},n).length}function ei(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function ti(e={},t){let n=En(t).getMutationCache(),r=q.useRef(e),i=q.useRef(null);return i.current===null&&(i.current=ei(n,e)),q.useEffect(()=>{r.current=e}),q.useSyncExternalStore(q.useCallback(e=>n.subscribe(()=>{let t=Fn(i.current,ei(n,r.current));i.current!==t&&(i.current=t,jn.schedule(e))}),[n]),()=>i.current,()=>i.current)}function ni(e,t){let n=En(t),[r]=q.useState(()=>new Lr(n,e));q.useEffect(()=>{r.setOptions(e)},[r,e]);let i=q.useSyncExternalStore(q.useCallback(e=>r.subscribe(jn.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=q.useCallback((e,t)=>{r.mutate(e,t).catch(Nt)},[r]);if(i.error&&pt(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function ri(e){return typeof e==`object`&&!!e&&`current`in e}function ii(){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 ai=[`Control`,`Alt`,`Shift`,`Meta`];new Set(ai);var oi={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 si(e,t=ii()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var ci=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),li=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),ui=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),di=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),fi=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),pi=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),mi={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};new Set([...ci,...li,...ui,...di,...fi,...pi]);var hi={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 gi(e){return/^\p{Letter}$/u.test(e)}function _i(e){if(!e)return``;if(e in hi)return hi[e];if(gi(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 vi={Control:`⌃`,Alt:`⌥`,Shift:`⇧`,Meta:`⌘`,Mod:`⌘`},yi={Control:`Control`,Alt:`Option`,Shift:`Shift`,Meta:`Cmd`,Mod:`Cmd`},bi={Control:`Ctrl`,Alt:`Alt`,Shift:`Shift`,Meta:`Win`,Mod:`Ctrl`},xi={...bi,Meta:`Super`},Si={"`":`Backquote`,"\\":`Backslash`,"[":`Left Bracket`,"]":`Right Bracket`,",":`Comma`,"=":`Equal`,"-":`Minus`,".":`Period`,";":`Semicolon`},Ci={ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,Enter:`↵`,Escape:`Esc`,Backspace:`⌫`,Delete:`⌦`,Tab:`⇥`,Space:`␣`};function wi(e,t=ii()){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=_i(a);else{let e=oi[a]??oi[a.toLowerCase()];if(e){let n=si(e,t);r.add(n)}else n.length===1&&(i=_i(a))}}return!i&&n.length>0&&(i=_i(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:ai.filter(e=>r.has(e))}}function Ti(e,t=ii()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(si(`Mod`,t)===`Control`?n=!0:a=!0);let o=ai.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 Ei(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 ai)e.modifiers.includes(t)&&r.push(t);return r.push(_i(e.key)),r.join(`+`)}function Di(e,t=ii()){return Ei(wi(e,t),t)}function Oi(e,t=ii()){return Ei(e,t)}function ki(e,t=ii()){return typeof e==`string`?Di(e,t):Oi(Ti(e,t),t)}function Ai(e){return e in oi||e.toLowerCase()in oi}function ji(e){let t=[];for(let n of ai)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function Mi(e,t={}){let n=t.platform??ii(),r=t.useSymbols??!0,i=t.separatorToken??(n===`mac`&&r?` `:`+`);return ki(e,n).split(`+`).map(e=>{if(Ai(e)){let t=oi[e]??oi[e.toLowerCase()];return n===`mac`?r?vi[t]:yi[t]:n===`windows`?bi[t]:xi[t]}else return r&&Ci[e]||!r&&Si[e]||e}).join(i)}function Ni(e,t,n=ii()){let r=typeof t==`string`?wi(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=_i(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(gi(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 mi?mi[e.code]===a:!1}return i===a}var Pi={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function Fi(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function Ii(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 Li(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 Ri(e,t,n){let r=Li(t);return r&&Ii(r)&&r!==n||e.composedPath().some(e=>Ii(e)&&e!==n)?!0:Ii(e.target)&&e.target!==n}function zi(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 Bi(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 Vi=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 Hi({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&(Vi.RecursedCheck|Vi.Recursed|Vi.Dirty|Vi.Pending)?a&(Vi.RecursedCheck|Vi.Recursed)?a&Vi.RecursedCheck?!(a&(Vi.Dirty|Vi.Pending))&&c(e,i)?(i.flags=a|(Vi.Recursed|Vi.Pending),a&=Vi.Mutable):a=Vi.None:i.flags=a&~Vi.Recursed|Vi.Pending:a=Vi.None:i.flags=a|Vi.Pending,a&Vi.Watching&&t(i),a&Vi.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&Vi.Dirty)a=!0;else if((c&(Vi.Mutable|Vi.Dirty))===(Vi.Mutable|Vi.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(Vi.Mutable|Vi.Pending))===(Vi.Mutable|Vi.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&=~Vi.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&(Vi.Pending|Vi.Dirty))===Vi.Pending&&(n.flags=r|Vi.Dirty,(r&(Vi.Watching|Vi.RecursedCheck))===Vi.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 Ui(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 Wi=[],Gi=0,{link:Ki,unlink:qi,propagate:Ji,checkDirty:Yi,shallowPropagate:Xi}=Hi({update(e){return e._update()},notify(e){Wi[Qi++]=e,e.flags&=~Vi.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Vi.Mutable|Vi.Dirty,na(e))}}),Zi=0,Qi=0,$i,ea=0;function ta(e){try{++ea,e()}finally{--ea||ra()}}function na(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=qi(n,e)}function ra(){if(!(ea>0)){for(;Zi<Qi;){let e=Wi[Zi];Wi[Zi++]=void 0,e.notify()}Zi=0,Qi=0}}function ia(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?Vi.None:Vi.Mutable,get(){return $i!==void 0&&Ki(i,$i,Gi),i._snapshot},subscribe(e){let t=Ui(e),n={current:!1},r=aa(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=$i,o=t?.compare??Object.is;if(n)$i=i,++Gi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=Vi.Mutable|Vi.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{$i=a,n&&(i.flags&=~Vi.RecursedCheck),na(i)}}};return n?(i.flags=Vi.Mutable|Vi.Dirty,i.get=function(){let e=i.flags;if(e&Vi.Dirty||e&Vi.Pending&&Yi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Xi(e)}}else e&Vi.Pending&&(i.flags=e&~Vi.Pending);return $i!==void 0&&Ki(i,$i,Gi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Ji(e),Xi(e),ra())}},i}function aa(e){let t=()=>{let t=$i;$i=n,++Gi,n.depsTail=void 0,n.flags=Vi.Watching|Vi.RecursedCheck;try{return e()}finally{$i=t,n.flags&=~Vi.RecursedCheck,na(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Vi.Watching|Vi.RecursedCheck,notify(){let e=this.flags;e&Vi.Dirty||e&Vi.Pending&&Yi(this.deps,this)?t():this.flags=Vi.Watching},stop(){this.flags=Vi.None,this.depsTail=void 0,na(this)}};return t(),n}var oa=class{constructor(e,t){this.atom=ia(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(Ui(e))}},sa=class{constructor(e){this.atom=ia(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Ui(e))}};function ca(e,t){return typeof e==`function`?new sa(e):t?new oa(e,t):new oa(e)}function la(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=ua(e);if(n.length!==ua(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 ua(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var da=0;function fa(){return`hotkey_${++da}`}var tee=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new oa(new Map),this.#t=ii()}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:fa(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=fa(),i=n.platform??this.#t,a=typeof e==`string`?wi(e,i):Ti(e,i),o=typeof e==`string`?e:ji(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&Bi(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??Fi(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...Pi,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&&zi(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&Ri(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;Ni(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`&&Ni(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=_i(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 pa(){return tee.getInstance()}function ma(e,t={}){let n=a().hotkey,r=pa(),i=t.platform??n?.platform??ii(),o=(0,q.useRef)(new Map),s=(0,q.useRef)(e),c=(0,q.useRef)([]),l=(0,q.useRef)(t),u=(0,q.useRef)(n),d=(0,q.useRef)(r),f=e.map(e=>ki(e.hotkey,i));s.current=e,c.current=f,l.current=t,u.current=n,d.current=r,(0,q.useEffect)(()=>{let e=o.current,t=new Map,n=[];for(let e=0;e<s.current.length;e++){let t=s.current[e],r=c.current[e],i={...u.current,...l.current,...t.options},a=ri(i.target)?i.target.current:i.target??(typeof document<`u`?document:null);if(!a)continue;let o=`${e}:${r}`;n.push({registrationKey:o,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=d.current.register(a,i.callback,{...o,target:s});t.set(n,{handle:l,target:s})}o.current=t}),(0,q.useEffect)(()=>()=>{for(let{handle:e}of o.current.values())e.isActive&&e.unregister();o.current=new Map},[]);for(let r=0;r<e.length;r++){let i=e[r],a=f[r],s=`${r}:${a}`,c=o.current.get(s)?.handle;if(c?.isActive){c.callback=i.callback;let{target:e,...r}={...n,...t,...i.options};c.setOptions(r)}}}var ha=er();function ga(e,t){return e===t}function _a(e,t=e=>e,n){let r=n?.compare??ga,i=(0,q.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,q.useCallback)(()=>e.get(),[e]);return(0,ha.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var va=0;function ya(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(va);let a=()=>e?.focus({preventScroll:n});if(i)return a(),Ce;let o=requestAnimationFrame(a);return va=o,()=>{va===o&&(cancelAnimationFrame(o),va=0)}}var ba={inert:new WeakMap,"aria-hidden":new WeakMap},xa=`data-base-ui-inert`,Sa={inert:new WeakSet,"aria-hidden":new WeakSet},Ca=new WeakMap,wa=0;function nee(e){return Sa[e]}function Ta(e){return e?wn(e)?e.host:Ta(e.parentNode):null}var Ea=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ta(t);return e.contains(n)?n:null}).filter(e=>e!=null),Da=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Oa=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Zn(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function ka(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=Ea(t,e),u=i?Ea(t,a):[],d=new Set(u),f=i?Oa(t,Da(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=ba[o],n=nee(o);c=n,s=e;let r=Ea(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);Oa(t,Da(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=(Ca.get(e)||0)+1;Ca.set(e,t),m.push(e),t===1&&e.setAttribute(xa,``)}),wa+=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=(Ca.get(e)||0)-1;Ca.set(e,t),t||e.removeAttribute(xa)}),--wa,wa||(ba.inert=new WeakMap,ba[`aria-hidden`]=new WeakMap,Sa.inert=new WeakSet,Sa[`aria-hidden`]=new WeakSet,Ca=new WeakMap)}}function Aa(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:a=!0,markerIgnoreElements:o=[]}=t,s=i(e[0]).body;return ka(e,s,n,r,{mark:a,markerIgnoreElements:o})}function ja(e,t){let n=yn(Bn(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 Ma=20,Na=[];function Pa(){Na=Na.filter(e=>e.deref()?.isConnected)}function Fa(e){Pa(),e&&Zn(e)!==`body`&&(Na.push(new WeakRef(e)),Na.length>Ma&&(Na=Na.slice(-Ma)))}function Ia(){return Pa(),Na[Na.length-1]?.deref()}function La(e){return e?c(e)?e:ln(e)[0]||e:null}function Ra(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():Dr(e)}function za(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=mr(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return c(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 Ba(e){let{context:t,children:n,disabled:r=!1,initialFocus:a=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:l=!0,closeOnFocusOut:u=!0,openInteractionType:d=``,nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:h,getInsideElements:g}=e,v=`rootStore`in t?t.rootStore:t,y=v.useState(`open`),b=v.useState(`domReferenceElement`),x=v.useState(`floatingElement`),{events:S,dataRef:C}=v.context,w=On(()=>C.current.floatingContext?.nodeId),E=a===!1,D=Ue(b)&&E,O=q.useRef([`content`]),k=Kn(a),A=Kn(o),j=Kn(d),N=Ut(h),P=$t(),F=q.useRef(!1),R=q.useRef(!1),z=q.useRef(!1),B=q.useRef(null),V=q.useRef(``),H=q.useRef(``),U=q.useRef(null),ee=q.useRef(null),te=on(U,m,P?.beforeInsideRef),ne=on(ee,P?.afterInsideRef),re=Qe(),ie=Qe(),ae=nr(),oe=P!=null,se=I(x),le=On((e=se)=>e?ln(e):[]),ue=On(()=>g?.().filter(e=>e!=null)??[]);q.useEffect(()=>{if(r||!l)return;function e(e){e.key===`Tab`&&W(se,M(i(se)))&&le().length===0&&!D&&Or(e)}return Nn(i(se),`keydown`,e)},[r,b,se,l,O,D,le]),q.useEffect(()=>{if(r||!y)return;let e=i(se);function t(){z.current=!1}function n(e){let t=Bn(e),n=ue();z.current=!(W(x,t)||W(b,t)||W(P?.portalNode,t)||n.some(e=>e===t||W(e,t))),H.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(R.current=!0)}function a(){H.current=`keyboard`}return bt(Nn(e,`pointerdown`,n,!0),Nn(e,`pointerup`,t,!0),Nn(e,`pointercancel`,t,!0),Nn(e,`keydown`,a,!0))},[r,x,b,se,y,P,ue]),q.useEffect(()=>{if(r||!u)return;let e=i(se);function t(){R.current=!0,ie.start(0,()=>{R.current=!1})}function n(e){let t=Bn(e);c(t)&&(B.current=t)}function a(t){let n=t.relatedTarget,r=t.currentTarget,i=Bn(t);queueMicrotask(()=>{let a=w(),o=v.context.triggerElements,c=ue(),u=n?.hasAttribute(vr(`focus-guard`))&&[U.current,ee.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Xn(p),Xn(f)].includes(n),d=!(W(b,n)||W(x,n)||W(n,x)||W(P?.portalNode,n)||c.some(e=>e===n||W(e,n))||n!=null&&o.hasElement(n)||o.hasMatchingElement(e=>W(e,n))||u||N&&(_(N.nodesRef.current,a).find(e=>W(e.context?.elements.floating,n)||W(e.context?.elements.domReference,n))||Fe(N.nodesRef.current,a).find(e=>[e.context?.elements.floating,I(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===b&&se&&za(se,O),s&&r!==b&&!Ra(i)&&M(e)===e.body){if(Ft(se)&&(se.focus(),s===`popup`)){ae.request(()=>{se.focus()});return}let e=le(),t=B.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||se;Ft(n)&&n.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(D||!l)&&n&&d&&!R.current&&(D||n!==Ia())&&(F.current=!0,v.setOpen(!1,en(wr,t)))})}function o(){z.current||(C.current.insideReactTree=!0,re.start(0,()=>{C.current.insideReactTree=!1}))}let d=Ft(b)?b:null;if(!(!x&&!d))return bt(d&&Nn(d,`focusout`,a),d&&Nn(d,`pointerdown`,t),x&&Nn(x,`focusin`,n),x&&Nn(x,`focusout`,a),x&&P&&Nn(x,`focusout`,o,!0))},[r,b,x,se,l,N,P,v,u,s,le,D,w,O,C,re,ie,ae,f,p,ue]),q.useEffect(()=>{if(r||!x||!y)return;let e=Array.from(P?.portalNode?.querySelectorAll(`[${vr(`portal`)}]`)||[]),t=(N?Fe(N.nodesRef.current,w()):[]).find(e=>Ue(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Aa([...[x,...e,U.current,ee.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,...ue()],t,Xn(p),Xn(f),D?b:null].filter(e=>e!=null),{ariaHidden:l||D,mark:!1}),i=Aa([x,...e].filter(e=>e!=null));return()=>{i(),n()}},[y,r,b,x,l,O,P,D,N,w,f,p,ue]),Vn(()=>{if(!y||r||!Ft(se))return;let e=M(i(se));queueMicrotask(()=>{let t=k.current,n=typeof t==`function`?t(j.current||``):t;if(n===void 0||n===!1||W(se,e))return;let r=null,i=()=>(r??=le(se),r[0]||se),a;a=n===!0||n===null?i():Xn(n),a||=i(),ya(a,{preventScroll:a===se})})},[r,y,se,E,le,k,j]),Vn(()=>{if(r||!se)return;let e=i(se);Fa(M(e));function t(e){if(e.open||(V.current=ja(e.nativeEvent,H.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(F.current=!0),e.reason===`outside-press`)if(e.nested)F.current=!1;else if(ce(e.nativeEvent)||je(e.nativeEvent))F.current=!1;else{let e=!1;i(se).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?F.current=!1:F.current=!0}}S.on(`openchange`,t);function n(){let e=A.current,t=typeof e==`function`?e(V.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=b||Ia();return e&&e.isConnected?e:null}let n=b||Ia();return Xn(t)||n||null}return()=>{S.off(`openchange`,t);let r=M(e),i=ue(),a=W(x,r)||i.some(e=>e===r||W(e,r))||N&&_(N.nodesRef.current,w(),!1).some(e=>W(e.context?.elements.floating,r)),o=A.current,s=n();queueMicrotask(()=>{let t=La(s),n=typeof o!=`boolean`;o&&!F.current&&Ft(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),F.current=!1})}},[r,x,se,A,C,S,N,b,w,ue]),Vn(()=>{if(!L||y||!x)return;let e=M(i(x));!Ft(e)||!Ze(e)||W(x,e)&&e.blur()},[y,x]),Vn(()=>{if(!(r||!P))return P.setFocusManagerState({modal:l,closeOnFocusOut:u,open:y,onOpenChange:v.setOpen,domReference:b}),()=>{P.setFocusManagerState(null)}},[r,P,l,y,v,u,b]),Vn(()=>{if(!(r||!se))return za(se,O),()=>{queueMicrotask(Pa)}},[r,se,O]);let de=!r&&(l?!D:!0)&&(oe||l);return(0,J.jsxs)(q.Fragment,{children:[de&&(0,J.jsx)(Ee,{"data-type":`inside`,ref:te,onFocus:e=>{if(l){let e=le();ya(e[e.length-1])}else P?.portalNode&&(F.current=!1,pn(e,P.portalNode)?ze(b)?.focus():Xn(p??P.beforeOutsideRef)?.focus())}}),n,de&&(0,J.jsx)(Ee,{"data-type":`inside`,ref:ne,onFocus:e=>{l?ya(le()[0]):P?.portalNode&&(u&&(F.current=!0),pn(e,P.portalNode)?T(b)?.focus():Xn(f??P.afterOutsideRef)?.focus())}})]})}function Va(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=be}=t,d=q.useRef(void 0),f=nr(),p=Qe(),m=q.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`||V(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=Bn(i);if(Ze(y)){let e=en(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=en(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(V(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)||k(f))),g=en(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 q.useMemo(()=>i?{reference:m}:ge,[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 ree=`Escape`;function Ua(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Wa(e,t){return Ua(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Ga(e,t,n){return Ua(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function iee(e,t,n){return Ua(t,n?e===at:e===tt,e===ee)}function aee(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ree:Ua(t,n?e===tt:e===at,e===lt)}function oee(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),a=n.useState(`floatingElement`),o=n.useState(`domReferenceElement`),s=n.context.dataRef,{listRef:c,activeIndex:l,onNavigate:u=()=>{},enabled:d=!0,selectedIndex:p=null,allowEscape:m=!1,loopFocus:h=!1,nested:g=!1,rtl:_=!1,virtual:v=!1,focusItemOnOpen:y=`auto`,focusItemOnHover:b=!0,openOnArrowKeyDown:x=!0,disabledIndices:S=void 0,orientation:C=`vertical`,parentOrientation:w,cols:T=1,id:E,resetOnPointerLeave:D=!0,externalTree:k}=t,A=Kn(I(a)),j=Pt(),N=Ut(k);Vn(()=>{s.current.orientation=C},[s,C]);let P=Ue(o),F=q.useRef(y),L=q.useRef(p??-1),R=q.useRef(null),z=q.useRef(!0),V=On(e=>{u(L.current===-1?null:L.current,e)}),H=q.useRef(V),U=q.useRef(!!a),ee=q.useRef(r),te=q.useRef(!1),ne=q.useRef(!1),re=q.useRef(null),ie=Kn(S),ae=Kn(r),oe=Kn(p),le=Kn(D),ue=On(()=>{function e(e){v?N?.events.emit(`virtualfocus`,e):re.current=ya(e,{sync:te.current,preventScroll:!0})}let t=c.current[L.current],n=ne.current;t&&e(t),(te.current?e=>e():requestAnimationFrame)(()=>{let r=c.current[L.current]||t;r&&(t||e(r),me&&(n||!z.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Vn(()=>{d&&(r&&a?(L.current=p??-1,F.current&&p!=null&&(ne.current=!0,V())):U.current&&(L.current=-1,H.current()))},[d,r,a,p,V]),Vn(()=>{if(d){if(!r){te.current=!1;return}if(a)if(l==null){if(te.current=!1,oe.current!=null)return;if(U.current&&(L.current=-1,ue()),(!ee.current||!U.current)&&F.current&&(R.current!=null||F.current===!0&&R.current==null)){let e=0,t=()=>{c.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(L.current=R.current==null||Ga(R.current,C,_)||g?Ae(c):se(c),R.current=null,V())};t()}}else f(c.current,l)||(L.current=l,ue(),ne.current=!1)}},[d,r,a,l,oe,g,c,C,_,V,ue,ie]),Vn(()=>{if(!d||a||!N||v||!U.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=M(i(a)),r=e.some(e=>e.context&&W(e.context.elements.floating,n));t&&!r&&z.current&&t.focus({preventScroll:!0})},[d,a,N,j,v]),Vn(()=>{H.current=V,ee.current=r,U.current=!!a}),Vn(()=>{r||(R.current=null,F.current=y)},[r,y]);let fe=l!=null,pe=On(e=>{if(!ae.current)return;let t=c.current.indexOf(e.currentTarget);t!==-1&&(L.current!==t||l!==t)&&(L.current=t,V(e))}),me=q.useMemo(()=>({onFocus(e){te.current=!0,pe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){te.current=!0,ne.current=!1,b&&pe(e)},onPointerLeave(e){if(!ae.current||!z.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!Ha(e)&&!(!b||c.current.includes(t))&&le.current&&(re.current?.(),re.current=null,L.current=-1,V(e),!v)){let e=A.current,t=M(i(e));e&&W(e,t)&&e.focus({preventScroll:!0})}}}),[pe,ae,A,b,c,V,le,v]),ge=q.useCallback(()=>w??N?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation,[j,N,w]),_e=On(e=>{if(z.current=!1,te.current=!0,e.which===229||!ae.current&&e.currentTarget===A.current)return;if(g&&aee(e.key,C,_,T)){Wa(e.key,ge())||Or(e),n.setOpen(!1,en(Ie,e.nativeEvent)),Ft(o)&&(v?N?.events.emit(`virtualfocus`,o):o.focus());return}let t=L.current,i=Ae(c,S),a=se(c,S);if(P||(e.key===`Home`&&(Or(e),L.current=i,V(e)),e.key===`End`&&(Or(e),L.current=a,V(e))),T>1){let t=Array.from({length:c.current.length},()=>({width:1,height:1})),n=de(t,T,!1),r=n.findIndex(e=>e!=null&&!qe(c.current,e,S)),o=n.reduce((e,t,n)=>t!=null&&!qe(c.current,t,S)?n:e,-1),s=n[B(n.map(e=>e==null?null:c.current[e]),{event:e,orientation:C,loopFocus:h,rtl:_,cols:T,disabledIndices:O([...(typeof S==`function`?null:S)||c.current.map((e,t)=>qe(c.current,t,S)?t:void 0),void 0],n),minIndex:r,maxIndex:o,prevIndex:Se(L.current>a?i:L.current,t,n,T,e.key===`ArrowDown`?`bl`:e.key===(_?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(s!=null&&(L.current=s,V(e)),C===`both`)return}if(Wa(e.key,C)){if(Or(e),r&&!v&&M(e.currentTarget.ownerDocument)===e.currentTarget){L.current=Ga(e.key,C,_)?i:a,V(e);return}Ga(e.key,C,_)?h?t>=a?m&&t!==c.current.length?L.current=-1:(te.current=!1,L.current=i):L.current=he(c.current,{startingIndex:t,disabledIndices:S}):L.current=Math.min(a,he(c.current,{startingIndex:t,disabledIndices:S})):h?t<=i?m&&t!==-1?L.current=c.current.length:(te.current=!1,L.current=a):L.current=he(c.current,{startingIndex:t,decrement:!0,disabledIndices:S}):L.current=Math.max(i,he(c.current,{startingIndex:t,decrement:!0,disabledIndices:S})),f(c.current,L.current)&&(L.current=-1),V(e)}}),ve=q.useMemo(()=>v&&r&&fe&&{"aria-activedescendant":`${E}-${l}`},[v,r,fe,E,l]),ye=q.useMemo(()=>({"aria-orientation":C===`both`?void 0:C,...P?{}:ve,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!v){let t=Bn(e.nativeEvent);if(t&&!W(A.current,t))return;Or(e),n.setOpen(!1,en(wr,e.nativeEvent)),Ft(o)&&o.focus();return}_e(e)},onPointerMove(){z.current=!0}}),[ve,_e,A,C,P,n,r,v,o]),be=q.useMemo(()=>{function e(e){y===`auto`&&ce(e.nativeEvent)&&(F.current=!v)}function t(e){F.current=y,y===`auto`&&je(e.nativeEvent)&&(F.current=!0)}return{onKeyDown(e){let t=n.select(`open`);z.current=!1;let r=e.key.startsWith(`Arrow`),i=iee(e.key,ge(),_),a=Wa(e.key,C),o=(g?i:a)||e.key===`Enter`||e.key.trim()===``;if(v&&t)return _e(e);if(!(!t&&!x&&r)){if(o){let t=Wa(e.key,ge());R.current=g&&t?null:e.key}if(g){i&&(Or(e),t?(L.current=Ae(c,ie.current),V(e)):n.setOpen(!0,en(Ie,e.nativeEvent,e.currentTarget)));return}a&&(oe.current!=null&&(L.current=oe.current),Or(e),!t&&x?n.setOpen(!0,en(Ie,e.nativeEvent,e.currentTarget)):_e(e),t&&V(e))}},onFocus(e){n.select(`open`)&&!v&&(L.current=-1,V(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[_e,ie,y,c,g,V,n,x,C,ge,_,oe,v]),G=q.useMemo(()=>({...ve,...be}),[ve,be]);return q.useMemo(()=>d?{reference:G,floating:ye,item:me,trigger:be}:{},[d,G,ye,be,me])}var see=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Ka(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=wt(),l=a?.id||c,u=q.useMemo(()=>I(o)?.id||i,[o,i]),d=see.get(s)??s,f=Pt()!=null,p=q.useMemo(()=>d===`tooltip`||s===`label`?ge:{"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=q.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=q.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=q.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 q.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function qa(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Qe(),m=q.useRef(``),h=q.useRef(f??s??-1),g=q.useRef(null);Vn(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),Vn(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=On(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=On(e=>{function t(e){let t=o?.current[e];return!t||Dr(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(m.current.length>0&&e.key===` `&&(Or(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(Or(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=On(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=W(r,t),o=W(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),b=q.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),x=q.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return q.useMemo(()=>u?{reference:b,floating:x}:{},[u,b,x])}function Ja(e){return Cr(19)?e:e?`true`:void 0}var Ya=C(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Xa=C(`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`}]]),Za=C(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Qa=C(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),$a=C(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),eo=C(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),to=C(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),no=C(`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`}]]),ro=C(`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`}]]),io=C(`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`}]]),ao=C(`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`}]]),oo=C(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),so=C(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),co=C(`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`}]]),lo=C(`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`}]]),uo=C(`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`}]]),fo=C(`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`}]]),po=C(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),mo=C(`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`}]]),ho=C(`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`}]]),go=C(`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`}]]),_o=C(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),vo=C(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),yo=C(`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`}]]),bo=C(`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`}]]),cee=C(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),lee=C(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),uee=C(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),xo=C(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),dee=C(`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`}]]),So=C(`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`}]]),fee=C(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Co=C(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),pee=C(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),wo=C(`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`}]]),mee=C(`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`}]]),To=C(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function hee(e){return typeof e==`function`}function Eo(e,...t){return hee(e)?e(...t):e}var gee=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)}},_ee=new Map;function vee(e,t){_ee.set(e,t)}function Do(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function yee(e){return typeof e.get==`function`?e.get():e.state}function bee(e){return{key:e.key,store:{state:Do(yee(e.store))},options:Do(e.options)}}var xee=class extends gee{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}},Oo=(e,t)=>{let n=t.key;n&&(vee(n,t),ko.emit(e,bee({...t,key:n})))},ko=new xee;function Ao(){return{currentAttempt:0,executionCount:0,isExecuting:!1,lastError:void 0,lastExecutionTime:0,lastResult:void 0,status:`idle`,totalExecutionTime:0}}var jo={backoff:`exponential`,baseWait:1e3,maxWait:1/0,enabled:!0,jitter:0,maxAttempts:3,maxExecutionTime:1/0,maxTotalExecutionTime:1/0,throwOnError:`last`},Mo=class{#e;constructor(e,t={}){this.fn=e,this.store=new oa(Ao()),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`}}),Oo(`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(Ao())},this.key=t.key,this.options={...jo,...t,throwOnError:t.throwOnError??(t.onError?!1:jo.throwOnError)},this.#t(this.options.initialState??{}),this.key&&ko.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 No(){return{canLeadingExecute:!0,errorCount:0,isExecuting:!1,isPending:!1,lastArgs:void 0,lastResult:void 0,maybeExecuteCount:0,settleCount:0,status:`idle`,successCount:0}}var Po={asyncRetryerOptions:{maxAttempts:1},enabled:!0,leading:!1,trailing:!0,wait:0},Fo=class{#e;#t;constructor(e,t){this.fn=e,this.store=new oa(No()),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`}}),Oo(`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 Mo(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(No()),this.asyncRetryers.forEach(e=>e.reset())},this.key=t.key,this.options={...Po,...t,throwOnError:t.throwOnError??!t.onError},this.#n(this.options.initialState??{}),this.key&&ko.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 Io(){return{executionCount:0,isEmpty:!0,isPending:!1,totalItemsProcessed:0,items:[],size:0,status:`idle`}}var Lo={getShouldExecute:()=>!1,maxSize:1/0,started:!0,wait:1/0},Ro=class{#e;constructor(e,t){this.fn=e,this.store=new oa(Io()),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`}}),Oo(`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(Io()),this.options.onItemsChange?.(this)},this.key=t.key,this.options={...Lo,...t},this.#t(this.options.initialState??{}),this.key&&ko.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 zo(){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},Vo=class{#e;constructor(e,t){this.fn=e,this.store=new oa(zo()),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`}}),Oo(`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(zo())},this.key=t.key,this.options={...Bo,...t},this.#t(this.options.initialState??{}),this.key&&ko.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};function Ho(e){return Jt(e.defaultTagName??`div`,e,e)}var Y=Lt(),Uo=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Wo=hn,Go=(e,t)=>n=>{if(t?.variants==null)return Wo(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=Uo(t)||Uo(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 Wo(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)},Ko=768;function qo(){let e=(0,Y.c)(2),[t,n]=q.useState(void 0),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${Ko-1}px)`),t=()=>{n(window.innerWidth<Ko)};return e.addEventListener(`change`,t),n(window.innerWidth<Ko),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),q.useEffect(r,i),!!t}var Jo=4,Yo=.5,Xo=.2,Zo=20,Qo=10,$o=320,es=256,ts=512;function ns(){if(typeof window>`u`)return`col-resize`;let e=window.navigator.userAgent;return e.includes(`Chrome`)||e.includes(`Firefox`)?`ew-resize`:`col-resize`}function rs(){if(typeof window>`u`)return`row-resize`;let e=window.navigator.userAgent;return e.includes(`Chrome`)||e.includes(`Firefox`)?`ns-resize`:`row-resize`}function is(){return typeof window>`u`?Qo:window.matchMedia(`(pointer:coarse)`).matches?Zo:Qo}function as(e){let t=document.createElement(`style`);return t.dataset.resizeCursor=`true`,t.textContent=`*, *:hover { cursor: ${e} !important; }`,document.head.append(t),()=>t.remove()}function os(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 ss(e,t,n){return Math.min(Math.max(e,t),n)}function cs(e){return e.closest(`[data-slot='sidebar']`)?.dataset.side===`right`?`right`:`left`}function ls(e){return e.closest(`[data-slot='sidebar-wrapper']`)}function us(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 ds(e){e.previewAnimationFrame!==null&&(window.cancelAnimationFrame(e.previewAnimationFrame),e.previewAnimationFrame=null)}function fs(e,t){let n=t-e.startX;return e.side===`left`?e.startWidth+n:e.startWidth-n}function ps(e,t){return e.side===`left`?t>e.startX:t<e.startX}function ms(e){let t=q.useRef(e);return t.current=e,t}function hs(e){let t=(0,Y.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?Xo: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=ms(m),g=q.useRef(!1),_=q.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]),q.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=os(t.minWidth,es),r=os(t.maxWidth,ts),i=os(t.width,$o),a={collapsed:t.state!==`expanded`,latestWidth:null,moved:!1,previewAnimationFrame:null,previewElement:ls(e.currentTarget),previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect,side:cs(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?.(),ds(a),Object.assign(document.body.style,{cursor:a.previousCursor,userSelect:a.previousUserSelect}),a.moved&&h.current.onResizeActiveChange(!1),_.current=null},c=()=>{let e=ns();a.moved=!0,g.current=!0,h.current.onResizeActiveChange(!0),o=as(e),Object.assign(document.body.style,{cursor:e,userSelect:`none`})},l=e=>{let t=`${Math.round(n)}px`;us(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`;us(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<Jo)return;a.moved||c(),e.preventDefault();let i=fs(a,e.clientX);if(a.collapsed){let t=n*h.current.expandThreshold;ps(a,e.clientX)&&i>=t&&u(e.clientX);return}if(i<=n*Yo){l(e.clientX);return}let o=ss(i,n,r);us(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}var gs=q.createContext(void 0);function _s(e=!1){let t=q.useContext(gs);if(t===void 0&&!e)throw Error(ie(16));return t}function vs(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:q.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 ys(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=q.useRef(null),s=_s(!0),c=a??s!==void 0,{props:l}=vs({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=q.useCallback(()=>{let e=o.current;bs(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Vn(u,[u]),{getButtonProps:q.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return dr({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(mt(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=bs(a),l=!i&&xs(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||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(mt(e),a?.(e),e.target===e.currentTarget&&i&&c&&bs(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:On(e=>{o.current=e,u()})}}function bs(e){return Ft(e)&&e.tagName===`BUTTON`}function xs(e){return!!(e?.tagName===`A`&&e?.href)}var Ss=q.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}=ys({disabled:i,focusableWhenDisabled:a,native:o});return Jt(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Cs=Go(`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 ws(e){let t=(0,Y.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=G(Cs({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,J.jsx)(Ss,{"data-slot":`button`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var Ts=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}({}),Es={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ds={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Os={disabled:!1,...Ds},ks={valid(e){return e===null?null:e?{[Ts.valid]:``}:{[Ts.invalid]:``}}},As=q.createContext({invalid:void 0,name:void 0,validityData:{state:Es,errors:[],error:``,value:``,initialValue:null},setValidityData:Ce,disabled:void 0,touched:Ds.touched,setTouched:Ce,dirty:Ds.dirty,setDirty:Ce,filled:Ds.filled,setFilled:Ce,focused:Ds.focused,setFocused:Ce,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Os,markedDirtyRef:{current:!1},registerFieldControl:Ce,validation:{getValidationProps:(e=ge)=>e,getInputValidationProps:(e=ge)=>e,inputRef:{current:null},commit:async()=>{}}});function js(e=!0){let t=q.useContext(As);if(t.setValidityData===Ce&&!e)throw Error(ie(28));return t}var See=q.createContext({controlId:void 0,registerControlId:Ce,labelId:void 0,setLabelId:Ce,messageIds:[],setMessageIds:Ce,getDescriptionProps:e=>e});function Ms(){return q.useContext(See)}function Ns({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=q.useRef(e!==void 0),[a,o]=q.useState(t);return[i?e:a,q.useCallback(e=>{i||o(e)},[])]}function Cee(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=js(),s=q.useRef(null);s.current||=Symbol(),Vn(()=>{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 wee(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=Ms(),o=A(t),s=n?i:void 0,c=ut(()=>Symbol(`labelable-control`)),l=q.useRef(!1),u=q.useRef(t!=null),d=On(()=>{!l.current||a===Ce||(l.current=!1,a(c.current,void 0))});return Vn(()=>{if(a===Ce)return;let e;if(n){let n=r?.current;e=sr(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),q.useEffect(()=>d,[d]),i??o}var Tee=q.forwardRef(function(e,t){let{render:n,className:r,id:a,name:o,value:s,disabled:c=!1,onValueChange:l,defaultValue:u,autoFocus:d=!1,style:f,...p}=e,{state:m,name:h,disabled:g,setTouched:_,setDirty:y,validityData:b,setFocused:x,setFilled:S,validationMode:C,validation:w}=js(),T=g||c,E=h??o,D={...m,disabled:T},{labelId:O}=Ms(),k=wee({id:a});Vn(()=>{let e=s!=null;w.inputRef.current?.value||e&&s!==``?S(!0):e&&s===``&&S(!1)},[w.inputRef,S,s]);let A=q.useRef(null);Vn(()=>{d&&A.current===M(i(A.current))&&x(!0)},[d,x]);let[j]=Ns({controlled:s,default:u,name:`FieldControl`,state:`value`}),N=s!==void 0,P=N?j:void 0,F=On(()=>w.inputRef.current?.value);return Cee(w.inputRef,{id:k,value:P,getValue:F}),Jt(`input`,e,{ref:[t,A],state:D,props:[{id:k,disabled:T,name:E,ref:w.inputRef,"aria-labelledby":O,autoFocus:d,...N?{value:P}:{defaultValue:u},onChange(e){let t=e.currentTarget.value;l?.(t,en(v,e.nativeEvent)),y(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:ks})}),Eee=q.forwardRef(function(e,t){return(0,J.jsx)(Tee,{ref:t,...e})});function Ps(e){let t=(0,Y.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=G(`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,J.jsx)(Eee,{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 Fs=`after:transition-colors after:duration-150 hover:after:bg-primary focus-visible:after:bg-primary active:after:bg-primary`,Dee=`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`,Is=q.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Jt(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Oee(e){let t=(0,Y.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=G(`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,J.jsx)(Is,{"data-slot":`separator`,orientation:a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var Ls=q.createContext(void 0);function Rs(e){let t=q.useContext(Ls);if(e===!1&&t===void 0)throw Error(ie(27));return t}var kee={...le,...Dn},zs=q.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Rs(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Jt(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:kee,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Bs=q.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=Rs(),l=c.useState(`open`);function u(e){l&&c.setOpen(!1,en(ht,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=ys({disabled:i,native:a});return Jt(`button`,e,{state:{disabled:i},ref:[t,f],props:[{onClick:u},s,d]})}),Vs=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Rs(),c=A(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Jt(`p`,e,{ref:t,props:[{id:c},o]})}),Aee=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),jee=function(e){return e[e.open=H.open]=`open`,e[e.closed=H.closed]=`closed`,e[e.startingStyle=H.startingStyle]=`startingStyle`,e[e.endingStyle=H.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Hs=q.createContext(void 0);function Mee(){let e=q.useContext(Hs);if(e===void 0)throw Error(ie(26));return e}var Us=`ArrowUp`,Ws=`ArrowDown`,Gs=`ArrowLeft`,Ks=`ArrowRight`,qs=`Home`,Js=new Set([Gs,Ks]),Nee=new Set([Gs,Ks,qs,`End`]),Ys=new Set([Us,Ws]),Pee=new Set([Us,Ws,qs,`End`]),Xs=new Set([...Js,...Ys]),Fee=new Set([...Xs,qs,`End`]),Zs=new Set([Us,Ws,Gs,Ks,qs,`End`]),Qs=new Set([`Shift`,`Control`,`Alt`,`Meta`]);function $s(e){return Ft(e)&&e.tagName===`INPUT`}function ec(e){return!!($s(e)&&e.selectionStart!=null||Ft(e)&&e.tagName===`TEXTAREA`)}function tc(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=nc(e,t,`left`),a=rc(e),o=rc(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=nc(e,t,`top`),r=rc(e),i=rc(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 nc(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 rc(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 ic={...le,...Dn,nestedDialogOpen(e){return e?{[jee.nestedDialogOpen]:``}:null}},ac=q.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:s,...c}=e,{store:l}=Rs(),u=l.useState(`descriptionElementId`),d=l.useState(`disablePointerDismissal`),f=l.useState(`floatingRootContext`),p=l.useState(`popupProps`),m=l.useState(`modal`),h=l.useState(`mounted`),g=l.useState(`nested`),_=l.useState(`nestedOpenDialogCount`),v=l.useState(`open`),y=l.useState(`openMethod`),b=l.useState(`titleElementId`),x=l.useState(`transitionStatus`),S=l.useState(`role`);Mee(),o({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?l.context.popupRef.current:!0}let w=i===void 0?C:i,T=Jt(`div`,e,{state:{open:v,nested:g,transitionStatus:x,nestedDialogOpen:_>0},props:[p,{"aria-labelledby":b??void 0,"aria-describedby":u??void 0,role:S,tabIndex:-1,hidden:!h,onKeyDown(e){Zs.has(e.key)&&e.stopPropagation()},style:{[Aee.nestedDialogs]:_}},c],ref:[t,l.context.popupRef,l.useStateSetter(`popupElement`)],stateAttributesMapping:ic});return(0,J.jsx)(Ba,{context:f,openInteractionType:y,disabled:!h,closeOnFocusOut:!d,initialFocus:w,returnFocus:r,modal:m!==!1,restoreFocus:`popup`,children:T})}),oc=q.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,J.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),sc=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Rs(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,J.jsx)(Hs.Provider,{value:n,children:(0,J.jsxs)(Cn,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(oc,{ref:i.context.internalBackdropRef,inert:Ja(!s)}),e.children]})}):null}),cc={},lc={},uc=``;function dc(e){if(typeof document>`u`)return!1;let t=i(e);return yn(t).innerWidth-t.documentElement.clientWidth>0}function fc(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=i(e),n=t.documentElement,r=t.body,a=Ln(n)?n:r,o=a.style.overflowY,s=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,a.style.overflowY=`scroll`;let c=a.offsetWidth;a.style.overflowY=`hidden`;let l=a.offsetWidth;return a.style.overflowY=o,n.style.scrollbarGutter=s,c===l}function pc(e){let t=i(e),n=t.documentElement,r=t.body,a=Ln(n)?n:r,o={overflowY:a.style.overflowY,overflowX:a.style.overflowX};return Object.assign(a.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(a.style,o)}}function mc(e){let t=i(e),n=t.documentElement,r=t.body,a=yn(n),o=0,s=0,c=!1,l=zt.create();if(L&&(a.visualViewport?.scale??1)!==1)return()=>{};function u(){let t=a.getComputedStyle(n),i=a.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;o=n.scrollTop,s=n.scrollLeft,cc={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},uc=n.style.scrollBehavior,lc={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`||i.overflowY===`scroll`,p=t.overflowX===`scroll`||i.overflowX===`scroll`,m=Math.max(0,a.innerWidth-r.clientWidth),h=Math.max(0,a.innerHeight-r.clientHeight),g=parseFloat(i.marginTop)+parseFloat(i.marginBottom),_=parseFloat(i.marginLeft)+parseFloat(i.marginRight),v=Ln(n)?n:r;if(c=fc(e),c){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=o,r.scrollLeft=s,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function d(){Object.assign(n.style,cc),Object.assign(r.style,lc),c||(n.scrollTop=o,n.scrollLeft=s,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=uc)}function f(){d(),l.request(u)}u();let p=Nn(a,`resize`,f);return()=>{l.cancel(),d(),typeof a.removeEventListener==`function`&&p()}}var hc=new class{lockCount=0;restore=null;timeoutLock=We.create();timeoutUnlock=We.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=i(e).documentElement,n=yn(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=Ce;return}let r=p||!dc(e);this.restore=r?pc(e):mc(e)}};function gc(e=!0,t=null){Vn(()=>{if(e)return hc.acquire(t)},[e,t])}function _c(e){let t=q.useRef(``),n=q.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:q.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 vc(e,t){let n=q.useRef(e),r=On(t);Vn(()=>{n.current!==e&&r(n.current)},[e,r]),Vn(()=>{n.current=e},[e])}function yc(e){let[t,n]=q.useState(null),r=On((t,r)=>{e||n(r||(p?`touch`:``))});vc(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=_c(r);return q.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function bc(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=yc(a);st(t);let{forceUnmount:d}=rt(a,t),f=On(e=>{let n=en(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),p=q.useCallback(()=>{t.setOpen(!1,f(Tt))},[t,f]);q.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);let m=P({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[h,g]=q.useState(0),[_,v]=q.useState(0),y=h===0,b=Ka(m),x=Mn(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`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=Bn(e);if(y&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||W(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:y});gc(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=Ye([b,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{g(e),v(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{g(0),v(0)}),q.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(h+1,_+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,h,_,n]);let T=q.useMemo(()=>S(u),[S,u]),E=q.useMemo(()=>w(u),[w,u]),D=q.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:m,nestedOpenDialogCount:h,nestedOpenDrawerCount:_})}var xc={...Hn,modal:yt(e=>e.modal),nested:yt(e=>e.nested),nestedOpenDialogCount:yt(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:yt(e=>e.nestedOpenDrawerCount),disablePointerDismissal:yt(e=>e.disablePointerDismissal),openMethod:yt(e=>e.openMethod),descriptionElementId:yt(e=>e.descriptionElementId),titleElementId:yt(e=>e.titleElementId),viewportElement:yt(e=>e.viewportElement),role:yt(e=>e.role)},Sc=class e extends an{constructor(e){super(Cc(e),{popupRef:q.createRef(),backdropRef:q.createRef(),internalBackdropRef:q.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new ne,onOpenChange:void 0,onOpenChangeComplete:void 0},xc)}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=ut(()=>new e(n)).current;return t??r}};function Cc(e={}){return{...ae(),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 wc=q.createContext(!1);function Tc(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=Rs(!0),p=q.useContext(wc),m=!!f,h=Sc.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});te(()=>{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`);bc({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=q.useMemo(()=>({store:h}),[h]);return(0,J.jsx)(wc.Provider,{value:!1,children:(0,J.jsx)(Ls.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}var Ec=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Rs(),c=A(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Jt(`h2`,e,{ref:t,props:[{id:c},o]})});function Dc(e){let t=(0,Y.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,J.jsx)(Tc,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function Oc(e){let t=(0,Y.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,J.jsx)(sc,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function kc(e){let t=(0,Y.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=G(`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,J.jsx)(zs,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ac(e){let t=(0,Y.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,J.jsx)(kc,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=G(`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,J.jsxs)(Bs,{"data-slot":`sheet-close`,render:(0,J.jsx)(ws,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,J.jsx)(To,{}),(0,J.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,J.jsxs)(Oc,{children:[l,(0,J.jsxs)(ac,{"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 jc(e){let t=(0,Y.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=G(`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,J.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mc(e){let t=(0,Y.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=G(`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,J.jsx)(Ec,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nc(e){let t=(0,Y.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=G(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(Vs,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Pc=`sidebar_state`,Fc=3600*24*7,Ic=`20rem`,Lc=`16rem`,Rc=`32rem`,zc=`pico-sidebar-width`,Bc=`sidebar_width`,Vc=`20rem`,Hc=`3rem`,Uc=`b`,Wc=q.createContext(null);function Gc(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 Kc(e){let t=Gc(Ic,320),n=Gc(Lc,256),r=Gc(Rc,512),i=Gc(e??``,t);return`${Math.round(Math.min(Math.max(i,n),r))}px`}function qc(){if(typeof window>`u`)return Kc(Ic);try{return Kc(window.localStorage.getItem(zc)??window.localStorage.getItem(Bc))}catch{return Kc(Ic)}}function Jc(e){try{window.localStorage.setItem(zc,e)}catch{}}function Yc(e){let t=q.useRef(e);return t.current=e,t}function Xc(){let e=q.use(Wc);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Zc(e){return{open:e,openMobile:!1,openMobileSettled:!1,sidebarResizing:!1,sidebarWidth:Kc(Ic)}}function Qc(e,t){switch(t.type){case`openChanged`:return e.open===t.open?e:{...e,open:t.open};case`openMobileChanged`:return e.openMobile===t.openMobile?e:{...e,openMobile:t.openMobile};case`openMobileSettledChanged`:return e.openMobileSettled===t.openMobileSettled?e:{...e,openMobileSettled:t.openMobileSettled};case`sidebarResizingChanged`:return e.sidebarResizing===t.sidebarResizing?e:{...e,sidebarResizing:t.sidebarResizing};case`sidebarWidthChanged`:return e.sidebarWidth===t.sidebarWidth?e:{...e,sidebarWidth:t.sidebarWidth};default:return e}}function $c({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=qo(),[c,l]=q.useReducer(Qc,e,Zc),{open:u,openMobile:d,openMobileSettled:f,sidebarResizing:p,sidebarWidth:m}=c,h=q.useRef(m);h.current=m,q.useEffect(()=>{let e=qc();h.current!==e&&(h.current=e,l({type:`sidebarWidthChanged`,sidebarWidth:e}))},[]);let g=e=>{let t=Kc(e);h.current!==t&&(h.current=t,l({type:`sidebarWidthChanged`,sidebarWidth:t}),Jc(t))},_=t??u,v=e=>{let t=typeof e==`function`?e(_):e;n?n(t):l({type:`openChanged`,open:t}),document.cookie=`${Pc}=${t}; path=/; max-age=${Fc}`},y=e=>{l({type:`openMobileChanged`,openMobile:e})},b=e=>{l({type:`openMobileSettledChanged`,openMobileSettled:e})},x=e=>{l({type:`sidebarResizingChanged`,sidebarResizing:e})},S=()=>s?y(!d):v(e=>!e),C=Yc(S);q.useEffect(()=>{let e=e=>{e.key.toLowerCase()===Uc&&(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:_?`expanded`:`collapsed`,open:_,setOpen:v,isMobile:s,openMobile:d,openMobileSettled:f,setOpenMobile:y,setOpenMobileSettled:b,sidebarResizing:p,setSidebarResizing:x,sidebarWidth:m,setSidebarWidth:g,toggleSidebar:S};return(0,J.jsx)(Wc.Provider,{value:w,children:(0,J.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{...i,"--sidebar-width":m,"--sidebar-width-icon":Hc},className:G(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function el(e){let t=(0,Y.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:_}=Xc();if(d===`none`){let e;t[8]===r?e=t[9]:(e=G(`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,J.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":Vc},t[14]=e):e=t[14];let r;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(jc,{className:`sr-only`,children:[(0,J.jsx)(Mc,{children:`Sidebar`}),(0,J.jsx)(Nc,{children:`Displays the mobile sidebar.`})]}),t[15]=r):r=t[15];let o;t[16]===n?o=t[17]:(o=(0,J.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,J.jsxs)(Ac,{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,J.jsx)(Dc,{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=G(`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,J.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=G(`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,J.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,J.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,J.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 tl(e){let t=(0,Y.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}=Xc(),o;t[4]===n?o=t[5]:(o=G(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,J.jsx)(cee,{}),l=(0,J.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,J.jsx)(tn,{title:`Toggle sidebar`,kbd:`⌃ B`,children:(0,J.jsxs)(ws,{"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 nl(e){let t=(0,Y.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}=Xc(),p;t[6]!==s||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==f?(p={isMobile:s,maxWidth:Rc,minWidth:Lc,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}=hs(p),[g,_]=q.useState(`col-resize`),[v,y]=q.useState(10),b,x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{let e=()=>{y(is())},t=window.matchMedia(`(pointer:coarse)`);return _(ns()),e(),t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},x=[],t[13]=b,t[14]=x):(b=t[13],x=t[14]),q.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=G(`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`,Fs,S,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full`,Dee,`[[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,J.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 rl(e){let t=(0,Y.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=G(`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,J.jsx)(`main`,{"data-slot":`sidebar-inset`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function il(e){let t=(0,Y.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=G(`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,J.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 al(e){let t=(0,Y.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=G(`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,J.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 ol(e){let t=(0,Y.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=G(`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,J.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 sl(e){let t=(0,Y.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=G(`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,J.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 cl(e){let t=(0,Y.c)(10),n,r,i,a;if(t[0]!==e){let{className:o,render:s,...c}=e;n=s,a=Ho,r=`div`,i=dr({className:G(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,o)},c),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o={slot:`sidebar-group-label`,sidebar:`group-label`},t[5]=o):o=t[5];let s;return t[6]!==n||t[7]!==r||t[8]!==i?(s={defaultTagName:r,props:i,render:n,state:o},t[6]=n,t[7]=r,t[8]=i,t[9]=s):s=t[9],a(s)}function ll(e){let t=(0,Y.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=G(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.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 ul(e){let t=(0,Y.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=G(`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,J.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 dl(e){let t=(0,Y.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=G(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.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 fl=Go(`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 pl(e){let t=(0,Y.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}=Xc(),m=dr({className:G(fl({variant:u,size:d}),s)},c),h;t[0]!==n||t[1]!==o?(h=o?(0,J.jsx)(fr,{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=Ho(_);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,J.jsx)(gt,{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,J.jsxs)(Xt,{children:[v,b]}),t[15]=v,t[16]=b,t[17]=x):x=t[17],x}var ml=1,hl=.9,gl=.8,_l=.17,vl=.1,yl=.999,bl=.9999,xl=.99,Sl=/[\\\/_+.#"@\[\(\{&]/,Cl=/[\\\/_+.#"@\[\(\{&]/g,wl=/[\s-]/,Tl=/[\s-]/g;function El(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ml:xl;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=El(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ml:Sl.test(e.charAt(l-1))?(d*=gl,p=e.slice(i,l-1).match(Cl),p&&i>0&&(d*=yl**+p.length)):wl.test(e.charAt(l-1))?(d*=hl,m=e.slice(i,l-1).match(Tl),m&&i>0&&(d*=yl**+m.length)):(d*=_l,i>0&&(d*=yl**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=bl)),(d<vl&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=El(e,t,n,r,l+1,a+2,o),f*vl>d&&(d=f*vl)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Dl(e){return e.toLowerCase().replace(Tl,` `)}function Ol(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,El(e,t,Dl(e),Dl(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function kl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Al(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function jl(...e){return t=>{let n=!1,r=e.map(e=>{let r=Al(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():Al(e[t],null)}}}}function Ml(...e){return q.useCallback(jl(...e),e)}function Nl(e,t){let n=q.createContext(t),r=e=>{let{children:t,...r}=e,i=q.useMemo(()=>r,Object.values(r));return(0,J.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=q.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Pl(e,t=[]){let n=[];function r(t,r){let i=q.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=q.useMemo(()=>o,Object.values(o));return(0,J.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=q.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=>q.createContext(e));return function(n){let r=n?.[e]||t;return q.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Fl(i,...t)]}function Fl(...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 q.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Il=globalThis?.document?q.useLayoutEffect:()=>{},Ll=q.useId||(()=>void 0),Rl=0;function zl(e){let[t,n]=q.useState(Ll());return Il(()=>{e||n(e=>e??String(Rl++))},[e]),e||(t?`radix-${t}`:``)}var Bl=q.useInsertionEffect||Il;function Vl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Hl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=q.useRef(e!==void 0);q.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,q.useCallback(t=>{if(s){let n=Ul(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Hl({defaultProp:e,onChange:t}){let[n,r]=q.useState(e),i=q.useRef(n),a=q.useRef(t);return Bl(()=>{a.current=t},[t]),q.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ul(e){return typeof e==`function`}var Wl=t(Pe(),1);function Gl(e){let t=Kl(e),n=q.forwardRef((e,n)=>{let{children:r,...i}=e,a=q.Children.toArray(r),o=a.find(Jl);if(o){let e=o.props.children,r=a.map(t=>t===o?q.Children.count(e)>1?q.Children.only(null):q.isValidElement(e)?e.props.children:null:t);return(0,J.jsx)(t,{...i,ref:n,children:q.isValidElement(e)?q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Kl(e){let t=q.forwardRef((e,t)=>{let{children:n,...r}=e;if(q.isValidElement(n)){let e=Xl(n),i=Yl(r,n.props);return n.type!==q.Fragment&&(i.ref=t?jl(t,e):e),q.cloneElement(n,i)}return q.Children.count(n)>1?q.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ql=Symbol(`radix.slottable`);function Jl(e){return q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ql}function Yl(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 Xl(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 Zl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Gl(`Primitive.${t}`),r=q.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,J.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ql(e,t){e&&Wl.flushSync(()=>e.dispatchEvent(t))}function $l(e){let t=q.useRef(e);return q.useEffect(()=>{t.current=e}),q.useMemo(()=>(...e)=>t.current?.(...e),[])}function eu(e,t=globalThis?.document){let n=$l(e);q.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 tu=`DismissableLayer`,nu=`dismissableLayer.update`,ru=`dismissableLayer.pointerDownOutside`,iu=`dismissableLayer.focusOutside`,au,ou=q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),su=q.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=q.useContext(ou),[u,d]=q.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=q.useState({}),m=Ml(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=uu(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=du(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return eu(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),q.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(au=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),fu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=au)}},[u,f,n,l]),q.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),fu())},[u,l]),q.useEffect(()=>{let e=()=>p({});return document.addEventListener(nu,e),()=>document.removeEventListener(nu,e)},[]),(0,J.jsx)(Zl.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:kl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:kl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:kl(e.onPointerDownCapture,x.onPointerDownCapture)})});su.displayName=tu;var cu=`DismissableLayerBranch`,lu=q.forwardRef((e,t)=>{let n=q.useContext(ou),r=q.useRef(null),i=Ml(t,r);return q.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,J.jsx)(Zl.div,{...e,ref:i})});lu.displayName=cu;function uu(e,t=globalThis?.document){let n=$l(e),r=q.useRef(!1),i=q.useRef(()=>{});return q.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){pu(ru,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 du(e,t=globalThis?.document){let n=$l(e),r=q.useRef(!1);return q.useEffect(()=>{let e=e=>{e.target&&!r.current&&pu(iu,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 fu(){let e=new CustomEvent(nu);document.dispatchEvent(e)}function pu(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?Ql(i,a):i.dispatchEvent(a)}var mu=`focusScope.autoFocusOnMount`,hu=`focusScope.autoFocusOnUnmount`,gu={bubbles:!1,cancelable:!0},_u=`FocusScope`,vu=q.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=q.useState(null),l=$l(i),u=$l(a),d=q.useRef(null),f=Ml(t,e=>c(e)),p=q.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;q.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Su(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Su(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Su(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]),q.useEffect(()=>{if(s){Cu.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(mu,gu);s.addEventListener(mu,l),s.dispatchEvent(t),t.defaultPrevented||(yu(Bee(bu(s)),{select:!0}),document.activeElement===e&&Su(s))}return()=>{s.removeEventListener(mu,l),setTimeout(()=>{let t=new CustomEvent(hu,gu);s.addEventListener(hu,u),s.dispatchEvent(t),t.defaultPrevented||Su(e??document.body,{select:!0}),s.removeEventListener(hu,u),Cu.remove(p)},0)}}},[s,l,u,p]);let m=q.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]=Iee(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Su(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Su(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,J.jsx)(Zl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});vu.displayName=_u;function yu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Su(r,{select:t}),document.activeElement!==n)return}function Iee(e){let t=bu(e);return[xu(t,e),xu(t.reverse(),e)]}function bu(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 xu(e,t){for(let n of e)if(!Lee(n,{upTo:t}))return n}function Lee(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 Ree(e){return e instanceof HTMLInputElement&&`select`in e}function Su(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ree(e)&&t&&e.select()}}var Cu=zee();function zee(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=wu(e,t),e.unshift(t)},remove(t){e=wu(e,t),e[0]?.resume()}}}function wu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Bee(e){return e.filter(e=>e.tagName!==`A`)}var Vee=`Portal`,Tu=q.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=q.useState(!1);Il(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Wl.createPortal((0,J.jsx)(Zl.div,{...r,ref:t}),o):null});Tu.displayName=Vee;function Hee(e,t){return q.useReducer((e,n)=>t[e][n]??e,e)}var Eu=e=>{let{present:t,children:n}=e,r=Uee(t),i=typeof n==`function`?n({present:r.isPresent}):q.Children.only(n),a=Ml(r.ref,Wee(i));return typeof n==`function`||r.isPresent?q.cloneElement(i,{ref:a}):null};Eu.displayName=`Presence`;function Uee(e){let[t,n]=q.useState(),r=q.useRef(null),i=q.useRef(e),a=q.useRef(`none`),[o,s]=Hee(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return q.useEffect(()=>{let e=Du(r.current);a.current=o===`mounted`?e:`none`},[o]),Il(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Du(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Il(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Du(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=Du(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:q.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Du(e){return e?.animationName||`none`}function Wee(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 Ou=0;function Gee(){q.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ku()),document.body.insertAdjacentElement(`beforeend`,e[1]??ku()),Ou++,()=>{Ou===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Ou--}},[])}function ku(){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 Au=function(){return Au=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},Au.apply(this,arguments)};function ju(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 Kee(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 Mu=`right-scroll-bar-position`,Nu=`width-before-scroll-bar`,qee=`with-scroll-bars-hidden`,Jee=`--removed-body-scroll-bar-size`;function Pu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Yee(e,t){var n=(0,q.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 Xee=typeof window<`u`?q.useLayoutEffect:q.useEffect,Fu=new WeakMap;function Zee(e,t){var n=Yee(t||null,function(t){return e.forEach(function(e){return Pu(e,t)})});return Xee(function(){var t=Fu.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Pu(e,null)}),i.forEach(function(e){r.has(e)||Pu(e,a)})}Fu.set(n,e)},[e]),n}function Qee(e){return e}function $ee(e,t){t===void 0&&(t=Qee);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 ete(e){e===void 0&&(e={});var t=$ee(null);return t.options=Au({async:!0,ssr:!1},e),t}var Iu=function(e){var t=e.sideCar,n=ju(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 q.createElement(r,Au({},n))};Iu.isSideCarExport=!0;function tte(e,t){return e.useMedium(t),Iu}var Lu=ete(),Ru=function(){},zu=q.forwardRef(function(e,t){var n=q.useRef(null),r=q.useState({onScrollCapture:Ru,onWheelCapture:Ru,onTouchMoveCapture:Ru}),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=ju(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Zee([n,t]),C=Au(Au({},b),i);return q.createElement(q.Fragment,null,u&&q.createElement(x,{sideCar:Lu,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?q.cloneElement(q.Children.only(s),Au(Au({},C),{ref:S})):q.createElement(v,Au({},C,{className:c,ref:S}),s))});zu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},zu.classNames={fullWidth:Nu,zeroRight:Mu};var Bu,nte=function(){if(Bu)return Bu;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function rte(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=nte();return t&&e.setAttribute(`nonce`,t),e}function ite(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ate(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ote=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rte())&&(ite(t,n),ate(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ste=function(){var e=ote();return function(t,n){q.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Vu=function(){var e=ste();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},cte={left:0,top:0,right:0,gap:0},Hu=function(e){return parseInt(e||``,10)||0},lte=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[Hu(n),Hu(r),Hu(i)]},ute=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return cte;var t=lte(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])}},dte=Vu(),Uu=`data-scroll-locked`,fte=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,$r as a,$t as o,A as s,An as c,Ar as l,At as u,B as d,Bn as f,Br as p,Bt as m,C as h,Ci as g,Cn as _,Cr as v,Ct as y,D as b,Dn as x,Dr as S,Dt as C,E as w,En as T,Et as E,F as D,Fn as O,Fr as k,Ft as A,G as j,Gn as M,Gr as N,Gt as P,H as F,Hn as I,Hr as L,Ht as R,I as z,In as B,Ir as V,It as H,J as U,Jn as ee,Jr as te,Jt as ne,K as re,Kn as W,Kr as ie,Kt as ae,L as oe,Ln as se,Lr as ce,Lt as le,M as ue,Mn as de,Mr as fe,Mt as pe,N as me,Nn as he,Nr as ge,Nt as _e,O as ve,On as ye,Or as be,Ot as G,P as xe,Pn as Se,Pr as Ce,Pt as we,Q as Te,Qn as Ee,Qr as De,Qt as Oe,R as ke,Rn as Ae,Rr as je,Rt as Me,S as Ne,Si as Pe,Sn as Fe,Sr as Ie,St as Le,T as Re,Tn as ze,Tr as Be,Tt as Ve,U as He,Un as Ue,Ur as We,Ut as Ge,V as Ke,Vn as qe,Vr as Je,Vt as Ye,W as Xe,Wn as Ze,Wr as Qe,Wt as $e,X as et,Xn as tt,Xr as nt,Xt as rt,Y as it,Yn as at,Yr as ot,Yt as st,Z as ct,Zn as lt,Zr as ut,Zt as dt,_ as ft,_i as pt,_n as mt,_r as ht,_t as gt,a as _t,ai as vt,an as yt,ar as bt,at as xt,b as St,bi as Ct,bn as wt,br as Tt,bt as Et,c as Dt,ci as Ot,cn as kt,cr as At,ct as jt,d as Mt,di as Nt,dn as Pt,dr as Ft,dt as It,ei as Lt,en as Rt,er as zt,et as Bt,f as Vt,fi as Ht,fn as Ut,fr as Wt,ft as Gt,g as Kt,gi as qt,gn as Jt,gr as Yt,gt as Xt,h as Zt,hi as Qt,hn as $t,hr as en,ht as tn,i as nn,ii as rn,in as an,ir as on,it as sn,j as cn,jn as ln,jr as un,jt as dn,k as fn,kn as pn,kr as mn,kt as hn,l as gn,li as _n,ln as vn,lr as yn,lt as bn,m as xn,mi as Sn,mn as Cn,mr as wn,mt as Tn,n as K,ni as En,nn as Dn,nr as On,nt as kn,o as An,oi as jn,on as Mn,or as Nn,ot as Pn,p as eee,pi as Fn,pn as In,pr as Ln,pt as Rn,q as zn,qn as Bn,qr as Vn,qt as Hn,r as Un,ri as Wn,rn as Gn,rr as Kn,rt as qn,s as Jn,si as Yn,sn as Xn,sr as Zn,st as Qn,t as $n,ti as er,tn as tr,tr as nr,tt as rr,u as ir,ui as ar,un as or,ur as sr,ut as cr,v as lr,vi as ur,vn as dr,vt as fr,w as pr,wn as mr,wt as hr,x as gr,xi as _r,xn as vr,xr as yr,xt as br,y as xr,yi as Sr,yn as Cr,yr as wr,yt as Tr,z as Er,zn as Dr,zr as Or,zt as kr}from"./index-DZbiiE6N.js";var Ar=class extends _r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=Yn(),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),Mr(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Nr(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Nr(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 Sn(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&&!qt(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Pr(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Sn(this.options.enabled,this.#t)!==Sn(t.enabled,this.#t)||Qt(this.options.staleTime,this.#t)!==Qt(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Sn(this.options.enabled,this.#t)!==Sn(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 Ir(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(Nt)),t}#g(){this.#b();let e=Qt(this.options.staleTime,this.#t);if(Ot.isServer()||this.#r.isStale||!ar(e))return;let t=ur(this.#r.dataUpdatedAt,e)+1;this.#d=Sr.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,!(Ot.isServer()||Sn(this.options.enabled,this.#t)===!1||!ar(this.#p)||this.#p===0)&&(this.#f=Sr.setInterval(()=>{(this.options.refetchIntervalInBackground||Ct.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Sr.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Sr.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&&Mr(e,t),o=i&&Pr(e,n,t,r);(a||o)&&(l={...l,...vt(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=Ht(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=Ht(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Fr(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Sn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=Yn())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}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),!qt(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){jn.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function jr(e,t){return Sn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function Mr(e,t){return jr(e,t)||e.state.data!==void 0&&Nr(e,t,t.refetchOnMount)}function Nr(e,t,n){if(Sn(t.enabled,e)!==!1&&Qt(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Fr(e,t)}return!1}function Pr(e,t,n,r){return(e!==t||Sn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Fr(e,n)}function Fr(e,t){return Sn(t.enabled,e)!==!1&&e.isStaleByTime(Qt(t.staleTime,e))}function Ir(e,t){return!qt(e.getCurrentResult(),t)}var Lr=class extends _r{#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),qt(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&_n(t.mutationKey)!==_n(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??rn();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){jn.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)})})}},q=t(g(),1),Rr=q.createContext(!1),zr=()=>q.useContext(Rr);Rr.Provider;var J=Wn();function Br(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Vr=q.createContext(Br()),Hr=()=>q.useContext(Vr),Ur=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?pt(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Wr=e=>{q.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||pt(n,[e.error,r])),Kr=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))}},qr=(e,t)=>e.isLoading&&e.isFetching&&!t,Jr=(e,t)=>e?.suspense&&t.isPending,Yr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Xr(e,t,n){let r=zr(),i=Hr(),a=En(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,Kr(o),Ur(o,i,s),Wr(i);let c=!a.getQueryCache().get(o.queryHash),[l]=q.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(q.useSyncExternalStore(q.useCallback(e=>{let t=d?l.subscribe(jn.batchCalls(e)):Nt;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),q.useEffect(()=>{l.setOptions(o)},[o,l]),Jr(o,u))throw Yr(o,l,i);if(Gr({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!Ot.isServer()&&qr(u,r)&&(c?Yr(o,l,i):s?.promise)?.catch(Nt).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function Zr(e,t){return Xr(e,Ar,t)}function Qr(e,t){let n=En(t),r=n.getQueryCache();return q.useSyncExternalStore(q.useCallback(e=>r.subscribe(jn.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function $r(e,t){let n=En(t);return ti({filters:{...e,status:`pending`}},n).length}function ei(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function ti(e={},t){let n=En(t).getMutationCache(),r=q.useRef(e),i=q.useRef(null);return i.current===null&&(i.current=ei(n,e)),q.useEffect(()=>{r.current=e}),q.useSyncExternalStore(q.useCallback(e=>n.subscribe(()=>{let t=Fn(i.current,ei(n,r.current));i.current!==t&&(i.current=t,jn.schedule(e))}),[n]),()=>i.current,()=>i.current)}function ni(e,t){let n=En(t),[r]=q.useState(()=>new Lr(n,e));q.useEffect(()=>{r.setOptions(e)},[r,e]);let i=q.useSyncExternalStore(q.useCallback(e=>r.subscribe(jn.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=q.useCallback((e,t)=>{r.mutate(e,t).catch(Nt)},[r]);if(i.error&&pt(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function ri(e){return typeof e==`object`&&!!e&&`current`in e}function ii(){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 ai=[`Control`,`Alt`,`Shift`,`Meta`];new Set(ai);var oi={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 si(e,t=ii()){return e===`Mod`?t===`mac`?`Meta`:`Control`:e}var ci=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``)),li=new Set([`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`]),ui=new Set([`F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7`,`F8`,`F9`,`F10`,`F11`,`F12`]),di=new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Home`,`End`,`PageUp`,`PageDown`]),fi=new Set([`Enter`,`Escape`,`Space`,`Tab`,`Backspace`,`Delete`]),pi=new Set([`/`,`[`,`]`,`\\`,`=`,`-`,`,`,`.`,`;`,"`"]),mi={Backquote:"`",Backslash:`\\`,BracketLeft:`[`,BracketRight:`]`,Comma:`,`,Equal:`=`,Minus:`-`,Period:`.`,Semicolon:`;`,Slash:`/`};new Set([...ci,...li,...ui,...di,...fi,...pi]);var hi={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 gi(e){return/^\p{Letter}$/u.test(e)}function _i(e){if(!e)return``;if(e in hi)return hi[e];if(gi(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 vi={Control:`⌃`,Alt:`⌥`,Shift:`⇧`,Meta:`⌘`,Mod:`⌘`},yi={Control:`Control`,Alt:`Option`,Shift:`Shift`,Meta:`Cmd`,Mod:`Cmd`},bi={Control:`Ctrl`,Alt:`Alt`,Shift:`Shift`,Meta:`Win`,Mod:`Ctrl`},xi={...bi,Meta:`Super`},Si={"`":`Backquote`,"\\":`Backslash`,"[":`Left Bracket`,"]":`Right Bracket`,",":`Comma`,"=":`Equal`,"-":`Minus`,".":`Period`,";":`Semicolon`},Ci={ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`,Enter:`↵`,Escape:`Esc`,Backspace:`⌫`,Delete:`⌦`,Tab:`⇥`,Space:`␣`};function wi(e,t=ii()){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=_i(a);else{let e=oi[a]??oi[a.toLowerCase()];if(e){let n=si(e,t);r.add(n)}else n.length===1&&(i=_i(a))}}return!i&&n.length>0&&(i=_i(n[n.length-1].trim())),{key:i,ctrl:r.has(`Control`),shift:r.has(`Shift`),alt:r.has(`Alt`),meta:r.has(`Meta`),modifiers:ai.filter(e=>r.has(e))}}function Ti(e,t=ii()){let n=e.ctrl??!1,r=e.shift??!1,i=e.alt??!1,a=e.meta??!1;e.mod&&(si(`Mod`,t)===`Control`?n=!0:a=!0);let o=ai.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 Ei(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 ai)e.modifiers.includes(t)&&r.push(t);return r.push(_i(e.key)),r.join(`+`)}function Di(e,t=ii()){return Ei(wi(e,t),t)}function Oi(e,t=ii()){return Ei(e,t)}function ki(e,t=ii()){return typeof e==`string`?Di(e,t):Oi(Ti(e,t),t)}function Ai(e){return e in oi||e.toLowerCase()in oi}function ji(e){let t=[];for(let n of ai)e.modifiers.includes(n)&&t.push(n);return t.push(e.key),t.join(`+`)}function Mi(e,t={}){let n=t.platform??ii(),r=t.useSymbols??!0,i=t.separatorToken??(n===`mac`&&r?` `:`+`);return ki(e,n).split(`+`).map(e=>{if(Ai(e)){let t=oi[e]??oi[e.toLowerCase()];return n===`mac`?r?vi[t]:yi[t]:n===`windows`?bi[t]:xi[t]}else return r&&Ci[e]||!r&&Si[e]||e}).join(i)}function Ni(e,t,n=ii()){let r=typeof t==`string`?wi(t,n):t;if(e.ctrlKey!==r.ctrl||e.shiftKey!==r.shift||e.altKey!==r.alt||e.metaKey!==r.meta)return!1;let i=_i(e.key),a=r.key;if(i!==`Dead`&&i.length===1&&a.length===1){if(i.toUpperCase()===a.toUpperCase())return!0;if(gi(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 mi?mi[e.code]===a:!1}return i===a}var Pi={preventDefault:!0,stopPropagation:!0,eventType:`keydown`,enabled:!0,ignoreInputs:!0,conflictBehavior:`warn`};function Fi(e){return!(e.ctrl||e.meta||e.key===`Escape`)}function Ii(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 Li(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 Ri(e,t,n){let r=Li(t);return r&&Ii(r)&&r!==n||e.composedPath().some(e=>Ii(e)&&e!==n)?!0:Ii(e.target)&&e.target!==n}function zi(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 Bi(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 Vi=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 Hi({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&(Vi.RecursedCheck|Vi.Recursed|Vi.Dirty|Vi.Pending)?a&(Vi.RecursedCheck|Vi.Recursed)?a&Vi.RecursedCheck?!(a&(Vi.Dirty|Vi.Pending))&&c(e,i)?(i.flags=a|(Vi.Recursed|Vi.Pending),a&=Vi.Mutable):a=Vi.None:i.flags=a&~Vi.Recursed|Vi.Pending:a=Vi.None:i.flags=a|Vi.Pending,a&Vi.Watching&&t(i),a&Vi.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&Vi.Dirty)a=!0;else if((c&(Vi.Mutable|Vi.Dirty))===(Vi.Mutable|Vi.Dirty)){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&(Vi.Mutable|Vi.Pending))===(Vi.Mutable|Vi.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&=~Vi.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&(Vi.Pending|Vi.Dirty))===Vi.Pending&&(n.flags=r|Vi.Dirty,(r&(Vi.Watching|Vi.RecursedCheck))===Vi.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 Ui(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 Wi=[],Gi=0,{link:Ki,unlink:qi,propagate:Ji,checkDirty:Yi,shallowPropagate:Xi}=Hi({update(e){return e._update()},notify(e){Wi[Qi++]=e,e.flags&=~Vi.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Vi.Mutable|Vi.Dirty,na(e))}}),Zi=0,Qi=0,$i,ea=0;function ta(e){try{++ea,e()}finally{--ea||ra()}}function na(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=qi(n,e)}function ra(){if(!(ea>0)){for(;Zi<Qi;){let e=Wi[Zi];Wi[Zi++]=void 0,e.notify()}Zi=0,Qi=0}}function ia(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?Vi.None:Vi.Mutable,get(){return $i!==void 0&&Ki(i,$i,Gi),i._snapshot},subscribe(e){let t=Ui(e),n={current:!1},r=aa(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=$i,o=t?.compare??Object.is;if(n)$i=i,++Gi,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=Vi.Mutable|Vi.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{$i=a,n&&(i.flags&=~Vi.RecursedCheck),na(i)}}};return n?(i.flags=Vi.Mutable|Vi.Dirty,i.get=function(){let e=i.flags;if(e&Vi.Dirty||e&Vi.Pending&&Yi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Xi(e)}}else e&Vi.Pending&&(i.flags=e&~Vi.Pending);return $i!==void 0&&Ki(i,$i,Gi),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Ji(e),Xi(e),ra())}},i}function aa(e){let t=()=>{let t=$i;$i=n,++Gi,n.depsTail=void 0,n.flags=Vi.Watching|Vi.RecursedCheck;try{return e()}finally{$i=t,n.flags&=~Vi.RecursedCheck,na(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Vi.Watching|Vi.RecursedCheck,notify(){let e=this.flags;e&Vi.Dirty||e&Vi.Pending&&Yi(this.deps,this)?t():this.flags=Vi.Watching},stop(){this.flags=Vi.None,this.depsTail=void 0,na(this)}};return t(),n}var oa=class{constructor(e,t){this.atom=ia(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(Ui(e))}},sa=class{constructor(e){this.atom=ia(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(Ui(e))}};function ca(e,t){return typeof e==`function`?new sa(e):t?new oa(e,t):new oa(e)}function la(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=ua(e);if(n.length!==ua(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 ua(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var da=0;function fa(){return`hotkey_${++da}`}var tee=class e{static#e=null;#t;#n=new Map;#r=new Map;constructor(){this.registrations=new oa(new Map),this.#t=ii()}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:fa(),unregister:()=>{},get callback(){return e},set callback(t){e=t},setOptions:()=>{},get isActive(){return!1}}}let r=fa(),i=n.platform??this.#t,a=typeof e==`string`?wi(e,i):Ti(e,i),o=typeof e==`string`?e:ji(a),s=n.target??document,c=n.conflictBehavior??`warn`,l=this.#d(o,s);l&&Bi(l.id,o,c,e=>this.#i(e));let u=n.ignoreInputs??Fi(a),d={id:r,hotkey:o,parsedHotkey:a,callback:t,options:{...Pi,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&&zi(e,t)&&r.options.enabled&&!(r.options.ignoreInputs!==!1&&Ri(e,t,r.target)))if(n===`keydown`){if(r.options.eventType!==`keydown`)continue;Ni(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`&&Ni(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=_i(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 pa(){return tee.getInstance()}function ma(e,t={}){let n=a().hotkey,r=pa(),i=t.platform??n?.platform??ii(),o=(0,q.useRef)(new Map),s=(0,q.useRef)(e),c=(0,q.useRef)([]),l=(0,q.useRef)(t),u=(0,q.useRef)(n),d=(0,q.useRef)(r),f=e.map(e=>ki(e.hotkey,i));s.current=e,c.current=f,l.current=t,u.current=n,d.current=r,(0,q.useEffect)(()=>{let e=o.current,t=new Map,n=[];for(let e=0;e<s.current.length;e++){let t=s.current[e],r=c.current[e],i={...u.current,...l.current,...t.options},a=ri(i.target)?i.target.current:i.target??(typeof document<`u`?document:null);if(!a)continue;let o=`${e}:${r}`;n.push({registrationKey:o,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=d.current.register(a,i.callback,{...o,target:s});t.set(n,{handle:l,target:s})}o.current=t}),(0,q.useEffect)(()=>()=>{for(let{handle:e}of o.current.values())e.isActive&&e.unregister();o.current=new Map},[]);for(let r=0;r<e.length;r++){let i=e[r],a=f[r],s=`${r}:${a}`,c=o.current.get(s)?.handle;if(c?.isActive){c.callback=i.callback;let{target:e,...r}={...n,...t,...i.options};c.setOptions(r)}}}var ha=er();function ga(e,t){return e===t}function _a(e,t=e=>e,n){let r=n?.compare??ga,i=(0,q.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,q.useCallback)(()=>e.get(),[e]);return(0,ha.useSyncExternalStoreWithSelector)(i,a,a,t,r)}var va=0;function ya(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(va);let a=()=>e?.focus({preventScroll:n});if(i)return a(),Ce;let o=requestAnimationFrame(a);return va=o,()=>{va===o&&(cancelAnimationFrame(o),va=0)}}var ba={inert:new WeakMap,"aria-hidden":new WeakMap},xa=`data-base-ui-inert`,Sa={inert:new WeakSet,"aria-hidden":new WeakSet},Ca=new WeakMap,wa=0;function nee(e){return Sa[e]}function Ta(e){return e?wn(e)?e.host:Ta(e.parentNode):null}var Ea=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ta(t);return e.contains(n)?n:null}).filter(e=>e!=null),Da=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},Oa=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Zn(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function ka(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=Ea(t,e),u=i?Ea(t,a):[],d=new Set(u),f=i?Oa(t,Da(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=ba[o],n=nee(o);c=n,s=e;let r=Ea(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);Oa(t,Da(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=(Ca.get(e)||0)+1;Ca.set(e,t),m.push(e),t===1&&e.setAttribute(xa,``)}),wa+=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=(Ca.get(e)||0)-1;Ca.set(e,t),t||e.removeAttribute(xa)}),--wa,wa||(ba.inert=new WeakMap,ba[`aria-hidden`]=new WeakMap,Sa.inert=new WeakSet,Sa[`aria-hidden`]=new WeakSet,Ca=new WeakMap)}}function Aa(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:a=!0,markerIgnoreElements:o=[]}=t,s=i(e[0]).body;return ka(e,s,n,r,{mark:a,markerIgnoreElements:o})}function ja(e,t){let n=yn(Bn(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 Ma=20,Na=[];function Pa(){Na=Na.filter(e=>e.deref()?.isConnected)}function Fa(e){Pa(),e&&Zn(e)!==`body`&&(Na.push(new WeakRef(e)),Na.length>Ma&&(Na=Na.slice(-Ma)))}function Ia(){return Pa(),Na[Na.length-1]?.deref()}function La(e){return e?c(e)?e:ln(e)[0]||e:null}function Ra(e){return!e||!e.isConnected?!1:typeof e.checkVisibility==`function`?e.checkVisibility():Dr(e)}function za(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=mr(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return c(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 Ba(e){let{context:t,children:n,disabled:r=!1,initialFocus:a=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:l=!0,closeOnFocusOut:u=!0,openInteractionType:d=``,nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:h,getInsideElements:g}=e,v=`rootStore`in t?t.rootStore:t,y=v.useState(`open`),b=v.useState(`domReferenceElement`),x=v.useState(`floatingElement`),{events:S,dataRef:C}=v.context,w=On(()=>C.current.floatingContext?.nodeId),E=a===!1,D=Ue(b)&&E,O=q.useRef([`content`]),k=Kn(a),A=Kn(o),j=Kn(d),N=Ut(h),P=$t(),F=q.useRef(!1),R=q.useRef(!1),z=q.useRef(!1),B=q.useRef(null),V=q.useRef(``),H=q.useRef(``),U=q.useRef(null),ee=q.useRef(null),te=on(U,m,P?.beforeInsideRef),ne=on(ee,P?.afterInsideRef),re=Qe(),ie=Qe(),ae=nr(),oe=P!=null,se=I(x),le=On((e=se)=>e?ln(e):[]),ue=On(()=>g?.().filter(e=>e!=null)??[]);q.useEffect(()=>{if(r||!l)return;function e(e){e.key===`Tab`&&W(se,M(i(se)))&&le().length===0&&!D&&Or(e)}return Nn(i(se),`keydown`,e)},[r,b,se,l,O,D,le]),q.useEffect(()=>{if(r||!y)return;let e=i(se);function t(){z.current=!1}function n(e){let t=Bn(e),n=ue();z.current=!(W(x,t)||W(b,t)||W(P?.portalNode,t)||n.some(e=>e===t||W(e,t))),H.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(R.current=!0)}function a(){H.current=`keyboard`}return bt(Nn(e,`pointerdown`,n,!0),Nn(e,`pointerup`,t,!0),Nn(e,`pointercancel`,t,!0),Nn(e,`keydown`,a,!0))},[r,x,b,se,y,P,ue]),q.useEffect(()=>{if(r||!u)return;let e=i(se);function t(){R.current=!0,ie.start(0,()=>{R.current=!1})}function n(e){let t=Bn(e);c(t)&&(B.current=t)}function a(t){let n=t.relatedTarget,r=t.currentTarget,i=Bn(t);queueMicrotask(()=>{let a=w(),o=v.context.triggerElements,c=ue(),u=n?.hasAttribute(vr(`focus-guard`))&&[U.current,ee.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Xn(p),Xn(f)].includes(n),d=!(W(b,n)||W(x,n)||W(n,x)||W(P?.portalNode,n)||c.some(e=>e===n||W(e,n))||n!=null&&o.hasElement(n)||o.hasMatchingElement(e=>W(e,n))||u||N&&(_(N.nodesRef.current,a).find(e=>W(e.context?.elements.floating,n)||W(e.context?.elements.domReference,n))||Fe(N.nodesRef.current,a).find(e=>[e.context?.elements.floating,I(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===b&&se&&za(se,O),s&&r!==b&&!Ra(i)&&M(e)===e.body){if(Ft(se)&&(se.focus(),s===`popup`)){ae.request(()=>{se.focus()});return}let e=le(),t=B.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||se;Ft(n)&&n.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(D||!l)&&n&&d&&!R.current&&(D||n!==Ia())&&(F.current=!0,v.setOpen(!1,en(wr,t)))})}function o(){z.current||(C.current.insideReactTree=!0,re.start(0,()=>{C.current.insideReactTree=!1}))}let d=Ft(b)?b:null;if(!(!x&&!d))return bt(d&&Nn(d,`focusout`,a),d&&Nn(d,`pointerdown`,t),x&&Nn(x,`focusin`,n),x&&Nn(x,`focusout`,a),x&&P&&Nn(x,`focusout`,o,!0))},[r,b,x,se,l,N,P,v,u,s,le,D,w,O,C,re,ie,ae,f,p,ue]),q.useEffect(()=>{if(r||!x||!y)return;let e=Array.from(P?.portalNode?.querySelectorAll(`[${vr(`portal`)}]`)||[]),t=(N?Fe(N.nodesRef.current,w()):[]).find(e=>Ue(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Aa([...[x,...e,U.current,ee.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,...ue()],t,Xn(p),Xn(f),D?b:null].filter(e=>e!=null),{ariaHidden:l||D,mark:!1}),i=Aa([x,...e].filter(e=>e!=null));return()=>{i(),n()}},[y,r,b,x,l,O,P,D,N,w,f,p,ue]),Vn(()=>{if(!y||r||!Ft(se))return;let e=M(i(se));queueMicrotask(()=>{let t=k.current,n=typeof t==`function`?t(j.current||``):t;if(n===void 0||n===!1||W(se,e))return;let r=null,i=()=>(r??=le(se),r[0]||se),a;a=n===!0||n===null?i():Xn(n),a||=i(),ya(a,{preventScroll:a===se})})},[r,y,se,E,le,k,j]),Vn(()=>{if(r||!se)return;let e=i(se);Fa(M(e));function t(e){if(e.open||(V.current=ja(e.nativeEvent,H.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(F.current=!0),e.reason===`outside-press`)if(e.nested)F.current=!1;else if(ce(e.nativeEvent)||je(e.nativeEvent))F.current=!1;else{let e=!1;i(se).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?F.current=!1:F.current=!0}}S.on(`openchange`,t);function n(){let e=A.current,t=typeof e==`function`?e(V.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=b||Ia();return e&&e.isConnected?e:null}let n=b||Ia();return Xn(t)||n||null}return()=>{S.off(`openchange`,t);let r=M(e),i=ue(),a=W(x,r)||i.some(e=>e===r||W(e,r))||N&&_(N.nodesRef.current,w(),!1).some(e=>W(e.context?.elements.floating,r)),o=A.current,s=n();queueMicrotask(()=>{let t=La(s),n=typeof o!=`boolean`;o&&!F.current&&Ft(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),F.current=!1})}},[r,x,se,A,C,S,N,b,w,ue]),Vn(()=>{if(!L||y||!x)return;let e=M(i(x));!Ft(e)||!Ze(e)||W(x,e)&&e.blur()},[y,x]),Vn(()=>{if(!(r||!P))return P.setFocusManagerState({modal:l,closeOnFocusOut:u,open:y,onOpenChange:v.setOpen,domReference:b}),()=>{P.setFocusManagerState(null)}},[r,P,l,y,v,u,b]),Vn(()=>{if(!(r||!se))return za(se,O),()=>{queueMicrotask(Pa)}},[r,se,O]);let de=!r&&(l?!D:!0)&&(oe||l);return(0,J.jsxs)(q.Fragment,{children:[de&&(0,J.jsx)(Ee,{"data-type":`inside`,ref:te,onFocus:e=>{if(l){let e=le();ya(e[e.length-1])}else P?.portalNode&&(F.current=!1,pn(e,P.portalNode)?ze(b)?.focus():Xn(p??P.beforeOutsideRef)?.focus())}}),n,de&&(0,J.jsx)(Ee,{"data-type":`inside`,ref:ne,onFocus:e=>{l?ya(le()[0]):P?.portalNode&&(u&&(F.current=!0),pn(e,P.portalNode)?T(b)?.focus():Xn(f??P.afterOutsideRef)?.focus())}})]})}function Va(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=be}=t,d=q.useRef(void 0),f=nr(),p=Qe(),m=q.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`||V(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=Bn(i);if(Ze(y)){let e=en(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=en(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(V(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)||k(f))),g=en(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 q.useMemo(()=>i?{reference:m}:ge,[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 ree=`Escape`;function Ua(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Wa(e,t){return Ua(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Ga(e,t,n){return Ua(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function iee(e,t,n){return Ua(t,n?e===at:e===tt,e===ee)}function aee(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ree:Ua(t,n?e===tt:e===at,e===lt)}function oee(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),a=n.useState(`floatingElement`),o=n.useState(`domReferenceElement`),s=n.context.dataRef,{listRef:c,activeIndex:l,onNavigate:u=()=>{},enabled:d=!0,selectedIndex:p=null,allowEscape:m=!1,loopFocus:h=!1,nested:g=!1,rtl:_=!1,virtual:v=!1,focusItemOnOpen:y=`auto`,focusItemOnHover:b=!0,openOnArrowKeyDown:x=!0,disabledIndices:S=void 0,orientation:C=`vertical`,parentOrientation:w,cols:T=1,id:E,resetOnPointerLeave:D=!0,externalTree:k}=t,A=Kn(I(a)),j=Pt(),N=Ut(k);Vn(()=>{s.current.orientation=C},[s,C]);let P=Ue(o),F=q.useRef(y),L=q.useRef(p??-1),R=q.useRef(null),z=q.useRef(!0),V=On(e=>{u(L.current===-1?null:L.current,e)}),H=q.useRef(V),U=q.useRef(!!a),ee=q.useRef(r),te=q.useRef(!1),ne=q.useRef(!1),re=q.useRef(null),ie=Kn(S),ae=Kn(r),oe=Kn(p),le=Kn(D),ue=On(()=>{function e(e){v?N?.events.emit(`virtualfocus`,e):re.current=ya(e,{sync:te.current,preventScroll:!0})}let t=c.current[L.current],n=ne.current;t&&e(t),(te.current?e=>e():requestAnimationFrame)(()=>{let r=c.current[L.current]||t;r&&(t||e(r),me&&(n||!z.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Vn(()=>{d&&(r&&a?(L.current=p??-1,F.current&&p!=null&&(ne.current=!0,V())):U.current&&(L.current=-1,H.current()))},[d,r,a,p,V]),Vn(()=>{if(d){if(!r){te.current=!1;return}if(a)if(l==null){if(te.current=!1,oe.current!=null)return;if(U.current&&(L.current=-1,ue()),(!ee.current||!U.current)&&F.current&&(R.current!=null||F.current===!0&&R.current==null)){let e=0,t=()=>{c.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(L.current=R.current==null||Ga(R.current,C,_)||g?Ae(c):se(c),R.current=null,V())};t()}}else f(c.current,l)||(L.current=l,ue(),ne.current=!1)}},[d,r,a,l,oe,g,c,C,_,V,ue,ie]),Vn(()=>{if(!d||a||!N||v||!U.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=M(i(a)),r=e.some(e=>e.context&&W(e.context.elements.floating,n));t&&!r&&z.current&&t.focus({preventScroll:!0})},[d,a,N,j,v]),Vn(()=>{H.current=V,ee.current=r,U.current=!!a}),Vn(()=>{r||(R.current=null,F.current=y)},[r,y]);let fe=l!=null,pe=On(e=>{if(!ae.current)return;let t=c.current.indexOf(e.currentTarget);t!==-1&&(L.current!==t||l!==t)&&(L.current=t,V(e))}),me=q.useMemo(()=>({onFocus(e){te.current=!0,pe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){te.current=!0,ne.current=!1,b&&pe(e)},onPointerLeave(e){if(!ae.current||!z.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!Ha(e)&&!(!b||c.current.includes(t))&&le.current&&(re.current?.(),re.current=null,L.current=-1,V(e),!v)){let e=A.current,t=M(i(e));e&&W(e,t)&&e.focus({preventScroll:!0})}}}),[pe,ae,A,b,c,V,le,v]),ge=q.useCallback(()=>w??N?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation,[j,N,w]),_e=On(e=>{if(z.current=!1,te.current=!0,e.which===229||!ae.current&&e.currentTarget===A.current)return;if(g&&aee(e.key,C,_,T)){Wa(e.key,ge())||Or(e),n.setOpen(!1,en(Ie,e.nativeEvent)),Ft(o)&&(v?N?.events.emit(`virtualfocus`,o):o.focus());return}let t=L.current,i=Ae(c,S),a=se(c,S);if(P||(e.key===`Home`&&(Or(e),L.current=i,V(e)),e.key===`End`&&(Or(e),L.current=a,V(e))),T>1){let t=Array.from({length:c.current.length},()=>({width:1,height:1})),n=de(t,T,!1),r=n.findIndex(e=>e!=null&&!qe(c.current,e,S)),o=n.reduce((e,t,n)=>t!=null&&!qe(c.current,t,S)?n:e,-1),s=n[B(n.map(e=>e==null?null:c.current[e]),{event:e,orientation:C,loopFocus:h,rtl:_,cols:T,disabledIndices:O([...(typeof S==`function`?null:S)||c.current.map((e,t)=>qe(c.current,t,S)?t:void 0),void 0],n),minIndex:r,maxIndex:o,prevIndex:Se(L.current>a?i:L.current,t,n,T,e.key===`ArrowDown`?`bl`:e.key===(_?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(s!=null&&(L.current=s,V(e)),C===`both`)return}if(Wa(e.key,C)){if(Or(e),r&&!v&&M(e.currentTarget.ownerDocument)===e.currentTarget){L.current=Ga(e.key,C,_)?i:a,V(e);return}Ga(e.key,C,_)?h?t>=a?m&&t!==c.current.length?L.current=-1:(te.current=!1,L.current=i):L.current=he(c.current,{startingIndex:t,disabledIndices:S}):L.current=Math.min(a,he(c.current,{startingIndex:t,disabledIndices:S})):h?t<=i?m&&t!==-1?L.current=c.current.length:(te.current=!1,L.current=a):L.current=he(c.current,{startingIndex:t,decrement:!0,disabledIndices:S}):L.current=Math.max(i,he(c.current,{startingIndex:t,decrement:!0,disabledIndices:S})),f(c.current,L.current)&&(L.current=-1),V(e)}}),ve=q.useMemo(()=>v&&r&&fe&&{"aria-activedescendant":`${E}-${l}`},[v,r,fe,E,l]),ye=q.useMemo(()=>({"aria-orientation":C===`both`?void 0:C,...P?{}:ve,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!v){let t=Bn(e.nativeEvent);if(t&&!W(A.current,t))return;Or(e),n.setOpen(!1,en(wr,e.nativeEvent)),Ft(o)&&o.focus();return}_e(e)},onPointerMove(){z.current=!0}}),[ve,_e,A,C,P,n,r,v,o]),be=q.useMemo(()=>{function e(e){y===`auto`&&ce(e.nativeEvent)&&(F.current=!v)}function t(e){F.current=y,y===`auto`&&je(e.nativeEvent)&&(F.current=!0)}return{onKeyDown(e){let t=n.select(`open`);z.current=!1;let r=e.key.startsWith(`Arrow`),i=iee(e.key,ge(),_),a=Wa(e.key,C),o=(g?i:a)||e.key===`Enter`||e.key.trim()===``;if(v&&t)return _e(e);if(!(!t&&!x&&r)){if(o){let t=Wa(e.key,ge());R.current=g&&t?null:e.key}if(g){i&&(Or(e),t?(L.current=Ae(c,ie.current),V(e)):n.setOpen(!0,en(Ie,e.nativeEvent,e.currentTarget)));return}a&&(oe.current!=null&&(L.current=oe.current),Or(e),!t&&x?n.setOpen(!0,en(Ie,e.nativeEvent,e.currentTarget)):_e(e),t&&V(e))}},onFocus(e){n.select(`open`)&&!v&&(L.current=-1,V(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[_e,ie,y,c,g,V,n,x,C,ge,_,oe,v]),G=q.useMemo(()=>({...ve,...be}),[ve,be]);return q.useMemo(()=>d?{reference:G,floating:ye,item:me,trigger:be}:{},[d,G,ye,be,me])}var see=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function Ka(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=wt(),l=a?.id||c,u=q.useMemo(()=>I(o)?.id||i,[o,i]),d=see.get(s)??s,f=Pt()!=null,p=q.useMemo(()=>d===`tooltip`||s===`label`?ge:{"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=q.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=q.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=q.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 q.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function qa(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Qe(),m=q.useRef(``),h=q.useRef(f??s??-1),g=q.useRef(null);Vn(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),Vn(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=On(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=On(e=>{function t(e){let t=o?.current[e];return!t||Dr(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(m.current.length>0&&e.key===` `&&(Or(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(Or(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=On(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=W(r,t),o=W(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),b=q.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),x=q.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return q.useMemo(()=>u?{reference:b,floating:x}:{},[u,b,x])}function Ja(e){return Cr(19)?e:e?`true`:void 0}var Ya=C(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Xa=C(`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`}]]),Za=C(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Qa=C(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),$a=C(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),eo=C(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),to=C(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),no=C(`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`}]]),ro=C(`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`}]]),io=C(`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`}]]),ao=C(`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`}]]),oo=C(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),so=C(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),co=C(`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`}]]),lo=C(`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`}]]),uo=C(`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`}]]),fo=C(`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`}]]),po=C(`git-pull-request-arrow`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v12`,key:`ih889a`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}]]),mo=C(`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`}]]),ho=C(`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`}]]),go=C(`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`}]]),_o=C(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),vo=C(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),yo=C(`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`}]]),bo=C(`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`}]]),cee=C(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),lee=C(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),uee=C(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),xo=C(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),dee=C(`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`}]]),So=C(`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`}]]),fee=C(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Co=C(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),pee=C(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),wo=C(`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`}]]),mee=C(`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`}]]),To=C(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function hee(e){return typeof e==`function`}function Eo(e,...t){return hee(e)?e(...t):e}var gee=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)}},_ee=new Map;function vee(e,t){_ee.set(e,t)}function Do(e){if(e!==void 0)try{return JSON.parse(JSON.stringify(e))}catch{return null}}function yee(e){return typeof e.get==`function`?e.get():e.state}function bee(e){return{key:e.key,store:{state:Do(yee(e.store))},options:Do(e.options)}}var xee=class extends gee{constructor(e){super({pluginId:`pacer`,debug:e?.debug,reconnectEveryMs:1e3})}},Oo=(e,t)=>{let n=t.key;n&&(vee(n,t),ko.emit(e,bee({...t,key:n})))},ko=new xee;function Ao(){return{currentAttempt:0,executionCount:0,isExecuting:!1,lastError:void 0,lastExecutionTime:0,lastResult:void 0,status:`idle`,totalExecutionTime:0}}var jo={backoff:`exponential`,baseWait:1e3,maxWait:1/0,enabled:!0,jitter:0,maxAttempts:3,maxExecutionTime:1/0,maxTotalExecutionTime:1/0,throwOnError:`last`},Mo=class{#e;constructor(e,t={}){this.fn=e,this.store=new oa(Ao()),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`}}),Oo(`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(Ao())},this.key=t.key,this.options={...jo,...t,throwOnError:t.throwOnError??(t.onError?!1:jo.throwOnError)},this.#t(this.options.initialState??{}),this.key&&ko.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 No(){return{canLeadingExecute:!0,errorCount:0,isExecuting:!1,isPending:!1,lastArgs:void 0,lastResult:void 0,maybeExecuteCount:0,settleCount:0,status:`idle`,successCount:0}}var Po={asyncRetryerOptions:{maxAttempts:1},enabled:!0,leading:!1,trailing:!0,wait:0},Fo=class{#e;#t;constructor(e,t){this.fn=e,this.store=new oa(No()),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`}}),Oo(`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 Mo(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(No()),this.asyncRetryers.forEach(e=>e.reset())},this.key=t.key,this.options={...Po,...t,throwOnError:t.throwOnError??!t.onError},this.#n(this.options.initialState??{}),this.key&&ko.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 Io(){return{executionCount:0,isEmpty:!0,isPending:!1,totalItemsProcessed:0,items:[],size:0,status:`idle`}}var Lo={getShouldExecute:()=>!1,maxSize:1/0,started:!0,wait:1/0},Ro=class{#e;constructor(e,t){this.fn=e,this.store=new oa(Io()),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`}}),Oo(`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(Io()),this.options.onItemsChange?.(this)},this.key=t.key,this.options={...Lo,...t},this.#t(this.options.initialState??{}),this.key&&ko.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 zo(){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},Vo=class{#e;constructor(e,t){this.fn=e,this.store=new oa(zo()),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`}}),Oo(`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(zo())},this.key=t.key,this.options={...Bo,...t},this.#t(this.options.initialState??{}),this.key&&ko.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};function Ho(e){return Jt(e.defaultTagName??`div`,e,e)}var Y=Lt(),Uo=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Wo=hn,Go=(e,t)=>n=>{if(t?.variants==null)return Wo(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=Uo(t)||Uo(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 Wo(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)},Ko=768;function qo(){let e=(0,Y.c)(2),[t,n]=q.useState(void 0),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=window.matchMedia(`(max-width: ${Ko-1}px)`),t=()=>{n(window.innerWidth<Ko)};return e.addEventListener(`change`,t),n(window.innerWidth<Ko),()=>e.removeEventListener(`change`,t)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),q.useEffect(r,i),!!t}var Jo=4,Yo=.5,Xo=.2,Zo=20,Qo=10,$o=320,es=256,ts=512;function ns(){if(typeof window>`u`)return`col-resize`;let e=window.navigator.userAgent;return e.includes(`Chrome`)||e.includes(`Firefox`)?`ew-resize`:`col-resize`}function rs(){if(typeof window>`u`)return`row-resize`;let e=window.navigator.userAgent;return e.includes(`Chrome`)||e.includes(`Firefox`)?`ns-resize`:`row-resize`}function is(){return typeof window>`u`?Qo:window.matchMedia(`(pointer:coarse)`).matches?Zo:Qo}function as(e){let t=document.createElement(`style`);return t.dataset.resizeCursor=`true`,t.textContent=`*, *:hover { cursor: ${e} !important; }`,document.head.append(t),()=>t.remove()}function os(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 ss(e,t,n){return Math.min(Math.max(e,t),n)}function cs(e){return e.closest(`[data-slot='sidebar']`)?.dataset.side===`right`?`right`:`left`}function ls(e){return e.closest(`[data-slot='sidebar-wrapper']`)}function us(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 ds(e){e.previewAnimationFrame!==null&&(window.cancelAnimationFrame(e.previewAnimationFrame),e.previewAnimationFrame=null)}function fs(e,t){let n=t-e.startX;return e.side===`left`?e.startWidth+n:e.startWidth-n}function ps(e,t){return e.side===`left`?t>e.startX:t<e.startX}function ms(e){let t=q.useRef(e);return t.current=e,t}function hs(e){let t=(0,Y.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?Xo: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=ms(m),g=q.useRef(!1),_=q.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]),q.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=os(t.minWidth,es),r=os(t.maxWidth,ts),i=os(t.width,$o),a={collapsed:t.state!==`expanded`,latestWidth:null,moved:!1,previewAnimationFrame:null,previewElement:ls(e.currentTarget),previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect,side:cs(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?.(),ds(a),Object.assign(document.body.style,{cursor:a.previousCursor,userSelect:a.previousUserSelect}),a.moved&&h.current.onResizeActiveChange(!1),_.current=null},c=()=>{let e=ns();a.moved=!0,g.current=!0,h.current.onResizeActiveChange(!0),o=as(e),Object.assign(document.body.style,{cursor:e,userSelect:`none`})},l=e=>{let t=`${Math.round(n)}px`;us(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`;us(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<Jo)return;a.moved||c(),e.preventDefault();let i=fs(a,e.clientX);if(a.collapsed){let t=n*h.current.expandThreshold;ps(a,e.clientX)&&i>=t&&u(e.clientX);return}if(i<=n*Yo){l(e.clientX);return}let o=ss(i,n,r);us(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}var gs=q.createContext(void 0);function _s(e=!1){let t=q.useContext(gs);if(t===void 0&&!e)throw Error(ie(16));return t}function vs(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:q.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 ys(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=q.useRef(null),s=_s(!0),c=a??s!==void 0,{props:l}=vs({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=q.useCallback(()=>{let e=o.current;bs(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Vn(u,[u]),{getButtonProps:q.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return dr({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(mt(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=bs(a),l=!i&&xs(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||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(mt(e),a?.(e),e.target===e.currentTarget&&i&&c&&bs(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:On(e=>{o.current=e,u()})}}function bs(e){return Ft(e)&&e.tagName===`BUTTON`}function xs(e){return!!(e?.tagName===`A`&&e?.href)}var Ss=q.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}=ys({disabled:i,focusableWhenDisabled:a,native:o});return Jt(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),Cs=Go(`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 ws(e){let t=(0,Y.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=G(Cs({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,J.jsx)(Ss,{"data-slot":`button`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}var Ts=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}({}),Es={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ds={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Os={disabled:!1,...Ds},ks={valid(e){return e===null?null:e?{[Ts.valid]:``}:{[Ts.invalid]:``}}},As=q.createContext({invalid:void 0,name:void 0,validityData:{state:Es,errors:[],error:``,value:``,initialValue:null},setValidityData:Ce,disabled:void 0,touched:Ds.touched,setTouched:Ce,dirty:Ds.dirty,setDirty:Ce,filled:Ds.filled,setFilled:Ce,focused:Ds.focused,setFocused:Ce,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Os,markedDirtyRef:{current:!1},registerFieldControl:Ce,validation:{getValidationProps:(e=ge)=>e,getInputValidationProps:(e=ge)=>e,inputRef:{current:null},commit:async()=>{}}});function js(e=!0){let t=q.useContext(As);if(t.setValidityData===Ce&&!e)throw Error(ie(28));return t}var See=q.createContext({controlId:void 0,registerControlId:Ce,labelId:void 0,setLabelId:Ce,messageIds:[],setMessageIds:Ce,getDescriptionProps:e=>e});function Ms(){return q.useContext(See)}function Ns({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=q.useRef(e!==void 0),[a,o]=q.useState(t);return[i?e:a,q.useCallback(e=>{i||o(e)},[])]}function Cee(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=js(),s=q.useRef(null);s.current||=Symbol(),Vn(()=>{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 wee(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=Ms(),o=A(t),s=n?i:void 0,c=ut(()=>Symbol(`labelable-control`)),l=q.useRef(!1),u=q.useRef(t!=null),d=On(()=>{!l.current||a===Ce||(l.current=!1,a(c.current,void 0))});return Vn(()=>{if(a===Ce)return;let e;if(n){let n=r?.current;e=sr(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),q.useEffect(()=>d,[d]),i??o}var Tee=q.forwardRef(function(e,t){let{render:n,className:r,id:a,name:o,value:s,disabled:c=!1,onValueChange:l,defaultValue:u,autoFocus:d=!1,style:f,...p}=e,{state:m,name:h,disabled:g,setTouched:_,setDirty:y,validityData:b,setFocused:x,setFilled:S,validationMode:C,validation:w}=js(),T=g||c,E=h??o,D={...m,disabled:T},{labelId:O}=Ms(),k=wee({id:a});Vn(()=>{let e=s!=null;w.inputRef.current?.value||e&&s!==``?S(!0):e&&s===``&&S(!1)},[w.inputRef,S,s]);let A=q.useRef(null);Vn(()=>{d&&A.current===M(i(A.current))&&x(!0)},[d,x]);let[j]=Ns({controlled:s,default:u,name:`FieldControl`,state:`value`}),N=s!==void 0,P=N?j:void 0,F=On(()=>w.inputRef.current?.value);return Cee(w.inputRef,{id:k,value:P,getValue:F}),Jt(`input`,e,{ref:[t,A],state:D,props:[{id:k,disabled:T,name:E,ref:w.inputRef,"aria-labelledby":O,autoFocus:d,...N?{value:P}:{defaultValue:u},onChange(e){let t=e.currentTarget.value;l?.(t,en(v,e.nativeEvent)),y(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:ks})}),Eee=q.forwardRef(function(e,t){return(0,J.jsx)(Tee,{ref:t,...e})});function Ps(e){let t=(0,Y.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=G(`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,J.jsx)(Eee,{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 Fs=`after:transition-colors after:duration-150 hover:after:bg-primary focus-visible:after:bg-primary active:after:bg-primary`,Dee=`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`,Is=q.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return Jt(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Oee(e){let t=(0,Y.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=G(`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,J.jsx)(Is,{"data-slot":`separator`,orientation:a,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}var Ls=q.createContext(void 0);function Rs(e){let t=q.useContext(Ls);if(e===!1&&t===void 0)throw Error(ie(27));return t}var kee={...le,...Dn},zs=q.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Rs(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return Jt(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:kee,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Bs=q.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=Rs(),l=c.useState(`open`);function u(e){l&&c.setOpen(!1,en(ht,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=ys({disabled:i,native:a});return Jt(`button`,e,{state:{disabled:i},ref:[t,f],props:[{onClick:u},s,d]})}),Vs=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Rs(),c=A(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),Jt(`p`,e,{ref:t,props:[{id:c},o]})}),Aee=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),jee=function(e){return e[e.open=H.open]=`open`,e[e.closed=H.closed]=`closed`,e[e.startingStyle=H.startingStyle]=`startingStyle`,e[e.endingStyle=H.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Hs=q.createContext(void 0);function Mee(){let e=q.useContext(Hs);if(e===void 0)throw Error(ie(26));return e}var Us=`ArrowUp`,Ws=`ArrowDown`,Gs=`ArrowLeft`,Ks=`ArrowRight`,qs=`Home`,Js=new Set([Gs,Ks]),Nee=new Set([Gs,Ks,qs,`End`]),Ys=new Set([Us,Ws]),Pee=new Set([Us,Ws,qs,`End`]),Xs=new Set([...Js,...Ys]),Fee=new Set([...Xs,qs,`End`]),Zs=new Set([Us,Ws,Gs,Ks,qs,`End`]),Qs=new Set([`Shift`,`Control`,`Alt`,`Meta`]);function $s(e){return Ft(e)&&e.tagName===`INPUT`}function ec(e){return!!($s(e)&&e.selectionStart!=null||Ft(e)&&e.tagName===`TEXTAREA`)}function tc(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=nc(e,t,`left`),a=rc(e),o=rc(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=nc(e,t,`top`),r=rc(e),i=rc(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 nc(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 rc(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 ic={...le,...Dn,nestedDialogOpen(e){return e?{[jee.nestedDialogOpen]:``}:null}},ac=q.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:s,...c}=e,{store:l}=Rs(),u=l.useState(`descriptionElementId`),d=l.useState(`disablePointerDismissal`),f=l.useState(`floatingRootContext`),p=l.useState(`popupProps`),m=l.useState(`modal`),h=l.useState(`mounted`),g=l.useState(`nested`),_=l.useState(`nestedOpenDialogCount`),v=l.useState(`open`),y=l.useState(`openMethod`),b=l.useState(`titleElementId`),x=l.useState(`transitionStatus`),S=l.useState(`role`);Mee(),o({open:v,ref:l.context.popupRef,onComplete(){v&&l.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?l.context.popupRef.current:!0}let w=i===void 0?C:i,T=Jt(`div`,e,{state:{open:v,nested:g,transitionStatus:x,nestedDialogOpen:_>0},props:[p,{"aria-labelledby":b??void 0,"aria-describedby":u??void 0,role:S,tabIndex:-1,hidden:!h,onKeyDown(e){Zs.has(e.key)&&e.stopPropagation()},style:{[Aee.nestedDialogs]:_}},c],ref:[t,l.context.popupRef,l.useStateSetter(`popupElement`)],stateAttributesMapping:ic});return(0,J.jsx)(Ba,{context:f,openInteractionType:y,disabled:!h,closeOnFocusOut:!d,initialFocus:w,returnFocus:r,modal:m!==!1,restoreFocus:`popup`,children:T})}),oc=q.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,J.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),sc=q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Rs(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,J.jsx)(Hs.Provider,{value:n,children:(0,J.jsxs)(Cn,{ref:t,...r,children:[a&&o===!0&&(0,J.jsx)(oc,{ref:i.context.internalBackdropRef,inert:Ja(!s)}),e.children]})}):null}),cc={},lc={},uc=``;function dc(e){if(typeof document>`u`)return!1;let t=i(e);return yn(t).innerWidth-t.documentElement.clientWidth>0}function fc(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=i(e),n=t.documentElement,r=t.body,a=Ln(n)?n:r,o=a.style.overflowY,s=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,a.style.overflowY=`scroll`;let c=a.offsetWidth;a.style.overflowY=`hidden`;let l=a.offsetWidth;return a.style.overflowY=o,n.style.scrollbarGutter=s,c===l}function pc(e){let t=i(e),n=t.documentElement,r=t.body,a=Ln(n)?n:r,o={overflowY:a.style.overflowY,overflowX:a.style.overflowX};return Object.assign(a.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(a.style,o)}}function mc(e){let t=i(e),n=t.documentElement,r=t.body,a=yn(n),o=0,s=0,c=!1,l=zt.create();if(L&&(a.visualViewport?.scale??1)!==1)return()=>{};function u(){let t=a.getComputedStyle(n),i=a.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;o=n.scrollTop,s=n.scrollLeft,cc={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},uc=n.style.scrollBehavior,lc={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`||i.overflowY===`scroll`,p=t.overflowX===`scroll`||i.overflowX===`scroll`,m=Math.max(0,a.innerWidth-r.clientWidth),h=Math.max(0,a.innerHeight-r.clientHeight),g=parseFloat(i.marginTop)+parseFloat(i.marginBottom),_=parseFloat(i.marginLeft)+parseFloat(i.marginRight),v=Ln(n)?n:r;if(c=fc(e),c){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=o,r.scrollLeft=s,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function d(){Object.assign(n.style,cc),Object.assign(r.style,lc),c||(n.scrollTop=o,n.scrollLeft=s,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=uc)}function f(){d(),l.request(u)}u();let p=Nn(a,`resize`,f);return()=>{l.cancel(),d(),typeof a.removeEventListener==`function`&&p()}}var hc=new class{lockCount=0;restore=null;timeoutLock=We.create();timeoutUnlock=We.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=i(e).documentElement,n=yn(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=Ce;return}let r=p||!dc(e);this.restore=r?pc(e):mc(e)}};function gc(e=!0,t=null){Vn(()=>{if(e)return hc.acquire(t)},[e,t])}function _c(e){let t=q.useRef(``),n=q.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:q.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 vc(e,t){let n=q.useRef(e),r=On(t);Vn(()=>{n.current!==e&&r(n.current)},[e,r]),Vn(()=>{n.current=e},[e])}function yc(e){let[t,n]=q.useState(null),r=On((t,r)=>{e||n(r||(p?`touch`:``))});vc(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=_c(r);return q.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function bc(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=yc(a);st(t);let{forceUnmount:d}=rt(a,t),f=On(e=>{let n=en(e);return n.preventUnmountOnClose=()=>{t.set(`preventUnmountingOnClose`,!0)},n}),p=q.useCallback(()=>{t.setOpen(!1,f(Tt))},[t,f]);q.useImperativeHandle(r,()=>({unmount:d,close:p}),[d,p]);let m=P({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[h,g]=q.useState(0),[_,v]=q.useState(0),y=h===0,b=Ka(m),x=Mn(m,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`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=Bn(e);if(y&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||W(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:y});gc(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=Ye([b,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{g(e),v(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{g(0),v(0)}),q.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(h+1,_+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,h,_,n]);let T=q.useMemo(()=>S(u),[S,u]),E=q.useMemo(()=>w(u),[w,u]),D=q.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:m,nestedOpenDialogCount:h,nestedOpenDrawerCount:_})}var xc={...Hn,modal:yt(e=>e.modal),nested:yt(e=>e.nested),nestedOpenDialogCount:yt(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:yt(e=>e.nestedOpenDrawerCount),disablePointerDismissal:yt(e=>e.disablePointerDismissal),openMethod:yt(e=>e.openMethod),descriptionElementId:yt(e=>e.descriptionElementId),titleElementId:yt(e=>e.titleElementId),viewportElement:yt(e=>e.viewportElement),role:yt(e=>e.role)},Sc=class e extends an{constructor(e){super(Cc(e),{popupRef:q.createRef(),backdropRef:q.createRef(),internalBackdropRef:q.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new ne,onOpenChange:void 0,onOpenChangeComplete:void 0},xc)}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=ut(()=>new e(n)).current;return t??r}};function Cc(e={}){return{...ae(),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 wc=q.createContext(!1);function Tc(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=Rs(!0),p=q.useContext(wc),m=!!f,h=Sc.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});te(()=>{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`);bc({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=q.useMemo(()=>({store:h}),[h]);return(0,J.jsx)(wc.Provider,{value:!1,children:(0,J.jsx)(Ls.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}var Ec=q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Rs(),c=A(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),Jt(`h2`,e,{ref:t,props:[{id:c},o]})});function Dc(e){let t=(0,Y.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,J.jsx)(Tc,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function Oc(e){let t=(0,Y.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,J.jsx)(sc,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function kc(e){let t=(0,Y.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=G(`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,J.jsx)(zs,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ac(e){let t=(0,Y.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,J.jsx)(kc,{}),t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=G(`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,J.jsxs)(Bs,{"data-slot":`sheet-close`,render:(0,J.jsx)(ws,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,J.jsx)(To,{}),(0,J.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,J.jsxs)(Oc,{children:[l,(0,J.jsxs)(ac,{"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 jc(e){let t=(0,Y.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=G(`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,J.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mc(e){let t=(0,Y.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=G(`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,J.jsx)(Ec,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nc(e){let t=(0,Y.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=G(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(Vs,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Pc=`sidebar_state`,Fc=3600*24*7,Ic=`20rem`,Lc=`16rem`,Rc=`32rem`,zc=`pico-sidebar-width`,Bc=`sidebar_width`,Vc=`20rem`,Hc=`3rem`,Uc=`b`,Wc=q.createContext(null);function Gc(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 Kc(e){let t=Gc(Ic,320),n=Gc(Lc,256),r=Gc(Rc,512),i=Gc(e??``,t);return`${Math.round(Math.min(Math.max(i,n),r))}px`}function qc(){if(typeof window>`u`)return Kc(Ic);try{return Kc(window.localStorage.getItem(zc)??window.localStorage.getItem(Bc))}catch{return Kc(Ic)}}function Jc(e){try{window.localStorage.setItem(zc,e)}catch{}}function Yc(e){let t=q.useRef(e);return t.current=e,t}function Xc(){let e=q.use(Wc);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function Zc(e){return{open:e,openMobile:!1,openMobileSettled:!1,sidebarResizing:!1,sidebarWidth:Kc(Ic)}}function Qc(e,t){switch(t.type){case`openChanged`:return e.open===t.open?e:{...e,open:t.open};case`openMobileChanged`:return e.openMobile===t.openMobile?e:{...e,openMobile:t.openMobile};case`openMobileSettledChanged`:return e.openMobileSettled===t.openMobileSettled?e:{...e,openMobileSettled:t.openMobileSettled};case`sidebarResizingChanged`:return e.sidebarResizing===t.sidebarResizing?e:{...e,sidebarResizing:t.sidebarResizing};case`sidebarWidthChanged`:return e.sidebarWidth===t.sidebarWidth?e:{...e,sidebarWidth:t.sidebarWidth};default:return e}}function $c({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o}){let s=qo(),[c,l]=q.useReducer(Qc,e,Zc),{open:u,openMobile:d,openMobileSettled:f,sidebarResizing:p,sidebarWidth:m}=c,h=q.useRef(m);h.current=m,q.useEffect(()=>{let e=qc();h.current!==e&&(h.current=e,l({type:`sidebarWidthChanged`,sidebarWidth:e}))},[]);let g=e=>{let t=Kc(e);h.current!==t&&(h.current=t,l({type:`sidebarWidthChanged`,sidebarWidth:t}),Jc(t))},_=t??u,v=e=>{let t=typeof e==`function`?e(_):e;n?n(t):l({type:`openChanged`,open:t}),document.cookie=`${Pc}=${t}; path=/; max-age=${Fc}`},y=e=>{l({type:`openMobileChanged`,openMobile:e})},b=e=>{l({type:`openMobileSettledChanged`,openMobileSettled:e})},x=e=>{l({type:`sidebarResizingChanged`,sidebarResizing:e})},S=()=>s?y(!d):v(e=>!e),C=Yc(S);q.useEffect(()=>{let e=e=>{e.key.toLowerCase()===Uc&&(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:_?`expanded`:`collapsed`,open:_,setOpen:v,isMobile:s,openMobile:d,openMobileSettled:f,setOpenMobile:y,setOpenMobileSettled:b,sidebarResizing:p,setSidebarResizing:x,sidebarWidth:m,setSidebarWidth:g,toggleSidebar:S};return(0,J.jsx)(Wc.Provider,{value:w,children:(0,J.jsx)(`div`,{"data-slot":`sidebar-wrapper`,style:{...i,"--sidebar-width":m,"--sidebar-width-icon":Hc},className:G(`group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar`,r),...o,children:a})})}function el(e){let t=(0,Y.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:_}=Xc();if(d===`none`){let e;t[8]===r?e=t[9]:(e=G(`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,J.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":Vc},t[14]=e):e=t[14];let r;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsxs)(jc,{className:`sr-only`,children:[(0,J.jsx)(Mc,{children:`Sidebar`}),(0,J.jsx)(Nc,{children:`Displays the mobile sidebar.`})]}),t[15]=r):r=t[15];let o;t[16]===n?o=t[17]:(o=(0,J.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,J.jsxs)(Ac,{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,J.jsx)(Dc,{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=G(`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,J.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=G(`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,J.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,J.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,J.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 tl(e){let t=(0,Y.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}=Xc(),o;t[4]===n?o=t[5]:(o=G(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,J.jsx)(cee,{}),l=(0,J.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,J.jsx)(tn,{title:`Toggle sidebar`,kbd:`⌃ B`,children:(0,J.jsxs)(ws,{"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 nl(e){let t=(0,Y.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}=Xc(),p;t[6]!==s||t[7]!==c||t[8]!==l||t[9]!==u||t[10]!==d||t[11]!==f?(p={isMobile:s,maxWidth:Rc,minWidth:Lc,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}=hs(p),[g,_]=q.useState(`col-resize`),[v,y]=q.useState(10),b,x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{let e=()=>{y(is())},t=window.matchMedia(`(pointer:coarse)`);return _(ns()),e(),t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},x=[],t[13]=b,t[14]=x):(b=t[13],x=t[14]),q.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=G(`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`,Fs,S,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full`,Dee,`[[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,J.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 rl(e){let t=(0,Y.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=G(`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,J.jsx)(`main`,{"data-slot":`sidebar-inset`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function il(e){let t=(0,Y.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=G(`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,J.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 al(e){let t=(0,Y.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=G(`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,J.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 ol(e){let t=(0,Y.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=G(`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,J.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 sl(e){let t=(0,Y.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=G(`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,J.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 cl(e){let t=(0,Y.c)(10),n,r,i,a;if(t[0]!==e){let{className:o,render:s,...c}=e;n=s,a=Ho,r=`div`,i=dr({className:G(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,o)},c),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o={slot:`sidebar-group-label`,sidebar:`group-label`},t[5]=o):o=t[5];let s;return t[6]!==n||t[7]!==r||t[8]!==i?(s={defaultTagName:r,props:i,render:n,state:o},t[6]=n,t[7]=r,t[8]=i,t[9]=s):s=t[9],a(s)}function ll(e){let t=(0,Y.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=G(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.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 ul(e){let t=(0,Y.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=G(`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,J.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 dl(e){let t=(0,Y.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=G(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.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 fl=Go(`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 pl(e){let t=(0,Y.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}=Xc(),m=dr({className:G(fl({variant:u,size:d}),s)},c),h;t[0]!==n||t[1]!==o?(h=o?(0,J.jsx)(fr,{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=Ho(_);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,J.jsx)(gt,{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,J.jsxs)(Xt,{children:[v,b]}),t[15]=v,t[16]=b,t[17]=x):x=t[17],x}var ml=1,hl=.9,gl=.8,_l=.17,vl=.1,yl=.999,bl=.9999,xl=.99,Sl=/[\\\/_+.#"@\[\(\{&]/,Cl=/[\\\/_+.#"@\[\(\{&]/g,wl=/[\s-]/,Tl=/[\s-]/g;function El(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ml:xl;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=El(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ml:Sl.test(e.charAt(l-1))?(d*=gl,p=e.slice(i,l-1).match(Cl),p&&i>0&&(d*=yl**+p.length)):wl.test(e.charAt(l-1))?(d*=hl,m=e.slice(i,l-1).match(Tl),m&&i>0&&(d*=yl**+m.length)):(d*=_l,i>0&&(d*=yl**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=bl)),(d<vl&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=El(e,t,n,r,l+1,a+2,o),f*vl>d&&(d=f*vl)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Dl(e){return e.toLowerCase().replace(Tl,` `)}function Ol(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,El(e,t,Dl(e),Dl(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function kl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Al(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function jl(...e){return t=>{let n=!1,r=e.map(e=>{let r=Al(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():Al(e[t],null)}}}}function Ml(...e){return q.useCallback(jl(...e),e)}function Nl(e,t){let n=q.createContext(t),r=e=>{let{children:t,...r}=e,i=q.useMemo(()=>r,Object.values(r));return(0,J.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=q.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Pl(e,t=[]){let n=[];function r(t,r){let i=q.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=q.useMemo(()=>o,Object.values(o));return(0,J.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=q.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=>q.createContext(e));return function(n){let r=n?.[e]||t;return q.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Fl(i,...t)]}function Fl(...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 q.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Il=globalThis?.document?q.useLayoutEffect:()=>{},Ll=q.useId||(()=>void 0),Rl=0;function zl(e){let[t,n]=q.useState(Ll());return Il(()=>{e||n(e=>e??String(Rl++))},[e]),e||(t?`radix-${t}`:``)}var Bl=q.useInsertionEffect||Il;function Vl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Hl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=q.useRef(e!==void 0);q.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,q.useCallback(t=>{if(s){let n=Ul(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Hl({defaultProp:e,onChange:t}){let[n,r]=q.useState(e),i=q.useRef(n),a=q.useRef(t);return Bl(()=>{a.current=t},[t]),q.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Ul(e){return typeof e==`function`}var Wl=t(Pe(),1);function Gl(e){let t=Kl(e),n=q.forwardRef((e,n)=>{let{children:r,...i}=e,a=q.Children.toArray(r),o=a.find(Jl);if(o){let e=o.props.children,r=a.map(t=>t===o?q.Children.count(e)>1?q.Children.only(null):q.isValidElement(e)?e.props.children:null:t);return(0,J.jsx)(t,{...i,ref:n,children:q.isValidElement(e)?q.cloneElement(e,void 0,r):null})}return(0,J.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Kl(e){let t=q.forwardRef((e,t)=>{let{children:n,...r}=e;if(q.isValidElement(n)){let e=Xl(n),i=Yl(r,n.props);return n.type!==q.Fragment&&(i.ref=t?jl(t,e):e),q.cloneElement(n,i)}return q.Children.count(n)>1?q.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ql=Symbol(`radix.slottable`);function Jl(e){return q.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ql}function Yl(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 Xl(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 Zl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Gl(`Primitive.${t}`),r=q.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,J.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ql(e,t){e&&Wl.flushSync(()=>e.dispatchEvent(t))}function $l(e){let t=q.useRef(e);return q.useEffect(()=>{t.current=e}),q.useMemo(()=>(...e)=>t.current?.(...e),[])}function eu(e,t=globalThis?.document){let n=$l(e);q.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 tu=`DismissableLayer`,nu=`dismissableLayer.update`,ru=`dismissableLayer.pointerDownOutside`,iu=`dismissableLayer.focusOutside`,au,ou=q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),su=q.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=q.useContext(ou),[u,d]=q.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=q.useState({}),m=Ml(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=uu(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=du(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return eu(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),q.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(au=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),fu(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=au)}},[u,f,n,l]),q.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),fu())},[u,l]),q.useEffect(()=>{let e=()=>p({});return document.addEventListener(nu,e),()=>document.removeEventListener(nu,e)},[]),(0,J.jsx)(Zl.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:kl(e.onFocusCapture,S.onFocusCapture),onBlurCapture:kl(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:kl(e.onPointerDownCapture,x.onPointerDownCapture)})});su.displayName=tu;var cu=`DismissableLayerBranch`,lu=q.forwardRef((e,t)=>{let n=q.useContext(ou),r=q.useRef(null),i=Ml(t,r);return q.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,J.jsx)(Zl.div,{...e,ref:i})});lu.displayName=cu;function uu(e,t=globalThis?.document){let n=$l(e),r=q.useRef(!1),i=q.useRef(()=>{});return q.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){pu(ru,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 du(e,t=globalThis?.document){let n=$l(e),r=q.useRef(!1);return q.useEffect(()=>{let e=e=>{e.target&&!r.current&&pu(iu,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 fu(){let e=new CustomEvent(nu);document.dispatchEvent(e)}function pu(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?Ql(i,a):i.dispatchEvent(a)}var mu=`focusScope.autoFocusOnMount`,hu=`focusScope.autoFocusOnUnmount`,gu={bubbles:!1,cancelable:!0},_u=`FocusScope`,vu=q.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=q.useState(null),l=$l(i),u=$l(a),d=q.useRef(null),f=Ml(t,e=>c(e)),p=q.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;q.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Su(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Su(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Su(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]),q.useEffect(()=>{if(s){Cu.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(mu,gu);s.addEventListener(mu,l),s.dispatchEvent(t),t.defaultPrevented||(yu(Bee(bu(s)),{select:!0}),document.activeElement===e&&Su(s))}return()=>{s.removeEventListener(mu,l),setTimeout(()=>{let t=new CustomEvent(hu,gu);s.addEventListener(hu,u),s.dispatchEvent(t),t.defaultPrevented||Su(e??document.body,{select:!0}),s.removeEventListener(hu,u),Cu.remove(p)},0)}}},[s,l,u,p]);let m=q.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]=Iee(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Su(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Su(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,J.jsx)(Zl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});vu.displayName=_u;function yu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Su(r,{select:t}),document.activeElement!==n)return}function Iee(e){let t=bu(e);return[xu(t,e),xu(t.reverse(),e)]}function bu(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 xu(e,t){for(let n of e)if(!Lee(n,{upTo:t}))return n}function Lee(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 Ree(e){return e instanceof HTMLInputElement&&`select`in e}function Su(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ree(e)&&t&&e.select()}}var Cu=zee();function zee(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=wu(e,t),e.unshift(t)},remove(t){e=wu(e,t),e[0]?.resume()}}}function wu(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Bee(e){return e.filter(e=>e.tagName!==`A`)}var Vee=`Portal`,Tu=q.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=q.useState(!1);Il(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Wl.createPortal((0,J.jsx)(Zl.div,{...r,ref:t}),o):null});Tu.displayName=Vee;function Hee(e,t){return q.useReducer((e,n)=>t[e][n]??e,e)}var Eu=e=>{let{present:t,children:n}=e,r=Uee(t),i=typeof n==`function`?n({present:r.isPresent}):q.Children.only(n),a=Ml(r.ref,Wee(i));return typeof n==`function`||r.isPresent?q.cloneElement(i,{ref:a}):null};Eu.displayName=`Presence`;function Uee(e){let[t,n]=q.useState(),r=q.useRef(null),i=q.useRef(e),a=q.useRef(`none`),[o,s]=Hee(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return q.useEffect(()=>{let e=Du(r.current);a.current=o===`mounted`?e:`none`},[o]),Il(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=Du(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),Il(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=Du(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=Du(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:q.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function Du(e){return e?.animationName||`none`}function Wee(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 Ou=0;function Gee(){q.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??ku()),document.body.insertAdjacentElement(`beforeend`,e[1]??ku()),Ou++,()=>{Ou===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),Ou--}},[])}function ku(){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 Au=function(){return Au=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},Au.apply(this,arguments)};function ju(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 Kee(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 Mu=`right-scroll-bar-position`,Nu=`width-before-scroll-bar`,qee=`with-scroll-bars-hidden`,Jee=`--removed-body-scroll-bar-size`;function Pu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Yee(e,t){var n=(0,q.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 Xee=typeof window<`u`?q.useLayoutEffect:q.useEffect,Fu=new WeakMap;function Zee(e,t){var n=Yee(t||null,function(t){return e.forEach(function(e){return Pu(e,t)})});return Xee(function(){var t=Fu.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Pu(e,null)}),i.forEach(function(e){r.has(e)||Pu(e,a)})}Fu.set(n,e)},[e]),n}function Qee(e){return e}function $ee(e,t){t===void 0&&(t=Qee);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 ete(e){e===void 0&&(e={});var t=$ee(null);return t.options=Au({async:!0,ssr:!1},e),t}var Iu=function(e){var t=e.sideCar,n=ju(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 q.createElement(r,Au({},n))};Iu.isSideCarExport=!0;function tte(e,t){return e.useMedium(t),Iu}var Lu=ete(),Ru=function(){},zu=q.forwardRef(function(e,t){var n=q.useRef(null),r=q.useState({onScrollCapture:Ru,onWheelCapture:Ru,onTouchMoveCapture:Ru}),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=ju(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Zee([n,t]),C=Au(Au({},b),i);return q.createElement(q.Fragment,null,u&&q.createElement(x,{sideCar:Lu,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?q.cloneElement(q.Children.only(s),Au(Au({},C),{ref:S})):q.createElement(v,Au({},C,{className:c,ref:S}),s))});zu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},zu.classNames={fullWidth:Nu,zeroRight:Mu};var Bu,nte=function(){if(Bu)return Bu;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function rte(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=nte();return t&&e.setAttribute(`nonce`,t),e}function ite(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ate(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ote=function(){var e=0,t=null;return{add:function(n){e==0&&(t=rte())&&(ite(t,n),ate(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ste=function(){var e=ote();return function(t,n){q.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Vu=function(){var e=ste();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},cte={left:0,top:0,right:0,gap:0},Hu=function(e){return parseInt(e||``,10)||0},lte=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[Hu(n),Hu(r),Hu(i)]},ute=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return cte;var t=lte(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])}},dte=Vu(),Uu=`data-scroll-locked`,fte=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
|
.${qee} {
|
|
4
4
|
overflow: hidden ${r};
|
|
5
5
|
padding-right: ${s}px ${r};
|
|
@@ -2191,5 +2191,5 @@ XID_Start XIDS`.split(/\s/).map(e=>[lO(e),e])),Iae=new Map([[`s`,MO(383)],[MO(38
|
|
|
2191
2191
|
}
|
|
2192
2192
|
`;function Nde(e){return e?.isDirectory()===!0}function Z5(e){return e.nativeEvent.composedPath().some(e=>e instanceof Element&&e.getAttribute(`data-type`)===`item`)}function Q5(e){let t=e[0]||` `,n=e[1]||` `;return e===`??`?`untracked`:e===`!!`?`ignored`:t===`R`||n===`R`||t===`C`||n===`C`?`renamed`:t===`D`||n===`D`?`deleted`:t===`A`||n===`A`?`added`:`modified`}function Pde(e){return e.map(e=>({path:e.path,status:Q5(e.status)}))}function Fde(e,t){if(t.length===0)return e;let n=new Set(e),r=!1;for(let e of t)Q5(e.status)===`deleted`&&(!e.path||n.has(e.path)||(n.add(e.path),r=!0));return r?[...n]:e}function Ide(e){let t=new Set;for(let n of e){let e=n.split(`/`).filter(Boolean);for(let n=1;n<e.length;n+=1)t.add(`${e.slice(0,n).join(`/`)}/`)}return Array.from(t).toSorted((e,t)=>t.split(`/`).length-e.split(`/`).length||t.length-e.length||t.localeCompare(e))}function Lde({collapseAllRevision:e,gitStatus:t,paths:n,selectedPath:r,onSelectFile:i}){let a=q.useRef(new Set(n)),o=q.useRef(i),s=q.useRef(0);a.current=new Set(n),o.current=i;let{model:c}=_le({paths:n,flattenEmptyDirectories:!0,gitStatus:t,initialExpansion:1,initialSelectedPaths:r?[r]:[],onSelectionChange:e=>{let[t]=e;!t||!a.current.has(t)||o.current(t)},search:!0,unsafeCSS:Mde});q.useEffect(()=>{c.resetPaths(n)},[c,n]),q.useEffect(()=>{c.setGitStatus(t)},[t,c]),q.useEffect(()=>{if(!r)return;let e=c.getItem(r);if(e){for(let e of c.getSelectedPaths())e!==r&&c.getItem(e)?.deselect();e.select(),e.focus()}},[c,r]),q.useEffect(()=>{if(!(e<=0||e===s.current||n.length===0)){s.current=e;for(let e of Ide(n)){let t=c.getItem(e);!Nde(t)||!t.isExpanded()||t.collapse()}c.focusNearestPath(r||c.getFocusedPath())}},[e,c,n,r]);let l=()=>{window.requestAnimationFrame(()=>{let e=c.getFocusedPath();!e||!a.current.has(e)||o.current(e)})};return(0,J.jsx)(gle,{model:c,className:`block h-full min-h-0 w-full overflow-hidden`,onClick:e=>{Z5(e)&&l()},onKeyUp:e=>{e.key!==`Enter`&&e.key!==` `||Z5(e)&&l()}})}function $5(e){let t=(0,Y.c)(61),{viewerContextId:n,cwd:r,active:i,activeFilePath:a,onCloseFile:o,onOpenFile:s,previewMode:c}=e,l=c===void 0?`external`:c,u=Ng(r),[d,f]=q.useState(!1),[p,m]=q.useState(0),h=l===`inline`,g=h&&!!a,_=Zr({...X5({viewerContextId:n,cwd:u}),enabled:!!(i&&n&&u),select:Bde,notifyOnChangeProps:[`data`,`isPending`,`error`]}),v=Rg({viewerContextId:n,cwd:u,scope:`files`}),y=!!(i&&n&&u),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=[`data`],t[0]=b):b=t[0];let x;t[1]!==v||t[2]!==y?(x={...v,enabled:y,select:zde,notifyOnChangeProps:b},t[1]=v,t[2]=y,t[3]=x):x=t[3];let S=Zr(x),C=_.data??vde,w=S.data??yde,T;t[4]!==w||t[5]!==C?(T=Fde(C,w),t[4]=w,t[5]=C,t[6]=T):T=t[6];let E=T,D;t[7]===w?D=t[8]:(D=Pde(w),t[7]=w,t[8]=D);let O=D,k=h?`relative flex flex-col`:`flex flex-col`,A;t[9]===k?A=t[10]:(A=G(`h-full min-h-0 overflow-hidden`,k),t[9]=k,t[10]=A);let j;t[11]===E.length?j=t[12]:(j=E.length.toLocaleString(),t[11]=E.length,t[12]=j);let M;t[13]===j?M=t[14]:(M=(0,J.jsxs)(`div`,{className:`text-xs font-bold tracking-[0.04em] text-muted-foreground uppercase`,children:[j,` files`]}),t[13]=j,t[14]=M);let N=E.length===0,P;t[15]===m?P=t[16]:(P=()=>{m(Rde)},t[15]=m,t[16]=P);let F;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsx)(eo,{className:`size-4`}),t[17]=F):F=t[17];let I;t[18]!==N||t[19]!==P?(I=(0,J.jsx)(tn,{title:`Collapse all folders`,children:(0,J.jsx)(ws,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Collapse all folders`,disabled:N,onClick:P,children:F})}),t[18]=N,t[19]=P,t[20]=I):I=t[20];let L;t[21]===f?L=t[22]:(L=(0,J.jsx)(ws,{type:`button`,variant:`outline`,onClick:()=>{f(!0)},children:`Open File`}),t[21]=f,t[22]=L);let R;t[23]!==I||t[24]!==L?(R=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[I,L]}),t[23]=I,t[24]=L,t[25]=R):R=t[25];let z;t[26]!==M||t[27]!==R?(z=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-border/70 p-2`,children:[M,R]}),t[26]=M,t[27]=R,t[28]=z):z=t[28];let B;t[29]!==a||t[30]!==p||t[31]!==_.data||t[32]!==_.error||t[33]!==_.isPending||t[34]!==O||t[35]!==u||t[36]!==s||t[37]!==E||t[38]!==n?(B=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden p-2`,children:u?n?_.isPending&&_.data===void 0?(0,J.jsxs)(W5,{children:[(0,J.jsx)(Rn,{}),` Loading files…`]}):_.error?(0,J.jsx)(W5,{tone:`destructive`,children:Pg(_.error,`Failed to load files`)}):E.length>0?(0,J.jsx)(Lde,{collapseAllRevision:p,gitStatus:O,paths:E,selectedPath:a,onSelectFile:s}):(0,J.jsx)(W5,{children:`No files found.`}):(0,J.jsx)(W5,{children:`Waiting for viewer context…`}):(0,J.jsx)(W5,{children:`No directory selected.`})}),t[29]=a,t[30]=p,t[31]=_.data,t[32]=_.error,t[33]=_.isPending,t[34]=O,t[35]=u,t[36]=s,t[37]=E,t[38]=n,t[39]=B):B=t[39];let V;t[40]!==z||t[41]!==B?(V=(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[z,B]}),t[40]=z,t[41]=B,t[42]=V):V=t[42];let H;t[43]!==i||t[44]!==a||t[45]!==h||t[46]!==u||t[47]!==o||t[48]!==g||t[49]!==n?(H=h?(0,J.jsxs)(`div`,{"aria-hidden":!g,inert:!g,className:G(`absolute inset-0 z-20 flex min-h-0 flex-col overflow-hidden bg-background transition-transform duration-200 ease-out`,g?`translate-x-0 shadow-xl`:`pointer-events-none translate-x-full`),children:[(0,J.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center gap-2 border-b border-border/70 px-2 text-xs font-medium text-muted-foreground`,children:[(0,J.jsxs)(`button`,{type:`button`,"aria-label":`Back to file tree`,className:`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:o,children:[(0,J.jsx)(Ve,{className:`size-4`}),(0,J.jsx)(`span`,{children:`Files`})]}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(t7,{viewerContextId:n,cwd:u,active:i&&g,path:a})})]}):null,t[43]=i,t[44]=a,t[45]=h,t[46]=u,t[47]=o,t[48]=g,t[49]=n,t[50]=H):H=t[50];let U;t[51]!==s||t[52]!==d||t[53]!==E||t[54]!==f?(U=(0,J.jsx)(e7,{open:d,onOpenChange:f,paths:E,onOpenFile:s}),t[51]=s,t[52]=d,t[53]=E,t[54]=f,t[55]=U):U=t[55];let ee;return t[56]!==V||t[57]!==H||t[58]!==U||t[59]!==A?(ee=(0,J.jsxs)(`div`,{className:A,children:[V,H,U]}),t[56]=V,t[57]=H,t[58]=U,t[59]=A,t[60]=ee):ee=t[60],ee}function Rde(e){return e+1}function zde(e){return e.files??[]}function Bde(e){return e.paths}function e7(e){let t=(0,Y.c)(38),{open:n,onOpenChange:r,paths:i,onOpenFile:a}=e,[o,s]=q.useState(``),c=qo(),l,u;t[0]===n?(l=t[1],u=t[2]):(l=()=>{n||s(``)},u=[n],t[0]=n,t[1]=l,t[2]=u),q.useEffect(l,u);let d=c&&`min-h-0 flex-1`,f;t[3]===d?f=t[4]:(f=G(d),t[3]=d,t[4]=f);let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,J.jsx)(H5,{}),t[5]=p):p=t[5];let m;t[6]===o?m=t[7]:(m=(0,J.jsx)(pp,{value:o,onValueChange:s,placeholder:`Search files…`,className:`text-base md:text-sm`}),t[6]=o,t[7]=m);let h=c&&`max-h-none min-h-0 flex-1`,g;t[8]===h?g=t[9]:(g=G(h),t[8]=h,t[9]=g);let _;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,J.jsx)(hp,{children:`No files found.`}),t[10]=_):_=t[10];let v;if(t[11]!==r||t[12]!==a||t[13]!==i){let e;t[15]!==r||t[16]!==a?(e=e=>(0,J.jsxs)(_p,{value:e,keywords:[e],onSelect:()=>{a(e),r(!1)},children:[(0,J.jsx)(U5,{path:e}),(0,J.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e})]},e),t[15]=r,t[16]=a,t[17]=e):e=t[17],v=i.map(e),t[11]=r,t[12]=a,t[13]=i,t[14]=v}else v=t[14];let y;t[18]===v?y=t[19]:(y=(0,J.jsx)(gp,{heading:`Files`,children:v}),t[18]=v,t[19]=y);let b;t[20]!==y||t[21]!==g?(b=(0,J.jsxs)(mp,{className:g,children:[_,y]}),t[20]=y,t[21]=g,t[22]=b):b=t[22];let x;t[23]!==b||t[24]!==f||t[25]!==m?(x=(0,J.jsxs)(dp,{shouldFilter:!0,className:f,children:[p,m,b]}),t[23]=b,t[24]=f,t[25]=m,t[26]=x):x=t[26];let S=x;if(c){let e;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsxs)(Am,{children:[(0,J.jsx)(Mm,{children:`Open Files`}),(0,J.jsx)(Nm,{children:`Search project files to open.`})]}),t[27]=e):e=t[27];let i;t[28]===S?i=t[29]:(i=(0,J.jsxs)(km,{className:`max-h-[90svh] overflow-hidden`,children:[e,(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:S})]}),t[28]=S,t[29]=i);let a;return t[30]!==r||t[31]!==n||t[32]!==i?(a=(0,J.jsx)(Em,{open:n,onOpenChange:r,children:i}),t[30]=r,t[31]=n,t[32]=i,t[33]=a):a=t[33],a}let C;return t[34]!==S||t[35]!==r||t[36]!==n?(C=(0,J.jsx)(fp,{open:n,onOpenChange:r,title:`Open Files`,description:`Search project files to open.`,children:S}),t[34]=S,t[35]=r,t[36]=n,t[37]=C):C=t[37],C}function t7(e){let t=(0,Y.c)(37),{viewerContextId:n,cwd:r,active:i,path:a}=e,o,s,c;t[0]!==r||t[1]!==a||t[2]!==n?(o=Ng(r),c=Zr,s=jde({viewerContextId:n,cwd:o,path:a}),t[0]=r,t[1]=a,t[2]=n,t[3]=o,t[4]=s,t[5]=c):(o=t[3],s=t[4],c=t[5]);let l=!!(i&&n&&o&&a),u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=[`data`,`isPending`,`error`],t[6]=u):u=t[6];let d;t[7]!==s||t[8]!==l?(d={...s,enabled:l,notifyOnChangeProps:u},t[7]=s,t[8]=l,t[9]=d):d=t[9];let f=c(d),p=f.data?.content??``,m;t[10]===a?m=t[11]:(m=Ede(a),t[10]=a,t[11]=m);let h=m,g;t[12]===a?g=t[13]:(g=Dde(a),t[12]=a,t[13]=g);let _=g,v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v={},t[14]=v):v=t[14];let[y,b]=q.useState(v),x=_?y[a]||`preview`:`source`,S=_&&x===`preview`,[C,w]=q.useReducer(kde,null),T,E;if(t[15]!==i||t[16]!==p||t[17]!==h||t[18]!==S?(E=()=>{let e=!1;if(!i||!p||!h||S){w({type:`clear`});return}return w({type:`clear`}),Ade(p,h).then(t=>{e||w({type:`loaded`,payload:t})}).catch(()=>{e||w({type:`unavailable`})}),()=>{e=!0}},T=[i,p,h,S],t[15]=i,t[16]=p,t[17]=h,t[18]=S,t[19]=T,t[20]=E):(T=t[19],E=t[20]),q.useEffect(E,T),!a){let e;return t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground`,children:`Select a file to preview it.`}),t[21]=e):e=t[21],e}let D;t[22]!==_||t[23]!==x||t[24]!==a?(D=_?(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-border/70 px-3 py-2`,children:[(0,J.jsx)(`div`,{className:`truncate text-xs font-medium text-muted-foreground`,children:`Markdown`}),(0,J.jsxs)(B5,{variant:`outline`,value:[x],onValueChange:e=>{let t=e[0];(t===`preview`||t===`source`)&&b(e=>({...e,[a]:t}))},children:[(0,J.jsx)(V5,{value:`preview`,children:`Preview`}),(0,J.jsx)(V5,{value:`source`,children:`Source`})]})]}):null,t[22]=_,t[23]=x,t[24]=a,t[25]=D):D=t[25];let O;t[26]!==p||t[27]!==f.data||t[28]!==f.error||t[29]!==f.isPending||t[30]!==C||t[31]!==h||t[32]!==S?(O=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:f.isPending&&!f.data?(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsxs)(W5,{children:[(0,J.jsx)(Rn,{}),` Loading file…`]})}):f.error?(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsx)(W5,{tone:`destructive`,children:Pg(f.error,`Failed to load file`)})}):S?(0,J.jsx)(`div`,{className:`min-h-full p-4 text-foreground`,children:(0,J.jsx)(iq,{text:p})}):Ode(C)?(0,J.jsx)(`pre`,{className:`m-0 min-h-full p-4 font-mono text-[13px] leading-5 whitespace-pre-wrap text-foreground`,children:(0,J.jsx)(jK,{html:C.html,language:h})}):(0,J.jsx)(`pre`,{className:`m-0 min-h-full p-4 font-mono text-[13px] leading-5 whitespace-pre-wrap text-foreground`,children:(0,J.jsx)(`code`,{children:p})})}),t[26]=p,t[27]=f.data,t[28]=f.error,t[29]=f.isPending,t[30]=C,t[31]=h,t[32]=S,t[33]=O):O=t[33];let k;return t[34]!==D||t[35]!==O?(k=(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[D,O]}),t[34]=D,t[35]=O,t[36]=k):k=t[36],k}function n7(e){let t=(0,Y.c)(62),{active:n,dragging:r,dragListeners:i,dragAttributes:a,index:o,onActiveFileChange:s,onActiveTabChange:c,onCloseAllFiles:l,onCloseFile:u,onCloseFilesToRight:d,onCloseOtherFiles:f,path:p,preview:m,tabCount:h}=e,g=r===void 0?!1:r,_=n&&`bg-muted text-foreground`,v=g&&`border-transparent shadow-none ring-0`,y;t[0]!==_||t[1]!==v?(y=G(`inline-flex h-8 shrink-0 items-center rounded-md border border-transparent text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,_,v),t[0]=_,t[1]=v,t[2]=y):y=t[2];let b;t[3]!==s||t[4]!==c||t[5]!==p?(b=()=>{c(`files`),s?.(p)},t[3]=s,t[4]=c,t[5]=p,t[6]=b):b=t[6];let x;t[7]===p?x=t[8]:(x=(0,J.jsx)(U5,{path:p}),t[7]=p,t[8]=x);let S=m&&`italic`,C;t[9]===S?C=t[10]:(C=G(`block min-w-0 truncate`,S),t[9]=S,t[10]=C);let w;t[11]===p?w=t[12]:(w=ofe(p),t[11]=p,t[12]=w);let T;t[13]!==C||t[14]!==w?(T=(0,J.jsx)(`span`,{className:C,children:w}),t[13]=C,t[14]=w,t[15]=T):T=t[15];let E;t[16]!==p||t[17]!==T||t[18]!==b||t[19]!==x?(E=(0,J.jsxs)(`button`,{type:`button`,title:p,className:`flex min-w-0 flex-1 items-center gap-1.5 px-2.5 text-left`,onClick:b,children:[x,T]}),t[16]=p,t[17]=T,t[18]=b,t[19]=x,t[20]=E):E=t[20];let D=`Close ${p}`,O;t[21]!==u||t[22]!==p?(O=()=>{u?.(p)},t[21]=u,t[22]=p,t[23]=O):O=t[23];let k;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,J.jsx)(To,{className:`size-3`}),t[24]=k):k=t[24];let A;t[25]!==D||t[26]!==O?(A=(0,J.jsx)(`button`,{type:`button`,"aria-label":D,className:`mr-1 inline-flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:O,children:k}),t[25]=D,t[26]=O,t[27]=A):A=t[27];let j;t[28]!==a||t[29]!==i||t[30]!==E||t[31]!==A||t[32]!==y?(j=(0,J.jsxs)(`div`,{className:y,...a,...i,children:[E,A]}),t[28]=a,t[29]=i,t[30]=E,t[31]=A,t[32]=y,t[33]=j):j=t[33];let M=j,N;t[34]===M?N=t[35]:(N=(0,J.jsx)(j5,{render:M}),t[34]=M,t[35]=N);let P;t[36]!==u||t[37]!==p?(P=(0,J.jsx)(F5,{onClick:()=>u?.(p),children:`Close`}),t[36]=u,t[37]=p,t[38]=P):P=t[38];let F=h<=1,I;t[39]!==f||t[40]!==p?(I=()=>f?.(p),t[39]=f,t[40]=p,t[41]=I):I=t[41];let L;t[42]!==F||t[43]!==I?(L=(0,J.jsx)(F5,{disabled:F,onClick:I,children:`Close others`}),t[42]=F,t[43]=I,t[44]=L):L=t[44];let R=o>=h-1,z;t[45]!==d||t[46]!==p?(z=()=>d?.(p),t[45]=d,t[46]=p,t[47]=z):z=t[47];let B;t[48]!==R||t[49]!==z?(B=(0,J.jsx)(F5,{disabled:R,onClick:z,children:`Close to the right`}),t[48]=R,t[49]=z,t[50]=B):B=t[50];let V;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,J.jsx)(I5,{}),t[51]=V):V=t[51];let H;t[52]===l?H=t[53]:(H=(0,J.jsx)(F5,{onClick:()=>l?.(),children:`Close all`}),t[52]=l,t[53]=H);let U;t[54]!==P||t[55]!==L||t[56]!==B||t[57]!==H?(U=(0,J.jsxs)(M5,{className:`w-44`,children:[P,L,B,V,H]}),t[54]=P,t[55]=L,t[56]=B,t[57]=H,t[58]=U):U=t[58];let ee;return t[59]!==N||t[60]!==U?(ee=(0,J.jsxs)(A5,{children:[N,U]}),t[59]=N,t[60]=U,t[61]=ee):ee=t[61],ee}function r7(e){return`file:${e}`}function i7(e){return`commit-diff:${e}`}function a7(e){return e.startsWith(`file:`)?e.slice(5):``}function o7(e){return e.startsWith(`commit-diff:`)?e.slice(12):``}function Vde(e){let t=(0,Y.c)(20),n;t[0]===e.path?n=t[1]:(n=r7(e.path),t[0]=e.path,t[1]=n);let r;t[2]===n?r=t[3]:(r={id:n},t[2]=n,t[3]=r);let{attributes:i,isDragging:a,listeners:o,setNodeRef:s,transform:c,transition:l}=O5(r),u;t[4]===c?u=t[5]:(u=s8.Transform.toString(c),t[4]=c,t[5]=u);let d;t[6]!==u||t[7]!==l?(d={transform:u,transition:l},t[6]=u,t[7]=l,t[8]=d):d=t[8];let f=d,p=a&&`opacity-0`,m;t[9]===p?m=t[10]:(m=G(`shrink-0`,p),t[9]=p,t[10]=m);let h;t[11]!==i||t[12]!==o||t[13]!==e?(h=(0,J.jsx)(n7,{...e,dragAttributes:i,dragListeners:o}),t[11]=i,t[12]=o,t[13]=e,t[14]=h):h=t[14];let g;return t[15]!==s||t[16]!==f||t[17]!==m||t[18]!==h?(g=(0,J.jsx)(`div`,{ref:s,style:f,className:m,children:h}),t[15]=s,t[16]=f,t[17]=m,t[18]=h,t[19]=g):g=t[19],g}function s7(e){let t=(0,Y.c)(57),{active:n,dragging:r,dragListeners:i,dragAttributes:a,index:o,onActiveCommitDiffChange:s,onActiveTabChange:c,onCloseAllCommitDiffs:l,onCloseCommitDiff:u,onCloseCommitDiffsToRight:d,onCloseOtherCommitDiffs:f,tab:p,tabCount:m}=e,h=r===void 0?!1:r,g=n&&`bg-muted text-foreground`,_=h&&`border-transparent shadow-none ring-0`,v;t[0]!==g||t[1]!==_?(v=G(`inline-flex h-8 shrink-0 items-center rounded-md border border-transparent text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,g,_),t[0]=g,t[1]=_,t[2]=v):v=t[2];let y;t[3]!==s||t[4]!==c||t[5]!==p.key?(y=()=>{s?.(p.key),c(`commit-diff`)},t[3]=s,t[4]=c,t[5]=p.key,t[6]=y):y=t[6];let b;t[7]===p.path?b=t[8]:(b=p.path?(0,J.jsx)(U5,{path:p.path}):(0,J.jsx)(so,{className:`size-4 shrink-0 text-muted-foreground`}),t[7]=p.path,t[8]=b);let x;t[9]===p.title?x=t[10]:(x=(0,J.jsx)(`span`,{className:`block min-w-0 truncate`,children:p.title}),t[9]=p.title,t[10]=x);let S;t[11]!==y||t[12]!==b||t[13]!==x||t[14]!==p.title?(S=(0,J.jsxs)(`button`,{type:`button`,title:p.title,className:`flex min-w-0 flex-1 items-center gap-1.5 px-2.5 text-left`,onClick:y,children:[b,x]}),t[11]=y,t[12]=b,t[13]=x,t[14]=p.title,t[15]=S):S=t[15];let C=`Close ${p.title}`,w;t[16]!==u||t[17]!==p.key?(w=()=>{u?.(p.key)},t[16]=u,t[17]=p.key,t[18]=w):w=t[18];let T;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,J.jsx)(To,{className:`size-3`}),t[19]=T):T=t[19];let E;t[20]!==w||t[21]!==C?(E=(0,J.jsx)(`button`,{type:`button`,"aria-label":C,className:`mr-1 inline-flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted hover:text-foreground`,onClick:w,children:T}),t[20]=w,t[21]=C,t[22]=E):E=t[22];let D;t[23]!==a||t[24]!==i||t[25]!==E||t[26]!==v||t[27]!==S?(D=(0,J.jsxs)(`div`,{className:v,...a,...i,children:[S,E]}),t[23]=a,t[24]=i,t[25]=E,t[26]=v,t[27]=S,t[28]=D):D=t[28];let O=D,k;t[29]===O?k=t[30]:(k=(0,J.jsx)(j5,{render:O}),t[29]=O,t[30]=k);let A;t[31]!==u||t[32]!==p.key?(A=(0,J.jsx)(F5,{onClick:()=>u?.(p.key),children:`Close`}),t[31]=u,t[32]=p.key,t[33]=A):A=t[33];let j=m<=1,M;t[34]!==f||t[35]!==p.key?(M=()=>f?.(p.key),t[34]=f,t[35]=p.key,t[36]=M):M=t[36];let N;t[37]!==j||t[38]!==M?(N=(0,J.jsx)(F5,{disabled:j,onClick:M,children:`Close others`}),t[37]=j,t[38]=M,t[39]=N):N=t[39];let P=o>=m-1,F;t[40]!==d||t[41]!==p.key?(F=()=>d?.(p.key),t[40]=d,t[41]=p.key,t[42]=F):F=t[42];let I;t[43]!==P||t[44]!==F?(I=(0,J.jsx)(F5,{disabled:P,onClick:F,children:`Close to the right`}),t[43]=P,t[44]=F,t[45]=I):I=t[45];let L;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(I5,{}),t[46]=L):L=t[46];let R;t[47]===l?R=t[48]:(R=(0,J.jsx)(F5,{onClick:()=>l?.(),children:`Close all`}),t[47]=l,t[48]=R);let z;t[49]!==A||t[50]!==N||t[51]!==I||t[52]!==R?(z=(0,J.jsxs)(M5,{className:`w-44`,children:[A,N,I,L,R]}),t[49]=A,t[50]=N,t[51]=I,t[52]=R,t[53]=z):z=t[53];let B;return t[54]!==k||t[55]!==z?(B=(0,J.jsxs)(A5,{children:[k,z]}),t[54]=k,t[55]=z,t[56]=B):B=t[56],B}function Hde(e){let t=(0,Y.c)(20),n;t[0]===e.tab.key?n=t[1]:(n=i7(e.tab.key),t[0]=e.tab.key,t[1]=n);let r;t[2]===n?r=t[3]:(r={id:n},t[2]=n,t[3]=r);let{attributes:i,isDragging:a,listeners:o,setNodeRef:s,transform:c,transition:l}=O5(r),u;t[4]===c?u=t[5]:(u=s8.Transform.toString(c),t[4]=c,t[5]=u);let d;t[6]!==u||t[7]!==l?(d={transform:u,transition:l},t[6]=u,t[7]=l,t[8]=d):d=t[8];let f=d,p=a&&`opacity-0`,m;t[9]===p?m=t[10]:(m=G(`shrink-0`,p),t[9]=p,t[10]=m);let h;t[11]!==i||t[12]!==o||t[13]!==e?(h=(0,J.jsx)(s7,{...e,dragAttributes:i,dragListeners:o}),t[11]=i,t[12]=o,t[13]=e,t[14]=h):h=t[14];let g;return t[15]!==s||t[16]!==f||t[17]!==m||t[18]!==h?(g=(0,J.jsx)(`div`,{ref:s,style:f,className:m,children:h}),t[15]=s,t[16]=f,t[17]=m,t[18]=h,t[19]=g):g=t[19],g}function Ude(e){let t=(0,Y.c)(6),{activeFilePath:n,activePath:r,filePreviewPath:i,fileTabs:a}=e,o=a.indexOf(r);if(o<0)return null;let s=n===r,c=i===r,l;return t[0]!==r||t[1]!==a.length||t[2]!==o||t[3]!==s||t[4]!==c?(l=(0,J.jsx)(n7,{active:s,dragging:!0,index:o,onActiveTabChange:Wde,path:r,preview:c,tabCount:a.length}),t[0]=r,t[1]=a.length,t[2]=o,t[3]=s,t[4]=c,t[5]=l):l=t[5],l}function Wde(){}function Gde(e){let t=(0,Y.c)(3),{active:n,tab:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,J.jsx)(s7,{active:n,dragging:!0,index:0,onActiveTabChange:Kde,tab:r,tabCount:1}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Kde(){}function qde(e){let t=(0,Y.c)(37),{activeCommitDiffKey:n,activeFilePath:r,activeTab:i,commitDiffTabs:a,filePreviewPath:o,fileTabs:s,onActiveCommitDiffChange:c,onActiveFileChange:l,onActiveTabChange:u,onCloseAllCommitDiffs:d,onCloseAllFiles:f,onCloseCommitDiff:p,onCloseCommitDiffsToRight:m,onCloseFile:h,onCloseFilesToRight:g,onCloseOtherCommitDiffs:_,onCloseOtherFiles:v,onOpenFileDialog:y,onReorderCommitDiffs:b,onReorderFiles:x,showHistory:S,showReview:C}=e,w=n===void 0?``:n,T=a===void 0?xde:a,E=o===void 0?``:o,D=s===void 0?bde:s,O=S===void 0?!1:S,k=C===void 0?!1:C,A;t[0]!==i||t[1]!==u?(A=e=>{let{label:t,value:n}=e,r=i===n;return(0,J.jsx)(`button`,{type:`button`,"aria-pressed":r,className:G(`inline-flex h-8 shrink-0 items-center rounded-md border border-transparent px-2.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,r&&`bg-muted text-foreground`),onClick:()=>{u(n)},children:t},n)},t[0]=i,t[1]=u,t[2]=A):A=t[2];let j=A,M=D.map(r7),N=T.map(Zde),P=[...M,...N],F=new Set(P),I;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(I=[],t[3]=I):I=t[3];let[L,R]=q.useState(I),[z,B]=q.useState(``),V=[...L.filter(e=>F.has(e)),...P.filter(e=>!L.includes(e))],H=D.length>0,U=T.length>0,ee;t[4]!==T||t[5]!==H?(ee=H||T.some(Xde),t[4]=T,t[5]=H,t[6]=ee):ee=t[6];let te=ee,ne=V.length>0,re;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(re={activationConstraint:{distance:6}},t[7]=re):re=t[7];let W=p8(f8(U8,re)),ie=P.join(`\0`),ae;t[8]===ie?ae=t[9]:(ae=[ie],t[8]=ie,t[9]=ae),q.useEffect(()=>{R(e=>{let t=[...e.filter(e=>F.has(e)),...P.filter(t=>!e.includes(t))];return t.length===e.length&&t.every((t,n)=>t===e[n])?e:t})},ae);let oe;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(oe=e=>{B(String(e.active.id))},t[10]=oe):oe=t[10];let se=oe,ce=e=>{let t=String(e.active.id),n=e.over?String(e.over.id):``;if(!t||!n||t===n){B(``);return}let r=V.indexOf(t),i=V.indexOf(n);if(r===-1||i===-1){B(``);return}let a=y5(V,r,i);R(a),x?.(a.flatMap(Yde)),b?.(a.flatMap(Jde)),B(``)},le;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>{B(``)},t[11]=le):le=t[11];let ue=le,de;t[12]===te?de=t[13]:(de=te?(0,J.jsx)(H5,{}):null,t[12]=te,t[13]=de);let fe;t[14]!==j||t[15]!==k?(fe=k?j({label:`Changes`,value:`review`}):null,t[14]=j,t[15]=k,t[16]=fe):fe=t[16];let pe;t[17]!==j||t[18]!==O?(pe=O?j({label:`History`,value:`history`}):null,t[17]=j,t[18]=O,t[19]=pe):pe=t[19];let me;t[20]!==H||t[21]!==j?(me=H?null:j({label:`Files`,value:`files`}),t[20]=H,t[21]=j,t[22]=me):me=t[22];let he;t[23]!==U||t[24]!==H?(he=H||U?(0,J.jsx)(`span`,{className:`mx-1 shrink-0 text-xs text-border`,"aria-hidden":`true`,children:`|`}):null,t[23]=U,t[24]=H,t[25]=he):he=t[25];let ge=ne?(0,J.jsxs)(p5,{sensors:W,collisionDetection:g8,onDragStart:se,onDragEnd:ce,onDragCancel:ue,children:[(0,J.jsx)(E5,{items:V,strategy:Jue,children:V.map(e=>{let t=a7(e);if(t)return(0,J.jsx)(Vde,{active:i===`files`&&r===t,index:D.indexOf(t),onActiveFileChange:l,onActiveTabChange:u,onCloseAllFiles:f,onCloseFile:h,onCloseFilesToRight:g,onCloseOtherFiles:v,path:t,preview:E===t,tabCount:D.length},e);let n=o7(e),a=T.find(e=>e.key===n);return a?(0,J.jsx)(Hde,{active:i===`commit-diff`&&w===a.key,index:T.findIndex(e=>e.key===a.key),onActiveCommitDiffChange:c,onActiveTabChange:u,onCloseAllCommitDiffs:d,onCloseCommitDiff:p,onCloseCommitDiffsToRight:m,onCloseOtherCommitDiffs:_,tab:a,tabCount:T.length},e):null})}),(0,J.jsx)(v5,{dropAnimation:null,modifiers:wde,children:a7(z)?(0,J.jsx)(Ude,{activeFilePath:r,activePath:a7(z),filePreviewPath:E,fileTabs:D}):o7(z)?(0,J.jsx)(Gde,{active:i===`commit-diff`&&w===o7(z),tab:T.find(e=>e.key===o7(z))||T[0]}):null})]}):null,_e;t[26]!==H||t[27]!==y?(_e=H?(0,J.jsx)(tn,{title:`Open another file`,children:(0,J.jsx)(`button`,{type:`button`,"aria-label":`Open another file`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md border border-transparent text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:y,children:`+`})}):null,t[26]=H,t[27]=y,t[28]=_e):_e=t[28];let ve;return t[29]!==de||t[30]!==fe||t[31]!==pe||t[32]!==me||t[33]!==he||t[34]!==ge||t[35]!==_e?(ve=(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 overflow-x-auto border-b border-border/70 bg-background p-2`,children:[de,fe,pe,me,he,ge,_e]}),t[29]=de,t[30]=fe,t[31]=pe,t[32]=me,t[33]=he,t[34]=ge,t[35]=_e,t[36]=ve):ve=t[36],ve}function Jde(e){let t=o7(e);return t?[t]:[]}function Yde(e){let t=a7(e);return t?[t]:[]}function Xde(e){return!!e.path}function Zde(e){return i7(e.key)}function c7(e){return Number.isFinite(e)?Math.round(Math.min(Cde,Math.max(Sde,e))):q5}function Qde(){let e=ct(St);return e==null?q5:c7(Number(e))}var l7=new Set;function $de(e){return l7.add(e),()=>{l7.delete(e)}}function efe(){return q5}function tfe(e){Te(St,String(c7(e)));for(let e of l7)e()}function nfe(e){let t=(0,Y.c)(6),{onResize:n,width:r}=e,i;t[0]===n?i=t[1]:(i=e=>{n(c7(e))},t[0]=n,t[1]=i);let a=i,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=G(`absolute inset-y-0 right-0 z-20 w-3 translate-x-1/2 cursor-col-resize touch-none bg-transparent outline-hidden after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-border/70 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1`,Fs),t[2]=o):o=t[2];let s;return t[3]!==a||t[4]!==r?(s=(0,J.jsx)(`div`,{role:`separator`,"aria-label":`Resize file tree`,"aria-orientation":`vertical`,tabIndex:0,className:o,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=e.shiftKey?48:16;a(r+(e.key===`ArrowRight`?t:-t))},onPointerDown:e=>{if(e.button!==0)return;e.preventDefault();let t=e.clientX,n=r,i=document.body.style.cursor,o=document.body.style.userSelect,s=as(`col-resize`);Object.assign(document.body.style,{cursor:`col-resize`,userSelect:`none`});let c=e=>{a(n+e.clientX-t)},l=()=>{s(),Object.assign(document.body.style,{cursor:i,userSelect:o}),document.removeEventListener(`pointermove`,c),document.removeEventListener(`pointerup`,l),document.removeEventListener(`pointercancel`,l)};document.addEventListener(`pointermove`,c),document.addEventListener(`pointerup`,l),document.addEventListener(`pointercancel`,l)}}),t[3]=a,t[4]=r,t[5]=s):s=t[5],s}function rfe(e){let t=(0,Y.c)(15),{viewerContextId:n,cwd:r,active:i,activeFilePath:a,onOpenFile:o,previewMode:s}=e,c=q.useSyncExternalStore($de,Qde,efe),l=afe,u=`${c}px`,d;t[0]===u?d=t[1]:(d={width:u,maxWidth:`70%`},t[0]=u,t[1]=d);let f;t[2]!==i||t[3]!==a||t[4]!==r||t[5]!==o||t[6]!==s||t[7]!==n?(f=(0,J.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:(0,J.jsx)($5,{viewerContextId:n,cwd:r,active:i,activeFilePath:a,onCloseFile:ife,onOpenFile:o,previewMode:s})}),t[2]=i,t[3]=a,t[4]=r,t[5]=o,t[6]=s,t[7]=n,t[8]=f):f=t[8];let p;t[9]===c?p=t[10]:(p=(0,J.jsx)(nfe,{width:c,onResize:l}),t[9]=c,t[10]=p);let m;return t[11]!==d||t[12]!==f||t[13]!==p?(m=(0,J.jsxs)(`div`,{className:`relative min-h-0 shrink-0 overflow-visible border-r border-border/70`,style:d,children:[f,p]}),t[11]=d,t[12]=f,t[13]=p,t[14]=m):m=t[14],m}function ife(){}function afe(e){tfe(e)}function ofe(e){return e.split(`/`).filter(Boolean).at(-1)||e}function sfe(e){let t=(0,Y.c)(30),{fileTreeCollapsed:n,onFileTreeCollapsedChange:r,path:i}=e,a=n===void 0?!1:n,o,s,c,l,u,d,f,p,m;if(t[0]!==a||t[1]!==r||t[2]!==i){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i.split(`/`).filter(Boolean);if(e.length===0){m=null;break bb0}f=`flex h-10 shrink-0 items-center gap-2 border-b border-border/70 bg-background px-3`,t[12]!==a||t[13]!==r?(p=r?(0,J.jsx)(tn,{title:a?`Show file tree`:`Collapse file tree`,children:(0,J.jsx)(`button`,{type:`button`,"aria-pressed":a,"aria-label":a?`Show file tree`:`Collapse file tree`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md border border-transparent text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:()=>{r(!a)},children:a?(0,J.jsx)(bo,{className:`size-4`}):(0,J.jsx)(yo,{className:`size-4`})})}):null,t[12]=a,t[13]=r,t[14]=p):p=t[14],d=`min-w-0 flex-1 overflow-x-auto`,s=NZ,u=i,o=PZ,c=`flex-nowrap gap-1 font-mono text-xs whitespace-nowrap`,l=e.map((t,n)=>{let r=n===e.length-1,i=`${n}:${t}`;return(0,J.jsxs)(q.Fragment,{children:[n>0?(0,J.jsx)(LZ,{className:`text-muted-foreground/60`}):null,(0,J.jsx)(FZ,{className:`min-w-0 shrink-0`,children:r?(0,J.jsx)(IZ,{className:`max-w-80 truncate font-mono text-xs font-medium`,children:t}):(0,J.jsx)(`span`,{className:`max-w-40 truncate text-muted-foreground`,children:t})})]},i)})}t[0]=a,t[1]=r,t[2]=i,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let h;t[15]!==o||t[16]!==c||t[17]!==l?(h=(0,J.jsx)(o,{className:c,children:l}),t[15]=o,t[16]=c,t[17]=l,t[18]=h):h=t[18];let g;t[19]!==s||t[20]!==u||t[21]!==h?(g=(0,J.jsx)(s,{title:u,children:h}),t[19]=s,t[20]=u,t[21]=h,t[22]=g):g=t[22];let _;t[23]!==g||t[24]!==d?(_=(0,J.jsx)(`div`,{className:d,children:g}),t[23]=g,t[24]=d,t[25]=_):_=t[25];let v;return t[26]!==_||t[27]!==f||t[28]!==p?(v=(0,J.jsxs)(`div`,{className:f,children:[p,_]}),t[26]=_,t[27]=f,t[28]=p,t[29]=v):v=t[29],v}var u7={query:``,stage:`browse`,selectedValue:``,createBranchName:``};function cfe(e,t){switch(t.type){case`reset`:return u7;case`set-query`:return{...e,query:t.query};case`set-stage`:return{...e,stage:t.stage};case`set-selected-value`:return{...e,selectedValue:t.selectedValue};case`set-create-branch-name`:return{...e,createBranchName:t.createBranchName}}}function d7(e){let t=(0,Y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,J.jsx)(Tr,{children:n}),t[0]=n,t[1]=r),r}function lfe({localBranches:e,remoteBranches:t}){let n=e.find(e=>e.current);return n?`local:${n.name}`:e[0]?`local:${e[0].name}`:t[0]?`remote:${t[0].name}`:`action:create`}function ufe(e){let t=(0,Y.c)(37),{query:n,selectedValue:r,localBranches:i,remoteBranches:a,localBranchNames:o,branchesPending:s,checkoutPending:c,isMobile:l,onQueryChange:u,onSelectedValueChange:d,onCreateStage:f,onSwitchLocalBranch:p,onSwitchRemoteBranch:m}=e,h;t[0]===f?h=t[1]:(h=e=>{jh(e.nativeEvent,`Control+N`)&&(e.preventDefault(),f())},t[0]=f,t[1]=h);let g;t[2]!==u||t[3]!==n?(g=(0,J.jsx)(pp,{value:n,onValueChange:u,placeholder:`Search branches`,className:`text-base md:text-sm`}),t[2]=u,t[3]=n,t[4]=g):g=t[4];let _=s?`Loading branches…`:`No branches found.`,v;t[5]===_?v=t[6]:(v=(0,J.jsx)(hp,{children:_}),t[5]=_,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=[`new`,`create`,`branch`],t[7]=y):y=t[7];let b,x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,J.jsx)(fo,{className:`size-4 text-muted-foreground`}),x=(0,J.jsx)(`span`,{className:`font-medium`,children:`Create new branch…`}),t[8]=b,t[9]=x):(b=t[8],x=t[9]);let S;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(vp,{children:Ah(`Control+N`)}),t[10]=S):S=t[10];let C;t[11]===f?C=t[12]:(C=(0,J.jsx)(gp,{heading:`Actions`,children:(0,J.jsxs)(_p,{value:`action:create`,keywords:y,onSelect:f,children:[b,x,S]})}),t[11]=f,t[12]=C);let w;t[13]!==s||t[14]!==c||t[15]!==i||t[16]!==p?(w=(0,J.jsx)(dfe,{branches:i,branchesPending:s,checkoutPending:c,onSwitchBranch:p}),t[13]=s,t[14]=c,t[15]=i,t[16]=p,t[17]=w):w=t[17];let T;t[18]!==c||t[19]!==o||t[20]!==m||t[21]!==a?(T=(0,J.jsx)(ffe,{branches:a,localBranchNames:o,checkoutPending:c,onSwitchBranch:m}),t[18]=c,t[19]=o,t[20]=m,t[21]=a,t[22]=T):T=t[22];let E;t[23]!==w||t[24]!==T||t[25]!==v||t[26]!==C?(E=(0,J.jsxs)(mp,{className:`max-h-none min-h-0 flex-1 md:max-h-[min(70vh,28rem)]`,children:[v,C,w,T]}),t[23]=w,t[24]=T,t[25]=v,t[26]=C,t[27]=E):E=t[27];let D;t[28]===l?D=t[29]:(D=l?null:(0,J.jsx)(pfe,{}),t[28]=l,t[29]=D);let O;return t[30]!==d||t[31]!==r||t[32]!==h||t[33]!==E||t[34]!==D||t[35]!==g?(O=(0,J.jsxs)(dp,{shouldFilter:!0,loop:!0,value:r,onValueChange:d,onKeyDown:h,className:`min-h-0 flex-1`,children:[g,E,D]}),t[30]=d,t[31]=r,t[32]=h,t[33]=E,t[34]=D,t[35]=g,t[36]=O):O=t[36],O}function dfe(e){let t=(0,Y.c)(14),{branches:n,branchesPending:r,checkoutPending:i,onSwitchBranch:a}=e,o=`Local branches · ${n.length}`,s;t[0]!==n.length||t[1]!==r?(s=r&&n.length===0?(0,J.jsxs)(_p,{value:`loading:branches`,disabled:!0,children:[(0,J.jsx)(Rn,{className:`size-3.5 text-primary`}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`Loading branches…`})]}):null,t[0]=n.length,t[1]=r,t[2]=s):s=t[2];let c;if(t[3]!==n||t[4]!==i||t[5]!==a){let e;t[7]!==i||t[8]!==a?(e=e=>{let t=lre(e),n=e.current?`current`:qg(e.relativeDate),r=[e.name,e.upstream,e.subject].filter(Boolean).join(` · `)||e.name;return(0,J.jsxs)(_p,{value:`local:${e.name}`,keywords:[e.name,e.upstream??``,e.subject??``],disabled:i,onSelect:()=>a(e),className:`items-start py-2`,children:[(0,J.jsx)(`span`,{className:`mt-0.5 flex size-4 shrink-0 items-center justify-center`,children:e.current?(0,J.jsx)(Za,{className:`size-3.5 text-emerald-500`}):null}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,title:r,children:[(0,J.jsx)(`div`,{className:`truncate font-mono text-[13px] font-medium`,children:e.name}),(0,J.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[e.upstream,e.subject].filter(Boolean).join(` · `)||`Local branch`})]}),(0,J.jsx)(vp,{className:G(`shrink-0 tracking-normal normal-case`,t&&ure(e,t)),children:t||n})]},e.name)},t[7]=i,t[8]=a,t[9]=e):e=t[9],c=n.map(e),t[3]=n,t[4]=i,t[5]=a,t[6]=c}else c=t[6];let l;return t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,J.jsxs)(gp,{heading:o,children:[s,c]}),t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function ffe(e){let t=(0,Y.c)(12),{branches:n,localBranchNames:r,checkoutPending:i,onSwitchBranch:a}=e,o=`Remote branches · ${n.length}`,s;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e;t[5]!==i||t[6]!==r||t[7]!==a?(e=e=>{let t=Jg(e.name),n=t.branch||e.name,o=r.has(n);return(0,J.jsxs)(_p,{value:`remote:${e.name}`,keywords:[e.name,n,e.subject??``],disabled:i,onSelect:()=>a(e),className:`items-start py-2`,children:[(0,J.jsx)(fo,{className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,title:e.name,children:[(0,J.jsxs)(`div`,{className:`truncate font-mono text-[13px] font-medium`,children:[t.remote?(0,J.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[t.remote,`/`]}):null,t.branch||e.name]}),(0,J.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.subject||`Remote branch`})]}),(0,J.jsx)(vp,{className:`shrink-0 tracking-normal normal-case`,children:o?`Switch`:`Track`})]},e.name)},t[5]=i,t[6]=r,t[7]=a,t[8]=e):e=t[8],s=n.map(e),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=s}else s=t[4];let c;return t[9]!==o||t[10]!==s?(c=(0,J.jsx)(gp,{heading:o,children:s}),t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function pfe(){let e=(0,Y.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(d7,{children:`Enter`}),` Switch`]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(d7,{children:Ah(`Control+N`)}),` `,`New branch`]}),e[1]=n):n=e[1];let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.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:[t,n,(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(d7,{children:`Esc`}),` Close`]})]}),e[2]=r):r=e[2],r}function mfe(e){let t=(0,Y.c)(33),{createBranchName:n,checkoutPending:r,isMobile:i,onBranchNameChange:a,onBrowseStage:o,onCreateBranch:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,J.jsx)(Ve,{}),t[0]=c):c=t[0];let l;t[1]===o?l=t[2]:(l=(0,J.jsx)(ws,{type:`button`,variant:`ghost`,size:`icon`,onClick:o,"aria-label":`Back to branches`,children:c}),t[1]=o,t[2]=l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-sm font-medium`,children:`Create branch`}),(0,J.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:`From the current HEAD`})]}),t[3]=u):u=t[3];let d;t[4]===l?d=t[5]:(d=(0,J.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 px-3 py-2`,children:[l,u]}),t[4]=l,t[5]=d);let f;t[6]===a?f=t[7]:(f=e=>a(e.target.value),t[6]=a,t[7]=f);let p;t[8]!==o||t[9]!==s?(p=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),o();return}e.key!==`Enter`||e.nativeEvent.isComposing||(e.preventDefault(),e.stopPropagation(),s())},t[8]=o,t[9]=s,t[10]=p):p=t[10];let m;t[11]!==n||t[12]!==f||t[13]!==p?(m=(0,J.jsx)(Ps,{value:n,onChange:f,onKeyDown:p,placeholder:`branch-name`,className:`min-w-0 flex-1`}),t[11]=n,t[12]=f,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==r||t[16]!==n?(h=!n.trim()||r,t[15]=r,t[16]=n,t[17]=h):h=t[17];let g;t[18]===r?g=t[19]:(g=r?(0,J.jsx)(Rn,{}):null,t[18]=r,t[19]=g);let _;t[20]!==s||t[21]!==h||t[22]!==g?(_=(0,J.jsxs)(ws,{type:`button`,disabled:h,onClick:s,children:[g,`Create`]}),t[20]=s,t[21]=h,t[22]=g,t[23]=_):_=t[23];let v;t[24]!==_||t[25]!==m?(v=(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-center gap-2 p-3`,children:[m,_]}),t[24]=_,t[25]=m,t[26]=v):v=t[26];let y;t[27]===i?y=t[28]:(y=i?null:(0,J.jsx)(hfe,{}),t[27]=i,t[28]=y);let b;return t[29]!==v||t[30]!==y||t[31]!==d?(b=(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,y]}),t[29]=v,t[30]=y,t[31]=d,t[32]=b):b=t[32],b}function hfe(){let e=(0,Y.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(d7,{children:`Enter`}),` Create`]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,J.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:[t,(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(d7,{children:`Esc`}),` Back`]})]}),e[1]=n):n=e[1],n}function gfe(e){let t=(0,Y.c)(9),{stage:n,createBranchName:r,checkoutPending:i,isMobile:a,browseProps:o,onBranchNameChange:s,onBrowseStage:c,onCreateBranch:l}=e;if(n===`create`){let e;return t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==s||t[4]!==c||t[5]!==l?(e=(0,J.jsx)(mfe,{createBranchName:r,checkoutPending:i,isMobile:a,onBranchNameChange:s,onBrowseStage:c,onCreateBranch:l}),t[0]=i,t[1]=r,t[2]=a,t[3]=s,t[4]=c,t[5]=l,t[6]=e):e=t[6],e}let u;return t[7]===o?u=t[8]:(u=(0,J.jsx)(ufe,{...o}),t[7]=o,t[8]=u),u}function _fe(e){let t=(0,Y.c)(77),{viewerContextId:n,cwd:r,active:i,gitStatus:a,open:o,onOpenChange:s}=e,c=En(),l=qo(),u=Ng(r),[d,f]=q.useReducer(cfe,u7),p=Rg({viewerContextId:n,cwd:u,scope:`branches`}),m=!!(o&&i&&n&&u),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=[`data`,`isPending`,`error`],t[0]=h):h=t[0];let g;t[1]!==p||t[2]!==m?(g={...p,enabled:m,notifyOnChangeProps:h},t[1]=p,t[2]=m,t[3]=g):g=t[3];let _=Zr(g),v=_.data,y,b,x,S;t[4]!==v?.localBranches||t[5]!==v?.remoteBranches||t[6]!==d.selectedValue||t[7]!==a?(b=dre(v?.localBranches,a),x=(v?.remoteBranches??[]).filter(bfe),y=new Set(b.map(yfe)),S=d.selectedValue||lfe({localBranches:b,remoteBranches:x}),t[4]=v?.localBranches,t[5]=v?.remoteBranches,t[6]=d.selectedValue,t[7]=a,t[8]=y,t[9]=b,t[10]=x,t[11]=S):(y=t[8],b=t[9],x=t[10],S=t[11]);let C=S,w;t[12]!==f||t[13]!==o?(w=()=>{o||f({type:`reset`})},t[12]=f,t[13]=o,t[14]=w):w=t[14];let T;t[15]===o?T=t[16]:(T=[o],t[15]=o,t[16]=T),q.useEffect(w,T);let E;t[17]!==u||t[18]!==n?(E=async e=>await mh(ph(`/api/git-checkout`,{contextId:n}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:u,...e})}),t[17]=u,t[18]=n,t[19]=E):E=t[19];let D;t[20]!==u||t[21]!==s||t[22]!==c||t[23]!==n?(D=async(e,t)=>{await c.invalidateQueries({queryKey:Gh.gitStatus(n,u),exact:!0,refetchType:`active`}),await Vg({queryClient:c,viewerContextId:n,cwd:u}),s(!1),Tn.success(t.create?`Created and switched to ${t.branch}`:`Switched to ${t.branch}`)},t[20]=u,t[21]=s,t[22]=c,t[23]=n,t[24]=D):D=t[24];let O;t[25]!==E||t[26]!==D?(O={mutationFn:E,onSuccess:D,onError:vfe},t[25]=E,t[26]=D,t[27]=O):O=t[27];let k=ni(O),A;t[28]===k?A=t[29]:(A=e=>{e.current||k.isPending||k.mutate({branch:e.name})},t[28]=k,t[29]=A);let j=A,M;t[30]!==k||t[31]!==y?(M=e=>{if(k.isPending)return;let t=Jg(e.name).branch||e.name;if(y.has(t)){k.mutate({branch:t});return}k.mutate({branch:t,create:!0,startPoint:e.name,track:!0})},t[30]=k,t[31]=y,t[32]=M):M=t[32];let N=M,P;t[33]!==k||t[34]!==d.createBranchName?(P=()=>{let e=d.createBranchName.trim();!e||k.isPending||k.mutate({branch:e,create:!0})},t[33]=k,t[34]=d.createBranchName,t[35]=P):P=t[35];let F=P,I,L,R;t[36]===f?(I=t[37],L=t[38],R=t[39]):(I=e=>f({type:`set-query`,query:e}),L=e=>f({type:`set-selected-value`,selectedValue:e}),R=()=>f({type:`set-stage`,stage:`create`}),t[36]=f,t[37]=I,t[38]=L,t[39]=R);let z;t[40]!==_.isPending||t[41]!==k.isPending||t[42]!==d.query||t[43]!==l||t[44]!==y||t[45]!==b||t[46]!==x||t[47]!==C||t[48]!==j||t[49]!==N||t[50]!==I||t[51]!==L||t[52]!==R?(z={query:d.query,selectedValue:C,localBranches:b,remoteBranches:x,localBranchNames:y,branchesPending:_.isPending,checkoutPending:k.isPending,isMobile:l,onQueryChange:I,onSelectedValueChange:L,onCreateStage:R,onSwitchLocalBranch:j,onSwitchRemoteBranch:N},t[40]=_.isPending,t[41]=k.isPending,t[42]=d.query,t[43]=l,t[44]=y,t[45]=b,t[46]=x,t[47]=C,t[48]=j,t[49]=N,t[50]=I,t[51]=L,t[52]=R,t[53]=z):z=t[53];let B,V;t[54]===f?(B=t[55],V=t[56]):(B=e=>f({type:`set-create-branch-name`,createBranchName:e}),V=()=>f({type:`set-stage`,stage:`browse`}),t[54]=f,t[55]=B,t[56]=V);let H;t[57]!==k.isPending||t[58]!==F||t[59]!==d.createBranchName||t[60]!==d.stage||t[61]!==l||t[62]!==z||t[63]!==B||t[64]!==V?(H=(0,J.jsx)(gfe,{stage:d.stage,createBranchName:d.createBranchName,checkoutPending:k.isPending,isMobile:l,browseProps:z,onBranchNameChange:B,onBrowseStage:V,onCreateBranch:F}),t[57]=k.isPending,t[58]=F,t[59]=d.createBranchName,t[60]=d.stage,t[61]=l,t[62]=z,t[63]=B,t[64]=V,t[65]=H):H=t[65];let U=H;if(l){let e;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsxs)(Am,{children:[(0,J.jsx)(Mm,{children:`Branches`}),(0,J.jsx)(Nm,{children:`Switch branches or create a new branch.`})]}),t[66]=e):e=t[66];let n;t[67]===U?n=t[68]:(n=(0,J.jsxs)(km,{className:`max-h-[90svh] overflow-hidden`,children:[e,(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-4 pb-4`,children:U})]}),t[67]=U,t[68]=n);let r;return t[69]!==s||t[70]!==o||t[71]!==n?(r=(0,J.jsx)(Em,{open:o,onOpenChange:s,children:n}),t[69]=s,t[70]=o,t[71]=n,t[72]=r):r=t[72],r}let ee;return t[73]!==U||t[74]!==s||t[75]!==o?(ee=(0,J.jsx)(fp,{open:o,onOpenChange:s,title:`Branches`,description:`Switch branches or create a new branch.`,className:`sm:max-w-2xl`,initialFocus:!0,children:U}),t[73]=U,t[74]=s,t[75]=o,t[76]=ee):ee=t[76],ee}function vfe(e,t){Tn.error(Pg(e,t.create?`Failed to create branch`:`Failed to switch branch`))}function yfe(e){return e.name}function bfe(e){return!e.name.endsWith(`/HEAD`)}function xfe(e){let t=(0,Y.c)(20),{viewerContextId:n,cwd:r,active:i}=e,a=Ng(r),o=!!(i&&n&&a),s=Zr({...Lg({viewerContextId:n,cwd:a}),enabled:o,notifyOnChangeProps:[`error`,`errorUpdatedAt`]}),c=Zr({...Rg({viewerContextId:n,cwd:a,scope:`files`}),enabled:o,notifyOnChangeProps:[`error`,`errorUpdatedAt`]}),l=Zr({...Rg({viewerContextId:n,cwd:a,scope:`branches`}),enabled:o,notifyOnChangeProps:[`error`,`errorUpdatedAt`]}),u=Rg({viewerContextId:n,cwd:a,scope:`commits`}),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[`error`,`errorUpdatedAt`],t[0]=d):d=t[0];let f;t[1]!==o||t[2]!==u?(f={...u,enabled:o,notifyOnChangeProps:d},t[1]=o,t[2]=u,t[3]=f):f=t[3];let p=Zr(f),m;t[4]!==i||t[5]!==l.error||t[6]!==p.error||t[7]!==c.error||t[8]!==s.error?(m=()=>{if(!i)return;let e=c.error||l.error||p.error||s.error;e&&Tn.error(Pg(e,`Failed to load git view`))},t[4]=i,t[5]=l.error,t[6]=p.error,t[7]=c.error,t[8]=s.error,t[9]=m):m=t[9];let h;return t[10]!==i||t[11]!==l.error||t[12]!==l.errorUpdatedAt||t[13]!==p.error||t[14]!==p.errorUpdatedAt||t[15]!==c.error||t[16]!==c.errorUpdatedAt||t[17]!==s.error||t[18]!==s.errorUpdatedAt?(h=[i,l.error,l.errorUpdatedAt,p.error,p.errorUpdatedAt,c.error,c.errorUpdatedAt,s.error,s.errorUpdatedAt],t[10]=i,t[11]=l.error,t[12]=l.errorUpdatedAt,t[13]=p.error,t[14]=p.errorUpdatedAt,t[15]=c.error,t[16]=c.errorUpdatedAt,t[17]=s.error,t[18]=s.errorUpdatedAt,t[19]=h):h=t[19],q.useEffect(m,h),null}function Sfe(e){let t=(0,Y.c)(29),{viewerContextId:n,cwd:r,active:i,onBranchClick:a}=e,o=Ng(r),s=!!(i&&n&&o),c=Zr({...Lg({viewerContextId:n,cwd:o}),enabled:s,select:zg,notifyOnChangeProps:[`data`,`isPending`,`error`]});if(!o){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(W5,{children:`No directory selected.`}),t[0]=e):e=t[0],e}if(!n){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(W5,{children:`Waiting for viewer context…`}),t[1]=e):e=t[1],e}if(c.isPending&&c.data===void 0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsxs)(W5,{children:[(0,J.jsx)(Rn,{}),` Loading repository status…`]}),t[2]=e):e=t[2],e}if(c.error){let e;t[3]===c.error?e=t[4]:(e=Pg(c.error,`Failed to load repository status`),t[3]=c.error,t[4]=e);let n;return t[5]===e?n=t[6]:(n=(0,J.jsx)(W5,{tone:`destructive`,children:e}),t[5]=e,t[6]=n),n}let l=c.data;if(!l){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(W5,{children:`No git repository detected.`}),t[7]=e):e=t[7],e}let u=l.detached?`Detached HEAD${l.revision?` (${l.revision})`:``}`:l.branch||l.label,d=ere(o),f=l.ahead===0&&l.behind===0,p=$ne(o),m;t[8]!==l.title||t[9]!==p?(m=[p,l.title].filter(Boolean),t[8]=l.title,t[9]=p,t[10]=m):m=t[10];let h=m.join(` · `),g;t[11]===f?g=t[12]:(g=f?(0,J.jsx)(Za,{className:`size-3 shrink-0 text-emerald-500`}):null,t[11]=f,t[12]=g);let _;t[13]===l.behind?_=t[14]:(_=l.behind>0?(0,J.jsxs)(`span`,{className:`shrink-0 font-medium text-sky-500 tabular-nums`,children:[`↓`,l.behind]}):null,t[13]=l.behind,t[14]=_);let v;t[15]===l.ahead?v=t[16]:(v=l.ahead>0?(0,J.jsxs)(`span`,{className:`shrink-0 font-medium text-amber-500 tabular-nums`,children:[`↑`,l.ahead]}):null,t[15]=l.ahead,t[16]=v);let y=d||`No cwd`,b;t[17]===y?b=t[18]:(b=(0,J.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:y}),t[17]=y,t[18]=b);let x;t[19]!==u||t[20]!==a?(x=u?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:`→`}),a?(0,J.jsxs)(`button`,{type:`button`,"aria-label":`Switch branch`,className:`-mx-1 inline-flex min-w-0 items-center gap-1 rounded-md px-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:a,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:u}),(0,J.jsx)(to,{className:`size-3 shrink-0`})]}):(0,J.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:u})]}):null,t[19]=u,t[20]=a,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==b||t[26]!==x||t[27]!==h?(S=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-5`,title:h,children:[g,_,v,b,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=b,t[26]=x,t[27]=h,t[28]=S):S=t[28],S}function Cfe(e){let t=(0,Y.c)(50),{viewerContextId:n,cwd:r,active:i}=e,a=En(),o=Ng(r),[s,c]=q.useState(!1),[l,u]=q.useState(!1),d=Zr({...Lg({viewerContextId:n,cwd:o}),enabled:!!(i&&n&&o),select:zg,notifyOnChangeProps:[`data`]}),f=Zr({...Rg({viewerContextId:n,cwd:o,scope:`files`}),enabled:!!(i&&n&&o),select:Bg,notifyOnChangeProps:[`data`]}),p=Qr({queryKey:Gh.gitStatus(n,o),exact:!0}),m=Qr({queryKey:Gh.gitFiles(n,o),exact:!0}),h=Qr({queryKey:Gh.gitBranches(n,o),exact:!0}),g=Qr({queryKey:Gh.gitCommits(n,o),exact:!1}),_=p+m+h+g>0,v=d.data,y;t[0]===f.data?y=t[1]:(y=Array.isArray(f.data)?f.data:[],t[0]=f.data,t[1]=y);let b=y,x=!!v,S=!!(v?.dirty||b.length>0),C=!!(x&&!v?.detached&&(v?.ahead||0)>0),w;t[2]===v?w=t[3]:(w=Hg(v),t[2]=v,t[3]=w);let T=w,E=!!(x&&!v?.detached&&(v?.behind||0)>0),D=ni({mutationFn:async e=>await mh(ph(e===`pull`?`/api/git-pull`:`/api/git-push`,{contextId:n}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:o,force:e===`force-push`})}),onSuccess:async(e,t)=>{await a.invalidateQueries({queryKey:Gh.gitStatus(n,o),exact:!0,refetchType:`active`}),await Vg({queryClient:a,viewerContextId:n,cwd:o}),t!==`pull`&&wX({response:e,force:t===`force-push`})},onError:wfe}),O=$r({mutationKey:Gh.gitAction(n,o,`push`)}),k=$r({mutationKey:Gh.gitAction(n,o,`force-push`)}),A=Gh.gitAction(n,o,`pull`),j;t[4]===A?j=t[5]:(j={mutationKey:A},t[4]=A,t[5]=j);let M=$r(j),N=D.isPending&&D.variables===`push`||O>0,P=D.isPending&&D.variables===`force-push`||k>0,F=D.isPending&&D.variables===`pull`||M>0,I=D.isPending||N||P||F,L=!!(n&&o&&S),R=!!(n&&o&&C&&(!I||N)),z=!!(n&&o&&T&&(!I||P)),B=!!(n&&o&&E&&(!I||F)),V=L||R||z||B,H;t[6]===c?H=t[7]:(H=()=>{c(!0)},t[6]=c,t[7]=H);let U;t[8]!==i||t[9]!==o||t[10]!==H||t[11]!==n?(U=(0,J.jsx)(Sfe,{viewerContextId:n,cwd:o,active:i,onBranchClick:H}),t[8]=i,t[9]=o,t[10]=H,t[11]=n,t[12]=U):U=t[12];let ee;t[13]!==i||t[14]!==_?(ee=i&&_?(0,J.jsx)(Rn,{className:`size-3 shrink-0 text-primary`}):null,t[13]=i,t[14]=_,t[15]=ee):ee=t[15];let te;t[16]!==U||t[17]!==ee?(te=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[U,ee]}),t[16]=U,t[17]=ee,t[18]=te):te=t[18];let ne;t[19]!==P||t[20]!==I||t[21]!==D||t[22]!==F||t[23]!==N||t[24]!==u||t[25]!==V||t[26]!==L||t[27]!==z||t[28]!==B||t[29]!==R?(ne=V?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[L?(0,J.jsx)(tn,{title:`Commit`,kbd:Ah(`Control+C`),children:(0,J.jsxs)(ws,{variant:`outline`,onClick:()=>{u(!0)},children:[(0,J.jsx)(uo,{}),` Commit…`]})}):null,R?(0,J.jsx)(tn,{title:`Push`,kbd:Ah(`Control+P`),children:(0,J.jsxs)(ws,{variant:`outline`,disabled:I,onClick:()=>{D.mutate(`push`)},children:[N?(0,J.jsx)(Rn,{}):(0,J.jsx)(wo,{}),`Push`]})}):null,z?(0,J.jsx)(tn,{title:`Force push`,kbd:Ah(`Control+Shift+P`),children:(0,J.jsxs)(ws,{variant:`outline`,disabled:I,onClick:()=>{D.mutate(`force-push`)},children:[P?(0,J.jsx)(Rn,{}):(0,J.jsx)(wo,{}),`Force Push`]})}):null,B?(0,J.jsx)(tn,{title:`Pull`,kbd:Ah(`Alt+P`),children:(0,J.jsxs)(ws,{variant:`outline`,disabled:I,onClick:()=>{D.mutate(`pull`)},children:[F?(0,J.jsx)(Rn,{}):(0,J.jsx)(ro,{}),`Pull`]})}):null]}):null,t[19]=P,t[20]=I,t[21]=D,t[22]=F,t[23]=N,t[24]=u,t[25]=V,t[26]=L,t[27]=z,t[28]=B,t[29]=R,t[30]=ne):ne=t[30];let re;t[31]!==i||t[32]!==s||t[33]!==v||t[34]!==o||t[35]!==c||t[36]!==n?(re=(0,J.jsx)(_fe,{viewerContextId:n,cwd:o,active:i,gitStatus:v,open:s,onOpenChange:c}),t[31]=i,t[32]=s,t[33]=v,t[34]=o,t[35]=c,t[36]=n,t[37]=re):re=t[37];let W;t[38]!==l||t[39]!==b||t[40]!==v||t[41]!==o||t[42]!==u||t[43]!==n?(W=(0,J.jsx)(i_,{viewerContextId:n,cwd:o,files:b,gitStatus:v,open:l,onOpenChange:u}),t[38]=l,t[39]=b,t[40]=v,t[41]=o,t[42]=u,t[43]=n,t[44]=W):W=t[44];let ie;return t[45]!==re||t[46]!==W||t[47]!==te||t[48]!==ne?(ie=(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[te,ne,re,W]}),t[45]=re,t[46]=W,t[47]=te,t[48]=ne,t[49]=ie):ie=t[49],ie}function wfe(e,t){Tn.error(Pg(e,t===`pull`?`Failed to pull changes`:t===`force-push`?`Failed to force push changes`:`Failed to push changes`))}function Tfe(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Rs(!0),d=!!u,f=Sc.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);bc({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=q.useMemo(()=>({store:f}),[f]);return(0,J.jsx)(wc.Provider,{value:!1,children:(0,J.jsx)(Ls.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}function Efe(e){let t=(0,Y.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,J.jsx)(Tfe,{"data-slot":`alert-dialog`,...n}),t[2]=n,t[3]=r),r}function Dfe(e){let t=(0,Y.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,J.jsx)(sc,{"data-slot":`alert-dialog-portal`,...n}),t[2]=n,t[3]=r),r}function Ofe(e){let t=(0,Y.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=G(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs 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,J.jsx)(zs,{"data-slot":`alert-dialog-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function kfe(e){let t=(0,Y.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size: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]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(Ofe,{}),t[4]=o):o=t[4];let s;t[5]===n?s=t[6]:(s=G(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]: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`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==a||t[9]!==s?(c=(0,J.jsxs)(Dfe,{children:[o,(0,J.jsx)(ac,{"data-slot":`alert-dialog-content`,"data-size":a,className:s,...r})]}),t[7]=r,t[8]=a,t[9]=s,t[10]=c):c=t[10],c}function Afe(e){let t=(0,Y.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=G(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jfe(e){let t=(0,Y.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=G(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mfe(e){let t=(0,Y.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=G(`mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(`div`,{"data-slot":`alert-dialog-media`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nfe(e){let t=(0,Y.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=G(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(Ec,{"data-slot":`alert-dialog-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pfe(e){let t=(0,Y.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=G(`text-sm text-balance text-muted-foreground md:text-pretty *:[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,J.jsx)(Vs,{"data-slot":`alert-dialog-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ffe(e){let t=(0,Y.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=G(n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,J.jsx)(ws,{"data-slot":`alert-dialog-action`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ife(e){let t=(0,Y.c)(14),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?`outline`:i,s=a===void 0?`default`:a,c;t[5]===n?c=t[6]:(c=G(n),t[5]=n,t[6]=c);let l;t[7]!==s||t[8]!==o?(l=(0,J.jsx)(ws,{variant:o,size:s}),t[7]=s,t[8]=o,t[9]=l):l=t[9];let u;return t[10]!==r||t[11]!==c||t[12]!==l?(u=(0,J.jsx)(Bs,{"data-slot":`alert-dialog-cancel`,className:c,render:l,...r}),t[10]=r,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function f7(e,t){e(e=>Object.is(e,t)?e:t)}function p7(e){return!!(e&&e.scrollTop>0)}function Lfe(e){return e?e.scrollHeight-e.clientHeight-e.scrollTop>1:!1}function m7({getValue:e,scrollElement:t,selector:n}){if(!t||t.scrollTop<=0)return``;let r=t.getBoundingClientRect().top,i=Array.from(t.querySelectorAll(n));for(let t of i){let n=t.getBoundingClientRect();if(n.top<=r+1&&n.bottom>r+1)return e(t)}return``}function Rfe(e){let t=(0,Y.c)(23),{title:n,meta:r,controls:i,className:a,bodyClassName:o,children:s}=e,c;t[0]===a?c=t[1]:(c=G(`overflow-hidden rounded-xl border border-border/80 bg-card/50`,a),t[0]=a,t[1]=c);let l;t[2]===n?l=t[3]:(l=(0,J.jsx)(`div`,{className:`text-xs font-bold tracking-[0.04em] text-muted-foreground uppercase`,children:n}),t[2]=n,t[3]=l);let u;t[4]===r?u=t[5]:(u=r?(0,J.jsx)(`div`,{className:`min-w-0 truncate text-xs text-muted-foreground/80`,children:r}):null,t[4]=r,t[5]=u);let d;t[6]!==l||t[7]!==u?(d=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[l,u]}),t[6]=l,t[7]=u,t[8]=d):d=t[8];let f;t[9]===i?f=t[10]:(f=i?(0,J.jsx)(`div`,{className:`shrink-0`,children:i}):null,t[9]=i,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,J.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-3 border-b border-border/70 bg-background px-3 py-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]===o?m=t[15]:(m=G(`grid gap-2 px-3 py-2.5`,o),t[14]=o,t[15]=m);let h;t[16]!==s||t[17]!==m?(h=(0,J.jsx)(`div`,{className:m,children:s}),t[16]=s,t[17]=m,t[18]=h):h=t[18];let g;return t[19]!==c||t[20]!==p||t[21]!==h?(g=(0,J.jsxs)(`section`,{className:c,children:[p,h]}),t[19]=c,t[20]=p,t[21]=h,t[22]=g):g=t[22],g}var h7=[`#0ea5e9`,`#db2777`,`#22c55e`,`#f59e0b`,`#8b5cf6`,`#14b8a6`],g7=-1,_7=32,zfe=200,v7=14,y7=12,Bfe={hashCopied:!1,messageCopied:!1,formDialog:null,confirmDialog:null,contextMenuOpen:!1,contextMenuKey:0,scrollValue:``,commitBodyHeaderShadowed:!1,commitBodyFooterShadowed:!1};function Vfe(e,t){switch(t.type){case`set-hash-copied`:return e.hashCopied===t.copied?e:{...e,hashCopied:t.copied};case`set-message-copied`:return e.messageCopied===t.copied?e:{...e,messageCopied:t.copied};case`set-form-dialog`:return e.formDialog===t.formDialog?e:{...e,formDialog:t.formDialog};case`set-form-dialog-value`:return!e.formDialog||e.formDialog.value===t.value?e:{...e,formDialog:{...e.formDialog,value:t.value}};case`set-confirm-dialog`:return e.confirmDialog===t.confirmDialog?e:{...e,confirmDialog:t.confirmDialog};case`set-context-menu-open`:return e.contextMenuOpen===t.open?e:{...e,contextMenuOpen:t.open};case`reset-context-menu`:return{...e,contextMenuOpen:!1,contextMenuKey:e.contextMenuKey+1};case`set-scroll-shadows`:return e.scrollValue===t.value&&e.commitBodyHeaderShadowed===t.headerShadowed&&e.commitBodyFooterShadowed===t.footerShadowed?e:{...e,scrollValue:t.value,commitBodyHeaderShadowed:t.headerShadowed,commitBodyFooterShadowed:t.footerShadowed}}}function b7(e,t=!1){return t?`#f87171`:h7[e%h7.length]}var Hfe=class{colour;lines=[];constructor(e){this.colour=e}addLine(e,t){this.lines.push({p1:e,p2:t})}getColour(){return this.colour}getLines(){return this.lines}},x7=class{id;connections=[];nextParent=0;nextX=0;onBranch=null;parents=[];x=0;constructor(e){this.id=e}addParent(e){this.parents.push(e)}getNextParent(){return this.parents[this.nextParent]??null}registerParentProcessed(){this.nextParent+=1}isMerge(){return this.parents.length>1}addToBranch(e,t){this.onBranch===null&&(this.onBranch=e,this.x=t)}isNotOnBranch(){return this.onBranch===null}getBranch(){return this.onBranch}getPoint(){return{x:this.x,y:this.id}}getNextPoint(){return{x:this.nextX,y:this.id}}getPointConnectingTo(e,t){for(let n=0;n<this.connections.length;n++){let r=this.connections[n];if(r?.connectsTo===e&&r.onBranch===t)return{x:n,y:this.id}}return null}registerUnavailablePoint(e,t,n){e===this.nextX&&(this.nextX=e+1,this.connections[e]={connectsTo:t,onBranch:n})}};function S7(e){let t=e.map(e=>Xg(e)),n=new Map;t.forEach((e,t)=>{e.fullHash&&n.set(e.fullHash,t)});let r=new x7(g7),i=t.map((e,t)=>new x7(t)),a=[],o=[];t.forEach((e,t)=>{if(!e.fullHash)return;let a=i[t];e.parents.forEach(e=>{let t=n.get(e);if(typeof t==`number`){let e=i[t];a.addParent(e)}else a.addParent(r)})});let s=e=>{for(let t=0;t<o.length;t++)if(e>(o[t]??0))return t;return o.push(0),o.length-1},c=e=>{let t=e,n=i[t],r=n.getNextParent(),c=n.isNotOnBranch()?n.getNextPoint():n.getPoint();if(r!==null&&r.id!==g7&&n.isMerge()&&!n.isNotOnBranch()&&!r.isNotOnBranch()){let a=r.getBranch(),o=!1;for(t=e+1;t<i.length;t++){let e=i[t],s=e.getPointConnectingTo(r,a),l=s??e.getNextPoint();if(a.addLine(c,l),e.registerUnavailablePoint(l.x,r,a),c=l,s!==null){n.registerParentProcessed(),o=!0;break}}o||n.registerParentProcessed();return}let l=new Hfe(s(e));for(n.addToBranch(l,c.x),n.registerUnavailablePoint(c.x,n,l),t=e+1;t<i.length;t++){let e=i[t],a=r===e&&!r.isNotOnBranch()?e.getPoint():e.getNextPoint();if(l.addLine(c,a),e.registerUnavailablePoint(a.x,r,l),c=a,r===e){n.registerParentProcessed();let e=!r.isNotOnBranch();if(r.addToBranch(l,a.x),n=r,r=n.getNextParent(),r===null||e)break}}t===i.length&&r!==null&&r.id===g7&&n.registerParentProcessed(),a.push(l),o[l.getColour()]=t},l=0;for(;l<i.length;){let e=i[l];t[l].fullHash&&(e.getNextParent()!==null||e.isNotOnBranch())?c(l):l+=1}let u=t.map((e,t)=>{let n=i[t]?.getBranch()??null;return{colour:n?.getColour()??0,commitLane:e.fullHash&&n?i[t].getPoint().x:-1,parsed:e}});return{branches:a,maxLaneCount:Math.max(1,...i.map(e=>e.getNextPoint().x)),rows:u}}function C7(e,t){return e.parsed.fullHash||`commit-row:${t}`}function w7(e,t){let n=new Set(t);return e.map((e,t)=>n.has(C7(e,t))?_7+zfe:_7)}function Ufe(e){let t=0;return e.map(e=>{let n=t;return t+=e,n})}function Wfe(e){return e.reduce((e,t)=>e+t,0)}function T7(e,t){return(e[t]??t*_7)+_7/2}function Gfe({line:e,rowTops:t}){let n=e.p1.x*v7+y7,r=T7(t,e.p1.y),i=e.p2.x*v7+y7,a=T7(t,e.p2.y);if(n===i)return`M ${n} ${r} L ${i} ${a}`;let o=_7*.8;return`M ${n} ${r} C ${n} ${r+o}, ${i} ${a-o}, ${i} ${a}`}function Kfe(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,48)}function qfe(e,t){return`commit/${Kfe(e)||t}`}function Jfe(e){return`v-${e}`}function Yfe(e){switch(e){case`checkout`:return`Checked out commit`;case`cherry-pick`:return`Cherry-picked commit`;case`revert`:return`Reverted commit`;case`tag`:return`Tagged commit`;case`reset`:return`Reset branch`;case`rebase`:return`Rebased branch`;case`drop`:return`Dropped commit`;case`squash`:return`Squashed commits`}}function Xfe(e){let t=(0,Y.c)(15),{lines:n,openCommitValues:r,unpushedCommitHashes:i}=e,a,o,s,c;if(t[0]!==n||t[1]!==r||t[2]!==i){let{branches:e,maxLaneCount:l,rows:u}=S7(n),d=w7(u,r),f=Ufe(d);c=Math.max(24,l*v7+4),o=Math.max(_7,Wfe(d)),s=[],a=[],e.forEach((e,t)=>{e.getLines().forEach((n,r)=>{s.push((0,J.jsx)(`path`,{d:Gfe({line:n,rowTops:f}),fill:`none`,stroke:b7(e.getColour()),strokeLinecap:`round`,strokeWidth:`2`},`path:${t}:${r}`))})}),u.forEach((e,t)=>{if(e.commitLane<0)return;let n=e.commitLane*v7+y7,r=T7(f,t),o=!!(e.parsed.fullHash&&i.has(e.parsed.fullHash));a.push((0,J.jsx)(`circle`,{cx:n,cy:r,r:`4`,fill:b7(e.colour,o)},`circle:${t}:${e.parsed.fullHash}`))}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];let l=`0 0 ${c} ${o}`,u;t[7]!==o||t[8]!==c?(u={width:c,height:o},t[7]=o,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==s||t[12]!==l||t[13]!==u?(d=(0,J.jsxs)(`svg`,{"aria-hidden":!0,viewBox:l,className:`pointer-events-none absolute top-0 left-0 z-10 overflow-visible`,style:u,children:[s,a]}),t[10]=a,t[11]=s,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function Zfe(e){let t=(0,Y.c)(137),{disabled:n,busy:r,canCopyMessage:i,onViewDiff:a,onCompareHead:o,onComparePrevious:s,onCopyHash:c,onCopyMessage:l,onCreateBranch:u,onCheckout:d,onCherryPick:f,onRevert:p,onTag:m,onOpenRemote:h,onReset:g,onRebase:_,onDrop:v,onSquash:y}=e,[b,x]=q.useState(!1),[S,C]=q.useState(0),w=q.useRef(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{w.current?.close(),w.current?.unmount(),x(!1),C(Qfe),e()},t[0]=T):T=t[0];let E=T,D=n||r,O;t[1]===D?O=t[2]:(O=(0,J.jsx)(ws,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":`Commit actions`,disabled:D}),t[1]=D,t[2]=O);let k;t[3]===r?k=t[4]:(k=r?(0,J.jsx)(Rn,{className:`size-3`}):(0,J.jsx)(ao,{}),t[3]=r,t[4]=k);let A;t[5]!==O||t[6]!==k?(A=(0,J.jsx)(ny,{render:O,children:k}),t[5]=O,t[6]=k,t[7]=A):A=t[7];let j;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,J.jsx)(ay,{children:`Commit`}),t[8]=j):j=t[8];let M;t[9]===a?M=t[10]:(M=()=>E(a),t[9]=a,t[10]=M);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,J.jsx)(so,{}),t[11]=N):N=t[11];let P;t[12]!==n||t[13]!==M?(P=(0,J.jsxs)(oy,{disabled:n,onClick:M,children:[N,`View diff`]}),t[12]=n,t[13]=M,t[14]=P):P=t[14];let F;t[15]===o?F=t[16]:(F=()=>E(o),t[15]=o,t[16]=F);let I;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsx)(so,{}),t[17]=I):I=t[17];let L;t[18]!==n||t[19]!==F?(L=(0,J.jsxs)(oy,{disabled:n,onClick:F,children:[I,`Compare with HEAD`]}),t[18]=n,t[19]=F,t[20]=L):L=t[20];let R;t[21]===s?R=t[22]:(R=()=>E(s),t[21]=s,t[22]=R);let z;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,J.jsx)(so,{}),t[23]=z):z=t[23];let B;t[24]!==n||t[25]!==R?(B=(0,J.jsxs)(oy,{disabled:n,onClick:R,children:[z,`Compare with previous commit`]}),t[24]=n,t[25]=R,t[26]=B):B=t[26];let V;t[27]===h?V=t[28]:(V=()=>E(h),t[27]=h,t[28]=V);let H;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,J.jsx)(oo,{}),t[29]=H):H=t[29];let U;t[30]!==n||t[31]!==V?(U=(0,J.jsxs)(oy,{disabled:n,onClick:V,children:[H,`Open on remote`]}),t[30]=n,t[31]=V,t[32]=U):U=t[32];let ee;t[33]!==L||t[34]!==B||t[35]!==U||t[36]!==P?(ee=(0,J.jsxs)(iy,{children:[j,P,L,B,U]}),t[33]=L,t[34]=B,t[35]=U,t[36]=P,t[37]=ee):ee=t[37];let te;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,J.jsx)(uy,{}),t[38]=te):te=t[38];let ne;t[39]===c?ne=t[40]:(ne=()=>E(c),t[39]=c,t[40]=ne);let re;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,J.jsx)(no,{}),t[41]=re):re=t[41];let W;t[42]!==n||t[43]!==ne?(W=(0,J.jsxs)(oy,{disabled:n,onClick:ne,children:[re,`Copy commit hash`]}),t[42]=n,t[43]=ne,t[44]=W):W=t[44];let ie=!i,ae;t[45]===l?ae=t[46]:(ae=()=>E(l),t[45]=l,t[46]=ae);let oe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,J.jsx)(no,{}),t[47]=oe):oe=t[47];let se;t[48]!==ie||t[49]!==ae?(se=(0,J.jsxs)(oy,{disabled:ie,onClick:ae,children:[oe,`Copy commit message`]}),t[48]=ie,t[49]=ae,t[50]=se):se=t[50];let ce;t[51]!==W||t[52]!==se?(ce=(0,J.jsxs)(iy,{children:[W,se]}),t[51]=W,t[52]=se,t[53]=ce):ce=t[53];let le;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,J.jsx)(uy,{}),t[54]=le):le=t[54];let ue;t[55]===u?ue=t[56]:(ue=()=>E(u),t[55]=u,t[56]=ue);let de;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,J.jsx)(fo,{}),t[57]=de):de=t[57];let fe;t[58]!==n||t[59]!==ue?(fe=(0,J.jsxs)(oy,{disabled:n,onClick:ue,children:[de,`Create branch from commit…`]}),t[58]=n,t[59]=ue,t[60]=fe):fe=t[60];let pe;t[61]===d?pe=t[62]:(pe=()=>E(d),t[61]=d,t[62]=pe);let me;t[63]!==n||t[64]!==pe?(me=(0,J.jsx)(oy,{disabled:n,onClick:pe,children:`Checkout commit`}),t[63]=n,t[64]=pe,t[65]=me):me=t[65];let he;t[66]===f?he=t[67]:(he=()=>E(f),t[66]=f,t[67]=he);let ge;t[68]!==n||t[69]!==he?(ge=(0,J.jsx)(oy,{disabled:n,onClick:he,children:`Cherry-pick commit`}),t[68]=n,t[69]=he,t[70]=ge):ge=t[70];let _e;t[71]===p?_e=t[72]:(_e=()=>E(p),t[71]=p,t[72]=_e);let ve;t[73]!==n||t[74]!==_e?(ve=(0,J.jsx)(oy,{disabled:n,onClick:_e,children:`Revert commit`}),t[73]=n,t[74]=_e,t[75]=ve):ve=t[75];let ye;t[76]===m?ye=t[77]:(ye=()=>E(m),t[76]=m,t[77]=ye);let be;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,J.jsx)(Co,{}),t[78]=be):be=t[78];let G;t[79]!==n||t[80]!==ye?(G=(0,J.jsxs)(oy,{disabled:n,onClick:ye,children:[be,`Tag commit…`]}),t[79]=n,t[80]=ye,t[81]=G):G=t[81];let xe;t[82]!==fe||t[83]!==me||t[84]!==ge||t[85]!==ve||t[86]!==G?(xe=(0,J.jsxs)(iy,{children:[fe,me,ge,ve,G]}),t[82]=fe,t[83]=me,t[84]=ge,t[85]=ve,t[86]=G,t[87]=xe):xe=t[87];let Se;t[88]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,J.jsx)(uy,{}),t[88]=Se):Se=t[88];let Ce;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,J.jsx)(ay,{children:`Dangerous`}),t[89]=Ce):Ce=t[89];let we;t[90]===g?we=t[91]:(we=()=>E(()=>g(`soft`)),t[90]=g,t[91]=we);let Te;t[92]!==n||t[93]!==we?(Te=(0,J.jsx)(oy,{disabled:n,onClick:we,children:`Reset soft to commit`}),t[92]=n,t[93]=we,t[94]=Te):Te=t[94];let Ee;t[95]===g?Ee=t[96]:(Ee=()=>E(()=>g(`mixed`)),t[95]=g,t[96]=Ee);let De;t[97]!==n||t[98]!==Ee?(De=(0,J.jsx)(oy,{disabled:n,onClick:Ee,children:`Reset mixed to commit`}),t[97]=n,t[98]=Ee,t[99]=De):De=t[99];let Oe;t[100]===g?Oe=t[101]:(Oe=()=>E(()=>g(`hard`)),t[100]=g,t[101]=Oe);let ke;t[102]!==n||t[103]!==Oe?(ke=(0,J.jsx)(oy,{disabled:n,variant:`destructive`,onClick:Oe,children:`Reset hard to commit`}),t[102]=n,t[103]=Oe,t[104]=ke):ke=t[104];let Ae;t[105]===_?Ae=t[106]:(Ae=()=>E(_),t[105]=_,t[106]=Ae);let je;t[107]!==n||t[108]!==Ae?(je=(0,J.jsx)(oy,{disabled:n,onClick:Ae,children:`Rebase onto this commit`}),t[107]=n,t[108]=Ae,t[109]=je):je=t[109];let Me;t[110]===v?Me=t[111]:(Me=()=>E(v),t[110]=v,t[111]=Me);let Ne;t[112]!==n||t[113]!==Me?(Ne=(0,J.jsx)(oy,{disabled:n,variant:`destructive`,onClick:Me,children:`Drop commit`}),t[112]=n,t[113]=Me,t[114]=Ne):Ne=t[114];let Pe;t[115]===y?Pe=t[116]:(Pe=()=>E(y),t[115]=y,t[116]=Pe);let Fe;t[117]!==n||t[118]!==Pe?(Fe=(0,J.jsx)(oy,{disabled:n,variant:`destructive`,onClick:Pe,children:`Squash commits after this…`}),t[117]=n,t[118]=Pe,t[119]=Fe):Fe=t[119];let Ie;t[120]!==Te||t[121]!==De||t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,J.jsxs)(iy,{children:[Ce,Te,De,ke,je,Ne,Fe]}),t[120]=Te,t[121]=De,t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==ee||t[128]!==ce||t[129]!==xe||t[130]!==Ie?(Le=(0,J.jsxs)(ry,{align:`end`,className:`w-64`,children:[ee,te,ce,le,xe,Se,Ie]}),t[127]=ee,t[128]=ce,t[129]=xe,t[130]=Ie,t[131]=Le):Le=t[131];let Re;return t[132]!==S||t[133]!==b||t[134]!==A||t[135]!==Le?(Re=(0,J.jsxs)(ty,{open:b,onOpenChange:x,actionsRef:w,children:[A,Le]},S),t[132]=S,t[133]=b,t[134]=A,t[135]=Le,t[136]=Re):Re=t[136],Re}function Qfe(e){return e+1}function $fe(e){let t=(0,Y.c)(141),{disabled:n,busy:r,canCopyMessage:i,onViewDiff:a,onCompareHead:o,onComparePrevious:s,onCopyHash:c,onCopyMessage:l,onCreateBranch:u,onCheckout:d,onCherryPick:f,onRevert:p,onTag:m,onOpenRemote:h,onReset:g,onRebase:_,onDrop:v,onSquash:y,runAction:b}=e,x=n||r,S;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(P5,{children:`Commit`}),t[0]=S):S=t[0];let C;t[1]!==a||t[2]!==b?(C=()=>b(a),t[1]=a,t[2]=b,t[3]=C):C=t[3];let w;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,J.jsx)(so,{}),t[4]=w):w=t[4];let T;t[5]!==x||t[6]!==C?(T=(0,J.jsxs)(F5,{disabled:x,onClick:C,children:[w,`View diff`]}),t[5]=x,t[6]=C,t[7]=T):T=t[7];let E;t[8]!==o||t[9]!==b?(E=()=>b(o),t[8]=o,t[9]=b,t[10]=E):E=t[10];let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,J.jsx)(so,{}),t[11]=D):D=t[11];let O;t[12]!==x||t[13]!==E?(O=(0,J.jsxs)(F5,{disabled:x,onClick:E,children:[D,`Compare with HEAD`]}),t[12]=x,t[13]=E,t[14]=O):O=t[14];let k;t[15]!==s||t[16]!==b?(k=()=>b(s),t[15]=s,t[16]=b,t[17]=k):k=t[17];let A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,J.jsx)(so,{}),t[18]=A):A=t[18];let j;t[19]!==x||t[20]!==k?(j=(0,J.jsxs)(F5,{disabled:x,onClick:k,children:[A,`Compare with previous commit`]}),t[19]=x,t[20]=k,t[21]=j):j=t[21];let M;t[22]!==h||t[23]!==b?(M=()=>b(h),t[22]=h,t[23]=b,t[24]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,J.jsx)(oo,{}),t[25]=N):N=t[25];let P;t[26]!==x||t[27]!==M?(P=(0,J.jsxs)(F5,{disabled:x,onClick:M,children:[N,`Open on remote`]}),t[26]=x,t[27]=M,t[28]=P):P=t[28];let F;t[29]!==j||t[30]!==P||t[31]!==T||t[32]!==O?(F=(0,J.jsxs)(N5,{children:[S,T,O,j,P]}),t[29]=j,t[30]=P,t[31]=T,t[32]=O,t[33]=F):F=t[33];let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsx)(I5,{}),t[34]=I):I=t[34];let L;t[35]!==c||t[36]!==b?(L=()=>b(c),t[35]=c,t[36]=b,t[37]=L):L=t[37];let R;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,J.jsx)(no,{}),t[38]=R):R=t[38];let z;t[39]!==x||t[40]!==L?(z=(0,J.jsxs)(F5,{disabled:x,onClick:L,children:[R,`Copy commit hash`]}),t[39]=x,t[40]=L,t[41]=z):z=t[41];let B=!i||r,V;t[42]!==l||t[43]!==b?(V=()=>b(l),t[42]=l,t[43]=b,t[44]=V):V=t[44];let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,J.jsx)(no,{}),t[45]=H):H=t[45];let U;t[46]!==B||t[47]!==V?(U=(0,J.jsxs)(F5,{disabled:B,onClick:V,children:[H,`Copy commit message`]}),t[46]=B,t[47]=V,t[48]=U):U=t[48];let ee;t[49]!==z||t[50]!==U?(ee=(0,J.jsxs)(N5,{children:[z,U]}),t[49]=z,t[50]=U,t[51]=ee):ee=t[51];let te;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,J.jsx)(I5,{}),t[52]=te):te=t[52];let ne;t[53]!==u||t[54]!==b?(ne=()=>b(u),t[53]=u,t[54]=b,t[55]=ne):ne=t[55];let re;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,J.jsx)(fo,{}),t[56]=re):re=t[56];let W;t[57]!==x||t[58]!==ne?(W=(0,J.jsxs)(F5,{disabled:x,onClick:ne,children:[re,`Create branch from commit…`]}),t[57]=x,t[58]=ne,t[59]=W):W=t[59];let ie;t[60]!==d||t[61]!==b?(ie=()=>b(d),t[60]=d,t[61]=b,t[62]=ie):ie=t[62];let ae;t[63]!==x||t[64]!==ie?(ae=(0,J.jsx)(F5,{disabled:x,onClick:ie,children:`Checkout commit`}),t[63]=x,t[64]=ie,t[65]=ae):ae=t[65];let oe;t[66]!==f||t[67]!==b?(oe=()=>b(f),t[66]=f,t[67]=b,t[68]=oe):oe=t[68];let se;t[69]!==x||t[70]!==oe?(se=(0,J.jsx)(F5,{disabled:x,onClick:oe,children:`Cherry-pick commit`}),t[69]=x,t[70]=oe,t[71]=se):se=t[71];let ce;t[72]!==p||t[73]!==b?(ce=()=>b(p),t[72]=p,t[73]=b,t[74]=ce):ce=t[74];let le;t[75]!==x||t[76]!==ce?(le=(0,J.jsx)(F5,{disabled:x,onClick:ce,children:`Revert commit`}),t[75]=x,t[76]=ce,t[77]=le):le=t[77];let ue;t[78]!==m||t[79]!==b?(ue=()=>b(m),t[78]=m,t[79]=b,t[80]=ue):ue=t[80];let de;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,J.jsx)(Co,{}),t[81]=de):de=t[81];let fe;t[82]!==x||t[83]!==ue?(fe=(0,J.jsxs)(F5,{disabled:x,onClick:ue,children:[de,`Tag commit…`]}),t[82]=x,t[83]=ue,t[84]=fe):fe=t[84];let pe;t[85]!==W||t[86]!==ae||t[87]!==se||t[88]!==le||t[89]!==fe?(pe=(0,J.jsxs)(N5,{children:[W,ae,se,le,fe]}),t[85]=W,t[86]=ae,t[87]=se,t[88]=le,t[89]=fe,t[90]=pe):pe=t[90];let me;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,J.jsx)(I5,{}),t[91]=me):me=t[91];let he;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,J.jsx)(P5,{children:`Dangerous`}),t[92]=he):he=t[92];let ge;t[93]!==g||t[94]!==b?(ge=()=>b(()=>g(`soft`)),t[93]=g,t[94]=b,t[95]=ge):ge=t[95];let _e;t[96]!==x||t[97]!==ge?(_e=(0,J.jsx)(F5,{disabled:x,onClick:ge,children:`Reset soft to commit`}),t[96]=x,t[97]=ge,t[98]=_e):_e=t[98];let ve;t[99]!==g||t[100]!==b?(ve=()=>b(()=>g(`mixed`)),t[99]=g,t[100]=b,t[101]=ve):ve=t[101];let ye;t[102]!==x||t[103]!==ve?(ye=(0,J.jsx)(F5,{disabled:x,onClick:ve,children:`Reset mixed to commit`}),t[102]=x,t[103]=ve,t[104]=ye):ye=t[104];let be;t[105]!==g||t[106]!==b?(be=()=>b(()=>g(`hard`)),t[105]=g,t[106]=b,t[107]=be):be=t[107];let G;t[108]!==x||t[109]!==be?(G=(0,J.jsx)(F5,{disabled:x,variant:`destructive`,onClick:be,children:`Reset hard to commit`}),t[108]=x,t[109]=be,t[110]=G):G=t[110];let xe;t[111]!==_||t[112]!==b?(xe=()=>b(_),t[111]=_,t[112]=b,t[113]=xe):xe=t[113];let Se;t[114]!==x||t[115]!==xe?(Se=(0,J.jsx)(F5,{disabled:x,onClick:xe,children:`Rebase onto this commit`}),t[114]=x,t[115]=xe,t[116]=Se):Se=t[116];let Ce;t[117]!==v||t[118]!==b?(Ce=()=>b(v),t[117]=v,t[118]=b,t[119]=Ce):Ce=t[119];let we;t[120]!==x||t[121]!==Ce?(we=(0,J.jsx)(F5,{disabled:x,variant:`destructive`,onClick:Ce,children:`Drop commit`}),t[120]=x,t[121]=Ce,t[122]=we):we=t[122];let Te;t[123]!==y||t[124]!==b?(Te=()=>b(y),t[123]=y,t[124]=b,t[125]=Te):Te=t[125];let Ee;t[126]!==x||t[127]!==Te?(Ee=(0,J.jsx)(F5,{disabled:x,variant:`destructive`,onClick:Te,children:`Squash commits after this…`}),t[126]=x,t[127]=Te,t[128]=Ee):Ee=t[128];let De;t[129]!==_e||t[130]!==ye||t[131]!==G||t[132]!==Se||t[133]!==we||t[134]!==Ee?(De=(0,J.jsxs)(N5,{children:[he,_e,ye,G,Se,we,Ee]}),t[129]=_e,t[130]=ye,t[131]=G,t[132]=Se,t[133]=we,t[134]=Ee,t[135]=De):De=t[135];let Oe;return t[136]!==F||t[137]!==ee||t[138]!==pe||t[139]!==De?(Oe=(0,J.jsxs)(M5,{className:`w-64`,children:[F,I,ee,te,pe,me,De]}),t[136]=F,t[137]=ee,t[138]=pe,t[139]=De,t[140]=Oe):Oe=t[140],Oe}function E7(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function epe(e){let t=(0,Y.c)(2),{status:n}=e,r;if(t[0]!==n){let[e,i]=Ug(n),a=`${e}${i}`.trim();r=(0,J.jsx)(`span`,{className:`inline-flex w-[2ch] shrink-0 items-center whitespace-pre text-muted-foreground/70`,children:[[`index`,e],[`worktree`,i]].map(e=>{let[t,n]=e;return(0,J.jsx)(`span`,{className:G(`w-[1ch] text-center whitespace-pre`,Gg(Wg(t,n))),children:n||(a?` `:`·`)},t)})}),t[0]=n,t[1]=r}else r=t[1];return r}function tpe(e){let t=(0,Y.c)(7),{file:n}=e,r=E7(n.linesAdded),i=E7(n.linesDeleted);if(r===0&&i===0)return null;let a;t[0]===r?a=t[1]:(a=r>0?(0,J.jsxs)(`span`,{className:`text-emerald-500`,children:[`+`,r]}):null,t[0]=r,t[1]=a);let o;t[2]===i?o=t[3]:(o=i>0?(0,J.jsxs)(`span`,{className:`text-red-500`,children:[`-`,i]}):null,t[2]=i,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 gap-2 justify-self-end whitespace-nowrap tabular-nums`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function npe(e){let t=(0,Y.c)(38),{viewerContextId:n,cwd:r,commit:i,shortHash:a,previousShortHash:o,subject:s,disabled:c,onOpenCommitDiff:l}=e,u;t[0]!==i||t[1]!==r||t[2]!==n?(u=i?Gh.gitCommitFiles(n,r,i):[`pico`,`git-commit-files`,n,r,``],t[0]=i,t[1]=r,t[2]=n,t[3]=u):u=t[3];let d;t[4]!==i||t[5]!==r||t[6]!==n?(d=()=>mh(ph(`/api/git-commit-files?cwd=${encodeURIComponent(r)}&commit=${encodeURIComponent(i)}`,{contextId:n})),t[4]=i,t[5]=r,t[6]=n,t[7]=d):d=t[7];let f=!!(!c&&n&&r&&i),p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=[`data`,`isPending`,`error`],t[8]=p):p=t[8];let m;t[9]!==u||t[10]!==d||t[11]!==f?(m={queryKey:u,queryFn:d,enabled:f,notifyOnChangeProps:p},t[9]=u,t[10]=d,t[11]=f,t[12]=m):m=t[12];let h=Zr(m),g;t[13]===h.data?.files?g=t[14]:(g=h.data?.files??[],t[13]=h.data?.files,t[14]=g);let _=g;if(h.isPending&&!h.data){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsxs)(W5,{className:`px-2 py-1.5`,children:[(0,J.jsx)(Rn,{}),` Loading changed files…`]}),t[15]=e):e=t[15],e}if(h.error){let e;t[16]===h.error?e=t[17]:(e=Pg(h.error,`Failed to load changed files`),t[16]=h.error,t[17]=e);let n;return t[18]===e?n=t[19]:(n=(0,J.jsx)(W5,{tone:`destructive`,className:`px-2 py-1.5`,children:e}),t[18]=e,t[19]=n),n}if(_.length===0)return null;let v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,J.jsx)(`div`,{className:`font-sans text-[11px] font-medium tracking-[0.04em] text-muted-foreground uppercase`,children:`Changed files`}),t[20]=v):v=t[20];let y;if(t[21]!==i||t[22]!==c||t[23]!==_||t[24]!==l||t[25]!==o||t[26]!==a||t[27]!==s){let e;t[29]!==i||t[30]!==c||t[31]!==l||t[32]!==o||t[33]!==a||t[34]!==s?(e=e=>(0,J.jsxs)(`button`,{type:`button`,className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-baseline gap-2 border-b border-border/60 px-2 py-1.5 text-left last:border-b-0 hover:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none`,disabled:c,onClick:()=>{l?.({commit:i,shortHash:a,subject:s,mode:`commit`,path:e.path,previousPath:e.previousPath,leftRevisionLabel:o||`${a}^`,rightRevisionLabel:a})},children:[(0,J.jsx)(epe,{status:e.status}),(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:e.previousPath?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e.previousPath}),(0,J.jsx)(`span`,{className:`text-muted-foreground/70`,children:` → `}),(0,J.jsx)(`span`,{children:e.path})]}):e.path}),(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 justify-self-end`,children:[(0,J.jsx)(tpe,{file:e}),(0,J.jsx)(Ya,{className:`size-3.5 shrink-0 text-muted-foreground/70`})]})]},`${e.previousPath||``}:${e.path}`),t[29]=i,t[30]=c,t[31]=l,t[32]=o,t[33]=a,t[34]=s,t[35]=e):e=t[35],y=_.map(e),t[21]=i,t[22]=c,t[23]=_,t[24]=l,t[25]=o,t[26]=a,t[27]=s,t[28]=y}else y=t[28];let b;return t[36]===y?b=t[37]:(b=(0,J.jsxs)(`div`,{className:`grid gap-1 pt-1`,children:[v,(0,J.jsx)(`div`,{className:`grid overflow-hidden rounded-lg border border-border/70 bg-background/60`,children:y})]}),t[36]=y,t[37]=b),b}function rpe(e){return ipe(e)}function ipe(e){let t=(0,Y.c)(262),{viewerContextId:n,cwd:r,graphWidth:i,line:a,value:o,onOpenCommitDiff:s}=e,c=Xg(a),l=En(),[u,d]=q.useReducer(Vfe,Bfe),f=q.useRef(void 0),p=q.useRef(void 0),m=q.useRef(null),h=q.useRef(null),g=c.subject.trim(),_=mre(c.relativeDate),v=gre(c.fullDate),y=Zg(c.stats,`insertions`),b=Zg(c.stats,`deletions`),x=c.hash||c.fullHash.slice(0,7),S=!!(n&&r&&c.fullHash),{hashCopied:C,messageCopied:w,formDialog:T,confirmDialog:E,contextMenuOpen:D,contextMenuKey:O}=u,k=u.scrollValue===o&&u.commitBodyHeaderShadowed,A=u.scrollValue===o&&u.commitBodyFooterShadowed,j;t[0]!==d||t[1]!==o?(j=e=>{d({type:`set-scroll-shadows`,value:o,headerShadowed:p7(e),footerShadowed:Lfe(e)})},t[0]=d,t[1]=o,t[2]=j):j=t[2];let M=j,N;t[3]===M?N=t[4]:(N=()=>{M(m.current)},t[3]=M,t[4]=N),q.useLayoutEffect(N);let P,F;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>()=>{typeof f.current==`number`&&window.clearTimeout(f.current),typeof p.current==`number`&&window.clearTimeout(p.current)},F=[],t[5]=P,t[6]=F):(P=t[5],F=t[6]),q.useEffect(P,F);let I;t[7]!==r||t[8]!==n?(I=async e=>await mh(ph(`/api/git-commit-action`,{contextId:n}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:r,...e})}),t[7]=r,t[8]=n,t[9]=I):I=t[9];let L;t[10]!==r||t[11]!==l||t[12]!==n?(L=async(e,t)=>{await l.invalidateQueries({queryKey:Gh.gitStatus(n,r),exact:!0,refetchType:`active`}),await Vg({queryClient:l,viewerContextId:n,cwd:r}),Tn.success(t.label||Yfe(t.action))},t[10]=r,t[11]=l,t[12]=n,t[13]=L):L=t[13];let R;t[14]!==I||t[15]!==L?(R={mutationFn:I,onSuccess:L,onError:cpe},t[14]=I,t[15]=L,t[16]=R):R=t[16];let z=ni(R),B;t[17]!==r||t[18]!==c.fullHash||t[19]!==n?(B=async e=>await mh(ph(`/api/git-checkout`,{contextId:n}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:r,branch:e,create:!0,startPoint:c.fullHash})}),t[17]=r,t[18]=c.fullHash,t[19]=n,t[20]=B):B=t[20];let V;t[21]!==r||t[22]!==l||t[23]!==n?(V=async()=>{await l.invalidateQueries({queryKey:Gh.gitStatus(n,r),exact:!0,refetchType:`active`}),await Vg({queryClient:l,viewerContextId:n,cwd:r}),Tn.success(`Created and checked out branch`)},t[21]=r,t[22]=l,t[23]=n,t[24]=V):V=t[24];let H;t[25]!==B||t[26]!==V?(H={mutationFn:B,onSuccess:V,onError:spe},t[25]=B,t[26]=V,t[27]=H):H=t[27];let U=ni(H),ee;t[28]!==d||t[29]!==c.fullHash?(ee=()=>{c.fullHash&&Qg(c.fullHash).then(e=>{e&&(d({type:`set-hash-copied`,copied:!0}),typeof f.current==`number`&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{d({type:`set-hash-copied`,copied:!1})},1200))})},t[28]=d,t[29]=c.fullHash,t[30]=ee):ee=t[30];let te=ee,ne;t[31]!==d||t[32]!==g?(ne=()=>{g&&Qg(g).then(e=>{e&&(d({type:`set-message-copied`,copied:!0}),typeof p.current==`number`&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{d({type:`set-message-copied`,copied:!1})},1200))})},t[31]=d,t[32]=g,t[33]=ne):ne=t[33];let re=ne,W;t[34]!==s||t[35]!==c.fullHash||t[36]!==x||t[37]!==g?(W=e=>{c.fullHash&&s?.({commit:c.fullHash,shortHash:x,subject:g,mode:e})},t[34]=s,t[35]=c.fullHash,t[36]=x,t[37]=g,t[38]=W):W=t[38];let ie=W,ae;t[39]!==r||t[40]!==c.fullHash||t[41]!==n?(ae=()=>{c.fullHash&&mh(ph(`/api/git-commit-remote-url?cwd=${encodeURIComponent(r)}&commit=${encodeURIComponent(c.fullHash)}`,{contextId:n})).then(ope).catch(ape)},t[39]=r,t[40]=c.fullHash,t[41]=n,t[42]=ae):ae=t[42];let oe=ae,se;t[43]!==E||t[44]!==d||t[45]!==z?(se=()=>{E&&(z.mutate(E),d({type:`set-confirm-dialog`,confirmDialog:null}))},t[43]=E,t[44]=d,t[45]=z,t[46]=se):se=t[46];let ce=se,le;t[47]!==U||t[48]!==d||t[49]!==T||t[50]!==z||t[51]!==c.fullHash?(le=e=>{if(e.preventDefault(),!T||!c.fullHash)return;let t=T.value.trim();t&&(T.kind===`branch`?U.mutate(t):T.kind===`tag`?z.mutate({action:`tag`,commit:c.fullHash,tagName:t,label:`Tagged commit`}):z.mutate({action:`squash`,commit:c.fullHash,message:t,label:`Squashed commits`}),d({type:`set-form-dialog`,formDialog:null}))},t[47]=U,t[48]=d,t[49]=T,t[50]=z,t[51]=c.fullHash,t[52]=le):le=t[52];let ue=le,de;t[53]===d?de=t[54]:(de=e=>{d({type:`set-confirm-dialog`,confirmDialog:e})},t[53]=d,t[54]=de);let fe=de,pe;t[55]!==c.fullHash||t[56]!==x||t[57]!==fe?(pe=e=>{c.fullHash&&fe({action:`reset`,commit:c.fullHash,resetMode:e,label:`Reset branch (${e})`,title:`Reset branch to ${x}?`,description:e===`hard`?`Hard reset moves the current branch and discards working tree and staged changes. This cannot be undone from Pico.`:e===`soft`?`Soft reset moves the current branch and keeps changes staged.`:`Mixed reset moves the current branch and keeps changes in the working tree.`,confirmLabel:`Reset ${e}`,destructive:e===`hard`})},t[55]=c.fullHash,t[56]=x,t[57]=fe,t[58]=pe):pe=t[58];let me=pe;if(!c.hash&&!c.subject){let e;t[59]===c.subject?e=t[60]:(e=c.subject?(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-foreground`,children:c.subject}):null,t[59]=c.subject,t[60]=e);let n;return t[61]===e?n=t[62]:(n=(0,J.jsx)(`div`,{className:`flex h-8 max-w-full min-w-0 items-center font-mono text-[13px] leading-5`,children:e}),t[61]=e,t[62]=n),n}let he;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(he=G(`h-8 min-h-8 w-full items-center gap-2 rounded-none px-1.5 py-0 font-mono text-[13px] leading-5 font-normal transition-[background-color,box-shadow,color] hover:no-underline focus-visible:ring-0 aria-expanded:bg-muted/50 **:data-[slot=accordion-trigger-icon]:size-4`),t[63]=he):he=t[63];let ge;t[64]===i?ge=t[65]:(ge={paddingLeft:i},t[64]=i,t[65]=ge);let _e=g||c.hash||`Commit`,ve;t[66]!==ge||t[67]!==_e?(ve=(0,J.jsx)(Hy,{headerClassName:`min-w-0`,className:he,children:(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate pr-8 text-foreground`,style:ge,children:_e})}),t[66]=ge,t[67]=_e,t[68]=ve):ve=t[68];let ye=ve,be=!S,xe,Se,Ce;t[69]===ie?(xe=t[70],Se=t[71],Ce=t[72]):(xe=()=>ie(`commit`),Se=()=>ie(`head`),Ce=()=>ie(`previous`),t[69]=ie,t[70]=xe,t[71]=Se,t[72]=Ce);let we;t[73]===c.fullHash?we=t[74]:(we=()=>{Qg(c.fullHash)},t[73]=c.fullHash,t[74]=we);let Te;t[75]===g?Te=t[76]:(Te=()=>{Qg(g)},t[75]=g,t[76]=Te);let Ee;t[77]!==d||t[78]!==x||t[79]!==g?(Ee=()=>{d({type:`set-form-dialog`,formDialog:{kind:`branch`,title:`Create branch from commit`,description:`Create and check out a new branch at ${x}.`,value:qfe(g,x)}})},t[77]=d,t[78]=x,t[79]=g,t[80]=Ee):Ee=t[80];let De,Oe,ke;t[81]!==c.fullHash||t[82]!==x||t[83]!==fe?(De=()=>{c.fullHash&&fe({action:`checkout`,commit:c.fullHash,label:`Checked out commit`,title:`Checkout ${x}?`,description:`This switches to a detached HEAD at the selected commit. Commit or stash local changes first.`,confirmLabel:`Checkout`})},Oe=()=>{c.fullHash&&fe({action:`cherry-pick`,commit:c.fullHash,label:`Cherry-picked commit`,title:`Cherry-pick ${x}?`,description:`This applies the selected commit on top of the current branch.`,confirmLabel:`Cherry-pick`})},ke=()=>{c.fullHash&&fe({action:`revert`,commit:c.fullHash,label:`Reverted commit`,title:`Revert ${x}?`,description:`This creates a new commit that reverses the selected commit.`,confirmLabel:`Revert`})},t[81]=c.fullHash,t[82]=x,t[83]=fe,t[84]=De,t[85]=Oe,t[86]=ke):(De=t[84],Oe=t[85],ke=t[86]);let Ae;t[87]!==d||t[88]!==x?(Ae=()=>{d({type:`set-form-dialog`,formDialog:{kind:`tag`,title:`Tag commit`,description:`Create a lightweight tag at ${x}.`,value:Jfe(x)}})},t[87]=d,t[88]=x,t[89]=Ae):Ae=t[89];let je,Me;t[90]!==c.fullHash||t[91]!==x||t[92]!==fe?(je=()=>{c.fullHash&&fe({action:`rebase`,commit:c.fullHash,label:`Rebased branch`,title:`Rebase onto ${x}?`,description:`This rebases the current branch onto the selected commit. Conflicts may need to be resolved from the terminal.`,confirmLabel:`Rebase`,destructive:!0})},Me=()=>{c.fullHash&&fe({action:`drop`,commit:c.fullHash,label:`Dropped commit`,title:`Drop ${x}?`,description:`This rewrites the current branch by replaying commits after the selected commit onto its parent.`,confirmLabel:`Drop commit`,destructive:!0})},t[90]=c.fullHash,t[91]=x,t[92]=fe,t[93]=je,t[94]=Me):(je=t[93],Me=t[94]);let Ne;t[95]!==d||t[96]!==x||t[97]!==g?(Ne=()=>{d({type:`set-form-dialog`,formDialog:{kind:`squash`,title:`Squash commits after this commit`,description:`Soft reset to ${x}, then create one replacement commit from all newer commits.`,value:g?`Squash changes after ${g}`:`Squash after ${x}`}})},t[95]=d,t[96]=x,t[97]=g,t[98]=Ne):Ne=t[98];let Pe=!!g,Fe=z.isPending||U.isPending,Ie;t[99]!==oe||t[100]!==me||t[101]!==be||t[102]!==xe||t[103]!==Se||t[104]!==Ce||t[105]!==we||t[106]!==Te||t[107]!==Ee||t[108]!==De||t[109]!==Oe||t[110]!==ke||t[111]!==Ae||t[112]!==je||t[113]!==Me||t[114]!==Ne||t[115]!==Pe||t[116]!==Fe?(Ie={disabled:be,onViewDiff:xe,onCompareHead:Se,onComparePrevious:Ce,onCopyHash:we,onCopyMessage:Te,onCreateBranch:Ee,onCheckout:De,onCherryPick:Oe,onRevert:ke,onTag:Ae,onOpenRemote:oe,onReset:me,onRebase:je,onDrop:Me,onSquash:Ne,canCopyMessage:Pe,busy:Fe},t[99]=oe,t[100]=me,t[101]=be,t[102]=xe,t[103]=Se,t[104]=Ce,t[105]=we,t[106]=Te,t[107]=Ee,t[108]=De,t[109]=Oe,t[110]=ke,t[111]=Ae,t[112]=je,t[113]=Me,t[114]=Ne,t[115]=Pe,t[116]=Fe,t[117]=Ie):Ie=t[117];let Le=Ie,Re;t[118]===d?Re=t[119]:(Re=e=>{h.current?.close(),h.current?.unmount(),d({type:`reset-context-menu`}),e()},t[118]=d,t[119]=Re);let ze=Re,Be;t[120]===d?Be=t[121]:(Be=e=>{d({type:`set-context-menu-open`,open:e})},t[120]=d,t[121]=Be);let Ve;t[122]===ye?Ve=t[123]:(Ve=(0,J.jsx)(j5,{render:ye}),t[122]=ye,t[123]=Ve);let He;t[124]!==Le||t[125]!==ze?(He=(0,J.jsx)($fe,{...Le,runAction:ze}),t[124]=Le,t[125]=ze,t[126]=He):He=t[126];let Ue;t[127]!==O||t[128]!==D||t[129]!==Be||t[130]!==Ve||t[131]!==He?(Ue=(0,J.jsx)(`div`,{className:`group/commit-row relative min-w-0`,children:(0,J.jsxs)(A5,{open:D,onOpenChange:Be,actionsRef:h,children:[Ve,He]},O)}),t[127]=O,t[128]=D,t[129]=Be,t[130]=Ve,t[131]=He,t[132]=Ue):Ue=t[132];let We;t[133]===M?We=t[134]:(We=e=>{M(e.currentTarget)},t[133]=M,t[134]=We);let Ge;t[135]===i?Ge=t[136]:(Ge={paddingLeft:i},t[135]=i,t[136]=Ge);let Ke=!S,qe;t[137]===ie?qe=t[138]:(qe=()=>ie(`commit`),t[137]=ie,t[138]=qe);let Je;t[139]===Symbol.for(`react.memo_cache_sentinel`)?(Je=(0,J.jsx)(so,{}),t[139]=Je):Je=t[139];let Ye;t[140]!==Ke||t[141]!==qe?(Ye=(0,J.jsxs)(ws,{type:`button`,size:`xs`,variant:`outline`,disabled:Ke,onClick:qe,children:[Je,`View diff`]}),t[140]=Ke,t[141]=qe,t[142]=Ye):Ye=t[142];let Xe;t[143]===Le?Xe=t[144]:(Xe=(0,J.jsx)(Zfe,{...Le}),t[143]=Le,t[144]=Xe);let Ze;t[145]!==Ye||t[146]!==Xe?(Ze=(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 font-sans`,children:[Ye,Xe]}),t[145]=Ye,t[146]=Xe,t[147]=Ze):Ze=t[147];let Qe;t[148]!==te||t[149]!==v||t[150]!==C||t[151]!==c.author||t[152]!==c.fullHash||t[153]!==x||t[154]!==_?(Qe=c.author||_||c.fullHash?(0,J.jsxs)(`div`,{className:`flex max-w-full flex-wrap items-center gap-x-2 gap-y-1 text-muted-foreground`,children:[c.author?(0,J.jsx)(`span`,{children:c.author}):null,c.author&&_?(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}):null,_?(0,J.jsx)(tn,{title:v,side:`top`,children:(0,J.jsx)(`span`,{children:_})}):null,(c.author||_)&&c.fullHash?(0,J.jsx)(`span`,{"aria-hidden":!0,children:`·`}):null,c.fullHash?(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:[(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:x}),(0,J.jsx)(tn,{title:C?`Copied`:`Copy full commit hash`,side:`top`,children:(0,J.jsx)(`button`,{type:`button`,"aria-label":`Copy full commit hash`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),te()},children:C?(0,J.jsx)(Za,{className:`size-3.5 text-emerald-500`}):(0,J.jsx)(no,{className:`size-3.5`})})})]}):null]}):null,t[148]=te,t[149]=v,t[150]=C,t[151]=c.author,t[152]=c.fullHash,t[153]=x,t[154]=_,t[155]=Qe):Qe=t[155];let $e=g||`No commit message`,et;t[156]!==re||t[157]!==w||t[158]!==g?(et=g?(0,J.jsx)(tn,{title:w?`Copied`:`Copy commit message`,side:`top`,children:(0,J.jsx)(`button`,{type:`button`,"aria-label":`Copy commit message`,className:`ml-1 inline-flex size-4 items-center justify-center rounded-sm align-middle text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:e=>{e.preventDefault(),e.stopPropagation(),re()},children:w?(0,J.jsx)(Za,{className:`size-3.5 text-emerald-500`}):(0,J.jsx)(no,{className:`size-3.5`})})}):null,t[156]=re,t[157]=w,t[158]=g,t[159]=et):et=t[159];let tt;t[160]!==$e||t[161]!==et?(tt=(0,J.jsxs)(`div`,{className:`max-w-full break-words whitespace-normal text-foreground`,children:[$e,et]}),t[160]=$e,t[161]=et,t[162]=tt):tt=t[162];let nt=y===1?``:`s`,rt;t[163]!==y||t[164]!==nt?(rt=(0,J.jsxs)(`span`,{className:`text-emerald-500`,children:[`+`,y,` addition`,nt]}),t[163]=y,t[164]=nt,t[165]=rt):rt=t[165];let it=b===1?``:`s`,at;t[166]!==b||t[167]!==it?(at=(0,J.jsxs)(`span`,{className:`text-red-400`,children:[`-`,b,` deletion`,it]}),t[166]=b,t[167]=it,t[168]=at):at=t[168];let ot;t[169]!==rt||t[170]!==at?(ot=(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[rt,at]}),t[169]=rt,t[170]=at,t[171]=ot):ot=t[171];let st;t[172]!==S||t[173]!==r||t[174]!==s||t[175]!==c.fullHash||t[176]!==c.parents||t[177]!==x||t[178]!==g||t[179]!==n?(st=c.fullHash?(0,J.jsx)(npe,{viewerContextId:n,cwd:r,commit:c.fullHash,shortHash:x,previousShortHash:c.parents[0]?.slice(0,7)||``,subject:g,disabled:!S,onOpenCommitDiff:s}):null,t[172]=S,t[173]=r,t[174]=s,t[175]=c.fullHash,t[176]=c.parents,t[177]=x,t[178]=g,t[179]=n,t[180]=st):st=t[180];let ct;t[181]!==Ge||t[182]!==Ze||t[183]!==Qe||t[184]!==tt||t[185]!==ot||t[186]!==st?(ct=(0,J.jsxs)(`div`,{className:`grid content-start gap-1.5 pt-1 font-mono text-xs leading-4`,style:Ge,children:[Ze,Qe,tt,ot,st]}),t[181]=Ge,t[182]=Ze,t[183]=Qe,t[184]=tt,t[185]=ot,t[186]=st,t[187]=ct):ct=t[187];let lt;t[188]!==We||t[189]!==ct?(lt=(0,J.jsx)(`div`,{ref:m,className:`h-full overflow-y-auto pr-2 pb-2`,onScroll:We,children:ct}),t[188]=We,t[189]=ct,t[190]=lt):lt=t[190];let ut=k?`opacity-100`:`opacity-0`,dt;t[191]===ut?dt=t[192]:(dt=G(`pointer-events-none absolute inset-x-0 top-0 h-1 bg-gradient-to-b from-black/10 to-transparent transition-opacity duration-150`,ut),t[191]=ut,t[192]=dt);let ft;t[193]===dt?ft=t[194]:(ft=(0,J.jsx)(`div`,{className:dt}),t[193]=dt,t[194]=ft);let pt=A?`opacity-100`:`opacity-0`,mt;t[195]===pt?mt=t[196]:(mt=G(`pointer-events-none absolute inset-x-0 bottom-0 h-1 bg-gradient-to-t from-black/10 to-transparent transition-opacity duration-150`,pt),t[195]=pt,t[196]=mt);let ht;t[197]===mt?ht=t[198]:(ht=(0,J.jsx)(`div`,{className:mt}),t[197]=mt,t[198]=ht);let gt;t[199]!==lt||t[200]!==ft||t[201]!==ht?(gt=(0,J.jsxs)(Uy,{className:`relative h-[200px] border-b border-border/70 bg-muted/50 p-0`,children:[lt,ft,ht]}),t[199]=lt,t[200]=ft,t[201]=ht,t[202]=gt):gt=t[202];let _t=T!==null,vt;t[203]===d?vt=t[204]:(vt=e=>{e||d({type:`set-form-dialog`,formDialog:null})},t[203]=d,t[204]=vt);let yt=T?.title||`Commit action`,bt;t[205]===yt?bt=t[206]:(bt=(0,J.jsx)(rp,{children:yt}),t[205]=yt,t[206]=bt);let xt=T?.description,St;t[207]===xt?St=t[208]:(St=(0,J.jsx)(ip,{children:xt}),t[207]=xt,t[208]=St);let Ct;t[209]!==bt||t[210]!==St?(Ct=(0,J.jsxs)(tp,{children:[bt,St]}),t[209]=bt,t[210]=St,t[211]=Ct):Ct=t[211];let wt;t[212]!==d||t[213]!==T?(wt=T?.kind===`squash`?(0,J.jsx)(ap,{value:T.value,rows:4,onChange:e=>{d({type:`set-form-dialog-value`,value:e.target.value})}}):(0,J.jsx)(Ps,{value:T?.value||``,onChange:e=>{d({type:`set-form-dialog-value`,value:e.target.value})}}),t[212]=d,t[213]=T,t[214]=wt):wt=t[214];let Tt;t[215]===d?Tt=t[216]:(Tt=(0,J.jsx)(ws,{type:`button`,variant:`outline`,onClick:()=>{d({type:`set-form-dialog`,formDialog:null})},children:`Cancel`}),t[215]=d,t[216]=Tt);let Et;t[217]===T?.value?Et=t[218]:(Et=T?.value.trim(),t[217]=T?.value,t[218]=Et);let Dt=!Et,Ot=T?.kind===`branch`?`Create branch`:T?.kind===`tag`?`Create tag`:`Squash`,kt;t[219]!==Dt||t[220]!==Ot?(kt=(0,J.jsx)(ws,{type:`submit`,disabled:Dt,children:Ot}),t[219]=Dt,t[220]=Ot,t[221]=kt):kt=t[221];let At;t[222]!==Tt||t[223]!==kt?(At=(0,J.jsxs)(np,{children:[Tt,kt]}),t[222]=Tt,t[223]=kt,t[224]=At):At=t[224];let jt;t[225]!==ue||t[226]!==Ct||t[227]!==wt||t[228]!==At?(jt=(0,J.jsx)(ep,{className:`sm:max-w-md`,children:(0,J.jsxs)(`form`,{className:`grid gap-4`,onSubmit:ue,children:[Ct,wt,At]})}),t[225]=ue,t[226]=Ct,t[227]=wt,t[228]=At,t[229]=jt):jt=t[229];let Mt;t[230]!==_t||t[231]!==vt||t[232]!==jt?(Mt=(0,J.jsx)(Zf,{open:_t,focusPromptOnClose:!1,onOpenChange:vt,children:jt}),t[230]=_t,t[231]=vt,t[232]=jt,t[233]=Mt):Mt=t[233];let Nt=E!==null,Pt;t[234]===d?Pt=t[235]:(Pt=e=>{e||d({type:`set-confirm-dialog`,confirmDialog:null})},t[234]=d,t[235]=Pt);let Ft;t[236]===Symbol.for(`react.memo_cache_sentinel`)?(Ft=(0,J.jsx)(Mfe,{children:(0,J.jsx)(br,{})}),t[236]=Ft):Ft=t[236];let It=E?.title||`Run commit action?`,Lt;t[237]===It?Lt=t[238]:(Lt=(0,J.jsx)(Nfe,{children:It}),t[237]=It,t[238]=Lt);let Rt=E?.description,zt;t[239]===Rt?zt=t[240]:(zt=(0,J.jsx)(Pfe,{children:Rt}),t[239]=Rt,t[240]=zt);let Bt;t[241]!==Lt||t[242]!==zt?(Bt=(0,J.jsxs)(Afe,{children:[Ft,Lt,zt]}),t[241]=Lt,t[242]=zt,t[243]=Bt):Bt=t[243];let Vt;t[244]===Symbol.for(`react.memo_cache_sentinel`)?(Vt=(0,J.jsx)(Ife,{children:`Cancel`}),t[244]=Vt):Vt=t[244];let Ht=E?.destructive?`destructive`:`default`,Ut=E?.confirmLabel||`Continue`,Wt;t[245]!==ce||t[246]!==Ht||t[247]!==Ut?(Wt=(0,J.jsxs)(jfe,{children:[Vt,(0,J.jsx)(Ffe,{variant:Ht,onClick:ce,children:Ut})]}),t[245]=ce,t[246]=Ht,t[247]=Ut,t[248]=Wt):Wt=t[248];let Gt;t[249]!==Bt||t[250]!==Wt?(Gt=(0,J.jsxs)(kfe,{children:[Bt,Wt]}),t[249]=Bt,t[250]=Wt,t[251]=Gt):Gt=t[251];let Kt;t[252]!==Gt||t[253]!==Nt||t[254]!==Pt?(Kt=(0,J.jsx)(Efe,{open:Nt,onOpenChange:Pt,children:Gt}),t[252]=Gt,t[253]=Nt,t[254]=Pt,t[255]=Kt):Kt=t[255];let qt;return t[256]!==Kt||t[257]!==Ue||t[258]!==gt||t[259]!==Mt||t[260]!==o?(qt=(0,J.jsxs)(Vy,{value:o,className:`border-0`,children:[Ue,gt,Mt,Kt]}),t[256]=Kt,t[257]=Ue,t[258]=gt,t[259]=Mt,t[260]=o,t[261]=qt):qt=t[261],qt}function ape(e){Tn.error(Pg(e,`Failed to open remote commit`))}function ope(e){window.open(e.remoteUrl,`_blank`,`noopener,noreferrer`)}function spe(e){Tn.error(Pg(e,`Failed to create branch`))}function cpe(e,t){Tn.error(Pg(e,`Failed to ${t.label}`))}function lpe(e){let t=(0,Y.c)(29),{viewerContextId:n,cwd:r,lines:i,unpushedCommitHashes:a,onOpenCommitDiff:o}=e,{maxLaneCount:s,rows:c}=S7(i),l=Math.max(24,s*v7+4),u=c.map(upe),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=[],t[0]=d):d=t[0];let[f,p]=q.useState(d),m=f.filter(e=>u.includes(e)),h=w7(c,m),g;t[1]!==i||t[2]!==a||t[3]!==m?(g=(0,J.jsx)(Xfe,{lines:i,openCommitValues:m,unpushedCommitHashes:a}),t[1]=i,t[2]=a,t[3]=m,t[4]=g):g=t[4];let _;t[5]===p?_=t[6]:(_=e=>{p(e.slice(-1))},t[5]=p,t[6]=_);let v;if(t[7]!==r||t[8]!==l||t[9]!==i||t[10]!==o||t[11]!==h||t[12]!==u||t[13]!==n){let e;t[15]!==r||t[16]!==l||t[17]!==o||t[18]!==h||t[19]!==u||t[20]!==n?(e=(e,t)=>(0,J.jsx)(`div`,{className:`min-w-0`,style:{minHeight:h[t]??_7},children:(0,J.jsx)(rpe,{viewerContextId:n,cwd:r,graphWidth:l,line:e,value:u[t]??`${t}`,onOpenCommitDiff:o})},u[t]??e),t[15]=r,t[16]=l,t[17]=o,t[18]=h,t[19]=u,t[20]=n,t[21]=e):e=t[21],v=i.map(e),t[7]=r,t[8]=l,t[9]=i,t[10]=o,t[11]=h,t[12]=u,t[13]=n,t[14]=v}else v=t[14];let y;t[22]!==_||t[23]!==v||t[24]!==m?(y=(0,J.jsx)(By,{multiple:!0,value:m,onValueChange:_,className:`grid min-w-0 gap-0`,children:v}),t[22]=_,t[23]=v,t[24]=m,t[25]=y):y=t[25];let b;return t[26]!==g||t[27]!==y?(b=(0,J.jsxs)(`div`,{className:`relative min-w-0`,children:[g,y]}),t[26]=g,t[27]=y,t[28]=b):b=t[28],b}function upe(e,t){return C7(e,t)}function dpe(e){let t=(0,Y.c)(11),{onRestoreEmbedded:n}=e,[r,i]=q.useState(!1),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>i(!1),t[0]=a):a=t[0];let o=a,s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>i(e),t[1]=s):s=t[1];let c;t[2]===n?c=t[3]:(c=()=>{o(),n()},t[2]=n,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(vo,{className:`size-4`}),t[4]=l):l=t[4];let u;t[5]===c?u=t[6]:(u=(0,J.jsx)(fr,{render:(0,J.jsx)(ws,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0`,"aria-label":`Restore history accordion`,onPointerDown:o,onClick:c,children:l})}),t[5]=c,t[6]=u);let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(gt,{children:`Restore history accordion`}),t[7]=d):d=t[7];let f;return t[8]!==u||t[9]!==r?(f=(0,J.jsxs)(Xt,{open:r,onOpenChange:s,children:[u,d]}),t[8]=u,t[9]=r,t[10]=f):f=t[10],f}function D7(e){let t=(0,Y.c)(55),{viewerContextId:n,cwd:r,active:i,onOpenCommitDiff:a,onRestoreEmbedded:o,embedded:s,flush:c}=e,l=s===void 0?!1:s,u=c===void 0?!1:c,d=Ng(r),[f,p]=q.useState(50),m=q.useRef(null),h;t[0]===p?h=t[1]:(h=()=>{p(50)},t[0]=p,t[1]=h),q.useEffect(h,[d]);let g=Gh.gitCommits(n,d),_=Rg({viewerContextId:n,cwd:d,scope:`commits`,commitsLimit:f}),v=!!(i&&n&&d),y;t[2]===g?y=t[3]:(y=(e,t)=>{let n=t?.queryKey;return Array.isArray(n)&&n.length>=g.length&&g.every((e,t)=>n[t]===e)?e:void 0},t[2]=g,t[3]=y);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=[`data`,`isFetching`,`isPending`,`error`],t[4]=b):b=t[4];let x;t[5]!==_||t[6]!==v||t[7]!==y?(x={..._,enabled:v,placeholderData:y,notifyOnChangeProps:b},t[5]=_,t[6]=v,t[7]=y,t[8]=x):x=t[8];let S=Zr(x),C=S.data,w=C?.commits,T=!!C?.commitsHasMore,E;t[9]===w?E=t[10]:(E=Array.isArray(w)?pre(w):``,t[9]=w,t[10]=E);let D=E,O;t[11]===C?.unpushedCommitHashes?O=t[12]:(O=C?.unpushedCommitHashes??[],t[11]=C?.unpushedCommitHashes,t[12]=O);let k;t[13]===O?k=t[14]:(k=new Set(O),t[13]=O,t[14]=k);let A=k,j;t[15]!==i||t[16]!==T||t[17]!==S.isFetching||t[18]!==p?(j=()=>{let e=m.current;if(!e||!i||!T||S.isFetching||typeof IntersectionObserver>`u`)return;let t=!1,n=new IntersectionObserver(e=>{let[n]=e;!n?.isIntersecting||t||(t=!0,p(fpe))},{rootMargin:`320px 0px`});return n.observe(e),()=>n.disconnect()},t[15]=i,t[16]=T,t[17]=S.isFetching,t[18]=p,t[19]=j):j=t[19];let M;t[20]!==i||t[21]!==T||t[22]!==S.isFetching||t[23]!==d?(M=[i,T,S.isFetching,d],t[20]=i,t[21]=T,t[22]=S.isFetching,t[23]=d,t[24]=M):M=t[24],q.useEffect(j,M);let N;t[25]!==w||t[26]!==T||t[27]!==S.error||t[28]!==S.isFetching||t[29]!==S.isPending||t[30]!==d||t[31]!==a||t[32]!==A||t[33]!==n?(N=d?n?S.isPending&&w===void 0||S.isFetching&&w===null?(0,J.jsxs)(W5,{className:`px-3 py-2.5`,children:[(0,J.jsx)(Rn,{}),` Loading commits…`]}):S.error?(0,J.jsx)(W5,{tone:`destructive`,className:`px-3 py-2.5`,children:Pg(S.error,`Failed to load commits`)}):w===null?(0,J.jsx)(W5,{className:`px-3 py-2.5`,children:`No git repository detected.`}):Array.isArray(w)&&w.length>0?(0,J.jsxs)(`div`,{className:`grid min-w-0 gap-0`,children:[(0,J.jsx)(lpe,{viewerContextId:n,cwd:d,lines:w,unpushedCommitHashes:A,onOpenCommitDiff:a}),T?(0,J.jsx)(`div`,{ref:m,className:`flex min-h-8 items-center`,children:S.isFetching?(0,J.jsxs)(`div`,{role:`status`,"aria-label":`Loading more commits`,className:`inline-flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(Rn,{className:`size-3`}),`Loading more commits…`]}):null}):null]}):(0,J.jsx)(W5,{className:`px-3 py-2.5`,children:`No commits on this branch yet.`}):(0,J.jsx)(W5,{className:`px-3 py-2.5`,children:`Waiting for viewer context…`}):(0,J.jsx)(W5,{className:`px-3 py-2.5`,children:`No directory selected.`}),t[25]=w,t[26]=T,t[27]=S.error,t[28]=S.isFetching,t[29]=S.isPending,t[30]=d,t[31]=a,t[32]=A,t[33]=n,t[34]=N):N=t[34];let P=N;if(l){let e;return t[35]===P?e=t[36]:(e=(0,J.jsx)(`div`,{className:`grid min-w-0 gap-2 overflow-x-hidden`,children:P}),t[35]=P,t[36]=e),e}if(u){let e;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`div`,{className:`text-xs font-bold tracking-[0.04em] text-muted-foreground uppercase`,children:`History`}),t[37]=e):e=t[37];let n;t[38]===D?n=t[39]:(n=D?(0,J.jsx)(`div`,{className:`min-w-0 truncate text-xs text-muted-foreground/80`,children:D}):null,t[38]=D,t[39]=n);let r;t[40]===n?r=t[41]:(r=(0,J.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[e,n]}),t[40]=n,t[41]=r);let i;t[42]===o?i=t[43]:(i=o?(0,J.jsx)(dpe,{onRestoreEmbedded:o}):null,t[42]=o,t[43]=i);let a;t[44]!==r||t[45]!==i?(a=(0,J.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-3 border-b border-border/70 bg-background px-3 py-1.5`,children:[r,i]}),t[44]=r,t[45]=i,t[46]=a):a=t[46];let s;t[47]===P?s=t[48]:(s=(0,J.jsx)(`div`,{className:`grid min-h-0 min-w-0 flex-1 gap-2 overflow-x-hidden overflow-y-auto`,children:P}),t[47]=P,t[48]=s);let c;return t[49]!==a||t[50]!==s?(c=(0,J.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[a,s]}),t[49]=a,t[50]=s,t[51]=c):c=t[51],c}let F;return t[52]!==P||t[53]!==D?(F=(0,J.jsx)(Rfe,{title:`Commits`,meta:D,className:`overflow-x-hidden`,bodyClassName:`min-w-0 overflow-x-hidden p-0`,children:P}),t[52]=P,t[53]=D,t[54]=F):F=t[54],F}function fpe(e){return e+50}function ppe(e){let t=(0,Y.c)(2),{status:n}=e,r;if(t[0]!==n){let[e,i]=Ug(n);r=(0,J.jsx)(`span`,{className:`inline-flex w-[2ch] shrink-0 items-center whitespace-pre text-muted-foreground/70`,children:[[`index`,e],[`worktree`,i]].map(e=>{let[t,r]=e,i=ore({character:r,column:t,status:n}),a=(0,J.jsx)(`span`,{"aria-label":i||void 0,className:G(`w-[1ch] text-center whitespace-pre`,i&&`cursor-help`,Gg(Wg(t,r))),children:r},t);return i?(0,J.jsx)(tn,{title:i,side:`top`,children:a},t):a})}),t[0]=n,t[1]=r}else r=t[1];return r}function mpe(e){let t=(0,Y.c)(8),{file:n}=e;if(!sre(n)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`span`,{className:`min-w-0`}),t[0]=e):e=t[0],e}let r=Kg(n.linesAdded),i=Kg(n.linesDeleted),a;t[1]===r?a=t[2]:(a=r>0?(0,J.jsxs)(`span`,{className:`text-emerald-500`,children:[`+`,r]}):null,t[1]=r,t[2]=a);let o;t[3]===i?o=t[4]:(o=i>0?(0,J.jsxs)(`span`,{className:`text-red-500`,children:[`-`,i]}):null,t[3]=i,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 gap-2 justify-self-end whitespace-nowrap tabular-nums`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function hpe(e){return e===`deletions`?`old`:`new`}function gpe(e){return Math.min(e.start,e.end)}function _pe(e){return e.side||e.endSide||`additions`}function vpe(e,t){return t===`deletions`&&e.previousPath||e.path}function ype(e){return`changes:${N7(e)}`}function bpe({comments:e,pendingComment:t}){let n=e.map(e=>({lineNumber:e.lineNumber,metadata:e,side:e.side}));return t&&n.push({lineNumber:t.lineNumber,metadata:t,side:t.side}),n}function xpe(e){let t=(0,Y.c)(39),{comment:n}=e,[r,i]=q.useState(``),a=q.useRef(null),o,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{a.current?.focus()},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),q.useEffect(o,s);let c;t[2]!==n||t[3]!==r?(c=()=>{let e=r.trim();e&&n.onSubmit(e)},t[2]=n,t[3]=r,t[4]=c):c=t[4];let l=c,u;t[5]===l?u=t[6]:(u=e=>{e.preventDefault(),l()},t[5]=l,t[6]=u);let d=n.path,f=n.lineNumber,p;t[7]===n.side?p=t[8]:(p=hpe(n.side),t[7]=n.side,t[8]=p);let m;t[9]!==n.lineNumber||t[10]!==n.path||t[11]!==p?(m=(0,J.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Comment on `,d,`:L`,f,` (`,p,`)`]}),t[9]=n.lineNumber,t[10]=n.path,t[11]=p,t[12]=m):m=t[12];let h;t[13]===n.onCancel?h=t[14]:(h=(0,J.jsx)(ws,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel line comment`,onClick:n.onCancel,children:`×`}),t[13]=n.onCancel,t[14]=h);let g;t[15]!==m||t[16]!==h?(g=(0,J.jsxs)(`div`,{className:`mb-2 flex min-w-0 items-center justify-between gap-2 text-xs text-muted-foreground`,children:[m,h]}),t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>i(e.target.value),t[18]=_):_=t[18];let v;t[19]!==n||t[20]!==l?(v=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),l()),e.key===`Escape`&&(e.preventDefault(),n.onCancel())},t[19]=n,t[20]=l,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==r?(y=(0,J.jsx)(ap,{ref:a,value:r,rows:2,placeholder:`Add a note for the prompt…`,className:`min-h-16 resize-none text-sm`,onChange:_,onKeyDown:v}),t[22]=v,t[23]=r,t[24]=y):y=t[24];let b;t[25]===n.onCancel?b=t[26]:(b=(0,J.jsx)(ws,{type:`button`,variant:`ghost`,onClick:n.onCancel,children:`Cancel`}),t[25]=n.onCancel,t[26]=b);let x;t[27]===r?x=t[28]:(x=r.trim(),t[27]=r,t[28]=x);let S=!x,C;t[29]===S?C=t[30]:(C=(0,J.jsx)(ws,{type:`submit`,disabled:S,children:`Add to prompt`}),t[29]=S,t[30]=C);let w;t[31]!==b||t[32]!==C?(w=(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:[b,C]}),t[31]=b,t[32]=C,t[33]=w):w=t[33];let T;return t[34]!==g||t[35]!==y||t[36]!==w||t[37]!==u?(T=(0,J.jsxs)(`form`,{className:`m-2 w-[min(38rem,calc(100vw_-_5rem))] max-w-[calc(100%_-_1rem)] rounded-lg border border-border/70 bg-background p-2 shadow-sm`,onPointerDown:Spe,onSubmit:u,children:[g,y,w]}),t[34]=g,t[35]=y,t[36]=w,t[37]=u,t[38]=T):T=t[38],T}function Spe(e){return e.stopPropagation()}function O7(e){let t=(0,Y.c)(5),{annotation:n}=e,r=n.metadata;if(!r)return null;if(r.kind===`pending`){let e=r,n;return t[0]===e?n=t[1]:(n=(0,J.jsx)(xpe,{comment:e}),t[0]=e,t[1]=n),n}let i=r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(`span`,{className:`shrink-0`,children:`💬`}),t[2]=a):a=t[2];let o;return t[3]===i.text?o=t[4]:(o=(0,J.jsxs)(`div`,{className:`my-1 ml-2 inline-flex max-w-[min(32rem,calc(100vw_-_5rem),90%)] items-center gap-1 rounded-full border border-amber-500/20 bg-amber-500/10 px-2 py-1 text-[11px] text-amber-800 dark:text-amber-200`,children:[a,(0,J.jsx)(`span`,{className:`truncate`,children:i.text})]}),t[3]=i.text,t[4]=o),o}var k7=160,Cpe=1600;function A7(e){if(Number.isFinite(e))return Math.round(Math.min(Cpe,Math.max(k7,e)))}function j7(){let e=ct(gr);if(e!=null)return A7(Number(e))}function wpe(e){let t=A7(e);typeof t==`number`&&Te(gr,String(t))}var Tpe={diffStyle:`unified`,historyOpen:!0,historyPanelHeight:void 0,defaultHistoryPanelHeight:void 0,openFiles:[],stickyReviewFileValue:``,historyHeaderShadowed:!1};function M7(e,t){return typeof t==`function`?t(e):t}function Epe(e,t){switch(t.type){case`diffStyleChanged`:return e.diffStyle===t.diffStyle?e:{...e,diffStyle:t.diffStyle};case`historyOpenToggled`:return{...e,historyOpen:!e.historyOpen};case`historyPanelHeightChanged`:return Object.is(e.historyPanelHeight,t.height)?e:{...e,historyPanelHeight:t.height};case`historyPanelLayoutChanged`:{let n=typeof e.historyPanelHeight==`number`?Math.min(t.maxHeight,Math.max(t.minHeight,e.historyPanelHeight)):e.historyPanelHeight;return Object.is(e.defaultHistoryPanelHeight,t.defaultHeight)&&Object.is(e.historyPanelHeight,n)?e:{...e,defaultHistoryPanelHeight:t.defaultHeight,historyPanelHeight:n}}case`openFilesChanged`:return e.openFiles===t.openFiles?e:{...e,openFiles:t.openFiles};case`cwdChanged`:return{...e,historyOpen:!0,historyPanelHeight:t.historyPanelHeight,defaultHistoryPanelHeight:void 0,openFiles:[],stickyReviewFileValue:``,historyHeaderShadowed:!1};case`stickyReviewFileValueChanged`:{let n=M7(e.stickyReviewFileValue,t.value);return Object.is(e.stickyReviewFileValue,n)?e:{...e,stickyReviewFileValue:n}}case`historyHeaderShadowedChanged`:{let n=M7(e.historyHeaderShadowed,t.value);return Object.is(e.historyHeaderShadowed,n)?e:{...e,historyHeaderShadowed:n}}default:return e}}function Dpe(){return()=>{}}function Ope(){return`row-resize`}function N7(e){return`${e.status}:${e.previousPath||``}:${e.path}`}function kpe(e){return Kg(e.linesAdded)+Kg(e.linesDeleted)}function Ape(e){return typeof e.sizeBytes==`number`&&e.sizeBytes>1e4||kpe(e)>100}function jpe(e){return Mpe(e)}function Mpe(e){let t=(0,Y.c)(119),{viewerContextId:n,cwd:r,active:i,diffLineComments:a,onAddDiffLineComment:o,onMaximizeHistory:s,onOpenCommitDiff:c,onOpenFile:l,showEmbeddedHistory:u}=e,d;t[0]===a?d=t[1]:(d=a===void 0?[]:a,t[0]=a,t[1]=d);let f=d,p=u===void 0?!0:u,m=Ng(r),h=qo(),[g,_]=q.useReducer(Epe,Tpe,Fpe),{diffStyle:v,historyOpen:y,historyPanelHeight:b,defaultHistoryPanelHeight:x,openFiles:S,stickyReviewFileValue:C,historyHeaderShadowed:w}=g,T=q.useSyncExternalStore(Dpe,rs,Ope),E;t[2]===_?E=t[3]:(E=e=>{_({type:`stickyReviewFileValueChanged`,value:e})},t[2]=_,t[3]=E);let D=E,O;t[4]===_?O=t[5]:(O=e=>{_({type:`historyHeaderShadowedChanged`,value:e})},t[4]=_,t[5]=O);let k=O,A=q.useRef(null),j=q.useRef(null),M=q.useRef(null),N=q.useRef(null),P=q.useRef(m),F=Rg({viewerContextId:n,cwd:m,scope:`files`}),I=!!(i&&n&&m),L;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(L=[`data`,`isPending`,`error`],t[6]=L):L=t[6];let R;t[7]!==F||t[8]!==I?(R={...F,enabled:I,select:Bg,notifyOnChangeProps:L},t[7]=F,t[8]=I,t[9]=R):R=t[9];let z=Zr(R),B=z.data,V;t[10]===B?V=t[11]:(V=Array.isArray(B)?B:[],t[10]=B,t[11]=V);let H=V,U;t[12]!==_||t[13]!==m||t[14]!==P?(U=()=>{P.current!==m&&(P.current=m,_({type:`cwdChanged`,historyPanelHeight:j7()}))},t[12]=_,t[13]=m,t[14]=P,t[15]=U):U=t[15];let ee;t[16]===m?ee=t[17]:(ee=[m],t[16]=m,t[17]=ee),q.useEffect(U,ee);let te;t[18]===D?te=t[19]:(te=e=>{f7(D,m7({getValue:Ppe,scrollElement:e,selector:`[data-review-file-trigger]`}))},t[18]=D,t[19]=te);let ne=te,re;t[20]===k?re=t[21]:(re=e=>{f7(k,p7(e))},t[20]=k,t[21]=re);let W=re,ie;t[22]===ne?ie=t[23]:(ie=()=>{ne(A.current)},t[22]=ne,t[23]=ie);let ae;t[24]===S?ae=t[25]:(ae=[S],t[24]=S,t[25]=ae),q.useEffect(ie,ae);let oe;t[26]!==y||t[27]!==k||t[28]!==W?(oe=()=>{if(!y){f7(k,!1);return}W(N.current)},t[26]=y,t[27]=k,t[28]=W,t[29]=oe):oe=t[29];let se;t[30]===y?se=t[31]:(se=[y],t[30]=y,t[31]=se),q.useEffect(oe,se);let ce;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ce=()=>{let e=j.current?.getBoundingClientRect().height||0;if(e<=0)return{minHeight:k7,maxHeight:1/0};let t=Math.min(k7,e/2);return{minHeight:t,maxHeight:Math.max(t,e-t)}},t[32]=ce):ce=t[32];let le=ce,ue;t[33]!==_||t[34]!==h?(ue=e=>{if(h||e.button!==0)return;e.preventDefault();let{maxHeight:t,minHeight:n}=le(),r=M.current?.getBoundingClientRect().height||n,i=e.clientY,a=document.body.style.cursor,o=document.body.style.userSelect,s=rs(),c=as(s),l=Math.min(t,Math.max(n,r));Object.assign(document.body.style,{cursor:s,userSelect:`none`});let u=e=>{let a=r-(e.clientY-i);l=Math.min(t,Math.max(n,a)),_({type:`historyPanelHeightChanged`,height:l})},d=()=>{wpe(l),c(),Object.assign(document.body.style,{cursor:a,userSelect:o}),document.removeEventListener(`pointermove`,u),document.removeEventListener(`pointerup`,d),document.removeEventListener(`pointercancel`,d)};document.addEventListener(`pointermove`,u),document.addEventListener(`pointerup`,d),document.addEventListener(`pointercancel`,d)},t[33]=_,t[34]=h,t[35]=ue):ue=t[35];let de=ue,fe;t[36]!==_||t[37]!==y||t[38]!==h?(fe=()=>{if(h||!y)return;let e=()=>{let e=j.current?.getBoundingClientRect().height||0,{maxHeight:t,minHeight:n}=le(),r=e>0?e*.5:0;_({type:`historyPanelLayoutChanged`,defaultHeight:r>0?Math.min(t,Math.max(n,r)):void 0,maxHeight:t,minHeight:n})};return e(),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},t[36]=_,t[37]=y,t[38]=h,t[39]=fe):fe=t[39];let pe;t[40]!==y||t[41]!==h||t[42]!==m?(pe=[y,h,m],t[40]=y,t[41]=h,t[42]=m,t[43]=pe):pe=t[43],q.useEffect(fe,pe);let me=S.length>0,he;t[44]!==H||t[45]!==_||t[46]!==me?(he=()=>{_({type:`openFilesChanged`,openFiles:me?[]:H.map(N7)})},t[44]=H,t[45]=_,t[46]=me,t[47]=he):he=t[47];let ge=he,_e;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,J.jsx)(H5,{}),t[48]=_e):_e=t[48];let ve;t[49]!==i||t[50]!==m||t[51]!==n?(ve=(0,J.jsx)(`div`,{className:`flex min-h-12 shrink-0 flex-col justify-center gap-2 border-b border-border/70 bg-background p-2`,children:(0,J.jsx)(Cfe,{viewerContextId:n,cwd:m,active:i})}),t[49]=i,t[50]=m,t[51]=n,t[52]=ve):ve=t[52];let ye;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,J.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,J.jsx)(`span`,{className:`text-xs font-bold tracking-[0.04em] text-muted-foreground uppercase`,children:`Diffs`})}),t[53]=ye):ye=t[53];let be=me?`Collapse all`:`Expand all`,xe=me?`Collapse all`:`Expand all`,Se=H.length===0,Ce;t[54]===me?Ce=t[55]:(Ce=me?(0,J.jsx)(eo,{className:`size-4`}):(0,J.jsx)(to,{className:`size-4`}),t[54]=me,t[55]=Ce);let we;t[56]!==xe||t[57]!==Se||t[58]!==Ce||t[59]!==ge?(we=(0,J.jsx)(ws,{variant:`outline`,size:`icon`,"aria-label":xe,disabled:Se,onClick:ge,children:Ce}),t[56]=xe,t[57]=Se,t[58]=Ce,t[59]=ge,t[60]=we):we=t[60];let Te;t[61]!==be||t[62]!==we?(Te=(0,J.jsx)(tn,{title:be,children:we}),t[61]=be,t[62]=we,t[63]=Te):Te=t[63];let Ee;t[64]===v?Ee=t[65]:(Ee=[v],t[64]=v,t[65]=Ee);let De;t[66]===_?De=t[67]:(De=e=>{let t=e[0];(t===`unified`||t===`split`)&&_({type:`diffStyleChanged`,diffStyle:t})},t[66]=_,t[67]=De);let Oe;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=[`unified`,`split`],t[68]=Oe):Oe=t[68];let ke;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(ke=Oe.map(Npe),t[69]=ke):ke=t[69];let Ae;t[70]!==Ee||t[71]!==De?(Ae=(0,J.jsx)(B5,{variant:`outline`,value:Ee,onValueChange:De,children:ke}),t[70]=Ee,t[71]=De,t[72]=Ae):Ae=t[72];let je;t[73]!==Te||t[74]!==Ae?(je=(0,J.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border/70 bg-background p-2`,children:[ye,(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[Te,Ae]})]}),t[73]=Te,t[74]=Ae,t[75]=je):je=t[75];let Me;t[76]===ne?Me=t[77]:(Me=e=>{ne(e.currentTarget)},t[76]=ne,t[77]=Me);let Ne;t[78]!==i||t[79]!==H||t[80]!==f||t[81]!==v||t[82]!==_||t[83]!==B||t[84]!==z.error||t[85]!==z.isPending||t[86]!==m||t[87]!==o||t[88]!==l||t[89]!==S||t[90]!==C||t[91]!==n?(Ne=m?n?z.isPending&&B===void 0?(0,J.jsxs)(W5,{className:`px-3 py-2.5`,children:[(0,J.jsx)(Rn,{}),` Loading changes…`]}):z.error?(0,J.jsx)(W5,{tone:`destructive`,className:`px-3 py-2.5`,children:Pg(z.error,`Failed to load changes`)}):B===null?(0,J.jsx)(W5,{className:`px-3 py-2.5`,children:`No git repository detected.`}):H.length>0?(0,J.jsx)(By,{multiple:!0,value:S,onValueChange:e=>{_({type:`openFilesChanged`,openFiles:e})},className:`border-b border-border/80`,children:H.map(e=>(0,J.jsx)(Ipe,{viewerContextId:n,cwd:m,active:i,diffLineComments:f,diffStyle:v,file:e,open:S.includes(N7(e)),stuck:C===N7(e),onAddDiffLineComment:o,onOpenFile:l},N7(e)))}):(0,J.jsx)(W5,{className:`px-3 py-2.5`,children:`Working tree clean.`}):(0,J.jsx)(W5,{className:`px-3 py-2.5`,children:`Waiting for viewer context…`}):(0,J.jsx)(W5,{className:`px-3 py-2.5`,children:`No directory selected.`}),t[78]=i,t[79]=H,t[80]=f,t[81]=v,t[82]=_,t[83]=B,t[84]=z.error,t[85]=z.isPending,t[86]=m,t[87]=o,t[88]=l,t[89]=S,t[90]=C,t[91]=n,t[92]=Ne):Ne=t[92];let Pe;t[93]!==Me||t[94]!==Ne?(Pe=(0,J.jsx)(`div`,{ref:A,className:`min-h-0 flex-1 overflow-auto`,onScroll:Me,children:Ne}),t[93]=Me,t[94]=Ne,t[95]=Pe):Pe=t[95];let Fe;t[96]!==i||t[97]!==x||t[98]!==_||t[99]!==B||t[100]!==z.error||t[101]!==w||t[102]!==y||t[103]!==b||t[104]!==h||t[105]!==m||t[106]!==s||t[107]!==c||t[108]!==p||t[109]!==de||t[110]!==W||t[111]!==T||t[112]!==n?(Fe=p&&m&&n&&B!==null&&!z.error?(0,J.jsxs)(`div`,{ref:M,className:`relative flex max-h-[50%] min-h-0 shrink-0 flex-col overflow-hidden border-t border-border/70 bg-card/50 md:max-h-none`,style:!h&&y?{height:b??x}:void 0,children:[y?(0,J.jsx)(`div`,{role:`separator`,"aria-label":`Resize history panel`,"aria-orientation":`horizontal`,style:{cursor:T},className:G(`absolute inset-x-0 top-0 z-10 hidden h-2 -translate-y-1/2 touch-none bg-transparent after:absolute after:inset-x-0 after:top-1/2 after:h-px after:bg-transparent md:block`,Fs,T===`ns-resize`?`cursor-ns-resize`:`cursor-row-resize`),onPointerDown:de}):null,(0,J.jsxs)(`div`,{className:G(`flex min-h-10 shrink-0 items-center bg-background transition-shadow`,w&&`shadow-sm`),children:[(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":y,className:`flex min-h-10 min-w-0 flex-1 items-center justify-between gap-3 px-3 py-2 text-left transition-colors hover:bg-muted/60`,onClick:()=>{_({type:`historyOpenToggled`})},children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center`,children:(0,J.jsx)(`span`,{className:`text-xs font-bold tracking-[0.04em] text-muted-foreground uppercase`,children:`History`})}),y?(0,J.jsx)(Qa,{className:`size-4 shrink-0 text-muted-foreground`}):(0,J.jsx)($a,{className:`size-4 shrink-0 text-muted-foreground`})]}),s?(0,J.jsx)(tn,{title:`Open history tab`,children:(0,J.jsx)(ws,{type:`button`,variant:`ghost`,size:`icon`,className:`mr-1 size-8 shrink-0`,"aria-label":`Open history tab`,onClick:s,children:(0,J.jsx)(_o,{className:`size-4`})})}):null]}),y?(0,J.jsx)(`div`,{ref:N,className:`min-h-0 flex-1 touch-pan-y overflow-x-hidden overflow-y-auto overscroll-contain border-t border-border/70`,onScroll:e=>{W(e.currentTarget)},children:(0,J.jsx)(D7,{viewerContextId:n,cwd:m,active:i&&y,embedded:!0,onOpenCommitDiff:c})}):null]}):null,t[96]=i,t[97]=x,t[98]=_,t[99]=B,t[100]=z.error,t[101]=w,t[102]=y,t[103]=b,t[104]=h,t[105]=m,t[106]=s,t[107]=c,t[108]=p,t[109]=de,t[110]=W,t[111]=T,t[112]=n,t[113]=Fe):Fe=t[113];let Ie;return t[114]!==ve||t[115]!==je||t[116]!==Pe||t[117]!==Fe?(Ie=(0,J.jsxs)(`div`,{ref:j,className:`flex h-full min-h-0 flex-col bg-background`,children:[_e,ve,je,Pe,Fe]}),t[114]=ve,t[115]=je,t[116]=Pe,t[117]=Fe,t[118]=Ie):Ie=t[118],Ie}function Npe(e){return(0,J.jsx)(V5,{value:e,children:e===`unified`?`Unified`:`Split`},e)}function Ppe(e){return e.dataset.reviewFileValue||``}function Fpe(e){return{...e,historyPanelHeight:j7()}}function Ipe(e){let t=(0,Y.c)(143),{viewerContextId:n,cwd:r,active:i,diffLineComments:a,diffStyle:o,file:s,open:c,stuck:l,onAddDiffLineComment:u,onOpenFile:d}=e,f=a===void 0?[]:a,p=Ng(r),m=En(),h;t[0]===s?h=t[1]:(h=N7(s),t[0]=s,t[1]=h);let g=h,_;t[2]===s?_=t[3]:(_=ype(s),t[2]=s,t[3]=_);let v=_,[y,b]=q.useState(null),[x,S]=q.useState(!1),C;t[4]!==s||t[5]!==x?(C=Ape(s)&&!x,t[4]=s,t[5]=x,t[6]=C):C=t[6];let w=C,T=Zr({...tre({viewerContextId:n,cwd:p,path:s.path}),enabled:!!(w&&c&&i&&n&&p),notifyOnChangeProps:[`data`,`isPending`,`error`]}),E=nre({viewerContextId:n,cwd:p,path:s.path,previousPath:s.previousPath}),D=!!(!w&&c&&i&&n&&p),O;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=[`data`,`isPending`,`error`],t[7]=O):O=t[7];let k;t[8]!==E||t[9]!==D?(k={...E,enabled:D,notifyOnChangeProps:O},t[8]=E,t[9]=D,t[10]=k):k=t[10];let A=Zr(k),j=A.data?.oldContent??``,M=A.data?.newContent??``,N=T.data?.patch??``,P;t[11]!==v||t[12]!==p?(P=e=>e.cwd===p&&e.tabKey===v,t[11]=v,t[12]=p,t[13]=P):P=t[13];let F=f.filter(P),I;t[14]!==v||t[15]!==s||t[16]!==u||t[17]!==b?(I=e=>{if(!u)return;let t=_pe(e);b({commit:`working-tree`,lineNumber:gpe(e),mode:`head`,path:vpe(s,t),shortHash:`working tree`,side:t,tabKey:v,tabTitle:`Working tree changes`})},t[14]=v,t[15]=s,t[16]=u,t[17]=b,t[18]=I):I=t[18];let L=I,R=bpe({comments:F,pendingComment:y?{...y,kind:`pending`,onCancel:()=>b(null),onSubmit:e=>{u?.({...y,text:e}),b(null)}}:null}),z;t[19]!==u||t[20]!==L?(z=u?{enableGutterUtility:!0,onGutterUtilityClick:L}:{},t[19]=u,t[20]=L,t[21]=z):z=t[21];let B=z,V=uq(),H;t[22]===s.status?H=t[23]:(H=Ug(s.status),t[22]=s.status,t[23]=H);let[U,ee]=H,te=ee!==` `||U===`?`,ne;t[24]!==p||t[25]!==m||t[26]!==n?(ne=async()=>{await Vg({queryClient:m,viewerContextId:n,cwd:p})},t[24]=p,t[25]=m,t[26]=n,t[27]=ne):ne=t[27];let re=ne,W;t[28]!==s.path||t[29]!==s.previousPath||t[30]!==p||t[31]!==n?(W=async()=>await mh(ph(`/api/git-stage`,{contextId:n}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:p,path:s.path,previousPath:s.previousPath})}),t[28]=s.path,t[29]=s.previousPath,t[30]=p,t[31]=n,t[32]=W):W=t[32];let ie;t[33]!==s.path||t[34]!==re||t[35]!==p||t[36]!==m||t[37]!==n?(ie=async()=>{await m.invalidateQueries({queryKey:Gh.gitStatus(n,p),exact:!0,refetchType:`active`}),await re(),Tn.success(`Staged changes`,{description:s.path})},t[33]=s.path,t[34]=re,t[35]=p,t[36]=m,t[37]=n,t[38]=ie):ie=t[38];let ae;t[39]!==W||t[40]!==ie?(ae={mutationFn:W,onSuccess:ie,onError:Bpe},t[39]=W,t[40]=ie,t[41]=ae):ae=t[41];let oe=ni(ae),se;t[42]!==s.path||t[43]!==s.previousPath||t[44]!==s.status||t[45]!==p||t[46]!==n?(se=async()=>await mh(ph(`/api/git-discard`,{contextId:n}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:p,path:s.path,previousPath:s.previousPath,status:s.status})}),t[42]=s.path,t[43]=s.previousPath,t[44]=s.status,t[45]=p,t[46]=n,t[47]=se):se=t[47];let ce;t[48]!==s.path||t[49]!==re||t[50]!==p||t[51]!==m||t[52]!==n?(ce=async()=>{await m.invalidateQueries({queryKey:Gh.gitStatus(n,p),exact:!0,refetchType:`active`}),await re(),Tn.success(`Discarded changes`,{description:s.path})},t[48]=s.path,t[49]=re,t[50]=p,t[51]=m,t[52]=n,t[53]=ce):ce=t[53];let le;t[54]!==se||t[55]!==ce?(le={mutationFn:se,onSuccess:ce,onError:zpe},t[54]=se,t[55]=ce,t[56]=le):le=t[56];let ue=ni(le),de=oe.isPending||ue.isPending,fe;t[57]===b?fe=t[58]:(fe=()=>{b(null)},t[57]=b,t[58]=fe);let pe;t[59]!==M||t[60]!==j||t[61]!==N||t[62]!==w||t[63]!==g?(pe=[g,w,N,j,M],t[59]=M,t[60]=j,t[61]=N,t[62]=w,t[63]=g,t[64]=pe):pe=t[64],q.useEffect(fe,pe);let me;t[65]!==s.path||t[66]!==d?(me=e=>{e?.stopPropagation(),d?.(s.path,{pin:!0})},t[65]=s.path,t[66]=d,t[67]=me):me=t[67];let he=me,ge;t[68]===ue?ge=t[69]:(ge=e=>{e?.stopPropagation(),ue.mutate()},t[68]=ue,t[69]=ge);let _e=ge,ve;t[70]===oe?ve=t[71]:(ve=e=>{e?.stopPropagation(),oe.mutate()},t[70]=oe,t[71]=ve);let ye=ve,be=l&&`shadow-sm`,xe;t[72]===be?xe=t[73]:(xe=G(`group/review-file-header sticky top-0 z-20 flex bg-background transition-shadow`,be),t[72]=be,t[73]=xe);let Se;t[74]===s.status?Se=t[75]:(Se=(0,J.jsx)(ppe,{status:s.status}),t[74]=s.status,t[75]=Se);let Ce;t[76]===s.path?Ce=t[77]:(Ce=(0,J.jsx)(U5,{path:s.path}),t[76]=s.path,t[77]=Ce);let we;t[78]!==s.path||t[79]!==s.previousPath?(we=s.previousPath?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:s.previousPath}),(0,J.jsx)(`span`,{className:`text-muted-foreground/70`,children:` → `}),(0,J.jsx)(`span`,{children:s.path})]}):s.path,t[78]=s.path,t[79]=s.previousPath,t[80]=we):we=t[80];let Te;t[81]===we?Te=t[82]:(Te=(0,J.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:we}),t[81]=we,t[82]=Te);let Ee;t[83]===s?Ee=t[84]:(Ee=(0,J.jsx)(mpe,{file:s}),t[83]=s,t[84]=Ee);let De;t[85]!==Se||t[86]!==Ce||t[87]!==Te||t[88]!==Ee?(De=(0,J.jsxs)(`span`,{className:`grid min-w-0 flex-1 grid-cols-[auto_auto_minmax(0,1fr)_auto] items-center gap-2`,children:[Se,Ce,Te,Ee]}),t[85]=Se,t[86]=Ce,t[87]=Te,t[88]=Ee,t[89]=De):De=t[89];let Oe,ke;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,J.jsx)($a,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none size-4 shrink-0 group-aria-expanded/review-file-trigger:hidden`}),ke=(0,J.jsx)(Qa,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden size-4 shrink-0 group-aria-expanded/review-file-trigger:inline`}),t[90]=Oe,t[91]=ke):(Oe=t[90],ke=t[91]);let Ae;t[92]!==De||t[93]!==g?(Ae=(0,J.jsxs)(Fy,{"data-review-file-trigger":!0,"data-review-file-value":g,className:`group/review-file-trigger relative flex min-h-10 min-w-0 flex-1 items-center justify-between gap-3 rounded-none border border-transparent bg-background px-3 py-2 text-left font-mono text-[13px] font-medium transition-all outline-none hover:no-underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 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`,children:[De,Oe,ke]}),t[92]=De,t[93]=g,t[94]=Ae):Ae=t[94];let je;t[95]!==xe||t[96]!==Ae?(je=(0,J.jsx)(My,{className:xe,children:Ae}),t[95]=xe,t[96]=Ae,t[97]=je):je=t[97];let Me;t[98]!==s.path||t[99]!==d||t[100]!==he?(Me=d?(0,J.jsxs)(ws,{type:`button`,variant:`outline`,"aria-label":`Open ${s.path}`,className:`min-w-0 flex-1`,onClick:he,children:[(0,J.jsx)(Ya,{className:`size-3.5`}),(0,J.jsx)(`span`,{children:`Open file`})]}):null,t[98]=s.path,t[99]=d,t[100]=he,t[101]=Me):Me=t[101];let Ne=`Discard changes to ${s.path}`,Pe=de||!n||!p,Fe,Ie;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,J.jsx)(pee,{className:`size-3.5`}),Ie=(0,J.jsx)(`span`,{children:`Discard`}),t[102]=Fe,t[103]=Ie):(Fe=t[102],Ie=t[103]);let Le;t[104]!==_e||t[105]!==Ne||t[106]!==Pe?(Le=(0,J.jsxs)(ws,{type:`button`,variant:`outline`,"aria-label":Ne,className:`min-w-0 flex-1 text-muted-foreground hover:text-destructive`,disabled:Pe,onClick:_e,children:[Fe,Ie]}),t[104]=_e,t[105]=Ne,t[106]=Pe,t[107]=Le):Le=t[107];let Re=`Stage changes to ${s.path}`,ze=de||!te||!n||!p,Be,Ve;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,J.jsx)(uee,{className:`size-3.5`}),Ve=(0,J.jsx)(`span`,{children:`Stage`}),t[108]=Be,t[109]=Ve):(Be=t[108],Ve=t[109]);let He;t[110]!==ye||t[111]!==Re||t[112]!==ze?(He=(0,J.jsxs)(ws,{type:`button`,variant:`outline`,"aria-label":Re,className:`min-w-0 flex-1 text-muted-foreground hover:text-emerald-500`,disabled:ze,onClick:ye,children:[Be,Ve]}),t[110]=ye,t[111]=Re,t[112]=ze,t[113]=He):He=t[113];let Ue;t[114]!==Me||t[115]!==Le||t[116]!==He?(Ue=(0,J.jsxs)(`div`,{className:`flex gap-2 border-b border-border/70 bg-card/40 p-2`,children:[Me,Le,He]}),t[114]=Me,t[115]=Le,t[116]=He,t[117]=Ue):Ue=t[117];let We;t[118]!==B||t[119]!==T.data||t[120]!==T.error||t[121]!==T.isPending||t[122]!==o||t[123]!==s.path||t[124]!==s.previousPath||t[125]!==R||t[126]!==M||t[127]!==j||t[128]!==N||t[129]!==w||t[130]!==A.data||t[131]!==A.error||t[132]!==A.isPending||t[133]!==S||t[134]!==V?(We=w?T.isPending&&!T.data?(0,J.jsx)(`div`,{className:`p-3`,children:(0,J.jsxs)(W5,{children:[(0,J.jsx)(Rn,{}),` Loading hunk…`]})}):T.error?(0,J.jsx)(`div`,{className:`p-3`,children:(0,J.jsx)(W5,{tone:`destructive`,children:Pg(T.error,`Failed to load hunk`)})}):N?(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-border/70 bg-background px-3 py-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:`Showing changed hunks only for this large change.`}),(0,J.jsx)(ws,{variant:`outline`,className:`shrink-0`,onClick:()=>{S(!0)},children:`Load full context`})]}),(0,J.jsx)(Uj,{patch:N,disableWorkerPool:!0,lineAnnotations:R,renderAnnotation:Rpe,options:{...V,diffStyle:o,disableFileHeader:!0,...B,overflow:`wrap`}})]}):(0,J.jsx)(`div`,{className:`p-3`,children:(0,J.jsx)(W5,{children:`No line changes.`})}):A.isPending&&!A.data?(0,J.jsx)(`div`,{className:`p-3`,children:(0,J.jsxs)(W5,{children:[(0,J.jsx)(Rn,{}),` Loading hunk…`]})}):A.error?(0,J.jsx)(`div`,{className:`p-3`,children:(0,J.jsx)(W5,{tone:`destructive`,children:Pg(A.error,`Failed to load hunk`)})}):j===M?(0,J.jsx)(`div`,{className:`p-3`,children:(0,J.jsx)(W5,{children:`No line changes.`})}):(0,J.jsx)(Vj,{oldFile:{name:s.previousPath||s.path,contents:j},newFile:{name:s.path,contents:M},disableWorkerPool:!0,lineAnnotations:R,renderAnnotation:Lpe,options:{...V,diffStyle:o,disableFileHeader:!0,...B,overflow:`wrap`}}),t[118]=B,t[119]=T.data,t[120]=T.error,t[121]=T.isPending,t[122]=o,t[123]=s.path,t[124]=s.previousPath,t[125]=R,t[126]=M,t[127]=j,t[128]=N,t[129]=w,t[130]=A.data,t[131]=A.error,t[132]=A.isPending,t[133]=S,t[134]=V,t[135]=We):We=t[135];let Ge;t[136]!==Ue||t[137]!==We?(Ge=(0,J.jsxs)(Uy,{className:`bg-background p-0`,children:[Ue,We]}),t[136]=Ue,t[137]=We,t[138]=Ge):Ge=t[138];let Ke;return t[139]!==je||t[140]!==Ge||t[141]!==g?(Ke=(0,J.jsxs)(Vy,{value:g,className:`border-border/70`,children:[je,Ge]}),t[139]=je,t[140]=Ge,t[141]=g,t[142]=Ke):Ke=t[142],Ke}function Lpe(e){return(0,J.jsx)(O7,{annotation:e})}function Rpe(e){return(0,J.jsx)(O7,{annotation:e})}function zpe(e){Tn.error(Pg(e,`Failed to discard changes`))}function Bpe(e){Tn.error(Pg(e,`Failed to stage changes`))}var P7=[],Vpe=[];function Hpe(){return ct(Ne)===`1`}function Upe(e){Te(Ne,e?`1`:`0`)}function Wpe(e,t,n=``){return`commit-diff:${t}:${e}:${n}`}function F7(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]||e}function Gpe(e){if(e.path){let t=e.previousPath||e.path,n=e.leftRevisionLabel||(e.mode===`head`?e.shortHash:`${e.shortHash}^`),r=e.rightRevisionLabel||(e.mode===`head`?`HEAD`:e.shortHash);return`${F7(t)} (${n}) → ${F7(e.path)} (${r})`}return e.mode===`head`?`${e.shortHash}..HEAD`:e.mode===`previous`?`${e.shortHash}^..${e.shortHash}`:`Diff ${e.shortHash}`}function Kpe(e){return{key:Wpe(e.commit,e.mode,e.path),commit:e.commit,shortHash:e.shortHash,title:Gpe(e),mode:e.mode,...e.path?{path:e.path}:{},...e.previousPath?{previousPath:e.previousPath}:{},...e.leftRevisionLabel?{leftRevisionLabel:e.leftRevisionLabel}:{},...e.rightRevisionLabel?{rightRevisionLabel:e.rightRevisionLabel}:{}}}var qpe={uncontrolledActiveTab:`review`,inlineActiveFilePath:``,openFileDialogOpen:!1,commitDiffTabs:[],activeCommitDiffKey:``};function Jpe(e,t){switch(t.type){case`set-active-tab`:return{...e,uncontrolledActiveTab:t.tab};case`set-inline-active-file`:return{...e,inlineActiveFilePath:t.path};case`set-open-file-dialog-open`:return{...e,openFileDialogOpen:t.open};case`upsert-commit-diff-tab`:return{...e,commitDiffTabs:e.commitDiffTabs.some(e=>e.key===t.tab.key)?e.commitDiffTabs.map(e=>e.key===t.tab.key?t.tab:e):[...e.commitDiffTabs,t.tab],activeCommitDiffKey:t.tab.key,uncontrolledActiveTab:`commit-diff`};case`set-active-commit-diff-key`:return{...e,activeCommitDiffKey:t.key};case`close-commit-diff-keys`:{let n=new Set(t.keys),r=e.commitDiffTabs.findIndex(e=>n.has(e.key)),i=e.commitDiffTabs.filter(e=>!n.has(e.key)),a=n.has(e.activeCommitDiffKey)?i[Math.max(0,r-1)]||i[0]:void 0;return{...e,commitDiffTabs:i,activeCommitDiffKey:n.has(e.activeCommitDiffKey)?a?.key||``:e.activeCommitDiffKey,uncontrolledActiveTab:a?e.uncontrolledActiveTab:e.uncontrolledActiveTab===`commit-diff`?`review`:e.uncontrolledActiveTab}}case`close-other-commit-diffs`:return{...e,commitDiffTabs:e.commitDiffTabs.filter(e=>e.key===t.key),activeCommitDiffKey:t.key,uncontrolledActiveTab:`commit-diff`};case`reorder-commit-diffs`:{let n=new Map(e.commitDiffTabs.map(e=>[e.key,e])),r=t.keys.flatMap(e=>{let t=n.get(e);return t?[t]:[]}),i=new Set(t.keys),a=e.commitDiffTabs.filter(e=>!i.has(e.key));return{...e,commitDiffTabs:[...r,...a]}}case`reset-navigation`:return{...e,inlineActiveFilePath:``,commitDiffTabs:[],activeCommitDiffKey:``,uncontrolledActiveTab:t.resetActiveTab?`review`:e.uncontrolledActiveTab}}}function I7(e,t){return`${t}:${e.prevName||``}:${e.name}`}function Ype(e){return e.hunks.reduce((e,t)=>({additions:e.additions+t.additionLines,deletions:e.deletions+t.deletionLines}),{additions:0,deletions:0})}function Xpe(e){return e===`deletions`?`old`:`new`}function Zpe({comments:e,pendingComment:t}){let n=e.map(e=>({lineNumber:e.lineNumber,metadata:e,side:e.side}));return t&&n.push({lineNumber:t.lineNumber,metadata:t,side:t.side}),n}function L7(e,t){for(let n of t.split(/\s+/))n&&e.classList.add(n)}function Qpe(e){let t=document.createElement(`form`);L7(t,`m-2 w-[min(38rem,calc(100vw_-_5rem))] max-w-[calc(100%_-_1rem)] rounded-lg border border-border/70 bg-background p-2 shadow-sm`);let n=document.createElement(`div`);L7(n,`mb-2 flex min-w-0 items-center justify-between gap-2 text-xs text-muted-foreground`);let r=document.createElement(`span`);r.textContent=`Comment on ${e.path}:L${e.lineNumber} (${Xpe(e.side)})`,L7(r,`min-w-0 truncate`);let i=document.createElement(`button`);i.type=`button`,i.textContent=`×`,i.setAttribute(`aria-label`,`Cancel line comment`),L7(i,`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground`),i.addEventListener(`click`,()=>e.onCancel()),n.append(r,i);let a=document.createElement(`textarea`);a.rows=2,a.placeholder=`Add a note for the prompt…`,L7(a,`flex min-h-16 w-full resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`),a.addEventListener(`keydown`,t=>{t.key===`Enter`&&(t.metaKey||t.ctrlKey)&&(t.preventDefault(),u()),t.key===`Escape`&&(t.preventDefault(),e.onCancel())});let o=document.createElement(`div`);L7(o,`mt-2 flex flex-wrap justify-end gap-2`);let s=document.createElement(`button`);s.type=`button`,s.textContent=`Cancel`,L7(s,`inline-flex h-8 items-center rounded-md px-3 text-sm hover:bg-muted`),s.addEventListener(`click`,()=>e.onCancel());let c=document.createElement(`button`);c.type=`submit`,c.textContent=`Add to prompt`,L7(c,`inline-flex h-8 items-center rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground disabled:pointer-events-none disabled:opacity-50`);function l(){c.disabled=a.value.trim().length===0}function u(){let t=a.value.trim();t&&e.onSubmit(t)}return a.addEventListener(`input`,l),t.addEventListener(`submit`,e=>{e.preventDefault(),u()}),o.append(s,c),t.append(n,a,o),l(),window.setTimeout(()=>a.focus(),0),t}function $pe(e){let t=e.metadata;if(!t)return;if(t.kind===`pending`)return Qpe(t);let n=t,r=document.createElement(`div`);L7(r,`my-1 ml-2 inline-flex max-w-[min(32rem,calc(100vw_-_5rem),90%)] items-center gap-1 rounded-full border border-amber-500/20 bg-amber-500/10 px-2 py-1 text-[11px] text-amber-800 dark:text-amber-200`);let i=document.createElement(`span`);i.textContent=`💬`,L7(i,`shrink-0`);let a=document.createElement(`span`);return a.textContent=n.text,L7(a,`truncate`),r.append(i,a),r}function R7(e){let t=(0,Y.c)(21),{comments:n,diffStyle:r,disableFileHeader:i,fileDiff:a,onStartComment:o,pendingComment:s}=e,c=i===void 0?!1:i,[l,u]=q.useState(null),d=q.useRef(null),f;t[0]!==n||t[1]!==s?(f=Zpe({comments:n,pendingComment:s}),t[0]=n,t[1]=s,t[2]=f):f=t[2];let p=f,m=uq(),h,g;t[3]!==a||t[4]!==o?(h=e=>{o({lineNumber:Math.min(e.start,e.end),path:a.name,side:e.side||e.endSide||`additions`})},g=e=>{o({lineNumber:e.lineNumber,path:a.name,side:e.annotationSide})},t[3]=a,t[4]=o,t[5]=h,t[6]=g):(h=t[5],g=t[6]);let _;t[7]!==r||t[8]!==c||t[9]!==h||t[10]!==g||t[11]!==m?(_={...m,diffStyle:r,disableFileHeader:c,enableGutterUtility:!0,lineDiffType:`word-alt`,lineHoverHighlight:`both`,maxLineDiffLength:1e3,onGutterUtilityClick:h,onLineNumberClick:g,overflow:`wrap`,renderAnnotation:$pe},t[7]=r,t[8]=c,t[9]=h,t[10]=g,t[11]=m,t[12]=_):_=t[12];let v=_,y;t[13]!==l||t[14]!==a||t[15]!==p||t[16]!==v?(y=()=>{if(!l)return;let e=d.current;if(e){e.setOptions(v),e.render({containerWrapper:l,fileDiff:a,forceRender:!0,lineAnnotations:p});return}let t=new Ej(v,void 0,!1);d.current=t,t.render({containerWrapper:l,fileDiff:a,lineAnnotations:p})},t[13]=l,t[14]=a,t[15]=p,t[16]=v,t[17]=y):y=t[17],q.useLayoutEffect(y);let b,x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>()=>{d.current?.cleanUp(),d.current=null},x=[],t[18]=b,t[19]=x):(b=t[18],x=t[19]),q.useLayoutEffect(b,x);let S;return t[20]===Symbol.for(`react.memo_cache_sentinel`)?(S=q.createElement(`div`,{ref:u}),t[20]=S):S=t[20],S}function eme(e){let t=(0,Y.c)(40),{comments:n,diffStyle:r,fileDiff:i,index:a,onStartComment:o,pendingComment:s,stuck:c}=e,l;t[0]!==i||t[1]!==a?(l=I7(i,a),t[0]=i,t[1]=a,t[2]=l):l=t[2];let u=l,d;t[3]===i?d=t[4]:(d=Ype(i),t[3]=i,t[4]=d);let f=d,p=c&&`shadow-sm`,m;t[5]===p?m=t[6]:(m=G(`sticky top-0 z-20 flex bg-background transition-shadow`,p),t[5]=p,t[6]=m);let h;t[7]!==i.name||t[8]!==i.prevName?(h=i.prevName?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:i.prevName}),(0,J.jsx)(`span`,{className:`text-muted-foreground/70`,children:` → `}),(0,J.jsx)(`span`,{children:i.name})]}):i.name,t[7]=i.name,t[8]=i.prevName,t[9]=h):h=t[9];let g;t[10]===h?g=t[11]:(g=(0,J.jsx)(`span`,{className:`min-w-0 truncate text-left`,children:h}),t[10]=h,t[11]=g);let _;t[12]===f.additions?_=t[13]:(_=f.additions>0?(0,J.jsxs)(`span`,{className:`text-emerald-500`,children:[`+`,f.additions]}):null,t[12]=f.additions,t[13]=_);let v;t[14]===f.deletions?v=t[15]:(v=f.deletions>0?(0,J.jsxs)(`span`,{className:`text-red-500`,children:[`-`,f.deletions]}):null,t[14]=f.deletions,t[15]=v);let y;t[16]!==_||t[17]!==v?(y=(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 gap-2 justify-self-end whitespace-nowrap tabular-nums`,children:[_,v]}),t[16]=_,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==g||t[20]!==y?(b=(0,J.jsxs)(`span`,{className:`grid min-w-0 flex-1 grid-cols-[minmax(0,1fr)_auto] items-baseline gap-3`,children:[g,y]}),t[19]=g,t[20]=y,t[21]=b):b=t[21];let x,S;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,J.jsx)($a,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none size-4 shrink-0 group-aria-expanded/commit-file-trigger:hidden`}),S=(0,J.jsx)(Qa,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden size-4 shrink-0 group-aria-expanded/commit-file-trigger:inline`}),t[22]=x,t[23]=S):(x=t[22],S=t[23]);let C;t[24]!==b||t[25]!==u?(C=(0,J.jsxs)(Fy,{"data-commit-file-trigger":!0,"data-commit-file-value":u,className:`group/commit-file-trigger relative flex min-h-10 min-w-0 flex-1 items-center justify-between gap-3 rounded-none border border-transparent bg-background px-3 py-2 text-left font-mono text-[13px] font-medium transition-all outline-none hover:no-underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 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`,children:[b,x,S]}),t[24]=b,t[25]=u,t[26]=C):C=t[26];let w;t[27]!==C||t[28]!==m?(w=(0,J.jsx)(My,{className:m,children:C}),t[27]=C,t[28]=m,t[29]=w):w=t[29];let T;t[30]!==n||t[31]!==r||t[32]!==i||t[33]!==o||t[34]!==s?(T=(0,J.jsx)(Uy,{className:`bg-background p-0`,children:(0,J.jsx)(R7,{comments:n,diffStyle:r,disableFileHeader:!0,fileDiff:i,onStartComment:o,pendingComment:s})}),t[30]=n,t[31]=r,t[32]=i,t[33]=o,t[34]=s,t[35]=T):T=t[35];let E;return t[36]!==w||t[37]!==T||t[38]!==u?(E=(0,J.jsxs)(Vy,{value:u,className:`border-border/70`,children:[w,T]}),t[36]=w,t[37]=T,t[38]=u,t[39]=E):E=t[39],E}function tme(e){let t=(0,Y.c)(10),{comments:n,diffStyle:r,onStartComment:i,patch:a,pendingComment:o}=e,s;t[0]===a?s=t[1]:(s=Sj(a).flatMap(nme),t[0]=a,t[1]=s);let c=s[0];if(!c){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsx)(W5,{children:`No line changes.`})}),t[2]=e):e=t[2],e}let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l={"--diffs-font-family":`var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace)`},t[3]=l):l=t[3];let u;return t[4]!==n||t[5]!==r||t[6]!==c||t[7]!==i||t[8]!==o?(u=(0,J.jsx)(`div`,{className:`min-h-full text-xs`,style:l,children:(0,J.jsx)(R7,{comments:n,diffStyle:r,fileDiff:c,onStartComment:i,pendingComment:o})}),t[4]=n,t[5]=r,t[6]=c,t[7]=i,t[8]=o,t[9]=u):u=t[9],u}function nme(e){return e.files}function rme(e){let t=(0,Y.c)(32),{comments:n,diffStyle:r,onStartComment:i,patch:a,pendingComment:o,stuckFileValue:s}=e,c,l,u,d,f,p,m,h;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Sj(a).flatMap(ime),g=e[0]?I7(e[0],0):void 0;if(e.length===0){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsx)(W5,{children:`No line changes.`})}),t[14]=e):e=t[14],h=e;break bb0}p=`min-h-full text-xs`;let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_={"--diffs-font-family":`var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace)`},t[15]=_):_=t[15],m=_,c=By,l=!0,u=g?[g]:[],d=`border-b border-border/80`;let v;t[16]!==n||t[17]!==r||t[18]!==i||t[19]!==o||t[20]!==s?(v=(e,t)=>(0,J.jsx)(eme,{comments:n.filter(t=>t.path===e.name),diffStyle:r,fileDiff:e,index:t,onStartComment:i,pendingComment:o?.path===e.name?o:null,stuck:s===I7(e,t)},I7(e,t)),t[16]=n,t[17]=r,t[18]=i,t[19]=o,t[20]=s,t[21]=v):v=t[21],f=e.map(v)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f?(g=(0,J.jsx)(c,{multiple:l,defaultValue:u,className:d,children:f}),t[22]=c,t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=g):g=t[27];let _;return t[28]!==p||t[29]!==m||t[30]!==g?(_=(0,J.jsx)(`div`,{className:p,style:m,children:g}),t[28]=p,t[29]=m,t[30]=g,t[31]=_):_=t[31],_}function ime(e){return e.files}function ame(e){let t=(0,Y.c)(15),{path:n}=e,r,i,a,o,s,c;if(t[0]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=n.split(`/`).filter(Boolean);if(e.length===0){c=null;break bb0}i=NZ,s=n,r=PZ,a=`flex-nowrap gap-1 font-mono text-xs whitespace-nowrap`,o=e.map((t,n)=>{let r=n===e.length-1,i=`${n}:${t}`;return(0,J.jsxs)(q.Fragment,{children:[n>0?(0,J.jsx)(LZ,{className:`text-muted-foreground/60`}):null,(0,J.jsx)(FZ,{className:`min-w-0 shrink-0`,children:r?(0,J.jsx)(IZ,{className:`max-w-80 truncate font-mono text-xs font-medium`,children:t}):(0,J.jsx)(`span`,{className:`max-w-40 truncate text-muted-foreground`,children:t})})]},i)})}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;t[7]!==r||t[8]!==a||t[9]!==o?(l=(0,J.jsx)(r,{className:a,children:o}),t[7]=r,t[8]=a,t[9]=o,t[10]=l):l=t[10];let u;return t[11]!==i||t[12]!==s||t[13]!==l?(u=(0,J.jsx)(i,{title:s,children:l}),t[11]=i,t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function ome(e){let t=(0,Y.c)(5),{tab:n}=e;if(!n.path){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`div`,{className:`truncate text-xs font-bold tracking-[0.04em] text-muted-foreground uppercase`,children:`Commit diff`}),t[0]=e):e=t[0];let r;return t[1]===n.title?r=t[2]:(r=(0,J.jsxs)(`div`,{className:`min-w-0`,children:[e,(0,J.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-xs text-muted-foreground`,children:n.title})]}),t[1]=n.title,t[2]=r),r}let r;return t[3]===n.path?r=t[4]:(r=(0,J.jsx)(`div`,{className:`min-w-0 flex-1 overflow-x-auto`,children:(0,J.jsx)(ame,{path:n.path})}),t[3]=n.path,t[4]=r),r}function sme(e){let t=(0,Y.c)(44),{viewerContextId:n,cwd:r,active:i,diffLineComments:a,onAddDiffLineComment:o,tab:s}=e,[c,l]=q.useState(`unified`),[u,d]=q.useState(``),[f,p]=q.useState(null),m=q.useRef(null),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>{f7(d,m7({getValue:cme,scrollElement:e,selector:`[data-commit-file-trigger]`}))},t[0]=h):h=t[0];let g=h,_;t[1]!==r||t[2]!==s||t[3]!==n?(_=s?Gh.gitCommitDiff(n,r,s.commit,s.mode,s.path,s.previousPath):[`pico`,`git-commit-diff`,n,r,``,``],t[1]=r,t[2]=s,t[3]=n,t[4]=_):_=t[4];let v;t[5]!==r||t[6]!==s||t[7]!==n?(v=()=>mh(ph(`/api/git-commit-diff?cwd=${encodeURIComponent(r)}&commit=${encodeURIComponent(s?.commit||``)}&mode=${encodeURIComponent(s?.mode||`commit`)}${s?.path?`&path=${encodeURIComponent(s.path)}`:``}${s?.previousPath?`&previousPath=${encodeURIComponent(s.previousPath)}`:``}`,{contextId:n})),t[5]=r,t[6]=s,t[7]=n,t[8]=v):v=t[8];let y=!!(i&&n&&r&&s?.commit),b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=[`data`,`isPending`,`error`],t[9]=b):b=t[9];let x;t[10]!==_||t[11]!==v||t[12]!==y?(x={queryKey:_,queryFn:v,enabled:y,notifyOnChangeProps:b},t[10]=_,t[11]=v,t[12]=y,t[13]=x):x=t[13];let S=Zr(x),C=s?a.filter(e=>e.tabKey===s.key&&e.commit===s.commit&&e.mode===s.mode):P7,w;t[14]!==o||t[15]!==s?(w=e=>{!s||!o||p({commit:s.commit,lineNumber:e.lineNumber,mode:s.mode,path:e.path,shortHash:s.shortHash,side:e.side,tabKey:s.key,tabTitle:s.title})},t[14]=o,t[15]=s,t[16]=w):w=t[16];let T=w,E;t[17]!==f||t[18]!==o?(E=f?{...f,kind:`pending`,onCancel:()=>p(null),onSubmit:e=>{o?.({...f,text:e}),p(null)}}:null,t[17]=f,t[18]=o,t[19]=E):E=t[19];let D=E,O;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{p(null),f7(d,``),g(m.current)},t[20]=O):O=t[20];let k=s?.key,A=S.data?.patch,j;if(t[21]!==k||t[22]!==A?(j=[k,A],t[21]=k,t[22]=A,t[23]=j):j=t[23],q.useEffect(O,j),!s){let e;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-center text-sm text-muted-foreground`,children:`Select a commit diff tab.`}),t[24]=e):e=t[24],e}let M;t[25]===s?M=t[26]:(M=(0,J.jsx)(ome,{tab:s}),t[25]=s,t[26]=M);let N;t[27]===c?N=t[28]:(N=[c],t[27]=c,t[28]=N);let P,F,I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{let t=e[0];(t===`unified`||t===`split`)&&l(t)},F=(0,J.jsx)(V5,{value:`unified`,children:`Unified`}),I=(0,J.jsx)(V5,{value:`split`,children:`Split`}),t[29]=P,t[30]=F,t[31]=I):(P=t[29],F=t[30],I=t[31]);let L;t[32]===N?L=t[33]:(L=(0,J.jsxs)(B5,{variant:`outline`,value:N,onValueChange:P,children:[F,I]}),t[32]=N,t[33]=L);let R;t[34]!==M||t[35]!==L?(R=(0,J.jsxs)(`div`,{className:`flex min-h-10 shrink-0 items-center justify-between gap-2 border-b border-border/70 bg-background p-2`,children:[M,L]}),t[34]=M,t[35]=L,t[36]=R):R=t[36];let z;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{g(e.currentTarget)},t[37]=z):z=t[37];let B=S.isPending&&!S.data?(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsxs)(W5,{children:[(0,J.jsx)(Rn,{}),` Loading commit diff…`]})}):S.error?(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsx)(W5,{tone:`destructive`,children:Pg(S.error,`Failed to load commit diff`)})}):S.data?.patch&&s.path?(0,J.jsx)(tme,{comments:C.filter(e=>s.path?e.path===s.path||e.path===s.previousPath:!0),diffStyle:c,onStartComment:T,patch:S.data.patch,pendingComment:D}):S.data?.patch?(0,J.jsx)(rme,{comments:C,diffStyle:c,onStartComment:T,patch:S.data.patch,pendingComment:D,stuckFileValue:u},`${S.data.commit}:${S.data.mode}`):(0,J.jsx)(`div`,{className:`p-4`,children:(0,J.jsx)(W5,{children:`No line changes.`})}),V;t[38]!==z||t[39]!==B?(V=(0,J.jsx)(`div`,{ref:m,className:`min-h-0 flex-1 overflow-auto`,onScroll:z,children:B}),t[38]=z,t[39]=B,t[40]=V):V=t[40];let H;return t[41]!==R||t[42]!==V?(H=(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[R,V]}),t[41]=R,t[42]=V,t[43]=H):H=t[43],H}function cme(e){return e.dataset.commitFileValue||``}function z7({viewerContextId:e,cwd:t,active:n,activeFilePath:r=``,activeTab:i,diffLineComments:a=P7,filePreviewPath:o=``,fileTabs:s=Vpe,fileTreeCollapsed:c=!1,onActiveFileChange:l,onActiveTabChange:u,onAddDiffLineComment:d,onCloseAllFiles:f,onCloseFile:p,onCloseFilesToRight:m,onCloseOtherFiles:h,onFileTreeCollapsedChange:g,onOpenFile:_,onReorderFiles:v,showToolbar:y=!0}){let b=Ng(t),x=qo(),[S,C]=q.useReducer(Jpe,qpe),[w,T]=q.useState(Hpe),E=i!==void 0,D=i??S.uncontrolledActiveTab,O=q.useRef(D);O.current=D;let k=q.useEffectEvent(e=>{u?.(e)}),A=e=>{C({type:`set-active-tab`,tab:e}),u?.(e)},j=e=>{T(e),Upe(e)},M=x?`inline`:`external`,N=y&&!x,P=M===`inline`?S.inlineActiveFilePath:r,F=s.length>0,I=S.commitDiffTabs.find(e=>e.key===S.activeCommitDiffKey)??S.commitDiffTabs[0],L=Zr({...X5({viewerContextId:e,cwd:b}),enabled:!!(n&&F&&e&&b),select:e=>e.paths,notifyOnChangeProps:[`data`]}).data??[],R=(e,t)=>{if(e){if(A(`files`),M===`inline`){C({type:`set-inline-active-file`,path:e});return}_?.(e,t),l?.(e)}},z=e=>{e.commit&&(C({type:`upsert-commit-diff-tab`,tab:Kpe(e)}),u?.(`commit-diff`))},B=e=>{let t=new Set(e),n=t.has(S.activeCommitDiffKey),r=S.commitDiffTabs.filter(e=>!t.has(e.key));C({type:`close-commit-diff-keys`,keys:e}),n&&r.length===0&&u?.(`review`)};return q.useEffect(()=>{C({type:`reset-navigation`,resetActiveTab:!E}),O.current===`commit-diff`&&k(`review`)},[E,x,b]),(0,J.jsxs)(`div`,{className:`h-full min-h-[520px] w-full min-w-0`,children:[(0,J.jsx)(xfe,{viewerContextId:e,cwd:b,active:n}),(0,J.jsxs)(`div`,{className:G(`flex h-full min-h-[520px] min-w-0 flex-col overflow-hidden bg-card/50`,N?`rounded-xl border border-border/80`:`rounded-none border-0`),children:[(0,J.jsx)(qde,{activeCommitDiffKey:I?.key||``,activeFilePath:P,activeTab:D,commitDiffTabs:S.commitDiffTabs,filePreviewPath:o,fileTabs:s,onActiveCommitDiffChange:e=>C({type:`set-active-commit-diff-key`,key:e}),onActiveFileChange:l,onActiveTabChange:A,onCloseAllCommitDiffs:()=>{B(S.commitDiffTabs.map(e=>e.key))},onCloseAllFiles:f,onCloseCommitDiff:e=>{B([e])},onCloseCommitDiffsToRight:e=>{let t=S.commitDiffTabs.findIndex(t=>t.key===e);t<0||B(S.commitDiffTabs.slice(t+1).map(e=>e.key))},onCloseFile:p,onCloseFilesToRight:m,onCloseOtherCommitDiffs:e=>{C({type:`close-other-commit-diffs`,key:e}),u?.(`commit-diff`)},onCloseOtherFiles:h,onOpenFileDialog:()=>{C({type:`set-open-file-dialog-open`,open:!0})},onReorderCommitDiffs:e=>{C({type:`reorder-commit-diffs`,keys:e})},onReorderFiles:v,showHistory:w,showReview:!0}),(0,J.jsx)(`div`,{className:D===`review`?`min-h-0 flex-1 overflow-hidden`:`hidden`,children:(0,J.jsx)(jpe,{viewerContextId:e,cwd:b,active:n&&D===`review`,diffLineComments:a,onMaximizeHistory:()=>{j(!0),A(`history`)},onAddDiffLineComment:d,onOpenCommitDiff:z,onOpenFile:R,showEmbeddedHistory:!w})}),(0,J.jsx)(`div`,{className:D===`history`?`min-h-0 flex-1 overflow-hidden`:`hidden`,children:(0,J.jsx)(D7,{viewerContextId:e,cwd:b,active:n&&D===`history`,flush:!0,onOpenCommitDiff:z,onRestoreEmbedded:()=>{j(!1),A(`review`)}})}),(0,J.jsx)(`div`,{className:D===`commit-diff`?`min-h-0 flex-1 overflow-hidden`:`hidden`,children:(0,J.jsx)(sme,{viewerContextId:e,cwd:b,active:n&&D===`commit-diff`,diffLineComments:a,onAddDiffLineComment:d,tab:I})}),(0,J.jsx)(`div`,{className:D===`files`?`min-h-0 flex-1 overflow-hidden`:`hidden`,children:M===`external`&&F?(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[P?(0,J.jsx)(sfe,{path:P,fileTreeCollapsed:c,onFileTreeCollapsedChange:g}):null,(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[c?null:(0,J.jsx)(rfe,{viewerContextId:e,cwd:b,active:n&&D===`files`,activeFilePath:P,onOpenFile:R,previewMode:M}),P?(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-hidden`,children:(0,J.jsx)(t7,{viewerContextId:e,cwd:b,active:n&&D===`files`,path:P})}):null]})]}):(0,J.jsx)($5,{viewerContextId:e,cwd:b,active:n&&D===`files`,activeFilePath:P,onCloseFile:()=>{C({type:`set-inline-active-file`,path:``})},onOpenFile:R,previewMode:M})}),(0,J.jsx)(e7,{open:S.openFileDialogOpen,onOpenChange:e=>C({type:`set-open-file-dialog-open`,open:e}),paths:L,onOpenFile:e=>{R(e,{pin:!0})}})]})]})}function lme(){let e=ct(xr);return e===`files`||e===`review`?e:`review`}function B7(e){e===`commit-diff`||e===`history`||Te(xr,e)}function V7(e,t){bg(e,`activeTab`,t),B7(t)}function ume(){return{activeTab:lme(),fileActivePath:``,filePreviewPath:``,fileTabs:[],fileTreeCollapsed:!1}}function H7(e){return e.filePreviewPath&&!e.fileTabs.includes(e.filePreviewPath)?[...e.fileTabs,e.filePreviewPath]:e.fileTabs}function dme(e){return H7(e).length>0}function U7(e){yg(e,e=>({...e,fileActivePath:``,filePreviewPath:``,fileTabs:[],fileTreeCollapsed:!1}))}function fme(e,t,n){t&&(B7(`files`),yg(e,e=>{let r=!!n?.pin||e.fileTabs.includes(t)||e.fileActivePath===t,i=r?e.fileTabs.includes(t)?e.fileTabs:[...e.fileTabs,t]:e.fileTabs,a=r?e.filePreviewPath===t?``:e.filePreviewPath:t;return{...e,activeTab:`files`,fileActivePath:t,filePreviewPath:a,fileTabs:i,fileTreeCollapsed:!1}}))}function pme(e,t){yg(e,e=>{let n=H7(e).indexOf(t),r=e.fileTabs.filter(e=>e!==t),i=e.filePreviewPath===t?``:e.filePreviewPath,a=i&&!r.includes(i)?[...r,i]:r,o=e.fileActivePath===t?a[Math.max(0,n-1)]||a[0]||``:e.fileActivePath;return{...e,fileActivePath:o,filePreviewPath:i,fileTabs:r}})}function mme(e,t){yg(e,e=>{let n=e.fileTabs.includes(t)?[t]:[];return{...e,fileActivePath:t,filePreviewPath:n.length===0?t:``,fileTabs:n}})}function hme(e,t){yg(e,e=>{let n=H7(e),r=n.indexOf(t);if(r<0)return e;let i=new Set(n.slice(0,r+1)),a=e.fileTabs.filter(e=>i.has(e)),o=i.has(e.filePreviewPath)?e.filePreviewPath:``,s=o&&!a.includes(o)?[...a,o]:a;return{...e,fileActivePath:s.includes(e.fileActivePath)?e.fileActivePath:t,filePreviewPath:o,fileTabs:a}})}function gme(e){yg(e,e=>({...e,fileActivePath:``,filePreviewPath:``,fileTabs:[]}))}function _me(e,t){let n=t.filter((e,n)=>e&&t.indexOf(e)===n);n.length!==0&&yg(e,e=>({...e,fileActivePath:n.includes(e.fileActivePath)?e.fileActivePath:n[0]||``,filePreviewPath:``,fileTabs:n}))}function W7(e){let t=(0,Y.c)(4),{sessionStore:n,viewerContextId:r}=e,i=_a(n,vme),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(dv,{value:`session`,className:`h-8 data-active:bg-muted dark:data-active:bg-muted`,children:`Session`}),t[0]=a):a=t[0];let o;return t[1]!==i||t[2]!==r?(o=(0,J.jsxs)(uv,{className:`w-full gap-2 rounded-none border-b border-border/70 bg-background p-2 group-data-horizontal/tabs:h-auto md:hidden`,children:[a,(0,J.jsx)(dv,{value:`git`,className:`h-8 data-active:bg-muted dark:data-active:bg-muted`,children:(0,J.jsx)(TX,{viewerContextId:r,cwd:i})})]}),t[1]=i,t[2]=r,t[3]=o):o=t[3],o}function vme(e){return e.cwd}var yme=q.memo(function(e){let t=(0,Y.c)(26),{active:n,composerDiffLineComments:r,onAddDiffLineComment:i,onCloseAllFiles:a,onCloseFile:o,onCloseFilesToRight:s,onCloseOtherFiles:c,onOpenFile:l,onReorderFiles:u,rightSidebarStore:d,sessionStore:f,viewerContextId:p}=e,m=_a(f,Nme),h=_a(d,Pme),g=_a(d,Fme),_=_a(d,Ime),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={compare:ug},t[0]=v):v=t[0];let y=_a(d,H7,v),b=_a(d,Lme),x,S;t[1]===d?(x=t[2],S=t[3]):(x=e=>{bg(d,`fileActivePath`,e)},S=e=>{V7(d,e)},t[1]=d,t[2]=x,t[3]=S);let C;t[4]===d?C=t[5]:(C=e=>{bg(d,`fileTreeCollapsed`,e)},t[4]=d,t[5]=C);let w;return t[6]!==n||t[7]!==h||t[8]!==g||t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==y||t[13]!==b||t[14]!==i||t[15]!==a||t[16]!==o||t[17]!==s||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==x||t[22]!==S||t[23]!==C||t[24]!==p?(w=(0,J.jsx)(z7,{viewerContextId:p,cwd:m,active:n,activeFilePath:h,activeTab:g,diffLineComments:r,filePreviewPath:_,fileTabs:y,fileTreeCollapsed:b,onActiveFileChange:x,onActiveTabChange:S,onAddDiffLineComment:i,onCloseAllFiles:a,onCloseFile:o,onCloseFilesToRight:s,onCloseOtherFiles:c,onFileTreeCollapsedChange:C,onOpenFile:l,onReorderFiles:u}),t[6]=n,t[7]=h,t[8]=g,t[9]=r,t[10]=m,t[11]=_,t[12]=y,t[13]=b,t[14]=i,t[15]=a,t[16]=o,t[17]=s,t[18]=c,t[19]=l,t[20]=u,t[21]=x,t[22]=S,t[23]=C,t[24]=p,t[25]=w):w=t[25],w});function bme(e){let t=(0,Y.c)(30),{active:n,composerDiffLineComments:r,onAddDiffLineComment:i,onCloseAllFiles:a,onCloseFile:o,onCloseFilesToRight:s,onCloseOtherFiles:c,onOpenFile:l,onReorderFiles:u,rightSidebarStore:d,sessionStore:f,viewerContextId:p}=e,m=_a(f,Tme),h=_a(d,wme),g=_a(d,Cme),_=_a(d,Sme),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={compare:ug},t[0]=v):v=t[0];let y=_a(d,H7,v),b=_a(d,xme),x=!n,S=n?`open`:`closed`,C,w;t[1]===d?(C=t[2],w=t[3]):(C=e=>{bg(d,`fileActivePath`,e)},w=e=>{V7(d,e)},t[1]=d,t[2]=C,t[3]=w);let T;t[4]===d?T=t[5]:(T=e=>{bg(d,`fileTreeCollapsed`,e)},t[4]=d,t[5]=T);let E;t[6]!==n||t[7]!==h||t[8]!==g||t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==y||t[13]!==b||t[14]!==i||t[15]!==a||t[16]!==o||t[17]!==s||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==C||t[22]!==w||t[23]!==T||t[24]!==p?(E=(0,J.jsx)(z7,{viewerContextId:p,cwd:m,active:n,activeFilePath:h,activeTab:g,diffLineComments:r,filePreviewPath:_,fileTabs:y,fileTreeCollapsed:b,onActiveFileChange:C,onActiveTabChange:w,onAddDiffLineComment:i,onCloseAllFiles:a,onCloseFile:o,onCloseFilesToRight:s,onCloseOtherFiles:c,onFileTreeCollapsedChange:T,onOpenFile:l,onReorderFiles:u,showToolbar:!1}),t[6]=n,t[7]=h,t[8]=g,t[9]=r,t[10]=m,t[11]=_,t[12]=y,t[13]=b,t[14]=i,t[15]=a,t[16]=o,t[17]=s,t[18]=c,t[19]=l,t[20]=u,t[21]=C,t[22]=w,t[23]=T,t[24]=p,t[25]=E):E=t[25];let D;return t[26]!==x||t[27]!==S||t[28]!==E?(D=(0,J.jsx)(`aside`,{"aria-label":`Right sidebar`,"aria-hidden":x,"data-state":S,className:`flex h-full min-h-0 w-full min-w-0 flex-col border-l border-border/70 bg-background data-[state=closed]:pointer-events-none data-[state=closed]:border-transparent`,children:E}),t[26]=x,t[27]=S,t[28]=E,t[29]=D):D=t[29],D}function xme(e){return e.fileTreeCollapsed}function Sme(e){return e.filePreviewPath}function Cme(e){return e.activeTab}function wme(e){return e.fileActivePath}function Tme(e){return e.cwd}var G7=520,K7=320,q7=320,J7=260,Eme=1600;function Y7(){return{fileViewWidth:G7,gitPanelWidth:K7}}function X7(e,t){let n=typeof e==`number`?e:Number(e);return Number.isFinite(n)?Math.round(Math.min(Eme,Math.max(J7,n))):t}function Z7(e){if(!e||typeof e!=`object`)return Y7();let t=e;return{fileViewWidth:X7(t.fileViewWidth,G7),gitPanelWidth:X7(t.gitPanelWidth,K7)}}function Dme(){try{let e=ct(pr);return e?Z7(JSON.parse(e)):Y7()}catch{return Y7()}}function Ome(e){Te(pr,JSON.stringify(Z7(e)))}function Q7(e,t){return e.fileViewWidth===t.fileViewWidth&&e.gitPanelWidth===t.gitPanelWidth}function $7(e,t,n){return Number.isFinite(e)?n<=t?Math.max(0,n):Math.min(n,Math.max(t,e)):t}function kme({availableWidth:e,fileOpen:t,fileWidth:n,gitOpen:r,gitWidth:i}){let a=Math.max(0,e-q7);if(!t&&!r)return{fileWidth:0,gitWidth:0,sideWidth:0};if(t&&!r){let e=$7(n,Math.min(J7,a),a);return{fileWidth:e,gitWidth:0,sideWidth:e}}if(!t&&r){let e=$7(i,Math.min(J7,a),a);return{fileWidth:0,gitWidth:e,sideWidth:e}}let o=Math.max(1,n+i);if(o<=a)return{fileWidth:n,gitWidth:i,sideWidth:n+i};let s=Math.min(J7,a/2),c=Math.round(n/o*a);c=Math.max(s,Math.min(a-s,c));let l=Math.max(0,a-c);return{fileWidth:c,gitWidth:l,sideWidth:c+l}}function Ame(e){let t=(0,Y.c)(24),{label:n,max:r,min:i,onResize:a,onResizeEnd:o,onResizeStart:s,size:c}=e,l;t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==s||t[5]!==c?(l={max:r,min:i,onResize:a,onResizeEnd:o,onResizeStart:s,size:c},t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l):l=t[6];let u=fg(l),[d,f]=q.useState(`col-resize`),[p,m]=q.useState(10),h,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{let e=()=>{m(is())},t=window.matchMedia(`(pointer:coarse)`);return f(ns()),e(),t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)}},g=[],t[7]=h,t[8]=g):(h=t[7],g=t[8]),q.useEffect(h,g);let _=d===`ew-resize`?`cursor-ew-resize`:`cursor-col-resize`,v;t[9]===u?v=t[10]:(v=e=>{let t=u.current;t.onResize($7(e,t.min,t.max))},t[9]=u,t[10]=v);let y=v,b=`${p}px`,x;t[11]!==d||t[12]!==b?(x={"--resize-target-width":b,cursor:d},t[11]=d,t[12]=b,t[13]=x):x=t[13];let S=x,C=`absolute inset-y-0 left-0 z-20 w-(--resize-target-width) -translate-x-1/2 touch-none bg-transparent outline-hidden after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-transparent focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 ${Fs} ${_}`,w,T;t[14]!==u||t[15]!==y?(T=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=e.shiftKey?48:16;y(u.current.size+(e.key===`ArrowLeft`?t:-t))},w=e=>{if(e.button!==0)return;e.preventDefault();let t=u.current,n=e.clientX,r=t.size,i=ns(),a=document.body.style.cursor,o=document.body.style.userSelect,s=as(i);t.onResizeStart?.(),Object.assign(document.body.style,{userSelect:`none`,cursor:i});let c=e=>{y(r+n-e.clientX)},l=()=>{s(),Object.assign(document.body.style,{userSelect:o,cursor:a}),document.removeEventListener(`pointermove`,c),document.removeEventListener(`pointerup`,l),document.removeEventListener(`pointercancel`,l),u.current.onResizeEnd?.()};document.addEventListener(`pointermove`,c),document.addEventListener(`pointerup`,l),document.addEventListener(`pointercancel`,l)},t[14]=u,t[15]=y,t[16]=w,t[17]=T):(w=t[16],T=t[17]);let E;return t[18]!==n||t[19]!==w||t[20]!==S||t[21]!==C||t[22]!==T?(E=(0,J.jsx)(`div`,{role:`separator`,"aria-label":n,"aria-orientation":`vertical`,tabIndex:0,style:S,className:C,onKeyDown:T,onPointerDown:w}),t[18]=n,t[19]=w,t[20]=S,t[21]=C,t[22]=T,t[23]=E):E=t[23],E}function jme(e){return Mme(e)}function Mme({actionsRef:e,appUiStore:t,awaitingFirstTurn:n,composerDiffLineComments:r,composerPanelRef:i,contextUsageStore:a,conversationFrameRef:o,conversationItemsStore:s,defaultNewSessionDirectory:c,displaySettingsStore:l,fileInputRef:u,gitPanelOpen:d,hiddenThinkingPreviewStore:f,isSessionViewLoading:p,isSubmitting:m,isMobile:h,newSessionDirectoryOptions:g,onCancelCompaction:_,onCreateSession:v,onOpenAddDirectoryDialog:y,onCloseAllFileViewTabs:b,onCloseFileViewTab:x,onCloseFileViewTabsToRight:S,onCloseOtherFileViewTabs:C,onAddDiffLineComment:w,onOpenFileViewTab:T,onReorderFileViewTabs:E,onValueChange:D,rightSidebarStore:O,sessionStore:k,store:A,viewerContextId:j,workingStateStore:M}){let N=_a(t,e=>e.currentTab),P=_a(k,e=>e.draft),F=h||!P||p,I=N===`git`?`hidden min-h-0 flex-1 flex-col md:flex`:`flex min-h-0 flex-1 flex-col`,L=N===`git`?`min-h-0 flex-1 overflow-hidden md:hidden`:`hidden`,R=_a(O,dme),z=!h&&d,B=!h&&d&&R,V=B||z,H=q.useRef(null),[U,ee]=q.useState(0),[te,ne]=q.useState(()=>Y7()),re=q.useRef(!1),W=q.useRef(te);W.current=te;let ie=te.fileViewWidth,ae=te.gitPanelWidth,oe=e=>{let t=W.current,n=Z7(vg(t,e));Q7(t,n)||(W.current=n,ne(n),re.current&&Ome(n))},se=e=>{oe(t=>({...t,fileViewWidth:X7(vg(t.fileViewWidth,e),G7)}))},ce=e=>{oe(t=>({...t,gitPanelWidth:X7(vg(t.gitPanelWidth,e),K7)}))},[le,ue]=q.useState(z),[de,fe]=q.useState(!1);q.useEffect(()=>{let e=Dme();re.current=!0,W.current=e,ne(t=>Q7(t,e)?t:e)},[]);let pe=(0,J.jsxs)(`div`,{className:`flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,J.jsx)(`div`,{className:I,children:(0,J.jsx)(jZ,{actionsRef:e,awaitingFirstTurn:n,composerPanelRef:i,contextUsageStore:a,conversationFrameRef:o,conversationItemsStore:s,defaultNewSessionDirectory:c,displaySettingsStore:l,fileInputRef:u,hiddenThinkingPreviewStore:f,isSessionViewLoading:p,isSubmitting:m,newSessionDirectoryOptions:g,onCancelCompaction:_,onCreateSession:v,onOpenAddDirectoryDialog:y,sessionStore:k,store:A,viewerContextId:j,workingStateStore:M})}),h?(0,J.jsx)(`div`,{className:L,children:(0,J.jsx)(yme,{viewerContextId:j,sessionStore:k,active:N===`git`,composerDiffLineComments:r,rightSidebarStore:O,onAddDiffLineComment:w,onCloseAllFiles:b,onCloseFile:x,onCloseFilesToRight:S,onCloseOtherFiles:C,onOpenFile:T,onReorderFiles:E})}):null]});q.useLayoutEffect(()=>{if(h){ue(!1);return}V&&ue(!0)},[V,h]),q.useLayoutEffect(()=>{if(h)return;let e=H.current;if(!e)return;let t=()=>{ee(e.clientWidth)};if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[h]);let me=U||(typeof window>`u`?1200:window.innerWidth),he=V||le||z,ge=kme({availableWidth:me,fileOpen:B,fileWidth:ie,gitOpen:z,gitWidth:ae}),_e=V||le,ve=V?ge.sideWidth:0,ye=de?``:`transition-[width] duration-200 ease-linear`,be=()=>{fe(!0)},G=()=>{fe(!1)},xe=Math.max(0,me-q7);return(0,J.jsxs)(cv,{value:N,onValueChange:D,className:`flex min-h-0 flex-1 flex-col gap-0 overflow-hidden`,children:[F?(0,J.jsx)(W7,{sessionStore:k,viewerContextId:j}):null,h?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:pe}):(0,J.jsxs)(`div`,{ref:H,className:`relative flex h-full min-h-0 w-full flex-1 overflow-hidden`,children:[(0,J.jsx)(`div`,{"data-desktop-panel":`session`,className:`h-full min-h-0 min-w-0 shrink-0 overflow-hidden ${ye}`,style:{width:V?`calc(100% - ${ve}px)`:`100%`},children:pe}),_e?(0,J.jsx)(`aside`,{"aria-label":`Desktop side workspace`,"aria-hidden":!V,"data-state":V?`open`:`closed`,"data-desktop-panel":`side-workspace`,className:`flex h-full min-h-0 min-w-0 shrink-0 overflow-visible bg-background data-[state=closed]:pointer-events-none ${ye}`,style:{width:`${ve}px`},children:he?(0,J.jsxs)(`div`,{"data-desktop-panel":`git`,className:`relative h-full min-h-0 min-w-0 shrink-0 overflow-visible ${ye}`,style:{width:`${ve}px`},children:[z?(0,J.jsx)(Ame,{label:`Resize right sidebar`,min:Math.min(J7,xe),max:xe,size:ve,onResize:e=>{if(!B){ce(e);return}se(Math.max(J7,e-ae))},onResizeStart:be,onResizeEnd:G}):null,(0,J.jsx)(`div`,{className:`h-full min-h-0 min-w-0 overflow-hidden`,children:he?(0,J.jsx)(bme,{viewerContextId:j,sessionStore:k,active:z,composerDiffLineComments:r,rightSidebarStore:O,onAddDiffLineComment:w,onCloseAllFiles:b,onCloseFile:x,onCloseFilesToRight:S,onCloseOtherFiles:C,onOpenFile:T,onReorderFiles:E}):null})]}):null}):null]})]})}function Nme(e){return e.cwd}function Pme(e){return e.fileActivePath}function Fme(e){return e.activeTab}function Ime(e){return e.filePreviewPath}function Lme(e){return e.fileTreeCollapsed}var Rme=q.memo(function(e){let t=(0,Y.c)(173),{actionsRef:n,defaultNewSessionDirectory:r,displaySessionCwd:i,gitPanelOpen:a,loadingDisplaySessionTitle:o,currentSessionPinned:s,displaySettingsStore:c,isSessionViewLoading:l,newSessionDirectoryOptions:u,onToggleGitPanel:d,sessionStore:f,viewerContextId:p}=e,m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m={compare:mg},t[0]=m):m=t[0];let h=_a(f,zme,m),g=_a(c,Bme),{isMobile:_,openMobile:v,state:y}=Xc(),b=!(_?v:y===`expanded`),x;t[1]!==l||t[2]!==o||t[3]!==h?(x=l?o:hg(h),t[1]=l,t[2]=o,t[3]=h,t[4]=x):x=t[4];let S=x,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L,R,z;if(t[5]!==n||t[6]!==s||t[7]!==r||t[8]!==i||t[9]!==S||t[10]!==l||t[11]!==u||t[12]!==h.sessionHasFile||t[13]!==h.sessionStreaming||t[14]!==b||t[15]!==p){let e;t[33]===i?e=t[34]:(e=e=>e.path!==i,t[33]=i,t[34]=e);let a=u.filter(e);M=`sticky top-0 z-50 flex h-[var(--header-height)] w-full shrink-0 items-center border-b border-border/70 bg-background p-2`,O=`relative flex w-full items-center gap-1`,t[35]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,J.jsx)(tl,{className:`shrink-0`}),t[35]=k):k=t[35],t[36]!==n||t[37]!==r||t[38]!==b?(A=b?(0,J.jsx)(tn,{title:r?`Create a new session in ${sg(r)}`:`Create a new session`,kbd:Ah(`Control+N`),children:(0,J.jsx)(ws,{size:`icon`,variant:`ghost`,className:`shrink-0`,"aria-label":`Create a new session`,onClick:()=>{n.current.createSession()},children:(0,J.jsx)(So,{})})}):null,t[36]=n,t[37]=r,t[38]=b,t[39]=A):A=t[39];let o;t[40]!==l||t[41]!==h.sessionStreaming?(o=!l&&h.sessionStreaming?(0,J.jsx)(Rn,{className:`size-3.5 shrink-0`,"aria-label":`Session streaming`}):null,t[40]=l,t[41]=h.sessionStreaming,t[42]=o):o=t[42];let c;t[43]===S?c=t[44]:(c=(0,J.jsx)(`h2`,{className:`min-w-0 truncate text-[13px] leading-tight font-semibold`,children:S}),t[43]=S,t[44]=c);let d;t[45]!==S||t[46]!==c?(d=(0,J.jsx)(tn,{title:S,children:c}),t[45]=S,t[46]=c,t[47]=d):d=t[47];let f;t[48]!==o||t[49]!==d?(f=(0,J.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center justify-center gap-1.5`,children:[o,d]}),t[48]=o,t[49]=d,t[50]=f):f=t[50];let m;t[51]===i?m=t[52]:(m=i?(0,J.jsx)(`span`,{className:`inline-flex min-w-0 items-center text-xs text-muted-foreground`,children:(0,J.jsx)(`span`,{className:`truncate`,children:cg(i)})}):null,t[51]=i,t[52]=m);let g;t[53]!==i||t[54]!==p?(g=(0,J.jsx)(DX,{viewerContextId:p,cwd:i}),t[53]=i,t[54]=p,t[55]=g):g=t[55];let _;t[56]!==m||t[57]!==g?(_=(0,J.jsxs)(`div`,{className:`flex max-w-full min-w-0 items-center justify-center gap-x-3`,children:[m,g]}),t[56]=m,t[57]=g,t[58]=_):_=t[58],t[59]!==f||t[60]!==_?(j=(0,J.jsxs)(`div`,{className:`absolute left-1/2 flex w-max max-w-[calc(100%-4rem)] -translate-x-1/2 flex-col items-center justify-center gap-0 text-center`,children:[f,_]}),t[59]=f,t[60]=_,t[61]=j):j=t[61],E=`ml-auto flex flex-wrap items-center gap-1`,t[62]!==i||t[63]!==p?(D=(0,J.jsx)(OX,{viewerContextId:p,cwd:i}),t[62]=i,t[63]=p,t[64]=D):D=t[64],w=ty,t[65]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,J.jsx)(tn,{title:`Session menu`,children:(0,J.jsx)(ny,{render:(0,J.jsx)(ws,{size:`icon`,variant:`ghost`,"aria-label":`Session menu`}),children:(0,J.jsx)(ao,{})})}),t[65]=T):T=t[65],C=ry,N=`end`,P=`w-56`;let v;t[66]===n?v=t[67]:(v=()=>{n.current.createSession()},t[66]=n,t[67]=v);let y;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,J.jsx)(`span`,{children:`Create new session`}),t[68]=y):y=t[68];let x;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,J.jsx)(dy,{children:Ah(`Control+N`)}),t[69]=x):x=t[69],t[70]===v?F=t[71]:(F=(0,J.jsxs)(oy,{onClick:v,children:[y,x]}),t[70]=v,t[71]=F),t[72]!==n||t[73]!==r||t[74]!==u?(I=u.length>0?(0,J.jsxs)(sy,{children:[(0,J.jsx)(cy,{children:`New session in…`}),(0,J.jsx)(ly,{className:`w-72`,children:u.map(e=>(0,J.jsxs)(oy,{onClick:()=>{n.current.createSession(e.path)},children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,J.jsx)(`span`,{className:`truncate`,children:sg(e.path)})]}),e.path===r?(0,J.jsx)(dy,{children:`Default`}):null]},e.path))})]}):null,t[72]=n,t[73]=r,t[74]=u,t[75]=I):I=t[75],t[76]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(uy,{}),t[76]=L):L=t[76];let B=!h.sessionHasFile,V;t[77]===n?V=t[78]:(V=()=>{n.current.onToggleCurrentSessionPinned()},t[77]=n,t[78]=V);let H=s?`Unpin from sidebar`:`Pin to sidebar`,U;t[79]===H?U=t[80]:(U=(0,J.jsx)(`span`,{children:H}),t[79]=H,t[80]=U),t[81]!==B||t[82]!==V||t[83]!==U?(R=(0,J.jsx)(oy,{disabled:B,onClick:V,children:U}),t[81]=B,t[82]=V,t[83]=U,t[84]=R):R=t[84],z=h.sessionHasFile?(0,J.jsxs)(sy,{children:[(0,J.jsx)(cy,{children:`Move to…`}),(0,J.jsxs)(ly,{className:`w-72`,children:[a.map(e=>(0,J.jsx)(oy,{onClick:()=>{n.current.onMoveCurrentSession(e.path)},children:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.label}),(0,J.jsx)(`span`,{className:`truncate`,children:sg(e.path)})]})},e.path)),(0,J.jsx)(oy,{onClick:()=>{n.current.onMoveCurrentSessionToAnyDirectory()},children:`Other directory…`})]})]}):null,t[5]=n,t[6]=s,t[7]=r,t[8]=i,t[9]=S,t[10]=l,t[11]=u,t[12]=h.sessionHasFile,t[13]=h.sessionStreaming,t[14]=b,t[15]=p,t[16]=C,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O,t[22]=k,t[23]=A,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 C=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21],k=t[22],A=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[85]===n?B=t[86]:(B=()=>{n.current.onRunCompact()},t[85]=n,t[86]=B);let V;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,J.jsx)(`span`,{children:`Compact session`}),t[87]=V):V=t[87];let H;t[88]===B?H=t[89]:(H=(0,J.jsx)(oy,{onClick:B,children:V}),t[88]=B,t[89]=H);let U;t[90]===n?U=t[91]:(U=()=>{n.current.onTreeSession()},t[90]=n,t[91]=U);let ee,te;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,J.jsx)(`span`,{children:`Tree`}),te=(0,J.jsx)(dy,{children:`Esc Esc`}),t[92]=ee,t[93]=te):(ee=t[92],te=t[93]);let ne;t[94]===U?ne=t[95]:(ne=(0,J.jsxs)(oy,{onClick:U,children:[ee,te]}),t[94]=U,t[95]=ne);let re;t[96]===n?re=t[97]:(re=()=>{n.current.onForkSession()},t[96]=n,t[97]=re);let W;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,J.jsx)(`span`,{children:`Fork`}),t[98]=W):W=t[98];let ie;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,J.jsx)(dy,{children:Ah(`Control+F`)}),t[99]=ie):ie=t[99];let ae;t[100]===re?ae=t[101]:(ae=(0,J.jsxs)(oy,{onClick:re,children:[W,ie]}),t[100]=re,t[101]=ae);let oe;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,J.jsx)(uy,{}),t[102]=oe):oe=t[102];let se;t[103]===n?se=t[104]:(se=()=>{n.current.onToggleHideThinking()},t[103]=n,t[104]=se);let ce=h.hideThinkingBlock?`Show thinking`:`Hide thinking`,le;t[105]===ce?le=t[106]:(le=(0,J.jsx)(`span`,{children:ce}),t[105]=ce,t[106]=le);let ue;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,J.jsx)(dy,{children:Ah(`Control+T`)}),t[107]=ue):ue=t[107];let de;t[108]!==se||t[109]!==le?(de=(0,J.jsxs)(oy,{onClick:se,children:[le,ue]}),t[108]=se,t[109]=le,t[110]=de):de=t[110];let fe;t[111]===n?fe=t[112]:(fe=()=>{n.current.onToggleHideToolBlocks()},t[111]=n,t[112]=fe);let pe=g?`Show tools`:`Hide tools`,me;t[113]===pe?me=t[114]:(me=(0,J.jsx)(`span`,{children:pe}),t[113]=pe,t[114]=me);let he;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,J.jsx)(dy,{children:Ah(`Control+O`)}),t[115]=he):he=t[115];let ge;t[116]!==fe||t[117]!==me?(ge=(0,J.jsxs)(oy,{onClick:fe,children:[me,he]}),t[116]=fe,t[117]=me,t[118]=ge):ge=t[118];let _e;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,J.jsx)(uy,{}),t[119]=_e):_e=t[119];let ve=!h.sessionHasFile,ye;t[120]===n?ye=t[121]:(ye=()=>{n.current.onRenameSession()},t[120]=n,t[121]=ye);let be;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,J.jsx)(`span`,{children:`Rename session`}),t[122]=be):be=t[122];let G;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,J.jsx)(dy,{children:Ah(`Control+E`)}),t[123]=G):G=t[123];let xe;t[124]!==ve||t[125]!==ye?(xe=(0,J.jsxs)(oy,{disabled:ve,onClick:ye,children:[be,G]}),t[124]=ve,t[125]=ye,t[126]=xe):xe=t[126];let Se=!h.sessionHasFile,Ce;t[127]===n?Ce=t[128]:(Ce=()=>{n.current.onDeleteCurrentSession()},t[127]=n,t[128]=Ce);let we;t[129]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,J.jsx)(`span`,{children:`Delete session`}),t[129]=we):we=t[129];let Te;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,J.jsx)(dy,{children:Ah(`Control+X`)}),t[130]=Te):Te=t[130];let Ee;t[131]!==Se||t[132]!==Ce?(Ee=(0,J.jsxs)(oy,{variant:`destructive`,disabled:Se,onClick:Ce,children:[we,Te]}),t[131]=Se,t[132]=Ce,t[133]=Ee):Ee=t[133];let De;t[134]!==C||t[135]!==H||t[136]!==ne||t[137]!==ae||t[138]!==N||t[139]!==de||t[140]!==ge||t[141]!==P||t[142]!==xe||t[143]!==F||t[144]!==Ee||t[145]!==I||t[146]!==L||t[147]!==R||t[148]!==z?(De=(0,J.jsxs)(C,{align:N,className:P,children:[F,I,L,R,z,H,ne,ae,oe,de,ge,_e,xe,Ee]}),t[134]=C,t[135]=H,t[136]=ne,t[137]=ae,t[138]=N,t[139]=de,t[140]=ge,t[141]=P,t[142]=xe,t[143]=F,t[144]=Ee,t[145]=I,t[146]=L,t[147]=R,t[148]=z,t[149]=De):De=t[149];let Oe;t[150]!==w||t[151]!==T||t[152]!==De?(Oe=(0,J.jsxs)(w,{children:[T,De]}),t[150]=w,t[151]=T,t[152]=De,t[153]=Oe):Oe=t[153];let ke;t[154]===Symbol.for(`react.memo_cache_sentinel`)?(ke=Ah(`Control+\\`),t[154]=ke):ke=t[154];let Ae;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,J.jsx)(lee,{}),t[155]=Ae):Ae=t[155];let je;t[156]!==a||t[157]!==d?(je=(0,J.jsx)(tn,{title:`Toggle right sidebar`,kbd:ke,children:(0,J.jsx)(ws,{size:`icon`,variant:`ghost`,className:`hidden md:inline-flex`,"aria-pressed":a,"aria-label":`Toggle right sidebar`,onClick:d,children:Ae})}),t[156]=a,t[157]=d,t[158]=je):je=t[158];let Me;t[159]!==E||t[160]!==D||t[161]!==Oe||t[162]!==je?(Me=(0,J.jsxs)(`div`,{className:E,children:[D,Oe,je]}),t[159]=E,t[160]=D,t[161]=Oe,t[162]=je,t[163]=Me):Me=t[163];let Ne;t[164]!==O||t[165]!==k||t[166]!==A||t[167]!==j||t[168]!==Me?(Ne=(0,J.jsxs)(`div`,{className:O,children:[k,A,j,Me]}),t[164]=O,t[165]=k,t[166]=A,t[167]=j,t[168]=Me,t[169]=Ne):Ne=t[169];let Pe;return t[170]!==M||t[171]!==Ne?(Pe=(0,J.jsx)(`div`,{className:M,children:Ne}),t[170]=M,t[171]=Ne,t[172]=Pe):Pe=t[172],Pe});function zme(e){return{firstMessage:e.firstMessage,hideThinkingBlock:e.hideThinkingBlock,sessionHasFile:!!e.sessionFile,sessionName:e.sessionName,sessionStreaming:e.streaming}}function Bme(e){return e.hideToolBlocks}var Vme=250,Hme=1e3,e9=1e3,t9=60*e9,n9=60*t9,r9=24*n9,Ume=7*r9,Wme=30*r9,Gme=365*r9;function Kme(e,t){let n=(0,Y.c)(4),[r,i]=q.useState(!1),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!e){i(!1);return}let n=window.setTimeout(()=>{i(!0)},t);return()=>{window.clearTimeout(n)}},o=[t,e],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),q.useEffect(a,o),r}function qme(e){return e.replace(/^\/Users\/[^/]+(?=\/|$)/,`~`).replace(/^\/home\/[^/]+(?=\/|$)/,`~`)}function Jme(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 Yme(e){let t=(0,Y.c)(10),{path:n}=e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=qme(n),i=Jme(r),t[0]=n,t[1]=r,t[2]=i);let{leading:a,trailing:o}=i,s;t[3]===a?s=t[4]:(s=a?(0,J.jsx)(`span`,{className:`truncate text-sidebar-foreground/60`,children:a}):null,t[3]=a,t[4]=s);let c=o||r,l;t[5]===c?l=t[6]:(l=(0,J.jsx)(`span`,{className:`shrink-0 font-medium`,children:c}),t[5]=c,t[6]=l);let u;return t[7]!==s||t[8]!==l?(u=(0,J.jsx)(`span`,{className:`block min-w-0 text-sm text-sidebar-foreground`,children:(0,J.jsxs)(`span`,{className:`flex min-w-0 items-center`,children:[s,l]})}),t[7]=s,t[8]=l,t[9]=u):u=t[9],u}var i9=[],a9=`__pico_pinned_sessions__`,o9=`__pico_directories__`;function Xme(){if(typeof window>`u`)return!1;let e=window.navigator.platform||window.navigator.userAgent;return/mac|iphone|ipad|ipod/i.test(e)}function Zme(e){return Xme()?e.metaKey:e.ctrlKey}function s9(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?``:`in `;if(a<60)return`${o}${a}s`;let s=Math.floor(a/60);if(s<60)return`${o}${s}m`;let c=Math.floor(s/60);if(c<24)return`${o}${c}h`;let l=Math.floor(c/24);if(l<7)return`${o}${l}d`;let u=Math.floor(l/7);if(u<5)return`${o}${u}w`;let d=Math.floor(l/30);if(d<12)return`${o}${Math.max(1,d)}mo`;let f=Math.floor(l/365);return`${o}${Math.max(1,f)}y`}function Qme(e){return e?!Number.isNaN(new Date(e).getTime()):!1}function $me(e){let t=Math.max(1,Math.floor(e/e9));if(t<60)return e9;let n=Math.floor(t/60);if(n<60)return t9;let r=Math.floor(n/60);if(r<24)return n9;let i=Math.floor(r/24);return i<7?r9:Math.floor(i/7)<5?Ume:Math.floor(i/30)<12?Wme:Gme}function ehe(e,t=Date.now()){let n=t-e,r=Math.abs(n),i=$me(r),a=r%i,o=n>=0?i-a:a||i;return Math.max(Hme,o)}function the(e){let t=(0,Y.c)(18),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({value:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===i?a=t[5]:(a=i?new Date(i).getTime():NaN,t[4]=i,t[5]=a);let o=a,s;t[6]===i?s=t[7]:(s=()=>s9(i),t[6]=i,t[7]=s);let[c,l]=q.useState(s),u,d;if(t[8]!==o||t[9]!==i?(u=()=>{if(Number.isNaN(o)){l(``);return}let e,t=!1,n=()=>{if(t)return;let r=Date.now();l(s9(i,r)),e=window.setTimeout(n,ehe(o,r))};return n(),()=>{t=!0,e!==void 0&&window.clearTimeout(e)}},d=[o,i],t[8]=o,t[9]=i,t[10]=u,t[11]=d):(u=t[10],d=t[11]),q.useEffect(u,d),!c)return null;let f;t[12]===n?f=t[13]:(f=G(`tabular-nums`,n),t[12]=n,t[13]=f);let p;return t[14]!==c||t[15]!==r||t[16]!==f?(p=(0,J.jsx)(`span`,{className:f,...r,children:c}),t[14]=c,t[15]=r,t[16]=f,t[17]=p):p=t[17],p}function c9(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function nhe(e,t){let n=Object.keys(e).sort();return c9(n,Object.keys(t).sort())?n.every(n=>!!e[n]==!!t[n]):!1}function rhe(){let e=_g({},nhe),t=()=>{Te(xn,JSON.stringify(e.state))};return Object.assign(e,{loadStored(){yg(e,ke())},toggle(t){e.setCollapsed(t,!e.state[t])},setCollapsed(n,r){yg(e,e=>{if(!!e[n]===r)return e;let t={...e};return r?t[n]=!0:delete t[n],t}),t()},setAll(n,r){yg(e,e=>{let t=!1,i={...e};for(let e of n)if(r){if(i[e])continue;i[e]=!0,t=!0}else{if(!i[e])continue;delete i[e],t=!0}return t?i:e}),t()},remove(n){yg(e,e=>{if(!e[n])return e;let t={...e};return delete t[n],t}),t()}}),e}function l9(e,t,n){let r=(0,Y.c)(3),i;return r[0]!==t||r[1]!==n?(i=e=>n?!1:!!e[t],r[0]=t,r[1]=n,r[2]=i):i=r[2],_a(e,i)}function ihe(e,t){let n=(0,Y.c)(2),r;return n[0]===t?r=n[1]:(r=e=>t.length>0&&t.every(t=>e[t]),n[0]=t,n[1]=r),_a(e,r)}function ahe(e){let t=(0,Y.c)(20),{id:n,disabled:r,children:i}=e,a;t[0]===n?a=t[1]:(a={type:`directory`,directory:n},t[0]=n,t[1]=a);let o;t[2]!==n||t[3]!==a?(o={id:n,data:a},t[2]=n,t[3]=a,t[4]=o):o=t[4];let{attributes:s,listeners:c,setNodeRef:l,transform:u,transition:d,isDragging:f}=O5(o),p;t[5]===u?p=t[6]:(p=s8.Transform.toString(u),t[5]=u,t[6]=p);let m;t[7]!==p||t[8]!==d?(m={transform:p,transition:d},t[7]=p,t[8]=d,t[9]=m):m=t[9];let h;t[10]!==s||t[11]!==i||t[12]!==r||t[13]!==f||t[14]!==c?(h=i({attributes:r?{}:s,listeners:r?{}:c,isDragging:r?!1:f}),t[10]=s,t[11]=i,t[12]=r,t[13]=f,t[14]=c,t[15]=h):h=t[15];let g;return t[16]!==l||t[17]!==m||t[18]!==h?(g=(0,J.jsx)(`div`,{ref:l,style:m,children:h}),t[16]=l,t[17]=m,t[18]=h,t[19]=g):g=t[19],g}function ohe(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function she(){let e=_g(new Set,ohe);return Object.assign(e,{setKeys(t){yg(e,new Set(t.filter(Boolean)))}}),e}function che(e){let t=e?.trim()||``;return t?t.startsWith(`path:`)||t.startsWith(`id:`)?t:t.includes(`/`)||t.includes(`\\`)?r({path:t}):t:``}function lhe(){let e=_g({sessionId:``,sessionKey:``});return Object.assign(e,{setActive(t){let n=t.sessionId||``,r=che(t.sessionKey);yg(e,e=>e.sessionId===n&&e.sessionKey===r?e:{sessionId:n,sessionKey:r})}}),e}function uhe(e,t){let n=(0,Y.c)(2),r;return n[0]===t?r=n[1]:(r=e=>!!(t&&e.has(t)),n[0]=t,n[1]=r),_a(e,r)}function dhe(e,t,n){let r=(0,Y.c)(3),i;return r[0]!==t||r[1]!==n?(i=e=>e.sessionKey&&t===e.sessionKey?!0:!!(e.sessionId&&n===e.sessionId),r[0]=t,r[1]=n,r[2]=i):i=r[2],_a(e,i)}function u9({entryKey:e,directorySessionsStore:t,activeSessionStore:n,selectedSessionKeyStore:r,isPinned:i,isMobile:a,overlay:o,moveTargetDirectories:s,setOpenMobile:c,onSessionClick:l,onRenameSession:u,onDeleteSession:d,onSetSessionUnread:f,onMoveSession:p,onMoveSessionAnyDirectory:m,onTogglePinnedSession:h}){let g=ghe(t,e),_=uhe(r,e),v=dhe(n,e,g?.id),y=h5({id:`session:${e}`,disabled:a||o||!g?.path,data:{type:`session`,entry:g,entryKey:e,sourceDirectory:g?.cwd||``}});if(!g)return null;let b=g.lastMessageAt||g.modified||g.lastUserMessageAt,x=Qme(b),S=g.lastMessagePreview?.trim()||``,C=i?sg(g.cwd?.trim()||g.path?.trim()||``):``,w=x&&b?new Date(b).toLocaleString():void 0,T=!!g.unread&&!g.streaming,E=!!(g.optimistic||g.id?.startsWith(`optimistic:`)&&!g.path),D=s.filter(e=>e&&e!==g.cwd),O=!!(g.path&&m),k=!!(g.path&&p)&&D.length>0||O,A=!!(!E&&h||g.path&&(u||d||f)||k)&&!o,j=(0,J.jsxs)(pl,{type:`button`,"data-sidebar-session-item":!0,"data-session-key":e,isActive:v||_,className:G(`relative h-auto min-w-0 items-start gap-2 py-2 pr-2 pl-8 not-data-active:hover:bg-transparent! not-data-active:hover:text-sidebar-foreground! not-data-active:data-open:hover:bg-transparent! not-data-active:data-open:hover:text-sidebar-foreground!`,(v||_)&&`bg-sidebar-accent text-sidebar-accent-foreground`),onClick:e=>{l?.(g,{multiSelectKey:Zme(e),shiftKey:e.shiftKey}),a&&c(!1)},children:[g.streaming?(0,J.jsx)(`span`,{className:`absolute top-2.5 left-2 flex size-4 items-center justify-center`,children:(0,J.jsx)(Rn,{className:`size-3.5`,"aria-label":`Session streaming`})}):T?(0,J.jsx)(`span`,{className:`absolute top-2.5 left-2 flex size-4 items-center justify-center`,children:(0,J.jsx)(`span`,{className:`size-2 rounded-full bg-primary`,"aria-label":`Session done`})}):null,(0,J.jsx)(`span`,{className:`flex min-w-0 flex-1 items-start gap-2`,children:(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate pr-16 font-medium`,children:g.title})}),S?(0,J.jsx)(`span`,{className:`min-w-0 truncate text-[11px] font-normal text-sidebar-foreground/50`,children:S}):null,C?(0,J.jsx)(`span`,{className:`min-w-0 truncate text-[11px] font-normal text-sidebar-foreground/50`,children:C}):null]})})]}),M=x?(0,J.jsx)(`span`,{className:`absolute top-2.5 right-2 z-10 flex min-w-4 items-center justify-end`,children:(0,J.jsx)(tn,{title:a?void 0:w,side:`right`,align:`center`,children:(0,J.jsx)(the,{value:b,className:`shrink-0 text-[11px] font-normal text-sidebar-foreground/50`})})}):null,N=(0,J.jsxs)(`div`,{ref:y.setNodeRef,className:G(`group/session relative`,y.isDragging&&!o&&`opacity-40`),style:{transform:s8.Translate.toString(y.transform)},...y.attributes,...y.listeners,children:[j,M]});return(0,J.jsx)(dl,{children:A?(0,J.jsxs)(A5,{children:[(0,J.jsx)(j5,{render:N}),(0,J.jsxs)(M5,{className:`w-44`,children:[h&&!E?(0,J.jsx)(F5,{onClick:()=>h(g),children:i?`Unpin`:`Pin to sidebar`}):null,f&&g.path?(0,J.jsx)(F5,{onClick:()=>f(g,!g.unread),children:g.unread?`Mark as read`:`Mark as unread`}):null,k?(0,J.jsxs)(sde,{children:[(0,J.jsx)(cde,{children:`Move to…`}),(0,J.jsxs)(lde,{className:`w-72`,children:[D.map(e=>(0,J.jsx)(F5,{onClick:()=>p?.(g,e),children:(0,J.jsx)(`span`,{className:`truncate`,children:sg(e)})},e)),O?(0,J.jsx)(F5,{onClick:()=>m?.(g),children:`Other directory…`}):null]})]}):null,u&&g.path?(0,J.jsx)(F5,{onClick:()=>u(g),children:`Rename`}):null,d&&g.path?(0,J.jsx)(F5,{variant:`destructive`,onClick:()=>d(g),children:`Delete`}):null]})]}):N})}function d9(e,t){return e===t?!0:!e||!t?!1:e.path===t.path&&e.id===t.id&&e.cwd===t.cwd&&e.name===t.name&&e.title===t.title&&e.modified===t.modified&&e.lastUserMessageAt===t.lastUserMessageAt&&e.lastMessageAt===t.lastMessageAt&&e.lastMessagePreview===t.lastMessagePreview&&e.messageCount===t.messageCount&&JSON.stringify(e.contextUsage??null)===JSON.stringify(t.contextUsage??null)&&!!e.streaming==!!t.streaming&&!!e.unread==!!t.unread&&!!e.optimistic==!!t.optimistic}function f9(e){let t=new Map;for(let n of Object.values(e))for(let e of n){let n=r(e);!n||t.has(n)||t.set(n,e)}return t}function p9(e){let t={};for(let[n,i]of Object.entries(e))t[n]=i.flatMap(e=>{let t=r(e);return t?[t]:[]});return t}function fhe(e,t){return e.isLoadingSessions===t.isLoadingSessions&&c9(e.sessionKeys,t.sessionKeys)}function phe(e,t){let n=new Set([...Object.keys(e.sessionKeysByDirectory),...Object.keys(e.loadingByDirectory),...Object.keys(t.sessionKeysByDirectory),...Object.keys(t.loadingByDirectory)]);for(let r of n)if(!c9(e.sessionKeysByDirectory[r]??i9,t.sessionKeysByDirectory[r]??i9)||!!e.loadingByDirectory[r]!=!!t.loadingByDirectory[r])return!1;let r=new Set([...e.entriesByKey.keys(),...t.entriesByKey.keys()]);for(let n of r)if(!d9(e.entriesByKey.get(n),t.entriesByKey.get(n)))return!1;return!0}function mhe(e,t){let n=_g({sessionKeysByDirectory:p9(e),entriesByKey:f9(e),loadingByDirectory:t},phe);return Object.assign(n,{setData(e,t){yg(n,{sessionKeysByDirectory:p9(e),entriesByKey:f9(e),loadingByDirectory:t})}}),n}function hhe(e,t){let n=(0,Y.c)(3),r;n[0]===t?r=n[1]:(r=e=>({sessionKeys:e.sessionKeysByDirectory[t]??i9,isLoadingSessions:!!e.loadingByDirectory[t]}),n[0]=t,n[1]=r);let i;return n[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={compare:fhe},n[2]=i):i=n[2],_a(e,r,i)}function ghe(e,t){let n=(0,Y.c)(3),r;n[0]===t?r=n[1]:(r=e=>e.entriesByKey.get(t),n[0]=t,n[1]=r);let i;return n[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={compare:d9},n[2]=i):i=n[2],_a(e,r,i)}var m9=q.memo(function(e){let t=(0,Y.c)(68),{directory:n,directorySessionsStore:r,collapsedDirectoryStore:i,searchActive:a,moveTargetDirectories:o,activeSessionStore:s,selectedSessionKeyStore:c,pinnedSessionKeys:l,isMobile:u,setOpenMobile:d,isDragging:f,isSessionDropTarget:p,overlay:m,attributes:h,listeners:g,onSessionClick:_,onRenameSession:v,onDeleteSession:y,onSetSessionUnread:b,onMoveSession:x,onMoveSessionAnyDirectory:S,onTogglePinnedSession:C,onCreateSessionInDirectory:w,onDeleteOldSessionsInDirectory:T,onRemoveDirectory:E}=e,D=m===void 0?!1:m,[O,k]=q.useState(5),{isLoadingSessions:A,sessionKeys:j}=hhe(r,n),M=l9(i,n,a),N;t[0]===l?N=t[1]:(N=new Set(l),t[0]=l,t[1]=N);let P=N,F;t[2]===P?F=t[3]:(F=e=>!P.has(e),t[2]=P,t[3]=F);let I=j.filter(F),L=a?I.length:Math.min(I.length,O),R=I.slice(0,L),z=L<I.length,B=Kme(A,Vme),V=A&&j.length===0,H=B&&I.length===0&&M,U=!D&&!!(w||T||E),ee;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(ee=G(`group/directory-label flex min-w-0 flex-1 cursor-default items-center gap-2 text-left text-sm text-sidebar-foreground`),t[4]=ee):ee=t[4];let te=a||D,ne;t[5]===h?ne=t[6]:(ne=h??{},t[5]=h,t[6]=ne);let re;t[7]===g?re=t[8]:(re=g??{},t[7]=g,t[8]=re);let W;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,J.jsx)(lo,{className:`size-4 shrink-0 text-sidebar-foreground/50`}),t[9]=W):W=t[9];let ie;t[10]===n?ie=t[11]:(ie=(0,J.jsx)(`span`,{className:`max-w-full min-w-0`,children:(0,J.jsx)(Yme,{path:n})}),t[10]=n,t[11]=ie);let ae;t[12]!==M||t[13]!==D||t[14]!==a?(ae=!a&&!D?M?(0,J.jsx)($a,{className:`size-4 shrink-0 opacity-0 transition-opacity group-hover/directory-label:opacity-100 group-focus-visible/directory-label:opacity-100`}):(0,J.jsx)(Qa,{className:`size-4 shrink-0 opacity-0 transition-opacity group-hover/directory-label:opacity-100 group-focus-visible/directory-label:opacity-100`}):null,t[12]=M,t[13]=D,t[14]=a,t[15]=ae):ae=t[15];let oe;t[16]===H?oe=t[17]:(oe=H?(0,J.jsx)(Rn,{className:`size-3.5 shrink-0`}):null,t[16]=H,t[17]=oe);let se;t[18]!==ae||t[19]!==oe||t[20]!==te||t[21]!==ne||t[22]!==re||t[23]!==ie?(se=(0,J.jsxs)(vq,{type:`button`,className:ee,disabled:te,...ne,...re,children:[W,ie,ae,oe]}),t[18]=ae,t[19]=oe,t[20]=te,t[21]=ne,t[22]=re,t[23]=ie,t[24]=se):se=t[24];let ce;t[25]!==n||t[26]!==u||t[27]!==w||t[28]!==D?(ce=w&&!D&&!u?(0,J.jsx)(tn,{title:`Create a session in ${n}`,children:(0,J.jsx)(ws,{size:`icon`,variant:`ghost`,className:`shrink-0 hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`,onClick:()=>w(n),children:(0,J.jsx)(So,{className:`size-4`})})}):null,t[25]=n,t[26]=u,t[27]=w,t[28]=D,t[29]=ce):ce=t[29];let le;t[30]!==n||t[31]!==U||t[32]!==u||t[33]!==w||t[34]!==T||t[35]!==E?(le=U&&u?(0,J.jsxs)(ty,{children:[(0,J.jsx)(ny,{render:(0,J.jsx)(ws,{size:`icon`,variant:`ghost`,className:`shrink-0 hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`,"aria-label":`Directory actions for ${n}`}),children:(0,J.jsx)(io,{className:`size-4`})}),(0,J.jsxs)(ry,{align:`end`,className:`w-48`,children:[w?(0,J.jsx)(oy,{onClick:()=>w(n),children:`New session`}):null,T?(0,J.jsx)(oy,{onClick:()=>T(n),children:`Delete old sessions…`}):null,E?(0,J.jsx)(oy,{variant:`destructive`,onClick:()=>E(n),children:`Remove from sidebar`}):null]})]}):null,t[30]=n,t[31]=U,t[32]=u,t[33]=w,t[34]=T,t[35]=E,t[36]=le):le=t[36];let ue;t[37]!==se||t[38]!==ce||t[39]!==le?(ue=(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg`,children:[se,ce,le]}),t[37]=se,t[38]=ce,t[39]=le,t[40]=ue):ue=t[40];let de=ue,fe=_q,pe=!M,me;t[41]!==i||t[42]!==n||t[43]!==D||t[44]!==a?(me=e=>{a||D||i.setCollapsed(n,!e)},t[41]=i,t[42]=n,t[43]=D,t[44]=a,t[45]=me):me=t[45];let he=D&&`bg-sidebar shadow-lg ring-1 ring-sidebar-border/70`,ge=p&&!D&&`bg-sidebar-accent/40 ring-1 ring-sidebar-ring/50`,_e=f&&!D&&`opacity-0`,ve;t[46]!==he||t[47]!==ge||t[48]!==_e?(ve=G(`rounded-lg py-1`,he,ge,_e),t[46]=he,t[47]=ge,t[48]=_e,t[49]=ve):ve=t[49];let ye=sl,be;t[50]!==n||t[51]!==de||t[52]!==U||t[53]!==u||t[54]!==w||t[55]!==T||t[56]!==E?(be=U&&!u?(0,J.jsxs)(A5,{children:[(0,J.jsx)(j5,{render:de}),(0,J.jsxs)(M5,{className:`w-48`,children:[w?(0,J.jsx)(F5,{onClick:()=>w(n),children:`New session`}):null,T?(0,J.jsx)(F5,{onClick:()=>T(n),children:`Delete old sessions…`}):null,E?(0,J.jsx)(F5,{variant:`destructive`,onClick:()=>E(n),children:`Remove from sidebar`}):null]})]}):de,t[50]=n,t[51]=de,t[52]=U,t[53]=u,t[54]=w,t[55]=T,t[56]=E,t[57]=be):be=t[57];let xe=D?null:(0,J.jsx)(yq,{children:(0,J.jsx)(ll,{children:V?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 p-2 text-sm text-sidebar-foreground/70`,children:[B?(0,J.jsx)(Rn,{}):(0,J.jsx)(`span`,{className:`size-4`,"aria-hidden":`true`}),`Loading sessions…`]}):I.length>0?(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(ul,{children:R.map(e=>(0,J.jsx)(u9,{entryKey:e,directorySessionsStore:r,activeSessionStore:s,selectedSessionKeyStore:c,isPinned:l.includes(e),isMobile:u,overlay:D,moveTargetDirectories:o,setOpenMobile:d,onSessionClick:_,onRenameSession:v,onDeleteSession:y,onSetSessionUnread:b,onMoveSession:x,onMoveSessionAnyDirectory:S,onTogglePinnedSession:C},e))}),z?(0,J.jsxs)(ws,{variant:`ghost`,className:`h-8 justify-start pl-8 text-sidebar-foreground/60 hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`,onClick:()=>{k(e=>Math.min(I.length,e+5))},children:[`Show`,` `,Math.min(5,I.length-L),` `,`more`]}):null]}):(0,J.jsx)(`div`,{className:`p-2 text-sm text-sidebar-foreground/70`,children:a?`No matching unpinned sessions.`:`No unpinned sessions.`})})}),Se;t[58]!==ye||t[59]!==be||t[60]!==xe?(Se=(0,J.jsxs)(ye,{className:`py-0`,children:[be,xe]}),t[58]=ye,t[59]=be,t[60]=xe,t[61]=Se):Se=t[61];let Ce;return t[62]!==fe||t[63]!==pe||t[64]!==me||t[65]!==ve||t[66]!==Se?(Ce=(0,J.jsx)(fe,{open:pe,onOpenChange:me,className:ve,children:Se}),t[62]=fe,t[63]=pe,t[64]=me,t[65]=ve,t[66]=Se,t[67]=Ce):Ce=t[67],Ce});function _he(e){let t=(0,Y.c)(53),{pinnedSessionKeys:n,directorySessionsStore:r,collapsedDirectoryStore:i,searchActive:a,activeSessionStore:o,selectedSessionKeyStore:s,isMobile:c,moveTargetDirectories:l,setOpenMobile:u,onSessionClick:d,onRenameSession:f,onDeleteSession:p,onSetSessionUnread:m,onMoveSession:h,onMoveSessionAnyDirectory:g,onTogglePinnedSession:_}=e,v=l9(i,a9,a);if(n.length===0)return null;let y=!v,b;t[0]!==i||t[1]!==a?(b=e=>{a||i.setCollapsed(a9,!e)},t[0]=i,t[1]=a,t[2]=b):b=t[2];let x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,J.jsx)(vq,{className:`group/pinned-label justify-between gap-3`}),t[3]=x):x=t[3];let S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:`Pinned`}),t[4]=S):S=t[4];let C;t[5]!==v||t[6]!==a?(C=a?null:v?(0,J.jsx)($a,{className:`size-4 shrink-0 opacity-0 transition-opacity group-hover/pinned-label:opacity-100 group-focus-visible/pinned-label:opacity-100`}):(0,J.jsx)(Qa,{className:`size-4 shrink-0 opacity-0 transition-opacity group-hover/pinned-label:opacity-100 group-focus-visible/pinned-label:opacity-100`}),t[5]=v,t[6]=a,t[7]=C):C=t[7];let w;t[8]===C?w=t[9]:(w=(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2 text-left`,children:[S,C]}),t[8]=C,t[9]=w);let T;t[10]===n.length?T=t[11]:(T=(0,J.jsx)(`span`,{className:`text-[11px] font-normal text-sidebar-foreground/50`,children:n.length}),t[10]=n.length,t[11]=T);let E;t[12]!==w||t[13]!==T?(E=(0,J.jsxs)(cl,{render:x,children:[w,T]}),t[12]=w,t[13]=T,t[14]=E):E=t[14];let D;if(t[15]!==o||t[16]!==r||t[17]!==c||t[18]!==l||t[19]!==p||t[20]!==h||t[21]!==g||t[22]!==f||t[23]!==d||t[24]!==m||t[25]!==_||t[26]!==n||t[27]!==s||t[28]!==u){let e;t[30]!==o||t[31]!==r||t[32]!==c||t[33]!==l||t[34]!==p||t[35]!==h||t[36]!==g||t[37]!==f||t[38]!==d||t[39]!==m||t[40]!==_||t[41]!==s||t[42]!==u?(e=e=>(0,J.jsx)(u9,{entryKey:e,directorySessionsStore:r,activeSessionStore:o,selectedSessionKeyStore:s,isPinned:!0,isMobile:c,overlay:!1,moveTargetDirectories:l,setOpenMobile:u,onSessionClick:d,onRenameSession:f,onDeleteSession:p,onSetSessionUnread:m,onMoveSession:h,onMoveSessionAnyDirectory:g,onTogglePinnedSession:_},e),t[30]=o,t[31]=r,t[32]=c,t[33]=l,t[34]=p,t[35]=h,t[36]=g,t[37]=f,t[38]=d,t[39]=m,t[40]=_,t[41]=s,t[42]=u,t[43]=e):e=t[43],D=n.map(e),t[15]=o,t[16]=r,t[17]=c,t[18]=l,t[19]=p,t[20]=h,t[21]=g,t[22]=f,t[23]=d,t[24]=m,t[25]=_,t[26]=n,t[27]=s,t[28]=u,t[29]=D}else D=t[29];let O;t[44]===D?O=t[45]:(O=(0,J.jsx)(yq,{children:(0,J.jsx)(ll,{children:(0,J.jsx)(ul,{children:D})})}),t[44]=D,t[45]=O);let k;t[46]!==O||t[47]!==E?(k=(0,J.jsxs)(sl,{className:`py-1`,children:[E,O]}),t[46]=O,t[47]=E,t[48]=k):k=t[48];let A;return t[49]!==y||t[50]!==k||t[51]!==b?(A=(0,J.jsx)(_q,{open:y,onOpenChange:b,children:k}),t[49]=y,t[50]=k,t[51]=b,t[52]=A):A=t[52],A}function vhe(e){let t=(0,Y.c)(14),{searchActive:n,visibleDirectories:r,collapsedDirectoryStore:i}=e,a=ihe(i,r),o=a?`Expand all directories`:`Collapse all directories`,s=n||r.length===0,c;t[0]!==a||t[1]!==i||t[2]!==r?(c=()=>{i.setAll(r,!a)},t[0]=a,t[1]=i,t[2]=r,t[3]=c):c=t[3];let l;t[4]===a?l=t[5]:(l=a?(0,J.jsx)(to,{}):(0,J.jsx)(eo,{}),t[4]=a,t[5]=l);let u;t[6]!==s||t[7]!==c||t[8]!==l||t[9]!==o?(u=(0,J.jsx)(ws,{size:`icon`,variant:`ghost`,className:`text-sidebar-foreground/70 hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`,disabled:s,onClick:c,"aria-label":o,children:l}),t[6]=s,t[7]=c,t[8]=l,t[9]=o,t[10]=u):u=t[10];let d;return t[11]!==u||t[12]!==o?(d=(0,J.jsx)(tn,{title:o,children:u}),t[11]=u,t[12]=o,t[13]=d):d=t[13],d}function yhe(e){let t=(0,Y.c)(13),{onOpenSessionsDialog:n,onCreateSession:r}=e,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(xo,{}),a=(0,J.jsx)(`span`,{children:`Search sessions…`}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(`span`,{className:`ml-auto hidden items-center md:flex`,children:(0,J.jsx)(Tr,{children:Ah(`Control+S`)})}),t[2]=o):o=t[2];let s;t[3]===n?s=t[4]:(s=(0,J.jsx)(dl,{children:(0,J.jsxs)(pl,{type:`button`,onClick:n,children:[i,a,o]})}),t[3]=n,t[4]=s);let c,l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,J.jsx)(So,{}),l=(0,J.jsx)(`span`,{children:`New session`}),t[5]=c,t[6]=l):(c=t[5],l=t[6]);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsx)(`span`,{className:`ml-auto hidden items-center md:flex`,children:(0,J.jsx)(Tr,{children:Ah(`Control+N`)})}),t[7]=u):u=t[7];let d;t[8]===r?d=t[9]:(d=(0,J.jsx)(dl,{children:(0,J.jsxs)(pl,{type:`button`,onClick:r,children:[c,l,u]})}),t[8]=r,t[9]=d);let f;return t[10]!==s||t[11]!==d?(f=(0,J.jsx)(il,{className:`gap-2 border-b border-sidebar-border/70`,children:(0,J.jsxs)(ul,{className:`gap-1`,children:[s,d]})}),t[10]=s,t[11]=d,t[12]=f):f=t[12],f}function bhe(e){let t=(0,Y.c)(25),{sessionSearch:n,visibleDirectories:r,matchingSessionCount:i,collapsed:a,collapsedDirectoryStore:o,onOpenAddDirectoryDialog:s}=e,c;t[0]===n?c=t[1]:(c=n.trim(),t[0]=n,t[1]=c);let l=c.length>0,u=l?`${i} matching session${i===1?``:`s`}`:`Directories`,d;t[2]===u?d=t[3]:(d=(0,J.jsx)(`span`,{className:`min-w-0 truncate`,children:u}),t[2]=u,t[3]=d);let f;t[4]!==a||t[5]!==l?(f=l?null:a?(0,J.jsx)($a,{className:`size-4 shrink-0 text-sidebar-foreground/60`}):(0,J.jsx)(Qa,{className:`size-4 shrink-0 text-sidebar-foreground/60`}),t[4]=a,t[5]=l,t[6]=f):f=t[6];let p;t[7]!==d||t[8]!==f?(p=(0,J.jsxs)(vq,{type:`button`,className:`group/directories-label flex min-w-0 flex-1 items-center gap-2 text-left outline-hidden`,children:[d,f]}),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==a||t[11]!==o||t[12]!==l||t[13]!==r?(m=a?null:(0,J.jsx)(vhe,{searchActive:l,visibleDirectories:r,collapsedDirectoryStore:o}),t[10]=a,t[11]=o,t[12]=l,t[13]=r,t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=Ah(`Control+D`),t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,J.jsx)(co,{}),t[16]=g):g=t[16];let _;t[17]===s?_=t[18]:(_=(0,J.jsx)(tn,{title:`Add directory`,kbd:h,children:(0,J.jsx)(ws,{variant:`ghost`,size:`icon`,className:`hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground`,onClick:s,"aria-label":`Add directory`,children:g})}),t[17]=s,t[18]=_);let v;t[19]!==m||t[20]!==_?(v=(0,J.jsxs)(`span`,{className:`flex items-center gap-1`,children:[m,_]}),t[19]=m,t[20]=_,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==p?(y=(0,J.jsxs)(cl,{className:`justify-between gap-3`,children:[p,v]}),t[22]=v,t[23]=p,t[24]=y):y=t[24],y}function xhe(e){return She(e)}function She(e){let t=(0,Y.c)(165),{sessionSearch:n,onOpenSessionsDialog:r,visibleDirectories:i,directorySessionsStore:a,matchingSessionCount:o,selectedSessionKeys:s,activeSessionId:c,activeSessionKey:l,pinnedSessionKeys:u,emptyStateText:d,onCreateSession:f,onOpenAddDirectoryDialog:p,onOpenCommandPalette:m,onOpenSettings:h,onSessionClick:g,onRenameSession:_,onDeleteSession:v,onSetSessionUnread:b,onMoveSession:x,onMoveSessionAnyDirectory:S,onTogglePinnedSession:C,onCreateSessionInDirectory:w,onDeleteOldSessionsInDirectory:T,onRemoveDirectory:E,onReorderDirectories:D}=e,{isMobile:O,setOpenMobile:k}=Xc(),A;t[0]===n?A=t[1]:(A=n.trim(),t[0]=n,t[1]=A);let j=A.length>0,M=!j&&i.length>1,[N,P]=q.useState(null),[F,I]=q.useState(null),[L,R]=q.useState(null),[z,B]=q.useState(null),[V]=q.useState(rhe),[H]=q.useState(she),[U]=q.useState(lhe),ee=l9(V,o9,j),te,ne;t[2]!==H||t[3]!==s?(te=()=>{H.setKeys(s)},ne=[H,s],t[2]=H,t[3]=s,t[4]=te,t[5]=ne):(te=t[4],ne=t[5]),q.useLayoutEffect(te,ne);let re,W;t[6]!==c||t[7]!==l||t[8]!==U?(re=()=>{U.setActive({sessionId:c,sessionKey:l})},W=[c,l,U],t[6]=c,t[7]=l,t[8]=U,t[9]=re,t[10]=W):(re=t[9],W=t[10]),q.useLayoutEffect(re,W);let ie;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(ie={activationConstraint:{distance:6}},t[11]=ie):ie=t[11];let ae=p8(f8(U8,ie)),oe,se;t[12]===V?(oe=t[13],se=t[14]):(oe=()=>{V.loadStored()},se=[V],t[12]=V,t[13]=oe,t[14]=se),q.useEffect(oe,se);let ce,le;t[15]===M?(ce=t[16],le=t[17]):(le=()=>{M||(P(null),B(null))},ce=[M],t[15]=M,t[16]=ce,t[17]=le),q.useEffect(le,ce);let ue;bb0:{if(!z||z.length===0){ue=i;break bb0}let e;t[18]===i?e=t[19]:(e=new Set(i),t[18]=i,t[19]=e);let n=e,r;if(t[20]!==z||t[21]!==i||t[22]!==n){let e;t[24]===n?e=t[25]:(e=e=>n.has(e),t[24]=n,t[25]=e);let a=z.filter(e),o=i.filter(e=>!a.includes(e));r=[...a,...o],t[20]=z,t[21]=i,t[22]=n,t[23]=r}else r=t[23];ue=r}let de=ue,fe,pe;t[26]!==de||t[27]!==z||t[28]!==i?(fe=()=>{z&&c9(de,i)&&B(null)},pe=[de,z,i],t[26]=de,t[27]=z,t[28]=i,t[29]=fe,t[30]=pe):(fe=t[29],pe=t[30]),q.useEffect(fe,pe);let me;t[31]!==V||t[32]!==E?(me=e=>{V.remove(e),E?.(e)},t[31]=V,t[32]=E,t[33]=me):me=t[33];let he=me,ge;t[34]===i?ge=t[35]:(ge=(e,t)=>{B(n=>{let r=n&&n.length>0?n:i,a=r.indexOf(e),o=r.indexOf(t);return a===-1||o===-1||a===o?n:y5(r,a,o)})},t[34]=i,t[35]=ge);let _e=ge,ve;t[36]!==M||t[37]!==O||t[38]!==i?(ve=e=>{let t=e.active.data.current;if(t?.type===`session`&&t.entry){if(O)return;I({entryKey:t.entryKey||String(e.active.id),entry:t.entry,sourceDirectory:t.sourceDirectory||t.entry.cwd||``}),R(null);return}t?.type!==`directory`||!M||(P(String(e.active.id)),B(i))},t[36]=M,t[37]=O,t[38]=i,t[39]=ve):ve=t[39];let ye=ve,be;t[40]!==M||t[41]!==O||t[42]!==_e||t[43]!==i?(be=e=>{let t=e.active.data.current,n=String(e.active.id),r=e.over?String(e.over.id):``;if(t?.type===`session`){if(O)return;let e=i.includes(r)?r:``;R(e&&e!==t.sourceDirectory?e:null);return}M&&(!n||!r||n===r||_e(n,r))},t[40]=M,t[41]=O,t[42]=_e,t[43]=i,t[44]=be):be=t[44];let G=be,xe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>{P(null),I(null),R(null),B(null)},t[45]=xe):xe=t[45];let Se=xe,Ce;t[46]!==M||t[47]!==O||t[48]!==x||t[49]!==D||t[50]!==z||t[51]!==i?(Ce=e=>{let t=e.active.data.current,n=String(e.active.id),r=e.over?String(e.over.id):``;if(t?.type===`session`){if(O){I(null),R(null);return}let e=i.includes(r)?r:``;t.entry&&e&&e!==t.sourceDirectory&&x?.(t.entry,e),I(null),R(null);return}let a=z;if(M&&(!a||a.length===0)&&n&&r&&n!==r){let e=i.indexOf(n),t=i.indexOf(r);e!==-1&&t!==-1&&(a=y5(i,e,t))}a&&a.length>0&&!c9(a,i)&&D?.(a),P(null),B(null)},t[46]=M,t[47]=O,t[48]=x,t[49]=D,t[50]=z,t[51]=i,t[52]=Ce):Ce=t[52];let we=Ce,Te;t[53]!==f||t[54]!==r?(Te=(0,J.jsx)(yhe,{onOpenSessionsDialog:r,onCreateSession:f}),t[53]=f,t[54]=r,t[55]=Te):Te=t[55];let Ee;t[56]!==U||t[57]!==V||t[58]!==a||t[59]!==O||t[60]!==v||t[61]!==x||t[62]!==_||t[63]!==g||t[64]!==b||t[65]!==C||t[66]!==u||t[67]!==j||t[68]!==H||t[69]!==k||t[70]!==i?(Ee=(0,J.jsx)(_he,{pinnedSessionKeys:u,directorySessionsStore:a,collapsedDirectoryStore:V,searchActive:j,activeSessionStore:U,selectedSessionKeyStore:H,isMobile:O,moveTargetDirectories:i,setOpenMobile:k,onSessionClick:g,onRenameSession:_,onDeleteSession:v,onSetSessionUnread:b,onMoveSession:x,onTogglePinnedSession:C}),t[56]=U,t[57]=V,t[58]=a,t[59]=O,t[60]=v,t[61]=x,t[62]=_,t[63]=g,t[64]=b,t[65]=C,t[66]=u,t[67]=j,t[68]=H,t[69]=k,t[70]=i,t[71]=Ee):Ee=t[71];let De=!ee,Oe;t[72]!==V||t[73]!==j?(Oe=e=>{j||V.setCollapsed(o9,!e)},t[72]=V,t[73]=j,t[74]=Oe):Oe=t[74];let ke;t[75]!==V||t[76]!==ee||t[77]!==o||t[78]!==p||t[79]!==n||t[80]!==i?(ke=(0,J.jsx)(bhe,{sessionSearch:n,visibleDirectories:i,matchingSessionCount:o,collapsed:ee,collapsedDirectoryStore:V,onOpenAddDirectoryDialog:p}),t[75]=V,t[76]=ee,t[77]=o,t[78]=p,t[79]=n,t[80]=i,t[81]=ke):ke=t[81];let Ae;t[82]!==U||t[83]!==V||t[84]!==M||t[85]!==a||t[86]!==d||t[87]!==O||t[88]!==w||t[89]!==T||t[90]!==v||t[91]!==x||t[92]!==S||t[93]!==E||t[94]!==_||t[95]!==g||t[96]!==b||t[97]!==C||t[98]!==de||t[99]!==u||t[100]!==he||t[101]!==j||t[102]!==H||t[103]!==L||t[104]!==k||t[105]!==i?(Ae=(0,J.jsx)(yq,{children:(0,J.jsx)(ll,{children:i.length===0?(0,J.jsx)(`div`,{className:`p-2`,children:(0,J.jsx)(gX,{className:`rounded-xl border border-dashed bg-sidebar-accent/10 py-10`,children:(0,J.jsxs)(_X,{children:[(0,J.jsx)(yX,{variant:`icon`,children:(0,J.jsx)(lo,{})}),(0,J.jsx)(bX,{children:d})]})})}):(0,J.jsx)(E5,{items:de,strategy:Xue,children:de.map(e=>(0,J.jsx)(ahe,{id:e,disabled:!M,children:t=>{let{attributes:n,listeners:r,isDragging:o}=t;return(0,J.jsx)(m9,{directory:e,directorySessionsStore:a,collapsedDirectoryStore:V,searchActive:j,moveTargetDirectories:i,activeSessionStore:U,selectedSessionKeyStore:H,pinnedSessionKeys:u,isMobile:O,setOpenMobile:k,isDragging:o,isSessionDropTarget:L===e,attributes:n,listeners:r,onSessionClick:g,onRenameSession:_,onDeleteSession:v,onSetSessionUnread:b,onMoveSession:x,onMoveSessionAnyDirectory:S,onTogglePinnedSession:C,onCreateSessionInDirectory:w,onDeleteOldSessionsInDirectory:T,onRemoveDirectory:E?he:void 0})}},e))})})}),t[82]=U,t[83]=V,t[84]=M,t[85]=a,t[86]=d,t[87]=O,t[88]=w,t[89]=T,t[90]=v,t[91]=x,t[92]=S,t[93]=E,t[94]=_,t[95]=g,t[96]=b,t[97]=C,t[98]=de,t[99]=u,t[100]=he,t[101]=j,t[102]=H,t[103]=L,t[104]=k,t[105]=i,t[106]=Ae):Ae=t[106];let je;t[107]!==ke||t[108]!==Ae?(je=(0,J.jsxs)(sl,{className:`py-1`,children:[ke,Ae]}),t[107]=ke,t[108]=Ae,t[109]=je):je=t[109];let Me;t[110]!==De||t[111]!==Oe||t[112]!==je?(Me=(0,J.jsx)(_q,{open:De,onOpenChange:Oe,children:je}),t[110]=De,t[111]=Oe,t[112]=je,t[113]=Me):Me=t[113];let Ne;t[114]!==N||t[115]!==F||t[116]!==U||t[117]!==V||t[118]!==a||t[119]!==O||t[120]!==w||t[121]!==T||t[122]!==v||t[123]!==x||t[124]!==S||t[125]!==E||t[126]!==_||t[127]!==g||t[128]!==b||t[129]!==C||t[130]!==u||t[131]!==he||t[132]!==j||t[133]!==H||t[134]!==k||t[135]!==i?(Ne=N?(0,J.jsx)(m9,{directory:N,directorySessionsStore:a,collapsedDirectoryStore:V,searchActive:j,moveTargetDirectories:i,activeSessionStore:U,selectedSessionKeyStore:H,pinnedSessionKeys:u,isMobile:O,setOpenMobile:k,overlay:!0,onSessionClick:g,onRenameSession:_,onDeleteSession:v,onSetSessionUnread:b,onMoveSession:x,onMoveSessionAnyDirectory:S,onTogglePinnedSession:C,onCreateSessionInDirectory:w,onDeleteOldSessionsInDirectory:T,onRemoveDirectory:E?he:void 0}):F?(0,J.jsx)(ul,{className:`w-64 rounded-lg bg-sidebar p-1 shadow-lg ring-1 ring-sidebar-border/70`,children:(0,J.jsx)(u9,{entryKey:F.entryKey,directorySessionsStore:a,activeSessionStore:U,selectedSessionKeyStore:H,isPinned:u.includes(F.entryKey),isMobile:O,overlay:!0,moveTargetDirectories:i,setOpenMobile:k,onSessionClick:g,onRenameSession:_,onDeleteSession:v,onSetSessionUnread:b,onMoveSession:x,onMoveSessionAnyDirectory:S,onTogglePinnedSession:C})}):null,t[114]=N,t[115]=F,t[116]=U,t[117]=V,t[118]=a,t[119]=O,t[120]=w,t[121]=T,t[122]=v,t[123]=x,t[124]=S,t[125]=E,t[126]=_,t[127]=g,t[128]=b,t[129]=C,t[130]=u,t[131]=he,t[132]=j,t[133]=H,t[134]=k,t[135]=i,t[136]=Ne):Ne=t[136];let Pe;t[137]===Ne?Pe=t[138]:(Pe=(0,J.jsx)(v5,{children:Ne}),t[137]=Ne,t[138]=Pe);let Fe;t[139]!==we||t[140]!==G||t[141]!==ye||t[142]!==ae||t[143]!==Ee||t[144]!==Me||t[145]!==Pe?(Fe=(0,J.jsx)(ol,{children:(0,J.jsxs)(p5,{sensors:ae,collisionDetection:g8,onDragStart:ye,onDragOver:G,onDragEnd:we,onDragCancel:Se,children:[Ee,Me,Pe]})}),t[139]=we,t[140]=G,t[141]=ye,t[142]=ae,t[143]=Ee,t[144]=Me,t[145]=Pe,t[146]=Fe):Fe=t[146];let Ie,Le;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=(0,J.jsx)(y,{}),Le=(0,J.jsx)(`span`,{children:`Commands`}),t[147]=Ie,t[148]=Le):(Ie=t[147],Le=t[148]);let Re;t[149]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,J.jsx)(`span`,{className:`ml-auto hidden items-center md:flex`,children:(0,J.jsx)(Tr,{children:Ah(`Control+K`)})}),t[149]=Re):Re=t[149];let ze;t[150]===m?ze=t[151]:(ze=(0,J.jsx)(dl,{children:(0,J.jsxs)(pl,{type:`button`,onClick:m,children:[Ie,Le,Re]})}),t[150]=m,t[151]=ze);let Be,Ve;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,J.jsx)(dee,{}),Ve=(0,J.jsx)(`span`,{children:`Settings`}),t[152]=Be,t[153]=Ve):(Be=t[152],Ve=t[153]);let He;t[154]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,J.jsx)(`span`,{className:`ml-auto hidden items-center md:flex`,children:(0,J.jsx)(Tr,{children:Ah(`Control+,`)})}),t[154]=He):He=t[154];let Ue;t[155]===h?Ue=t[156]:(Ue=(0,J.jsx)(dl,{children:(0,J.jsxs)(pl,{type:`button`,onClick:h,children:[Be,Ve,He]})}),t[155]=h,t[156]=Ue);let We;t[157]!==ze||t[158]!==Ue?(We=(0,J.jsx)(al,{className:`gap-2 border-t border-sidebar-border/70`,children:(0,J.jsxs)(ul,{className:`gap-1`,children:[ze,Ue]})}),t[157]=ze,t[158]=Ue,t[159]=We):We=t[159];let Ge;t[160]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,J.jsx)(nl,{}),t[160]=Ge):Ge=t[160];let Ke;return t[161]!==Te||t[162]!==Fe||t[163]!==We?(Ke=(0,J.jsxs)(el,{collapsible:`offcanvas`,className:`top-[var(--header-height)] !h-[calc(100svh_-_var(--header-height))] border-r border-sidebar-border/70`,children:[Te,Fe,We,Ge]}),t[161]=Te,t[162]=Fe,t[163]=We,t[164]=Ke):Ke=t[164],Ke}var Che=`__pico_pinned_sessions__`;function whe(e,t){let n=t.sessionPath?.trim()||``,i=t.sessionId?.trim()||``;if(n){let t=r({path:n});if(e.has(t))return t}if(i){let t=r({id:i});if(e.has(t))return t}for(let[t,r]of e)if(n&&r.path===n||i&&r.id===i)return t;return``}function The(e){return Ehe(e)}function Ehe(e){let t=(0,Y.c)(122),{viewerContextId:n,sidebarStore:i,sessionWorkspaceRef:a}=e,[o]=q.useState(Whe),s=Mg(i,Uhe,ug),c=Mg(i,Hhe,dg),l=Mg(i,Vhe),u=Mg(i,Bhe,Une),d=Mg(i,zhe),f;t[0]===d?f=t[1]:(f=d.flatMap(Rhe),t[0]=d,t[1]=f);let p=f,m=Mg(i,Lhe,dg),h=Mg(i,Ihe,ug),g=Mg(i,Fhe),_=Mg(i,Phe),v=Mg(i,Nhe,ug),y=Mg(i,Mhe,jhe),x=Mg(i,Ahe),S=y.activeSessionId,C=y.activeSessionKey,w=y.activeSessionPath,T=y.activeStreaming,E;if(t[2]!==u||t[3]!==h){let e;t[5]===u?e=t[6]:(e=(e,t)=>e+(u[t]?.length??0),t[5]=u,t[6]=e),E=h.reduce(e,0),t[2]=u,t[3]=h,t[4]=E}else E=t[4];let D=E,O=Mg(i,khe),k=Mg(i,Ohe),A=Mg(i,Dhe),j;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(j={signature:``,key:``},t[7]=j):j=t[7];let M=q.useRef(j),N=q.useRef(0),P;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(P={},t[8]=P):P=t[8];let F=q.useRef(P),I=q.useRef(null),L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{let t=N.current+1;N.current=t;for(let n of e)F.current[n]=t;return t},t[9]=L):L=t[9];let R=L,z;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(z=(e,t)=>e.filter(e=>F.current[e]===t),t[10]=z):z=t[10];let B=z,V;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(V=(e,t)=>{for(let n of e)F.current[n]===t&&delete F.current[n]},t[11]=V):V=t[11];let H=V,U,ee;t[12]!==_||t[13]!==o||t[14]!==u||t[15]!==d?(U=()=>{o.setData(d.length>0?{...u,[Che]:d}:u,_)},ee=[_,o,u,d],t[12]=_,t[13]=o,t[14]=u,t[15]=d,t[16]=U,t[17]=ee):(U=t[16],ee=t[17]),q.useLayoutEffect(U,ee);let te,ne;t[18]===i?(te=t[19],ne=t[20]):(te=()=>{let e=0,t=window.requestAnimationFrame(()=>{e=window.setTimeout(()=>{i.setSidebarDeferredDirectoryLoadingReady(!0)},0)});return()=>{window.cancelAnimationFrame(t),e&&window.clearTimeout(e)}},ne=[i],t[18]=i,t[19]=te,t[20]=ne),q.useEffect(te,ne);let re,W;t[21]!==s||t[22]!==i?(re=()=>{let e=new Set(s);i.setDirectoryIndexDataByPath(t=>{let n={};for(let[r,i]of Object.entries(t))e.has(r)&&(n[r]=i);return JSON.stringify(n)===JSON.stringify(t)?t:n}),i.setDirectoryIndexLoading(t=>{let n={};for(let[r,i]of Object.entries(t))e.has(r)&&(n[r]=i);return JSON.stringify(n)===JSON.stringify(t)?t:n});let t={};for(let[n,r]of Object.entries(F.current))e.has(n)&&(t[n]=r);F.current=t},W=[s,i],t[21]=s,t[22]=i,t[23]=re,t[24]=W):(re=t[23],W=t[24]),q.useEffect(re,W);let ie,ae;t[25]!==S||t[26]!==C||t[27]!==w||t[28]!==T||t[29]!==s||t[30]!==g||t[31]!==_||t[32]!==c||t[33]!==x||t[34]!==i||t[35]!==n?(ie=()=>{if(!n||!x)return;let e=x.directoryIndexes||{},t=Object.keys(e),r=new Set(t);i.setSidebarState(n=>{let r=Gne(t.length?wg(n.directoryIndexDataByPath,e):n.directoryIndexDataByPath,{sessionId:S,sessionPath:w}),i=t.length?Tg(n.directoryIndexLoading,t,!1):n.directoryIndexLoading,a=!Hne(n.directoryIndexDataByPath,r);return!a&&i===n.directoryIndexLoading?n:{directoryIndexDataByPath:a?r:n.directoryIndexDataByPath,directoryIndexLoading:i}});let a=I.current,o={},l=[];for(let e of s){let t=c.get(e)?.revision||``,n=a?.revisions[e]||``;o[e]=t,!r.has(e)&&Object.prototype.hasOwnProperty.call(g,e)&&(_[e]||F.current[e]||n!==t&&(T||l.push(e)))}if(I.current={activeSessionId:S,activeSessionKey:C,activeSessionPath:w,revisions:o},l.length===0)return;let u=R(l);Cg({viewerContextId:n,directories:l}).then(e=>{let t=B(l,u);if(t.length===0)return;H(t,u);let n=Object.fromEntries(t.flatMap(t=>{let n=e.directoryIndexes[t];return n?[[t,n]]:[]}));i.setSidebarState(e=>{let r=Object.keys(n).length>0?kg(e.directoryIndexDataByPath,n):e.directoryIndexDataByPath,i=Tg(e.directoryIndexLoading,t,!1);return r===e.directoryIndexDataByPath&&i===e.directoryIndexLoading?e:{directoryIndexDataByPath:r,directoryIndexLoading:i}})}).catch(e=>{let t=B(l,u);t.length!==0&&(H(t,u),i.setDirectoryIndexLoading(e=>Tg(e,t,!1)),Tn.error(e instanceof Error?e.message:`Failed to load sidebar sessions`))})},ae=[s,g,_,S,C,w,T,c,x,i,n],t[25]=S,t[26]=C,t[27]=w,t[28]=T,t[29]=s,t[30]=g,t[31]=_,t[32]=c,t[33]=x,t[34]=i,t[35]=n,t[36]=ie,t[37]=ae):(ie=t[36],ae=t[37]),q.useEffect(ie,ae);let oe,se;t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==i?(oe=()=>{!S&&!C&&!w||i.setSidebarSessionStatusByKey(e=>Ag(e,{type:`session_status`,sessionKey:C,sessionId:S,sessionPath:w,unread:!1}))},se=[S,C,w,i],t[38]=S,t[39]=C,t[40]=w,t[41]=i,t[42]=oe,t[43]=se):(oe=t[42],se=t[43]),q.useEffect(oe,se);let ce,le;t[44]!==S||t[45]!==C||t[46]!==w||t[47]!==m||t[48]!==i?(ce=()=>{let e=[S,w,C].join(`\0`),t=whe(m,{sessionId:S,sessionPath:w});!t&&C&&m.has(C)&&(t=C);let n=M.current;n.signature===e&&n.key===t||(M.current={signature:e,key:t},i.setSelectedSidebarSessionKeys(e=>{let n=t?[t]:[];return ug(e,n)?e:n}),i.setSidebarSessionSelectionAnchor(e=>e===t?e:t))},le=[S,C,w,m,i],t[44]=S,t[45]=C,t[46]=w,t[47]=m,t[48]=i,t[49]=ce,t[50]=le):(ce=t[49],le=t[50]),q.useEffect(ce,le);let de,fe;t[51]!==s||t[52]!==g||t[53]!==_||t[54]!==k||t[55]!==i||t[56]!==n?(de=()=>{if(!n||!k)return;let e=s.filter(e=>!Object.prototype.hasOwnProperty.call(g,e)&&!_[e]&&!F.current[e]);if(e.length===0)return;let t=R(e);i.setDirectoryIndexLoading(t=>Tg(t,e,!0)),Cg({viewerContextId:n,directories:e}).then(n=>{let r=B(e,t);if(r.length===0)return;H(r,t);let a=Object.fromEntries(r.flatMap(e=>{let t=n.directoryIndexes[e];return t?[[e,t]]:[]}));i.setSidebarState(e=>{let t=Object.keys(a).length>0?kg(e.directoryIndexDataByPath,a):e.directoryIndexDataByPath,n=Tg(e.directoryIndexLoading,r,!1);return t===e.directoryIndexDataByPath&&n===e.directoryIndexLoading?e:{directoryIndexDataByPath:t,directoryIndexLoading:n}})}).catch(n=>{let r=B(e,t);r.length!==0&&(H(r,t),i.setDirectoryIndexLoading(e=>Tg(e,r,!1)),Tn.error(n instanceof Error?n.message:`Failed to load sidebar sessions`))})},fe=[s,g,_,k,i,n],t[51]=s,t[52]=g,t[53]=_,t[54]=k,t[55]=i,t[56]=n,t[57]=de,t[58]=fe):(de=t[57],fe=t[58]),q.useEffect(de,fe);let pe,he;t[59]!==m||t[60]!==i?(pe=()=>{let e=new Set(m.keys());i.setSelectedSidebarSessionKeys(t=>{let n=t.filter(t=>e.has(t));return n.length===t.length?t:n}),i.setSidebarSessionSelectionAnchor(t=>t&&e.has(t)?t:``)},he=[m,i],t[59]=m,t[60]=i,t[61]=pe,t[62]=he):(pe=t[61],he=t[62]),q.useEffect(pe,he);let ge;t[63]===i?ge=t[64]:(ge=e=>{let t=me(e);t.length!==0&&i.setSidebarDirectories(e=>{let n=me(e);return JSON.stringify(n)===JSON.stringify(t)?e:(Te(b,JSON.stringify(t)),t)})},t[63]=i,t[64]=ge);let _e=ge,ve;t[65]===i?ve=t[66]:(ve=e=>{let t=r(e);t&&i.setPinnedSidebarSessionKeys(e=>{let n=ue(e),r=n.includes(t)?n.filter(e=>e!==t):[t,...n];return Te(ft,JSON.stringify(r)),r})},t[65]=i,t[66]=ve);let ye=ve,be;t[67]===i?be=t[68]:(be=(e,t)=>{let n=t===void 0?``:t,r=ue(e),a=r.length===0?``:n&&r.includes(n)?n:r[r.length-1]??``;i.setSelectedSidebarSessionKeys(e=>ug(e,r)?e:r),i.setSidebarSessionSelectionAnchor(e=>e===a?e:a)},t[67]=i,t[68]=be);let G=be,xe;t[69]!==v||t[70]!==G||t[71]!==A?(xe=e=>{let t=e.trim();if(!t)return;let n=Wne(),r=n.indexOf(t);if(r<0){G([t],t);return}let i=n.includes(A)?A:v.find(e=>n.includes(e))??t,a=n.indexOf(i);if(a<0){G([t],t);return}let o=Math.min(a,r),s=Math.max(a,r);G(n.slice(o,s+1),i)},t[69]=v,t[70]=G,t[71]=A,t[72]=xe):xe=t[72];let Se=xe,Ce;t[73]!==Se||t[74]!==v||t[75]!==a||t[76]!==G?(Ce=(e,t)=>{let n=r(e);if(!n){e.id&&a.current?.selectSession(e.id,{sessionPath:e.path});return}if(t.shiftKey){Se(n);return}if(t.multiSelectKey){G(v.includes(n)?v.filter(e=>e!==n):[...v,n],n);return}G([n],n),e.id&&!Og(e)&&a.current?.selectSession(e.id,{sessionPath:e.path})},t[73]=Se,t[74]=v,t[75]=a,t[76]=G,t[77]=Ce):Ce=t[77];let we=Ce,Ee;t[78]===a?Ee=t[79]:(Ee=()=>{a.current?.openSessionsDialog()},t[78]=a,t[79]=Ee);let De=S||void 0,Oe=C||void 0,ke,Ae,je,Me;t[80]===a?(ke=t[81],Ae=t[82],je=t[83],Me=t[84]):(ke=()=>{a.current?.createSession(void 0,{closeMobileSidebar:!0})},Ae=()=>{a.current?.openAddDirectoryDialog()},je=()=>{a.current?.openCommandPalette()},Me=()=>{a.current?.openSettingsDialog()},t[80]=a,t[81]=ke,t[82]=Ae,t[83]=je,t[84]=Me);let Ne,Pe,Fe,Ie,Le;t[85]===a?(Ne=t[86],Pe=t[87],Fe=t[88],Ie=t[89],Le=t[90]):(Ne=e=>{a.current?.openRenameDialogForEntry(e)},Pe=e=>{a.current?.openDeleteDialog([e])},Fe=(e,t)=>{a.current?.setSessionUnread(e,t)},Ie=(e,t)=>{a.current?.moveSessionToDirectory(e,t)},Le=e=>{a.current?.openMoveSessionDirectoryDialogForEntry(e)},t[85]=a,t[86]=Ne,t[87]=Pe,t[88]=Fe,t[89]=Ie,t[90]=Le);let Re,ze;t[91]===a?(Re=t[92],ze=t[93]):(Re=e=>{a.current?.createSession(e,{closeMobileSidebar:!0})},ze=e=>{a.current?.openDeleteOldDirectorySessionsDialog(e)},t[91]=a,t[92]=Re,t[93]=ze);let Be;t[94]===i?Be=t[95]:(Be=e=>{i.setSidebarDirectories(t=>{let n=t.filter(t=>t!==e);return Te(b,JSON.stringify(n)),n})},t[94]=i,t[95]=Be);let Ve;return t[96]!==o||t[97]!==l||t[98]!==we||t[99]!==D||t[100]!==p||t[101]!==_e||t[102]!==v||t[103]!==O||t[104]!==Ee||t[105]!==De||t[106]!==Oe||t[107]!==ke||t[108]!==Ae||t[109]!==je||t[110]!==Me||t[111]!==Ne||t[112]!==Pe||t[113]!==Fe||t[114]!==Ie||t[115]!==Le||t[116]!==Re||t[117]!==ze||t[118]!==Be||t[119]!==ye||t[120]!==h?(Ve=(0,J.jsx)(xhe,{sessionSearch:O,onOpenSessionsDialog:Ee,visibleDirectories:h,directorySessionsStore:o,matchingSessionCount:D,selectedSessionKeys:v,activeSessionId:De,activeSessionKey:Oe,pinnedSessionKeys:p,emptyStateText:l,onCreateSession:ke,onOpenAddDirectoryDialog:Ae,onOpenCommandPalette:je,onOpenSettings:Me,onSessionClick:we,onRenameSession:Ne,onDeleteSession:Pe,onSetSessionUnread:Fe,onMoveSession:Ie,onMoveSessionAnyDirectory:Le,onTogglePinnedSession:ye,onCreateSessionInDirectory:Re,onDeleteOldSessionsInDirectory:ze,onRemoveDirectory:Be,onReorderDirectories:_e}),t[96]=o,t[97]=l,t[98]=we,t[99]=D,t[100]=p,t[101]=_e,t[102]=v,t[103]=O,t[104]=Ee,t[105]=De,t[106]=Oe,t[107]=ke,t[108]=Ae,t[109]=je,t[110]=Me,t[111]=Ne,t[112]=Pe,t[113]=Fe,t[114]=Ie,t[115]=Le,t[116]=Re,t[117]=ze,t[118]=Be,t[119]=ye,t[120]=h,t[121]=Ve):Ve=t[121],Ve}function Dhe(e){return e.state.sidebarSessionSelectionAnchor}function Ohe(e){return e.state.sidebarDeferredDirectoryLoadingReady}function khe(e){return e.state.sessionSearch}function Ahe(e){return e.state.sessionsEvent}function jhe(e,t){return e.activeSessionId===t.activeSessionId&&e.activeSessionKey===t.activeSessionKey&&e.activeSessionPath===t.activeSessionPath&&e.activeStreaming===t.activeStreaming&&e.event?.activeSessionId===t.event?.activeSessionId&&e.event?.activeSessionKey===t.event?.activeSessionKey&&e.event?.activeSessionPath===t.event?.activeSessionPath&&ug(e.event?.directories||[],t.event?.directories||[])}function Mhe(e){let t=e.state.sessionsEvent,n=e.state.activeSidebarSessionId,r=e.state.activeSidebarSessionKey,i=e.state.activeSidebarSessionPath,a=e.state.sidebarSessionStatusByKey;return{event:t,activeSessionId:n,activeSessionKey:r,activeSessionPath:i,activeStreaming:!!((i?a[`path:${i}`]:void 0)||(n?a[`id:${n}`]:void 0)||(r?a[`key:${r}`]:void 0))?.streaming}}function Nhe(e){return e.state.selectedSidebarSessionKeys}function Phe(e){return e.state.directoryIndexLoading}function Fhe(e){return e.state.directoryIndexDataByPath}function Ihe(e){return e.derived.visibleDirectories}function Lhe(e){return e.derived.sidebarSessionEntriesByKey}function Rhe(e){let t=r(e);return t?[t]:[]}function zhe(e){return e.derived.pinnedSidebarSessions}function Bhe(e){return e.derived.filteredDirectorySessions}function Vhe(e){return e.derived.emptySidebarStateText}function Hhe(e){return e.derived.directoryStateByPath}function Uhe(e){return e.derived.baseSidebarDirectories}function Whe(){return mhe({},{})}var Ghe=4e3,h9=`/sounds/session-done.mp3`,Khe=.85,g9=null,_9=null,v9=null;function qhe(){if(typeof window>`u`)return null;let e=window;return globalThis.AudioContext??e.webkitAudioContext??null}function y9(){if(typeof navigator>`u`)return!1;let e=navigator.userActivation;return e?e.isActive:!0}function b9({requireUserActivation:e=!1}={}){let t=qhe();if(!t)return null;if(!g9){if(e&&!y9())return null;g9=new t}return g9}async function x9(e){if(e.state===`suspended`){if(!y9())return!1;try{await e.resume()}catch{return!1}}return e.state===`running`}async function S9(e){return _9||(v9??=fetch(h9).then(e=>{if(!e.ok)throw Error(`Failed to load ${h9}`);return e.arrayBuffer()}).then(t=>e.decodeAudioData(t)).then(e=>(_9=e,e)).catch(()=>(v9=null,null)),v9)}function Jhe(e){let t=e.createOscillator(),n=e.createGain();t.type=`triangle`,t.frequency.setValueAtTime(659.25,e.currentTime),t.frequency.linearRampToValueAtTime(783.99,e.currentTime+.12),n.gain.setValueAtTime(1e-4,e.currentTime),n.gain.exponentialRampToValueAtTime(.08,e.currentTime+.02),n.gain.exponentialRampToValueAtTime(1e-4,e.currentTime+.28),t.connect(n),n.connect(e.destination),t.start(e.currentTime),t.stop(e.currentTime+.3)}async function C9(){let e=b9({requireUserActivation:!0});return!e||!await x9(e)?!1:!!await S9(e)}async function w9(){let e=b9({requireUserActivation:!0});if(!e||!await x9(e))return!1;let t=await S9(e);if(!t)return Jhe(e),!0;let n=e.createBufferSource(),r=e.createGain();return n.buffer=t,r.gain.value=Khe,n.connect(r),r.connect(e.destination),n.start(),!0}function Yhe(){return typeof Notification>`u`?`unsupported`:Notification.permission}async function Xhe(){if(typeof Notification>`u`)return`unsupported`;let e=Notification.requestPermission();return typeof e==`string`?e:await e}function T9({title:e,body:t,tag:n}){if(typeof Notification>`u`||Notification.permission!==`granted`)return!1;try{let r=new Notification(e,{body:t,tag:n,silent:!0});return window.setTimeout(()=>{r.close()},Ghe),!0}catch{return!1}}var E9=[`🌑`,`🌒`,`🌓`,`🌔`,`🌕`,`🌖`,`🌗`,`🌘`],Zhe=500;function D9(){return typeof document>`u`?!0:document.visibilityState===`visible`&&document.hasFocus()}function Qhe(e,t){let n=new Set(e?e.split(`
|
|
2193
2193
|
`):[]);return t&&n.add(t),n.size}function $he({backgroundCurrentSessionUnreadKey:e,currentPageTitle:t,sessionStreaming:n,sidebarUnreadVersion:r,titleStreamingFrameIndex:i}){let a=`${n?`${E9[i]} `:``}${t}`,o=Qhe(r,e);document.title=o>0?`(${o}) ${a}`:a}function ege(e){let t=(0,Y.c)(20),{isSessionViewLoading:n,loadingDisplaySessionTitle:r,notificationStore:i,onSelectSession:a,sessionStore:o,sidebarStore:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={compare:mg},t[0]=c):c=t[0];let l=_a(o,nge,c),u=_a(i),d,f;t[1]===u.sessionDoneSoundEnabled?(d=t[2],f=t[3]):(d=()=>{if(!u.sessionDoneSoundEnabled)return;let e=tge;return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,e,!0)}},f=[u.sessionDoneSoundEnabled],t[1]=u.sessionDoneSoundEnabled,t[2]=d,t[3]=f),q.useEffect(d,f);let p;t[4]===l?p=t[5]:(p=hg(l),t[4]=l,t[5]=p);let m=p,h=n?r:l.uiTitle||(m===`New session`?`Pico`:m),g;t[6]===i?g=t[7]:(g=e=>{let t=new Set(e);bg(i,`sessionDoneEvents`,e=>e.filter(e=>!t.has(e.id)))},t[6]=i,t[7]=g);let _=g,v;return t[8]!==h||t[9]!==u.sessionDoneDesktopNotificationsEnabled||t[10]!==u.sessionDoneEvents||t[11]!==u.sessionDoneSoundEnabled||t[12]!==_||t[13]!==a||t[14]!==l.activeSessionKey||t[15]!==l.activeSessionNotificationKey||t[16]!==l.sessionCwd||t[17]!==l.sessionStreaming||t[18]!==s?(v=(0,J.jsx)(rge,{activeSessionKey:l.activeSessionKey,activeSessionNotificationKey:l.activeSessionNotificationKey,currentPageTitle:h,sessionCwd:l.sessionCwd,sessionDoneDesktopNotificationsEnabled:u.sessionDoneDesktopNotificationsEnabled,sessionDoneSoundEnabled:u.sessionDoneSoundEnabled,sessionStreaming:l.sessionStreaming,sessionDoneEvents:u.sessionDoneEvents,sidebarStore:s,onConsumeSessionDoneEvents:_,onSelectSession:a}),t[8]=h,t[9]=u.sessionDoneDesktopNotificationsEnabled,t[10]=u.sessionDoneEvents,t[11]=u.sessionDoneSoundEnabled,t[12]=_,t[13]=a,t[14]=l.activeSessionKey,t[15]=l.activeSessionNotificationKey,t[16]=l.sessionCwd,t[17]=l.sessionStreaming,t[18]=s,t[19]=v):v=t[19],v}function tge(){C9()}function nge(e){return{activeSessionKey:e.sessionKey,activeSessionNotificationKey:og({sessionId:e.sessionId,sessionFile:e.sessionFile}),sessionCwd:e.cwd,sessionName:e.sessionName,sessionStreaming:e.streaming,firstMessage:e.firstMessage,uiTitle:e.uiState.title?.trim()||``}}function rge(e){let t=(0,Y.c)(28),{activeSessionKey:n,activeSessionNotificationKey:r,currentPageTitle:i,sessionCwd:a,sessionDoneDesktopNotificationsEnabled:o,sessionDoneSoundEnabled:s,sessionStreaming:c,sessionDoneEvents:l,sidebarStore:u,onConsumeSessionDoneEvents:d,onSelectSession:f}=e,p=_a(u,ige),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=D9(),t[0]=m):m=t[0];let h=q.useRef(m),g=q.useRef(0),_=q.useRef(``),v;t[1]!==i||t[2]!==c||t[3]!==p?(v={currentPageTitle:i,sessionStreaming:c,sidebarUnreadVersion:p},t[1]=i,t[2]=c,t[3]=p,t[4]=v):v=t[4];let y=q.useRef(v),b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=new Set,t[5]=b):b=t[5];let x=q.useRef(b),S;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{$he({...y.current,backgroundCurrentSessionUnreadKey:_.current,titleStreamingFrameIndex:g.current})},t[6]=S):S=t[6];let C=S,w,T;t[7]!==i||t[8]!==c||t[9]!==p?(w=()=>{y.current={currentPageTitle:i,sessionStreaming:c,sidebarUnreadVersion:p},C()},T=[i,c,p],t[7]=i,t[8]=c,t[9]=p,t[10]=w,t[11]=T):(w=t[10],T=t[11]),q.useEffect(w,T);let E,D;t[12]===r?(E=t[13],D=t[14]):(E=()=>{let e=()=>{let e=D9();if(h.current=e,e||!r){_.current=``,C();return}let t=_.current;t&&t!==r&&(_.current=``,C())};return e(),window.addEventListener(`focus`,e),window.addEventListener(`blur`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`blur`,e),document.removeEventListener(`visibilitychange`,e)}},D=[r],t[12]=r,t[13]=E,t[14]=D),q.useEffect(E,D);let O,k;t[15]===c?(O=t[16],k=t[17]):(k=()=>{if(!c){g.current=0,C();return}let e=window.setInterval(()=>{g.current=(g.current+1)%E9.length,C()},Zhe);return()=>{window.clearInterval(e)}},O=[c],t[15]=c,t[16]=O,t[17]=k),q.useEffect(k,O);let A,j;return t[18]!==n||t[19]!==r||t[20]!==d||t[21]!==f||t[22]!==a||t[23]!==o||t[24]!==l||t[25]!==s?(A=()=>{if(l.length===0)return;let e=[],t=!1;for(let i of l){if(e.push(i.id),x.current.has(i.id))continue;x.current.add(i.id);let c=og({sessionId:i.sessionId,sessionPath:i.sessionPath}),l=!!(c&&r&&c===r||i.sessionKey&&n&&i.sessionKey===n),u=Rne(i),d=i.cwd||a||`Open Pico to continue`,p=i.sessionPath||i.sessionId||i.id,m=h.current;if(l){!m&&c&&(_.current=c,C()),o&&!m&&T9({title:u,body:d,tag:p}),s&&!m&&!t&&(t=!0,w9());continue}if(i.sessionId){let e=i.sessionId,t=i.id;Tn.success(u,{id:t,className:`cursor-pointer`,action:(0,J.jsx)(`button`,{type:`button`,"aria-label":`Open ${u}`,className:`absolute inset-0 z-10 cursor-pointer rounded-[var(--border-radius)] bg-transparent p-0 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-none`,onClick:()=>{Tn.dismiss(t),f(e)}})})}else Tn.success(u);o&&!m&&T9({title:u,body:d,tag:p}),s&&!t&&(t=!0,w9())}d(e)},j=[n,r,d,f,a,o,l,s],t[18]=n,t[19]=r,t[20]=d,t[21]=f,t[22]=a,t[23]=o,t[24]=l,t[25]=s,t[26]=A,t[27]=j):(A=t[26],j=t[27]),q.useEffect(A,j),null}function ige(e){return e.derived.sidebarSessions.flatMap(age).sort().join(`
|
|
2194
|
-
`)}function age(e){if(!e.unread)return[];let t=og(e);return t?[t]:[]}function O9(e,t){return e.optimisticId||`pending-draft:${t}`}function oge(e,t,n){let r=e.findIndex((e,n)=>O9(e,n)===t);if(r===-1)return null;let i=e[r];if(!i)return null;let a=[...e],o=r+n,s=a[o];if(n===-1&&(i.streamingBehavior===`followUp`&&!s||i.streamingBehavior===`followUp`&&s.streamingBehavior===`steer`))return a[r]={...i,streamingBehavior:`steer`},a;if(n===1&&(i.streamingBehavior===`steer`&&!s||i.streamingBehavior===`steer`&&s.streamingBehavior===`followUp`))return a[r]={...i,streamingBehavior:`followUp`},a;if(!s)return null;let[c]=a.splice(r,1);return c?(a.splice(o,0,c),a):null}var k9=[],A9=[],j9=[];function sge(e,t){if(e===t)return!0;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.id!==i.id||r.cwd!==i.cwd||r.path!==i.path||r.lineNumber!==i.lineNumber||r.side!==i.side||r.text!==i.text||r.tabKey!==i.tabKey||r.tabTitle!==i.tabTitle||r.commit!==i.commit||r.shortHash!==i.shortHash||r.mode!==i.mode)return!1}return!0}function M9(e,t){if(e===t)return!0;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.mimeType!==i.mimeType||r.data!==i.data||r.previewUrl!==i.previewUrl)return!1}return!0}function cge(e,t){if(e===t)return!0;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.pendingId!==i.pendingId||r.text!==i.text||r.streamingBehavior!==i.streamingBehavior||!M9(r.images,i.images))return!1}return!0}function lge(e,t){return e.activeSessionId===t.activeSessionId&&e.awaitingFirstTurn===t.awaitingFirstTurn&&e.centerMessages===t.centerMessages&&sge(e.composerDiffLineComments,t.composerDiffLineComments)&&e.composerSkill===t.composerSkill&&e.composerSyncNonce===t.composerSyncNonce&&e.composerText===t.composerText&&e.disabled===t.disabled&&e.isStreaming===t.isStreaming&&e.isSubmitting===t.isSubmitting&&e.viewerContextId===t.viewerContextId&&M9(e.composerImages,t.composerImages)&&cge(e.currentPendingMessages,t.currentPendingMessages)}function uge(e){return{activeSessionId:void 0,awaitingFirstTurn:!1,centerMessages:!1,composerDiffLineComments:k9,composerImages:A9,composerSkill:void 0,composerSyncNonce:0,composerText:``,currentPendingMessages:j9,disabled:!1,isStreaming:!1,isSubmitting:!1,viewerContextId:e}}function N9(e){let t=e.cwd?.trim()||e.previous.cwd?.trim()||``;return{...An(),connected:e.previous.connected,draft:!0,sessionKey:`optimistic:${e.ownerKey}`,cwd:t||void 0,model:e.previous.model,thinkingLevel:e.previous.thinkingLevel,availableThinkingLevels:e.previous.availableThinkingLevels,availableModels:e.previous.availableModels,availableSkills:e.previous.availableSkills,hideThinkingBlock:e.previous.hideThinkingBlock}}function dge(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`optimistic:${crypto.randomUUID()}`:`optimistic:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function fge(e,t){if(t.pendingId&&e.some(e=>e.kind===`user`&&e.pendingId===t.pendingId))return e;let n=[...e],r=n[n.length-1],i=r?.kind===`assistant`&&r.streaming?n.length-1:n.length;return n.splice(i,0,t),n}function pge(e,t){let n=!1,r=e.filter(e=>{let r=e.kind===`user`&&e.pendingId===t;return r&&(n=!0),!r});return n?r:e}var mge=`Compacting context...`,hge=`Error: Compaction cancelled`;function gge(e,t){return e?.label===t?.label&&e?.summary===t?.summary&&e?.done===t?.done&&e?.error===t?.error&&e?.cancelable===t?.cancelable}function _ge(e){let t=new Vo(t=>{e.onLatest(t)},{key:e.key,wait:e.wait,leading:!1,trailing:!0});return{add:e=>t.maybeExecute(e),flush:()=>t.flush(),cancel:()=>t.cancel()}}function vge(e,t){return e.assistantOutputSignature===t.assistantOutputSignature&&e.cwd===t.cwd&&e.draft===t.draft&&e.sessionFile===t.sessionFile&&e.sessionId===t.sessionId&&e.sessionKey===t.sessionKey&&e.streaming===t.streaming}function P9(e){let t=0,n=``;for(let r=0;r<e.length;r+=1){let i=e[r];!i||i.kind!==`assistant`||i.blocks.some(e=>e.type===`text`&&e.text.trim())&&(t+=1,n=i.itemKey||i.renderKey||`index:${r}`)}return`${t}:${n}`}function yge(e){let t=(0,Y.c)(1),n;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={compare:vge},t[0]=n):n=t[0],_a(e,bge,n)}function bge(e){return{assistantOutputSignature:P9(e.items),cwd:e.cwd,draft:e.draft,sessionFile:e.sessionFile,sessionId:e.sessionId,sessionKey:e.sessionKey,streaming:e.streaming}}function F9(e){return e===`followUp`?`followUp`:`steer`}function I9(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`optimistic:${crypto.randomUUID()}`:`optimistic:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function L9(e,{contextId:t,sessionState:n,fallbackSessionId:r}){let i=n.sessionKey&&!n.sessionKey.startsWith(`optimistic:`)?n.sessionKey:void 0,a=!!(i&&(n.draft||!n.sessionId));return ph(e,{contextId:t,sessionId:a||n.draft?void 0:n.sessionId??r,searchParams:a?{sessionKey:i}:void 0})}function xge(e){return e instanceof Error&&e.message.toLowerCase().includes(`pending prompt not found`)}function Sge(e,t,n){let r=e.findIndex(e=>e.pendingId===t);if(r===-1)return null;let i=e[r];if(!i)return null;let a=[...e],o=r+n,s=a[o];if(n===-1&&(i.streamingBehavior===`followUp`&&!s||i.streamingBehavior===`followUp`&&s.streamingBehavior===`steer`))return a[r]={...i,streamingBehavior:`steer`},a;if(n===1&&(i.streamingBehavior===`steer`&&!s||i.streamingBehavior===`steer`&&s.streamingBehavior===`followUp`))return a[r]={...i,streamingBehavior:`followUp`},a;if(!s)return null;let[c]=a.splice(r,1);return c?(a.splice(o,0,c),a):null}function Cge({viewerContextId:e,activeSessionId:t,defaultNewSessionDirectory:n,sessionStore:r,sessionStateRef:i,draftSessionLoadingOwnerKey:a,pendingDraftPrompt:o,pendingDraftFollowUps:s,awaitingFirstTurn:c,pendingMessages:l,composerDiffLineCommentsRef:u,composerImagesRef:d,composerTextRef:f,composerSkillRef:p,replaceComposerDraft:m,lastSyncedEditorTextRef:h,rememberRecentDirectory:g,prefetchDirectorySessionsIndex:_,addOptimisticUserMessage:v,removeOptimisticUserMessage:y,addOptimisticSidebarSession:x,removeOptimisticSidebarSession:S,setSidebarDirectories:C,setStoredDraftDirectory:w,setDraftSessionLoadingOwnerKey:T,setPendingDraftPrompt:E,setPendingDraftFollowUps:O,setPendingMessages:k,setAwaitingFirstTurn:A,setIsSubmitting:j,setComposerDiffLineComments:M,setComposerImages:N}){let P=En(),F=q.useRef(a),I=q.useRef(o),L=q.useRef(s),R=q.useRef(l),z=q.useRef(c),B=q.useRef(null),V=yge(r),H=q.useRef(V.streaming);q.useEffect(()=>{F.current=a},[a]),q.useEffect(()=>{I.current=o},[o]),q.useEffect(()=>{L.current=s},[s]),q.useEffect(()=>{R.current=l},[l]),q.useEffect(()=>{z.current=c},[c]),q.useEffect(()=>{H.current=V.streaming},[V.streaming]);let U=q.useCallback(e=>{k(t=>{let n=e(t);return R.current=n,n})},[k]),ee=q.useCallback(e=>{U(t=>t.some(t=>t.pendingId===e.pendingId)?t:[...t,e])},[U]),te=q.useCallback(e=>{U(t=>t.filter(t=>t.pendingId!==e))},[U]),ne=q.useCallback((e,t)=>{U(n=>{if(n.some(t=>t.pendingId===e.pendingId))return n;let r=[...n];return r.splice(Math.max(0,Math.min(t,r.length)),0,e),r})},[U]),re=ni({mutationFn:async n=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(ph(`/api/directory/resolve`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n})})},onSuccess:async t=>{await P.invalidateQueries({queryKey:Gh.directorySessionsIndex(e,t.path),refetchType:`active`})}}),W=q.useCallback(e=>(m(e.message),N(e.images.map(e=>({...e}))),!0),[m,N]),ie=q.useCallback(e=>{let t=I.current;if(!t||t.ownerKey!==e)return!1;y(t.optimisticId),S(t.optimisticSidebarSessionId);for(let e of L.current)y(e.optimisticId);return I.current=null,L.current=[],E(null),O([]),B.current=null,z.current=!1,A(!1),W(t)},[W,S,y,A,O,E]),ae=q.useCallback(async t=>{if(!e)return!1;let n=t.trim();if(!n)return!1;try{let e=await re.mutateAsync(n);return C(t=>{let n=me([...t,e.path]);return Te(b,JSON.stringify(n)),n}),g(e.path),_(e.path),e.path}catch(e){return Tn.error(e instanceof Error?e.message:`Failed to add directory`),!1}},[re,_,g,C,e]),oe=q.useCallback(async({cwd:n})=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/session/new`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:n})})},[t,i,e]),se=q.useCallback(async t=>{if(!e)return!1;let r=lg({cwdOverride:t,defaultDirectory:n,currentCwd:i.current.cwd});r&&(g(r),Te(Zt,r),w(r));let a=xe({cwd:r});F.current=a,T(a);try{return await oe({cwd:r}),!0}catch(e){return F.current===a&&(F.current=null),T(e=>e===a?null:e),ie(a),Tn.error(e instanceof Error?e.message:`Failed to create session`),!1}},[oe,n,g,ie,i,T,w,e]),ce=q.useCallback(e=>{let t=F.current;if(!t)return!1;let n=xx({text:f.current,skillName:p.current,diffLineComments:u.current}).trim(),r=d.current.map(e=>({...e}));if(!n&&r.length===0)return!1;if(I.current?.ownerKey===t&&I.current){let t=F9(e),i=I9(),a=[...L.current,{message:n,images:r,streamingBehavior:t,optimisticId:i}];L.current=a,O(a)}else{let e={ownerKey:t,message:n,images:r,optimisticId:v({message:n,images:r,queued:!1}),optimisticSidebarSessionId:x()};I.current=e,E(e),z.current=!0,A(!0),Tn.info(`Prompt will send when the new session is ready.`)}return m(``,void 0,{forceSync:!0}),M([]),N([]),h.current=``,!0},[x,v,u,d,p,f,h,m,A,M,N,O,E]),le=ni({mutationFn:async({message:n,images:r,streamingBehavior:a,pendingId:o,thinkingLevel:s})=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/prompt`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({message:n,images:r,streamingBehavior:a,pendingId:o,thinkingLevel:s})})},onSuccess:async()=>{await P.invalidateQueries({queryKey:Gh.sessionTree(e,Wh(i.current)),refetchType:`active`})}}),ue=q.useCallback(async(t,n)=>{if(!e)return!1;if(F.current)return ce(t);let r=u.current.map(e=>({...e})),a=xx({text:f.current,skillName:p.current,diffLineComments:r}).trim();if(!a&&d.current.length===0)return!1;let o=n?.forceFirstPrompt?!1:!!(H.current||z.current),s=o?F9(t):void 0,c=d.current.map(e=>({...e})),l=o?I9():void 0;o||(B.current=P9(i.current.items),z.current=!0,A(!0));let g=n?.optimisticId??(o?void 0:v({message:a,images:c,queued:!1})),_=n?.optimisticSidebarSessionId??(!o&&i.current.draft?x():void 0);l&&s&&ee({pendingId:l,text:a,images:c.map(e=>({...e})),streamingBehavior:s}),j(!0),m(``,void 0,{forceSync:!0}),M([]),N([]),h.current=``;try{let e=await le.mutateAsync({message:a,images:c,streamingBehavior:s,pendingId:l,thinkingLevel:i.current.thinkingLevel});return l&&`queued`in e&&(!e.queued||e.canceled)&&te(l),!0}catch(e){return l&&te(l),y(g),S(_),o||(B.current=null,z.current=!1,A(!1)),!_x({text:f.current,skillName:p.current}).trim()&&u.current.length===0&&(m(a),M(e=>e.length===0?r.map(e=>({...e})):e),N(e=>e.length===0?c.map(e=>({...e})):e)),Tn.error(e instanceof Error?e.message:`Failed to submit prompt`),!1}finally{j(!1)}},[ee,x,v,u,d,p,f,h,le,ce,i,te,S,y,m,A,M,N,j,e]),de=q.useCallback(async()=>{if(F.current)return!1;let e=L.current;if(e.length===0)return!1;let t=e.map(e=>({message:e.message,images:e.images.map(e=>({...e})),streamingBehavior:e.streamingBehavior,optimisticId:e.optimisticId}));L.current=[],O([]);let n=async(e=0)=>{let r=t[e];if(!r)return!0;try{await le.mutateAsync({message:r.message,images:r.images,streamingBehavior:r.streamingBehavior,pendingId:r.optimisticId,thinkingLevel:i.current.thinkingLevel})}catch(n){for(let n of t.slice(e))y(n.optimisticId);return f.current||(m(r.message),N(r.images)),Tn.error(n instanceof Error?n.message:`Failed to submit queued follow-up`),!1}return await n(e+1)};return await n()},[f,le,y,i,m,N,O]),fe=q.useCallback(async e=>{let t=I.current;if(!t||t.ownerKey!==e||F.current)return!1;if(I.current=null,E(null),W(t),!await ue(t.streamingBehavior,{forceFirstPrompt:!0,optimisticId:t.optimisticId,optimisticSidebarSessionId:t.optimisticSidebarSessionId})){S(t.optimisticSidebarSessionId);for(let e of L.current)y(e.optimisticId);return L.current=[],O([]),!1}return await de(),!0},[W,de,S,y,O,E,ue]);q.useEffect(()=>{if(!a)return;let e=i.current;if(e.sessionKey?.startsWith(`optimistic:`))return;let t=xe(e);!e.draft||!D(t,a)||(F.current=null,T(null),I.current?.ownerKey===a&&fe(a))},[a,fe,V,i,T]),q.useEffect(()=>{if(!c)return;let e=B.current,t=e!==null&&V.assistantOutputSignature!==e;(i.current.streaming||t||l.length>0)&&(B.current=null,z.current=!1,A(!1))},[c,l.length,V.assistantOutputSignature,V.streaming,i,A]);let pe=ni({mutationFn:async()=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/abort`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`})},onSuccess:async()=>{await P.invalidateQueries({queryKey:Gh.sessionTree(e,Wh(i.current)),refetchType:`active`})}}),he=q.useCallback(async()=>{if(e)try{await pe.mutateAsync()}catch(e){Tn.error(e instanceof Error?e.message:`Failed to abort session`)}},[pe,e]),ge=ni({mutationFn:async n=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/pending-messages/reorder`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({pendingMessages:n})})},onSuccess:async()=>{await P.invalidateQueries({queryKey:Gh.sessionTree(e,Wh(i.current)),refetchType:`active`})}}),_e=q.useCallback(async(t,n)=>{if(!e)return;let r=R.current,i=r.find(e=>e.pendingId===t);if(!i)return;if(!n.trim()&&i.images.length===0){Tn.error(`Enter a message or keep at least one image`);return}let a=r.map(e=>e.pendingId===t?{...e,text:n}:e);U(e=>e.map(e=>e.pendingId===t?{...e,text:n}:e));try{await ge.mutateAsync(a)}catch(e){U(()=>r),Tn.error(e instanceof Error?e.message:`Failed to update pending prompt`)}},[ge,R,U,e]),ve=ni({mutationFn:async n=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/pending-message/remove`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({pendingId:n})})},onSuccess:async()=>{await P.invalidateQueries({queryKey:Gh.sessionTree(e,Wh(i.current)),refetchType:`active`})}});return{abortSession:he,addDirectoryPath:ae,createSession:se,editPendingMessage:_e,removePendingMessage:q.useCallback(async t=>{if(!e)return;let n=R.current.findIndex(e=>e.pendingId===t),r=R.current[n];te(t);try{await ve.mutateAsync(t)}catch(e){if(xge(e))return;r&&ne(r,n),Tn.error(e instanceof Error?e.message:`Failed to remove pending prompt`)}},[te,ve,ne,e]),reorderPending:q.useCallback(async(t,n)=>{if(!e)return;let r=R.current,i=Sge(r,t,n);if(i){U(()=>i);try{await ge.mutateAsync(i)}catch(e){U(()=>r),Tn.error(e instanceof Error?e.message:`Failed to update pending prompts`)}}},[ge,R,U,e]),submitPrompt:ue}}function wge(){let{setTheme:e,systemTheme:t}=De(),n=q.useRef(void 0),r=n.current??U();n.current=r;let[i,a]=q.useState(r),[o,s]=q.useState(()=>bn(r)??it()),c=qn(i,o,t);return q.useEffect(()=>{e(c),Te(Mt,c);let t=sn(c);t&&(document.documentElement.dataset.picoThemeMode=t)},[c,e]),{appliedTheme:c,colorMode:o,previewThemeFamily:(e,t)=>{let n=Pn(e),r=bn(n);a(n),(t||r)&&s(xt(t??r))},setColorMode:e=>{let t=xt(e);s(t),Te(ve,t)},setThemeFamily:e=>{let t=Pn(e),n=bn(t);a(t),Te(fn,t),n&&(s(n),Te(ve,n))},systemTheme:t,themeFamily:i}}function R9(e,t){return e.sessionKey||t.sessionKey?e.sessionKey===t.sessionKey:e.sessionId||t.sessionId?e.sessionId===t.sessionId:e.sessionFile||t.sessionFile?e.sessionFile===t.sessionFile:e.cwd===t.cwd&&e.draft===t.draft}function Tge(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 z9(e,t,n){let r=!1,i={...e};for(let[a,o]of Object.entries(e)){let e=!1,s=o.sessions.map(i=>i.path!==t||i.name===n&&i.title===n?i:(e=!0,r=!0,{...i,name:n,title:n}));e&&(i[a]={...o,sessions:s})}return r?i:e}function B9(e,t){if(t.size===0)return e;let n=!1,r={...e};for(let[i,a]of Object.entries(e)){let e=a.sessions.filter(e=>!e.path||!t.has(e.path)),o=a.sessions.length-e.length;o!==0&&(n=!0,r[i]={...a,totalCount:Math.max(0,a.totalCount-o),sessions:e})}return n?r:e}function V9(e){if(!e)return 0;let t=new Date(e).getTime();return Number.isFinite(t)?t:0}function Ege(e,t){return V9(t.lastUserMessageAt||t.modified)-V9(e.lastUserMessageAt||e.modified)||V9(t.modified)-V9(e.modified)}function H9(e,t){return!!(e.path&&(e.path===t.previousPath||e.path===t.nextPath)||t.sessionId&&e.id===t.sessionId)}function U9(e,t){let n=t.previousPath.trim(),r=(t.nextPath||n).trim(),i=t.nextCwd.trim();if(!n||!r||!i)return e;let a=t.fallbackEntry.id||``,o=!1,s,c={...e};for(let[t,i]of Object.entries(e)){let e=0,l=i.sessions.filter(t=>H9(t,{previousPath:n,nextPath:r,sessionId:a})?(s??=t,e+=1,!1):!0);e!==0&&(o=!0,c[t]={...i,totalCount:Math.max(0,i.totalCount-e),sessions:l})}let l=c[i]||e[i];if(!l)return o?c:e;let u={...s||t.fallbackEntry,path:r,cwd:i};return l.sessions.some(e=>H9(e,{previousPath:r,nextPath:r,sessionId:u.id||a}))?o?c:e:(o=!0,c[i]={...l,totalCount:l.totalCount+1,sessions:[u,...l.sessions].sort(Ege)},c)}function W9(e,t){if(!e||t.size===0)return[];let n=[];for(let[r,i]of Object.entries(e))i.sessions.some(e=>e.path&&t.has(e.path))&&n.push(r);return n}function G9(e){return Array.from(new Set(e.filter(Boolean)))}function K9(e,t,n){if(n.length===0)return e;let r=!1,i={...e};for(let a of n){let n=t?.[a];if(n){e[a]!==n&&(i[a]=n,r=!0);continue}Object.prototype.hasOwnProperty.call(e,a)&&(delete i[a],r=!0)}return r?i:e}function q9(e,t){if(!e?.directoryIndexes)return e;let n=t(e.directoryIndexes);return n===e.directoryIndexes?e:{...e,directoryIndexes:n}}function Dge(e,t){return{selectedSidebarSessionKeys:e.selectedSidebarSessionKeys.filter(e=>!t.has(e)),sidebarSessionSelectionAnchor:e.sidebarSessionSelectionAnchor&&t.has(e.sidebarSessionSelectionAnchor)?``:e.sidebarSessionSelectionAnchor}}function J9(e,t,n){if(!t||!n||t===n)return e;let r=!1,i=new Set,a=[];for(let o of e){let e=o===t?n:o;e!==o&&(r=!0),!(!e||i.has(e))&&(i.add(e),a.push(e))}return r?a:e}function Oge({viewerContextId:e,activeSessionId:t,sessionStateRef:n,setSessionState:i,getDirectoryIndexDataByPath:a,setDirectoryIndexDataByPath:o,getSessionsEvent:s,setSessionsEvent:c,getSidebarSelection:l,optimisticallyClearActiveDeletedSession:u,setSelectedSidebarSessionKeys:d,setSidebarSessionSelectionAnchor:f,setPinnedSidebarSessionKeys:p,setCompactWorkingState:m,isCompactAbortRequested:h}){let g=En(),_=q.useRef(0),v=q.useRef(null);q.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]);let y=q.useCallback(async n=>{if(!e)return;let[r,i]=n.split(`/`);if(!(!r||!i))try{await mh(ph(`/api/model`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:r,modelId:i})})}catch(e){Tn.error(e instanceof Error?e.message:`Failed to update model`)}},[t,e]),b=q.useCallback(async r=>{if(!e)return;let a=_.current+1;_.current=a;let o=n.current,s=o.thinkingLevel,c=o.availableThinkingLevels,l={cwd:o.cwd,draft:o.draft,sessionFile:o.sessionFile,sessionId:o.sessionId,sessionKey:o.sessionKey};s!==r&&i({...o,thinkingLevel:r}),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{v.current=null,(async()=>{try{let o=await mh(ph(`/api/thinking`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({level:r})});if(_.current!==a)return;let s=n.current;if(!R9(l,s))return;let c=o.thinkingLevel||r,u=o.availableThinkingLevels.length>0?o.availableThinkingLevels:s.availableThinkingLevels;if(s.thinkingLevel===c&&s.availableThinkingLevels===u)return;i({...s,thinkingLevel:c,availableThinkingLevels:u})}catch(e){if(_.current!==a)return;let t=n.current;R9(l,t)&&t.thinkingLevel===r&&i({...t,thinkingLevel:s,availableThinkingLevels:c}),Tn.error(e instanceof Error?e.message:`Failed to update thinking level`)}})()},100)},[n,t,i,e]),x=q.useCallback(async e=>{let t=n.current,r=t.availableThinkingLevels.length?t.availableThinkingLevels:[`off`],i=r.indexOf(t.thinkingLevel||`off`);await b(r[((i>=0?i:0)+e+r.length)%r.length]||r[0])},[n,b]),S=q.useCallback(async n=>{if(e)try{await mh(ph(`/api/settings/hide-thinking`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({hide:n})}),Tn.info(n?`Thinking hidden`:`Thinking shown`)}catch(e){Tn.error(e instanceof Error?e.message:`Failed to update thinking visibility`)}},[t,e]),C=q.useCallback(async()=>{await S(!n.current.hideThinkingBlock)},[n,S]),w=q.useCallback(async()=>{if(e){m(!0);try{await mh(ph(`/api/slash-command`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:`compact`,args:``})})}catch(e){h()||Tn.error(e instanceof Error?e.message:`Failed to compact session`)}finally{m(!1)}}},[t,h,m,e]),T=q.useCallback(async()=>{if(e)try{if((await mh(ph(`/api/session/clone`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`}})).cancelled)return;Tn.success(`Cloned session`)}catch(e){Tn.error(e instanceof Error?e.message:`Failed to clone session`)}},[t,e]),E=ni({mutationFn:async({path:n,name:r})=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(ph(`/api/session/rename`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,name:r})})},onSuccess:async()=>{await g.invalidateQueries({queryKey:[`pico`,`directory-sessions-index`,e],refetchType:`active`})}}),D=q.useCallback(async(t,r)=>{if(!e||!t)return!1;let l=r.trim();if(!l)return Tn.error(`Name is required`),!1;let u=a(),d=s(),f=new Set([t]),p=W9(u,f),m=W9(d?.directoryIndexes,f),h=n.current.sessionName,g=n.current.sessionFile===t;return c(e=>q9(e,e=>z9(e,t,l))),o(e=>z9(e,t,l)),g&&n.current.sessionName!==l&&i(e=>e.sessionFile===t?{...e,sessionName:l}:e),(async()=>{try{let e=(await E.mutateAsync({path:t,name:l})).name||l;e!==l&&(c(n=>q9(n,n=>z9(n,t,e))),o(n=>z9(n,t,e)),i(n=>n.sessionFile===t&&n.sessionName===l?{...n,sessionName:e}:n)),Tn.success(`Renamed session`)}catch(e){c(e=>q9(e,e=>K9(e,d?.directoryIndexes,m))),o(e=>K9(e,u,p)),i(e=>e.sessionFile===t&&e.sessionName===l?{...e,sessionName:h}:e),Tn.error(e instanceof Error?e.message:`Failed to rename session`)}})(),!0},[a,s,E,n,o,i,c,e]),O=ni({mutationFn:async({path:n,cwd:r})=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(ph(`/api/session/move`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,cwd:r})})},onSuccess:async()=>{await g.invalidateQueries({queryKey:[`pico`,`directory-sessions-index`,e],refetchType:`active`})}}),k=q.useCallback(async(t,l)=>{if(!e||!t.path)return!1;let u=l.trim();if(!u)return Tn.error(`Directory is required`),!1;if(t.cwd===u)return!1;let m=t.path,h=a(),g=s(),_=new Set([m]),v=G9([...W9(h,_),...h[u]?[u]:[]]),y=G9([...W9(g?.directoryIndexes,_),...g?.directoryIndexes?.[u]?[u]:[]]),b=n.current.cwd,x=n.current.sessionFile===m;return c(e=>q9(e,e=>U9(e,{previousPath:m,nextCwd:u,fallbackEntry:t}))),o(e=>U9(e,{previousPath:m,nextCwd:u,fallbackEntry:t})),x&&i(e=>e.sessionFile===m?{...e,cwd:u}:e),(async()=>{try{let e=await O.mutateAsync({path:m,cwd:u}),n=r({path:e.previousPath||m}),a=r({path:e.path,id:e.sessionId||t.id});c(n=>q9(n,n=>U9(n,{previousPath:e.previousPath||m,nextPath:e.path,nextCwd:e.cwd,fallbackEntry:{...t,id:e.sessionId||t.id}}))),o(n=>U9(n,{previousPath:e.previousPath||m,nextPath:e.path,nextCwd:e.cwd,fallbackEntry:{...t,id:e.sessionId||t.id}})),d(e=>J9(e,n,a)),f(e=>e===n?a:e),p(e=>{let t=J9(e,n,a);return t!==e&&Te(ft,JSON.stringify(t)),t}),i(t=>t.sessionFile===e.previousPath||t.sessionFile===m?{...t,cwd:e.cwd,sessionFile:e.path}:t),Tn.success(`Moved session`)}catch(e){c(e=>q9(e,e=>K9(e,g?.directoryIndexes,y))),o(e=>K9(e,h,v)),i(e=>e.sessionFile===m&&e.cwd===u?{...e,cwd:b}:e),Tn.error(e instanceof Error?e.message:`Failed to move session`)}})(),!0},[a,s,O,n,o,p,d,i,c,f,e]),A=ni({mutationFn:async n=>{if(!e)throw Error(`Viewer context unavailable`);await mh(ph(`/api/sessions/delete`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({paths:n})})},onSuccess:async()=>{await g.invalidateQueries({queryKey:[`pico`,`directory-sessions-index`,e],refetchType:`active`})}});return{cycleThinkingLevel:x,deleteSessions:q.useCallback(async t=>{if(!e||t.length===0)return!1;let i=[...t.filter(e=>e.path&&e.path!==n.current.sessionFile),...t.filter(e=>e.path&&e.path===n.current.sessionFile)],p=[],m=new Set;for(let e of i)!e.path||m.has(e.path)||(m.add(e.path),p.push(e.path));if(p.length===0)return!1;let h=new Set(i.flatMap(e=>{let t=r(e);return t?[t]:[]})),g=a(),_=s(),v=W9(g,m),y=W9(_?.directoryIndexes,m),b=l(),x=Dge(b,h);c(e=>q9(e,e=>B9(e,m))),o(e=>B9(e,m)),d(e=>e.filter(e=>!h.has(e))),f(e=>e&&h.has(e)?``:e);let S=n.current.sessionFile,C=S&&m.has(S)?u?.(S):void 0;return(async()=>{try{await A.mutateAsync(p),Tn.success(p.length===1?`Deleted session`:`Deleted ${p.length} sessions`)}catch(e){c(e=>q9(e,e=>K9(e,_?.directoryIndexes,y))),o(e=>K9(e,g,v)),C?.();let t=l();Tge(t.selectedSidebarSessionKeys,x.selectedSidebarSessionKeys)&&t.sidebarSessionSelectionAnchor===x.sidebarSessionSelectionAnchor&&(d(b.selectedSidebarSessionKeys),f(b.sidebarSessionSelectionAnchor)),Tn.error(e instanceof Error?e.message:`Failed to delete session`)}})(),!0},[A,a,s,l,u,n,o,d,c,f,e]),moveSessionPath:k,renameSessionPath:D,runClone:T,runCompact:w,setModel:y,setThinkingBlocksHidden:S,setThinkingLevel:b,toggleHideThinking:C}}var kge=3e4,Age=`Compacting context...`;function jge(e){if($m(e)&&Array.isArray(e.pendingUserMessages))return e.pendingUserMessages.map(e=>({pendingId:typeof e.pendingId==`string`?e.pendingId:``,text:typeof e.text==`string`?e.text:``,images:Array.isArray(e.images)?e.images.flatMap(e=>{let t=Jn(e);return t?[t]:[]}):[],streamingBehavior:e.streamingBehavior===`steer`?`steer`:`followUp`}))}function Mge(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 Nge(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.mimeType!==i.mimeType||r.data!==i.data||r.previewUrl!==i.previewUrl)return!1}return!0}function Pge(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.pendingId!==i.pendingId||r.text!==i.text||r.streamingBehavior!==i.streamingBehavior||!Nge(r.images,i.images))return!1}return!0}function Fge(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.path!==i.path||r.totalCount!==i.totalCount||r.revision!==i.revision)return!1}return!0}function Ige(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.path!==i.path||r.id!==i.id||r.cwd!==i.cwd||r.name!==i.name||r.title!==i.title||r.modified!==i.modified||r.lastUserMessageAt!==i.lastUserMessageAt||r.lastMessageAt!==i.lastMessageAt||r.lastMessagePreview!==i.lastMessagePreview||r.messageCount!==i.messageCount||!gn(r.contextUsage,i.contextUsage)||!!r.streaming!=!!i.streaming||!!r.unread!=!!i.unread||!!r.optimistic!=!!i.optimistic)return!1}return!0}function Lge(e,t){let n=Object.entries(e||{}),r=Object.entries(t||{});if(n.length!==r.length)return!1;for(let[e,r]of n){let n=t?.[e];if(!r||!n||r.directory!==n.directory||r.totalCount!==n.totalCount||r.revision!==n.revision||!Ige(r.sessions,n.sessions))return!1}return!0}function Y9(e,t){return e===t?!0:!e||!t?!1:e.activeSessionId===t.activeSessionId&&e.activeSessionKey===t.activeSessionKey&&e.activeSessionPath===t.activeSessionPath&&Mge(e.directories||[],t.directories||[])&&Fge(e.directoryStates||[],t.directoryStates||[])&&Lge(e.directoryIndexes,t.directoryIndexes)}function Rge(e,t){switch(e.type){case`text`:return e.text.trim()?`text:${e.text}`:``;case`compaction`:return`compaction:${e.tokensBefore}:${e.summary}`;case`thinking`:return t.hideThinking?``:`thinking:${e.summaryLabel||``}:${e.text}`;case`tool`:return t.hideToolBlocks?``:`tool:${e.callId||``}:${e.name||``}:${JSON.stringify(e.args??null)}:${e.output}:${JSON.stringify(e.details??null)}:${e.isError?`1`:`0`}:${e.running?`1`:`0`}`;default:return``}}function zge(e){return e.renderKey||e.itemKey||``}function X9(e,t){let n=[];for(let r of e){let e=zge(r);if(r.kind===`user`){n.push(`user:${e}:${r.text}:${r.queued?`1`:`0`}:${r.streamingBehavior||``}:${r.images.map(e=>`${e.mimeType}:${e.data}`).join(`,`)}`);continue}let i=r.blocks.flatMap(e=>{let n=Rge(e,t);return n?[n]:[]}),a=[r.done===!1?`0`:`1`,r.model?.provider||``,r.model?.id||``].join(`:`);if(i.length===0){(r.streaming||r.done===!1||a!==`1::`)&&n.push(`assistant:${e}:${r.streaming?`1`:`0`}:${a}`);continue}n.push(`assistant:${e}:${r.streaming?`1`:`0`}:${a}:${i.join(`|`)}`)}return n.join(`
|
|
2194
|
+
`)}function age(e){if(!e.unread)return[];let t=og(e);return t?[t]:[]}function O9(e,t){return e.optimisticId||`pending-draft:${t}`}function oge(e,t,n){let r=e.findIndex((e,n)=>O9(e,n)===t);if(r===-1)return null;let i=e[r];if(!i)return null;let a=[...e],o=r+n,s=a[o];if(n===-1&&(i.streamingBehavior===`followUp`&&!s||i.streamingBehavior===`followUp`&&s.streamingBehavior===`steer`))return a[r]={...i,streamingBehavior:`steer`},a;if(n===1&&(i.streamingBehavior===`steer`&&!s||i.streamingBehavior===`steer`&&s.streamingBehavior===`followUp`))return a[r]={...i,streamingBehavior:`followUp`},a;if(!s)return null;let[c]=a.splice(r,1);return c?(a.splice(o,0,c),a):null}var k9=[],A9=[],j9=[];function sge(e,t){if(e===t)return!0;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.id!==i.id||r.cwd!==i.cwd||r.path!==i.path||r.lineNumber!==i.lineNumber||r.side!==i.side||r.text!==i.text||r.tabKey!==i.tabKey||r.tabTitle!==i.tabTitle||r.commit!==i.commit||r.shortHash!==i.shortHash||r.mode!==i.mode)return!1}return!0}function M9(e,t){if(e===t)return!0;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.mimeType!==i.mimeType||r.data!==i.data||r.previewUrl!==i.previewUrl)return!1}return!0}function cge(e,t){if(e===t)return!0;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.pendingId!==i.pendingId||r.text!==i.text||r.streamingBehavior!==i.streamingBehavior||!M9(r.images,i.images))return!1}return!0}function lge(e,t){return e.activeSessionId===t.activeSessionId&&e.awaitingFirstTurn===t.awaitingFirstTurn&&e.centerMessages===t.centerMessages&&sge(e.composerDiffLineComments,t.composerDiffLineComments)&&e.composerSkill===t.composerSkill&&e.composerSyncNonce===t.composerSyncNonce&&e.composerText===t.composerText&&e.disabled===t.disabled&&e.isStreaming===t.isStreaming&&e.isSubmitting===t.isSubmitting&&e.viewerContextId===t.viewerContextId&&M9(e.composerImages,t.composerImages)&&cge(e.currentPendingMessages,t.currentPendingMessages)}function uge(e){return{activeSessionId:void 0,awaitingFirstTurn:!1,centerMessages:!1,composerDiffLineComments:k9,composerImages:A9,composerSkill:void 0,composerSyncNonce:0,composerText:``,currentPendingMessages:j9,disabled:!1,isStreaming:!1,isSubmitting:!1,viewerContextId:e}}function N9(e){let t=e.cwd?.trim()||e.previous.cwd?.trim()||``;return{...An(),connected:e.previous.connected,draft:!0,sessionKey:`optimistic:${e.ownerKey}`,cwd:t||void 0,model:e.previous.model,thinkingLevel:e.previous.thinkingLevel,availableThinkingLevels:e.previous.availableThinkingLevels,availableModels:e.previous.availableModels,availableSkills:e.previous.availableSkills,hideThinkingBlock:e.previous.hideThinkingBlock}}function dge(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`optimistic:${crypto.randomUUID()}`:`optimistic:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function fge(e,t){if(t.pendingId&&e.some(e=>e.kind===`user`&&e.pendingId===t.pendingId))return e;let n=[...e],r=n[n.length-1],i=r?.kind===`assistant`&&r.streaming?n.length-1:n.length;return n.splice(i,0,t),n}function pge(e,t){let n=!1,r=e.filter(e=>{let r=e.kind===`user`&&e.pendingId===t;return r&&(n=!0),!r});return n?r:e}var mge=`Compacting context...`,hge=`Error: Compaction cancelled`;function gge(e,t){return e?.label===t?.label&&e?.summary===t?.summary&&e?.done===t?.done&&e?.error===t?.error&&e?.cancelable===t?.cancelable}function _ge(e){let t=new Vo(t=>{e.onLatest(t)},{key:e.key,wait:e.wait,leading:!1,trailing:!0});return{add:e=>t.maybeExecute(e),flush:()=>t.flush(),cancel:()=>t.cancel()}}function vge(e,t){return e.assistantOutputSignature===t.assistantOutputSignature&&e.cwd===t.cwd&&e.draft===t.draft&&e.sessionFile===t.sessionFile&&e.sessionId===t.sessionId&&e.sessionKey===t.sessionKey&&e.streaming===t.streaming}function P9(e){let t=0,n=``;for(let r=0;r<e.length;r+=1){let i=e[r];!i||i.kind!==`assistant`||i.blocks.some(e=>e.type===`text`&&e.text.trim())&&(t+=1,n=i.itemKey||i.renderKey||`index:${r}`)}return`${t}:${n}`}function yge(e){let t=(0,Y.c)(1),n;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={compare:vge},t[0]=n):n=t[0],_a(e,bge,n)}function bge(e){return{assistantOutputSignature:P9(e.items),cwd:e.cwd,draft:e.draft,sessionFile:e.sessionFile,sessionId:e.sessionId,sessionKey:e.sessionKey,streaming:e.streaming}}function F9(e){return e===`followUp`?`followUp`:`steer`}function I9(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`optimistic:${crypto.randomUUID()}`:`optimistic:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function L9(e,{contextId:t,sessionState:n,fallbackSessionId:r}){let i=n.sessionKey&&!n.sessionKey.startsWith(`optimistic:`)?n.sessionKey:void 0,a=!!(i&&(n.draft||!n.sessionId));return ph(e,{contextId:t,sessionId:a||n.draft?void 0:n.sessionId??r,searchParams:a?{sessionKey:i}:void 0})}function xge(e){return e instanceof Error&&e.message.toLowerCase().includes(`pending prompt not found`)}function Sge(e,t,n){let r=e.findIndex(e=>e.pendingId===t);if(r===-1)return null;let i=e[r];if(!i)return null;let a=[...e],o=r+n,s=a[o];if(n===-1&&(i.streamingBehavior===`followUp`&&!s||i.streamingBehavior===`followUp`&&s.streamingBehavior===`steer`))return a[r]={...i,streamingBehavior:`steer`},a;if(n===1&&(i.streamingBehavior===`steer`&&!s||i.streamingBehavior===`steer`&&s.streamingBehavior===`followUp`))return a[r]={...i,streamingBehavior:`followUp`},a;if(!s)return null;let[c]=a.splice(r,1);return c?(a.splice(o,0,c),a):null}function Cge({viewerContextId:e,activeSessionId:t,defaultNewSessionDirectory:n,sessionStore:r,sessionStateRef:i,draftSessionLoadingOwnerKey:a,pendingDraftPrompt:o,pendingDraftFollowUps:s,awaitingFirstTurn:c,pendingMessages:l,composerDiffLineCommentsRef:u,composerImagesRef:d,composerTextRef:f,composerSkillRef:p,replaceComposerDraft:m,lastSyncedEditorTextRef:h,rememberRecentDirectory:g,prefetchDirectorySessionsIndex:_,addOptimisticUserMessage:v,removeOptimisticUserMessage:y,addOptimisticSidebarSession:x,removeOptimisticSidebarSession:S,setSidebarDirectories:C,setStoredDraftDirectory:w,setDraftSessionLoadingOwnerKey:T,setPendingDraftPrompt:E,setPendingDraftFollowUps:O,setPendingMessages:k,setAwaitingFirstTurn:A,setIsSubmitting:j,setComposerDiffLineComments:M,setComposerImages:N}){let P=En(),F=q.useRef(a),I=q.useRef(o),L=q.useRef(s),R=q.useRef(l),z=q.useRef(c),B=q.useRef(null),V=yge(r),H=q.useRef(V.streaming),U=q.useRef(async()=>!1);q.useEffect(()=>{F.current=a},[a]),q.useEffect(()=>{I.current=o},[o]),q.useEffect(()=>{L.current=s},[s]),q.useEffect(()=>{R.current=l},[l]),q.useEffect(()=>{z.current=c},[c]),q.useEffect(()=>{H.current=V.streaming},[V.streaming]);let ee=q.useCallback(e=>{k(t=>{let n=e(t);return R.current=n,n})},[k]),te=q.useCallback(e=>{ee(t=>t.some(t=>t.pendingId===e.pendingId)?t:[...t,e])},[ee]),ne=q.useCallback(e=>{ee(t=>t.filter(t=>t.pendingId!==e))},[ee]),re=q.useCallback((e,t)=>{ee(n=>{if(n.some(t=>t.pendingId===e.pendingId))return n;let r=[...n];return r.splice(Math.max(0,Math.min(t,r.length)),0,e),r})},[ee]),W=ni({mutationFn:async n=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(ph(`/api/directory/resolve`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n})})},onSuccess:async t=>{await P.invalidateQueries({queryKey:Gh.directorySessionsIndex(e,t.path),refetchType:`active`})}}),ie=q.useCallback(e=>(m(e.message),N(e.images.map(e=>({...e}))),!0),[m,N]),ae=q.useCallback(e=>{let t=I.current;if(!t||t.ownerKey!==e)return!1;y(t.optimisticId),S(t.optimisticSidebarSessionId);for(let e of L.current)y(e.optimisticId);return I.current=null,L.current=[],E(null),O([]),B.current=null,z.current=!1,A(!1),ie(t)},[ie,S,y,A,O,E]),oe=q.useCallback(async t=>{if(!e)return!1;let n=t.trim();if(!n)return!1;try{let e=await W.mutateAsync(n);return C(t=>{let n=me([...t,e.path]);return Te(b,JSON.stringify(n)),n}),g(e.path),_(e.path),e.path}catch(e){return Tn.error(e instanceof Error?e.message:`Failed to add directory`),!1}},[W,_,g,C,e]),se=q.useCallback(async({cwd:n})=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/session/new`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:n})})},[t,i,e]),ce=q.useCallback(async t=>{if(!e)return!1;let r=lg({cwdOverride:t,defaultDirectory:n,currentCwd:i.current.cwd});r&&(g(r),Te(Zt,r),w(r));let a=xe({cwd:r});F.current=a,T(a);try{return await se({cwd:r}),F.current===a&&(F.current=null,T(e=>e===a?null:e)),I.current?.ownerKey===a&&U.current(a),!0}catch(e){return F.current===a&&(F.current=null),T(e=>e===a?null:e),ae(a),Tn.error(e instanceof Error?e.message:`Failed to create session`),!1}},[se,n,g,ae,i,T,w,e]),le=q.useCallback(e=>{let t=F.current;if(!t)return!1;let n=xx({text:f.current,skillName:p.current,diffLineComments:u.current}).trim(),r=d.current.map(e=>({...e}));if(!n&&r.length===0)return!1;if(I.current?.ownerKey===t&&I.current){let t=F9(e),i=I9(),a=[...L.current,{message:n,images:r,streamingBehavior:t,optimisticId:i}];L.current=a,O(a)}else{let e={ownerKey:t,message:n,images:r,optimisticId:v({message:n,images:r,queued:!1}),optimisticSidebarSessionId:x()};I.current=e,E(e),z.current=!0,A(!0),Tn.info(`Prompt will send when the new session is ready.`)}return m(``,void 0,{forceSync:!0}),M([]),N([]),h.current=``,!0},[x,v,u,d,p,f,h,m,A,M,N,O,E]),ue=ni({mutationFn:async({message:n,images:r,streamingBehavior:a,pendingId:o,thinkingLevel:s})=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/prompt`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({message:n,images:r,streamingBehavior:a,pendingId:o,thinkingLevel:s})})},onSuccess:async()=>{await P.invalidateQueries({queryKey:Gh.sessionTree(e,Wh(i.current)),refetchType:`active`})}}),de=q.useCallback(async(t,n)=>{if(!e)return!1;if(F.current)return le(t);let r=u.current.map(e=>({...e})),a=xx({text:f.current,skillName:p.current,diffLineComments:r}).trim();if(!a&&d.current.length===0)return!1;let o=n?.forceFirstPrompt?!1:!!(H.current||z.current),s=o?F9(t):void 0,c=d.current.map(e=>({...e})),l=o?I9():void 0;o||(B.current=P9(i.current.items),z.current=!0,A(!0));let g=n?.optimisticId??(o?void 0:v({message:a,images:c,queued:!1})),_=n?.optimisticSidebarSessionId??(!o&&i.current.draft?x():void 0);l&&s&&te({pendingId:l,text:a,images:c.map(e=>({...e})),streamingBehavior:s}),j(!0),m(``,void 0,{forceSync:!0}),M([]),N([]),h.current=``;try{let e=await ue.mutateAsync({message:a,images:c,streamingBehavior:s,pendingId:l,thinkingLevel:i.current.thinkingLevel});return l&&`queued`in e&&(!e.queued||e.canceled)&&ne(l),!0}catch(e){return l&&ne(l),y(g),S(_),o||(B.current=null,z.current=!1,A(!1)),!_x({text:f.current,skillName:p.current}).trim()&&u.current.length===0&&(m(a),M(e=>e.length===0?r.map(e=>({...e})):e),N(e=>e.length===0?c.map(e=>({...e})):e)),Tn.error(e instanceof Error?e.message:`Failed to submit prompt`),!1}finally{j(!1)}},[te,x,v,u,d,p,f,h,ue,le,i,ne,S,y,m,A,M,N,j,e]),fe=q.useCallback(async()=>{if(F.current)return!1;let e=L.current;if(e.length===0)return!1;let t=e.map(e=>({message:e.message,images:e.images.map(e=>({...e})),streamingBehavior:e.streamingBehavior,optimisticId:e.optimisticId}));L.current=[],O([]);let n=async(e=0)=>{let r=t[e];if(!r)return!0;try{await ue.mutateAsync({message:r.message,images:r.images,streamingBehavior:r.streamingBehavior,pendingId:r.optimisticId,thinkingLevel:i.current.thinkingLevel})}catch(n){for(let n of t.slice(e))y(n.optimisticId);return f.current||(m(r.message),N(r.images)),Tn.error(n instanceof Error?n.message:`Failed to submit queued follow-up`),!1}return await n(e+1)};return await n()},[f,ue,y,i,m,N,O]),pe=q.useCallback(async e=>{let t=I.current;if(!t||t.ownerKey!==e||F.current)return!1;if(I.current=null,E(null),ie(t),!await de(t.streamingBehavior,{forceFirstPrompt:!0,optimisticId:t.optimisticId,optimisticSidebarSessionId:t.optimisticSidebarSessionId})){S(t.optimisticSidebarSessionId);for(let e of L.current)y(e.optimisticId);return L.current=[],O([]),!1}return await fe(),!0},[ie,fe,S,y,O,E,de]);U.current=pe,q.useEffect(()=>{if(!a)return;let e=i.current;if(e.sessionKey?.startsWith(`optimistic:`))return;let t=xe(e);!e.draft||!D(t,a)||(F.current=null,T(null),I.current?.ownerKey===a&&pe(a))},[a,pe,V,i,T]),q.useEffect(()=>{if(!c)return;let e=B.current,t=e!==null&&V.assistantOutputSignature!==e;(i.current.streaming||t||l.length>0)&&(B.current=null,z.current=!1,A(!1))},[c,l.length,V.assistantOutputSignature,V.streaming,i,A]);let he=ni({mutationFn:async()=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/abort`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`})},onSuccess:async()=>{await P.invalidateQueries({queryKey:Gh.sessionTree(e,Wh(i.current)),refetchType:`active`})}}),ge=q.useCallback(async()=>{if(e)try{await he.mutateAsync()}catch(e){Tn.error(e instanceof Error?e.message:`Failed to abort session`)}},[he,e]),_e=ni({mutationFn:async n=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/pending-messages/reorder`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({pendingMessages:n})})},onSuccess:async()=>{await P.invalidateQueries({queryKey:Gh.sessionTree(e,Wh(i.current)),refetchType:`active`})}}),ve=q.useCallback(async(t,n)=>{if(!e)return;let r=R.current,i=r.find(e=>e.pendingId===t);if(!i)return;if(!n.trim()&&i.images.length===0){Tn.error(`Enter a message or keep at least one image`);return}let a=r.map(e=>e.pendingId===t?{...e,text:n}:e);ee(e=>e.map(e=>e.pendingId===t?{...e,text:n}:e));try{await _e.mutateAsync(a)}catch(e){ee(()=>r),Tn.error(e instanceof Error?e.message:`Failed to update pending prompt`)}},[_e,R,ee,e]),ye=ni({mutationFn:async n=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(L9(`/api/pending-message/remove`,{contextId:e,sessionState:i.current,fallbackSessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({pendingId:n})})},onSuccess:async()=>{await P.invalidateQueries({queryKey:Gh.sessionTree(e,Wh(i.current)),refetchType:`active`})}});return{abortSession:ge,addDirectoryPath:oe,createSession:ce,editPendingMessage:ve,removePendingMessage:q.useCallback(async t=>{if(!e)return;let n=R.current.findIndex(e=>e.pendingId===t),r=R.current[n];ne(t);try{await ye.mutateAsync(t)}catch(e){if(xge(e))return;r&&re(r,n),Tn.error(e instanceof Error?e.message:`Failed to remove pending prompt`)}},[ne,ye,re,e]),reorderPending:q.useCallback(async(t,n)=>{if(!e)return;let r=R.current,i=Sge(r,t,n);if(i){ee(()=>i);try{await _e.mutateAsync(i)}catch(e){ee(()=>r),Tn.error(e instanceof Error?e.message:`Failed to update pending prompts`)}}},[_e,R,ee,e]),submitPrompt:de}}function wge(){let{setTheme:e,systemTheme:t}=De(),n=q.useRef(void 0),r=n.current??U();n.current=r;let[i,a]=q.useState(r),[o,s]=q.useState(()=>bn(r)??it()),c=qn(i,o,t);return q.useEffect(()=>{e(c),Te(Mt,c);let t=sn(c);t&&(document.documentElement.dataset.picoThemeMode=t)},[c,e]),{appliedTheme:c,colorMode:o,previewThemeFamily:(e,t)=>{let n=Pn(e),r=bn(n);a(n),(t||r)&&s(xt(t??r))},setColorMode:e=>{let t=xt(e);s(t),Te(ve,t)},setThemeFamily:e=>{let t=Pn(e),n=bn(t);a(t),Te(fn,t),n&&(s(n),Te(ve,n))},systemTheme:t,themeFamily:i}}function R9(e,t){return e.sessionKey||t.sessionKey?e.sessionKey===t.sessionKey:e.sessionId||t.sessionId?e.sessionId===t.sessionId:e.sessionFile||t.sessionFile?e.sessionFile===t.sessionFile:e.cwd===t.cwd&&e.draft===t.draft}function Tge(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 z9(e,t,n){let r=!1,i={...e};for(let[a,o]of Object.entries(e)){let e=!1,s=o.sessions.map(i=>i.path!==t||i.name===n&&i.title===n?i:(e=!0,r=!0,{...i,name:n,title:n}));e&&(i[a]={...o,sessions:s})}return r?i:e}function B9(e,t){if(t.size===0)return e;let n=!1,r={...e};for(let[i,a]of Object.entries(e)){let e=a.sessions.filter(e=>!e.path||!t.has(e.path)),o=a.sessions.length-e.length;o!==0&&(n=!0,r[i]={...a,totalCount:Math.max(0,a.totalCount-o),sessions:e})}return n?r:e}function V9(e){if(!e)return 0;let t=new Date(e).getTime();return Number.isFinite(t)?t:0}function Ege(e,t){return V9(t.lastUserMessageAt||t.modified)-V9(e.lastUserMessageAt||e.modified)||V9(t.modified)-V9(e.modified)}function H9(e,t){return!!(e.path&&(e.path===t.previousPath||e.path===t.nextPath)||t.sessionId&&e.id===t.sessionId)}function U9(e,t){let n=t.previousPath.trim(),r=(t.nextPath||n).trim(),i=t.nextCwd.trim();if(!n||!r||!i)return e;let a=t.fallbackEntry.id||``,o=!1,s,c={...e};for(let[t,i]of Object.entries(e)){let e=0,l=i.sessions.filter(t=>H9(t,{previousPath:n,nextPath:r,sessionId:a})?(s??=t,e+=1,!1):!0);e!==0&&(o=!0,c[t]={...i,totalCount:Math.max(0,i.totalCount-e),sessions:l})}let l=c[i]||e[i];if(!l)return o?c:e;let u={...s||t.fallbackEntry,path:r,cwd:i};return l.sessions.some(e=>H9(e,{previousPath:r,nextPath:r,sessionId:u.id||a}))?o?c:e:(o=!0,c[i]={...l,totalCount:l.totalCount+1,sessions:[u,...l.sessions].sort(Ege)},c)}function W9(e,t){if(!e||t.size===0)return[];let n=[];for(let[r,i]of Object.entries(e))i.sessions.some(e=>e.path&&t.has(e.path))&&n.push(r);return n}function G9(e){return Array.from(new Set(e.filter(Boolean)))}function K9(e,t,n){if(n.length===0)return e;let r=!1,i={...e};for(let a of n){let n=t?.[a];if(n){e[a]!==n&&(i[a]=n,r=!0);continue}Object.prototype.hasOwnProperty.call(e,a)&&(delete i[a],r=!0)}return r?i:e}function q9(e,t){if(!e?.directoryIndexes)return e;let n=t(e.directoryIndexes);return n===e.directoryIndexes?e:{...e,directoryIndexes:n}}function Dge(e,t){return{selectedSidebarSessionKeys:e.selectedSidebarSessionKeys.filter(e=>!t.has(e)),sidebarSessionSelectionAnchor:e.sidebarSessionSelectionAnchor&&t.has(e.sidebarSessionSelectionAnchor)?``:e.sidebarSessionSelectionAnchor}}function J9(e,t,n){if(!t||!n||t===n)return e;let r=!1,i=new Set,a=[];for(let o of e){let e=o===t?n:o;e!==o&&(r=!0),!(!e||i.has(e))&&(i.add(e),a.push(e))}return r?a:e}function Oge({viewerContextId:e,activeSessionId:t,sessionStateRef:n,setSessionState:i,getDirectoryIndexDataByPath:a,setDirectoryIndexDataByPath:o,getSessionsEvent:s,setSessionsEvent:c,getSidebarSelection:l,optimisticallyClearActiveDeletedSession:u,setSelectedSidebarSessionKeys:d,setSidebarSessionSelectionAnchor:f,setPinnedSidebarSessionKeys:p,setCompactWorkingState:m,isCompactAbortRequested:h}){let g=En(),_=q.useRef(0),v=q.useRef(null);q.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]);let y=q.useCallback(async n=>{if(!e)return;let[r,i]=n.split(`/`);if(!(!r||!i))try{await mh(ph(`/api/model`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:r,modelId:i})})}catch(e){Tn.error(e instanceof Error?e.message:`Failed to update model`)}},[t,e]),b=q.useCallback(async r=>{if(!e)return;let a=_.current+1;_.current=a;let o=n.current,s=o.thinkingLevel,c=o.availableThinkingLevels,l={cwd:o.cwd,draft:o.draft,sessionFile:o.sessionFile,sessionId:o.sessionId,sessionKey:o.sessionKey};s!==r&&i({...o,thinkingLevel:r}),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{v.current=null,(async()=>{try{let o=await mh(ph(`/api/thinking`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({level:r})});if(_.current!==a)return;let s=n.current;if(!R9(l,s))return;let c=o.thinkingLevel||r,u=o.availableThinkingLevels.length>0?o.availableThinkingLevels:s.availableThinkingLevels;if(s.thinkingLevel===c&&s.availableThinkingLevels===u)return;i({...s,thinkingLevel:c,availableThinkingLevels:u})}catch(e){if(_.current!==a)return;let t=n.current;R9(l,t)&&t.thinkingLevel===r&&i({...t,thinkingLevel:s,availableThinkingLevels:c}),Tn.error(e instanceof Error?e.message:`Failed to update thinking level`)}})()},100)},[n,t,i,e]),x=q.useCallback(async e=>{let t=n.current,r=t.availableThinkingLevels.length?t.availableThinkingLevels:[`off`],i=r.indexOf(t.thinkingLevel||`off`);await b(r[((i>=0?i:0)+e+r.length)%r.length]||r[0])},[n,b]),S=q.useCallback(async n=>{if(e)try{await mh(ph(`/api/settings/hide-thinking`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({hide:n})}),Tn.info(n?`Thinking hidden`:`Thinking shown`)}catch(e){Tn.error(e instanceof Error?e.message:`Failed to update thinking visibility`)}},[t,e]),C=q.useCallback(async()=>{await S(!n.current.hideThinkingBlock)},[n,S]),w=q.useCallback(async()=>{if(e){m(!0);try{await mh(ph(`/api/slash-command`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:`compact`,args:``})})}catch(e){h()||Tn.error(e instanceof Error?e.message:`Failed to compact session`)}finally{m(!1)}}},[t,h,m,e]),T=q.useCallback(async()=>{if(e)try{if((await mh(ph(`/api/session/clone`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`}})).cancelled)return;Tn.success(`Cloned session`)}catch(e){Tn.error(e instanceof Error?e.message:`Failed to clone session`)}},[t,e]),E=ni({mutationFn:async({path:n,name:r})=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(ph(`/api/session/rename`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,name:r})})},onSuccess:async()=>{await g.invalidateQueries({queryKey:[`pico`,`directory-sessions-index`,e],refetchType:`active`})}}),D=q.useCallback(async(t,r)=>{if(!e||!t)return!1;let l=r.trim();if(!l)return Tn.error(`Name is required`),!1;let u=a(),d=s(),f=new Set([t]),p=W9(u,f),m=W9(d?.directoryIndexes,f),h=n.current.sessionName,g=n.current.sessionFile===t;return c(e=>q9(e,e=>z9(e,t,l))),o(e=>z9(e,t,l)),g&&n.current.sessionName!==l&&i(e=>e.sessionFile===t?{...e,sessionName:l}:e),(async()=>{try{let e=(await E.mutateAsync({path:t,name:l})).name||l;e!==l&&(c(n=>q9(n,n=>z9(n,t,e))),o(n=>z9(n,t,e)),i(n=>n.sessionFile===t&&n.sessionName===l?{...n,sessionName:e}:n)),Tn.success(`Renamed session`)}catch(e){c(e=>q9(e,e=>K9(e,d?.directoryIndexes,m))),o(e=>K9(e,u,p)),i(e=>e.sessionFile===t&&e.sessionName===l?{...e,sessionName:h}:e),Tn.error(e instanceof Error?e.message:`Failed to rename session`)}})(),!0},[a,s,E,n,o,i,c,e]),O=ni({mutationFn:async({path:n,cwd:r})=>{if(!e)throw Error(`Viewer context unavailable`);return await mh(ph(`/api/session/move`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,cwd:r})})},onSuccess:async()=>{await g.invalidateQueries({queryKey:[`pico`,`directory-sessions-index`,e],refetchType:`active`})}}),k=q.useCallback(async(t,l)=>{if(!e||!t.path)return!1;let u=l.trim();if(!u)return Tn.error(`Directory is required`),!1;if(t.cwd===u)return!1;let m=t.path,h=a(),g=s(),_=new Set([m]),v=G9([...W9(h,_),...h[u]?[u]:[]]),y=G9([...W9(g?.directoryIndexes,_),...g?.directoryIndexes?.[u]?[u]:[]]),b=n.current.cwd,x=n.current.sessionFile===m;return c(e=>q9(e,e=>U9(e,{previousPath:m,nextCwd:u,fallbackEntry:t}))),o(e=>U9(e,{previousPath:m,nextCwd:u,fallbackEntry:t})),x&&i(e=>e.sessionFile===m?{...e,cwd:u}:e),(async()=>{try{let e=await O.mutateAsync({path:m,cwd:u}),n=r({path:e.previousPath||m}),a=r({path:e.path,id:e.sessionId||t.id});c(n=>q9(n,n=>U9(n,{previousPath:e.previousPath||m,nextPath:e.path,nextCwd:e.cwd,fallbackEntry:{...t,id:e.sessionId||t.id}}))),o(n=>U9(n,{previousPath:e.previousPath||m,nextPath:e.path,nextCwd:e.cwd,fallbackEntry:{...t,id:e.sessionId||t.id}})),d(e=>J9(e,n,a)),f(e=>e===n?a:e),p(e=>{let t=J9(e,n,a);return t!==e&&Te(ft,JSON.stringify(t)),t}),i(t=>t.sessionFile===e.previousPath||t.sessionFile===m?{...t,cwd:e.cwd,sessionFile:e.path}:t),Tn.success(`Moved session`)}catch(e){c(e=>q9(e,e=>K9(e,g?.directoryIndexes,y))),o(e=>K9(e,h,v)),i(e=>e.sessionFile===m&&e.cwd===u?{...e,cwd:b}:e),Tn.error(e instanceof Error?e.message:`Failed to move session`)}})(),!0},[a,s,O,n,o,p,d,i,c,f,e]),A=ni({mutationFn:async n=>{if(!e)throw Error(`Viewer context unavailable`);await mh(ph(`/api/sessions/delete`,{contextId:e,sessionId:t}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({paths:n})})},onSuccess:async()=>{await g.invalidateQueries({queryKey:[`pico`,`directory-sessions-index`,e],refetchType:`active`})}});return{cycleThinkingLevel:x,deleteSessions:q.useCallback(async t=>{if(!e||t.length===0)return!1;let i=[...t.filter(e=>e.path&&e.path!==n.current.sessionFile),...t.filter(e=>e.path&&e.path===n.current.sessionFile)],p=[],m=new Set;for(let e of i)!e.path||m.has(e.path)||(m.add(e.path),p.push(e.path));if(p.length===0)return!1;let h=new Set(i.flatMap(e=>{let t=r(e);return t?[t]:[]})),g=a(),_=s(),v=W9(g,m),y=W9(_?.directoryIndexes,m),b=l(),x=Dge(b,h);c(e=>q9(e,e=>B9(e,m))),o(e=>B9(e,m)),d(e=>e.filter(e=>!h.has(e))),f(e=>e&&h.has(e)?``:e);let S=n.current.sessionFile,C=S&&m.has(S)?u?.(S):void 0;return(async()=>{try{await A.mutateAsync(p),Tn.success(p.length===1?`Deleted session`:`Deleted ${p.length} sessions`)}catch(e){c(e=>q9(e,e=>K9(e,_?.directoryIndexes,y))),o(e=>K9(e,g,v)),C?.();let t=l();Tge(t.selectedSidebarSessionKeys,x.selectedSidebarSessionKeys)&&t.sidebarSessionSelectionAnchor===x.sidebarSessionSelectionAnchor&&(d(b.selectedSidebarSessionKeys),f(b.sidebarSessionSelectionAnchor)),Tn.error(e instanceof Error?e.message:`Failed to delete session`)}})(),!0},[A,a,s,l,u,n,o,d,c,f,e]),moveSessionPath:k,renameSessionPath:D,runClone:T,runCompact:w,setModel:y,setThinkingBlocksHidden:S,setThinkingLevel:b,toggleHideThinking:C}}var kge=3e4,Age=`Compacting context...`;function jge(e){if($m(e)&&Array.isArray(e.pendingUserMessages))return e.pendingUserMessages.map(e=>({pendingId:typeof e.pendingId==`string`?e.pendingId:``,text:typeof e.text==`string`?e.text:``,images:Array.isArray(e.images)?e.images.flatMap(e=>{let t=Jn(e);return t?[t]:[]}):[],streamingBehavior:e.streamingBehavior===`steer`?`steer`:`followUp`}))}function Mge(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 Nge(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.mimeType!==i.mimeType||r.data!==i.data||r.previewUrl!==i.previewUrl)return!1}return!0}function Pge(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.pendingId!==i.pendingId||r.text!==i.text||r.streamingBehavior!==i.streamingBehavior||!Nge(r.images,i.images))return!1}return!0}function Fge(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.path!==i.path||r.totalCount!==i.totalCount||r.revision!==i.revision)return!1}return!0}function Ige(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.path!==i.path||r.id!==i.id||r.cwd!==i.cwd||r.name!==i.name||r.title!==i.title||r.modified!==i.modified||r.lastUserMessageAt!==i.lastUserMessageAt||r.lastMessageAt!==i.lastMessageAt||r.lastMessagePreview!==i.lastMessagePreview||r.messageCount!==i.messageCount||!gn(r.contextUsage,i.contextUsage)||!!r.streaming!=!!i.streaming||!!r.unread!=!!i.unread||!!r.optimistic!=!!i.optimistic)return!1}return!0}function Lge(e,t){let n=Object.entries(e||{}),r=Object.entries(t||{});if(n.length!==r.length)return!1;for(let[e,r]of n){let n=t?.[e];if(!r||!n||r.directory!==n.directory||r.totalCount!==n.totalCount||r.revision!==n.revision||!Ige(r.sessions,n.sessions))return!1}return!0}function Y9(e,t){return e===t?!0:!e||!t?!1:e.activeSessionId===t.activeSessionId&&e.activeSessionKey===t.activeSessionKey&&e.activeSessionPath===t.activeSessionPath&&Mge(e.directories||[],t.directories||[])&&Fge(e.directoryStates||[],t.directoryStates||[])&&Lge(e.directoryIndexes,t.directoryIndexes)}function Rge(e,t){switch(e.type){case`text`:return e.text.trim()?`text:${e.text}`:``;case`compaction`:return`compaction:${e.tokensBefore}:${e.summary}`;case`thinking`:return t.hideThinking?``:`thinking:${e.summaryLabel||``}:${e.text}`;case`tool`:return t.hideToolBlocks?``:`tool:${e.callId||``}:${e.name||``}:${JSON.stringify(e.args??null)}:${e.output}:${JSON.stringify(e.details??null)}:${e.isError?`1`:`0`}:${e.running?`1`:`0`}`;default:return``}}function zge(e){return e.renderKey||e.itemKey||``}function X9(e,t){let n=[];for(let r of e){let e=zge(r);if(r.kind===`user`){n.push(`user:${e}:${r.text}:${r.queued?`1`:`0`}:${r.streamingBehavior||``}:${r.images.map(e=>`${e.mimeType}:${e.data}`).join(`,`)}`);continue}let i=r.blocks.flatMap(e=>{let n=Rge(e,t);return n?[n]:[]}),a=[r.done===!1?`0`:`1`,r.model?.provider||``,r.model?.id||``].join(`:`);if(i.length===0){(r.streaming||r.done===!1||a!==`1::`)&&n.push(`assistant:${e}:${r.streaming?`1`:`0`}:${a}`);continue}n.push(`assistant:${e}:${r.streaming?`1`:`0`}:${a}:${i.join(`|`)}`)}return n.join(`
|
|
2195
2195
|
`)}function Bge(e,t,n){return e===t?!0:X9(e,n)===X9(t,n)}function Vge(e,t){return e.connected===t.connected&&e.replaying===t.replaying&&e.streaming===t.streaming&&e.compacting===t.compacting&&e.draft===t.draft&&e.historyOffset===t.historyOffset&&e.historyTotalCount===t.historyTotalCount&&e.sessionId===t.sessionId&&e.sessionKey===t.sessionKey&&e.sessionName===t.sessionName&&e.firstMessage===t.firstMessage&&e.sessionFile===t.sessionFile&&e.cwd===t.cwd&&e.modified===t.modified&&e.model===t.model&&e.thinkingLevel===t.thinkingLevel&&e.availableThinkingLevels===t.availableThinkingLevels&&e.availableModels===t.availableModels&&e.availableSkills===t.availableSkills&&e.hideThinkingBlock===t.hideThinkingBlock&&e.uiRequest===t.uiRequest}function Hge(e,t){return e.statuses===t.statuses&&e.title===t.title&&e.editorText===t.editorText}function Uge(e,t){return e===t?!1:!Vge(e,t)||!Hge(e.uiState,t.uiState)||e.items.length===0!=(t.items.length===0)}function Z9(e){return xe({cwd:typeof e.cwd==`string`?e.cwd:void 0,sessionFile:typeof e.sessionFile==`string`?e.sessionFile:void 0,sessionId:typeof e.sessionId==`string`?e.sessionId:void 0})}function Wge(e,t){return!t||e.draft!==!0?!1:D(Z9(e),t)}function Gge(e,t){return e.draft===!0?D(Z9(e),xe(t)):!1}function Kge(e){let t=e.previousState.sessionKey||``,n=typeof e.payload.sessionKey==`string`?e.payload.sessionKey:``;return!(!t.startsWith(`optimistic:`)||!n||n===t||Wge(e.payload,e.ownerKey)||Gge(e.payload,e.previousState))}function qge(e){let t=(0,Y.c)(81),{viewerContextId:n,sessionId:r,draftSessionLoadingOwnerKey:i,bootstrapSidebarDirectories:a,hideToolBlocksRef:o,sessionStore:s,sessionStateRef:c,composerTextRef:l,composerSkillRef:u,replaceComposerDraftRef:d,handleSelectSessionRef:f,pendingRouteSessionIdRef:p,pendingRouteSessionPathRef:m,setSessionState:h,setConversationItems:g,setHiddenThinkingPreview:_,setWorkingState:v,setCompactRunningState:y,setComposerContextUsage:b,setComposerStreaming:x,setSessionsEvent:S,setSessionDoneEvents:C,applySidebarSessionStatusRef:w,setComposerImages:T,setPendingMessages:E,pendingUiRequestHandlerRef:O,lastSyncedEditorTextRef:k}=e,A=En(),j=q.useRef(r),M=q.useRef(r),N=q.useRef(i),P=q.useRef(null),I=q.useRef(!1),[L,R]=q.useState(!1),z=q.useRef(null),B=q.useRef(!1),[V,H]=q.useState(0),U,ee;t[0]===r?(U=t[1],ee=t[2]):(U=()=>{M.current=r},ee=[r],t[0]=r,t[1]=U,t[2]=ee),q.useEffect(U,ee);let te,ne;t[3]===i?(te=t[4],ne=t[5]):(te=()=>{N.current=i},ne=[i],t[3]=i,t[4]=te,t[5]=ne),q.useEffect(te,ne);let re,W;t[6]===r?(re=t[7],W=t[8]):(re=()=>{P.current||(j.current=r)},W=[r],t[6]=r,t[7]=re,t[8]=W),q.useEffect(re,W);let ie=_a(s,$ge),ae=q.useRef(0),oe=q.useRef(Date.now()*1e3),se=q.useRef(void 0),ce=_a(s,Qge),le,ue;t[9]!==p||t[10]!==m||t[11]!==r||t[12]!==ie?(le=()=>{let e=se.current!==r;if(se.current=r,!r){p.current=void 0,m.current=void 0;return}if(r===ie){p.current===r&&(p.current=void 0,m.current=void 0);return}e&&(p.current!==r&&(m.current=void 0),p.current=r)},ue=[p,m,r,ie],t[9]=p,t[10]=m,t[11]=r,t[12]=ie,t[13]=le,t[14]=ue):(le=t[13],ue=t[14]),q.useEffect(le,ue);let de,fe;t[15]!==A||t[16]!==n?(fe=()=>{if(!n)return;let e=()=>{z.current=Date.now(),B.current=!0},t=e=>{let t=e===void 0?!1:e;if(document.visibilityState!==`visible`)return;let n=z.current,r=n?Date.now()-n:0,i=t||B.current&&r>=kge;if(z.current=null,B.current=!1,!i)return;let a=P.current;(t||!a||a.readyState!==EventSource.OPEN)&&(j.current=M.current,H(Zge)),A.invalidateQueries({refetchType:`active`}).catch(Xge)},r=()=>{if(document.visibilityState===`hidden`){e();return}t()},i=()=>{t()},a=e=>{t(e.persisted)};return document.visibilityState===`hidden`&&e(),window.addEventListener(`blur`,e),window.addEventListener(`focus`,i),window.addEventListener(`pagehide`,e),window.addEventListener(`pageshow`,a),document.addEventListener(`visibilitychange`,r),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`focus`,i),window.removeEventListener(`pagehide`,e),window.removeEventListener(`pageshow`,a),document.removeEventListener(`visibilitychange`,r)}},de=[A,n],t[15]=A,t[16]=n,t[17]=de,t[18]=fe):(de=t[17],fe=t[18]),q.useEffect(fe,de);let pe;t[19]!==c||t[20]!==g||t[21]!==h?(pe=e=>{if(P.current!==e)return;let t=c.current;if(t.connected)return;let n={...t,connected:!0};c.current=n,g(n.items),h(n)},t[19]=c,t[20]=g,t[21]=h,t[22]=pe):pe=t[22];let me=pe,he;t[23]!==c||t[24]!==g||t[25]!==h?(he=e=>{if(P.current!==e)return;let t=c.current;if(!t.connected)return;let n={...t,connected:!1};c.current=n,g(n.items),h(n)},t[23]=c,t[24]=g,t[25]=h,t[26]=he):he=t[26];let ge=he,_e;t[27]!==w||t[28]!==u||t[29]!==l||t[30]!==f||t[31]!==o||t[32]!==k||t[33]!==p||t[34]!==O||t[35]!==d||t[36]!==c||t[37]!==y||t[38]!==b||t[39]!==T||t[40]!==x||t[41]!==g||t[42]!==_||t[43]!==E||t[44]!==C||t[45]!==h||t[46]!==S||t[47]!==v?(_e=(e,t,n)=>{if(P.current!==e)return;let r=JSON.parse(n.data);if($m(r)){let e=r.activationRevision;if(typeof e==`number`&&e<ae.current)return;typeof e==`number`&&(ae.current=e),I.current||(I.current=!0,R(!0));let t=c.current;if(Kge({ownerKey:N.current,payload:r,previousState:t}))return;let n=l.current;et(t,_x({text:n,skillName:u.current}));let i=t.uiState.editorText||``,a=vh(t,r),s=xe(a)!==xe(t),m=M.current,C=N.current,O=a.draft&&!a.sessionKey?.startsWith(`optimistic:`),A=t.draft&&t.sessionKey?.startsWith(`optimistic:`),j=D(xe(a),C),P=!!(m&&!p.current&&O&&(j||A)),L=!s&&n!==i,z=L?n:F(a)??a.uiState.editorText??``;ta(()=>{c.current=a,_(a.hiddenThinkingPreview||``,{preserveExisting:!!(t.streaming&&a.streaming&&!a.hiddenThinkingPreview)}),t.contextUsage!==a.contextUsage&&b(a.contextUsage);let e=t.sessionKey!==a.sessionKey||t.sessionId!==a.sessionId||t.sessionFile!==a.sessionFile;t.streaming!==a.streaming&&x(a.streaming),(e||t.compacting!==a.compacting)&&y(a.compacting),(e||t.streaming||a.streaming||t.compacting||a.compacting)&&v(a.compacting?{label:Age,cancelable:!0}:a.streaming?{label:a.uiState.workingMessage||`Working…`}:null),(e||!Bge(t.items,a.items,{hideThinking:a.hideThinkingBlock,hideToolBlocks:o.current}))&&g(a.items),Uge(t,a)&&h(a),(t.sessionKey!==a.sessionKey||t.sessionId!==a.sessionId||t.sessionFile!==a.sessionFile||t.streaming!==a.streaming)&&w.current({type:`session_status`,sessionKey:a.sessionKey,sessionId:a.sessionId,sessionPath:a.sessionFile,streaming:a.streaming,unread:!1}),s&&S(e=>{if(!e)return e;let t={...e,activeSessionId:a.sessionId,activeSessionKey:a.sessionKey,activeSessionPath:a.sessionFile};return Y9(e,t)?e:t}),s&&T(Yge),P&&f.current(void 0,{replace:!0}),L||d.current(z,a),k.current=a.uiState.editorText||``;let n=jge(r);n&&E(e=>Pge(e,n)?e:n)});return}if(eh(r)){S(e=>Y9(e,r)?e:r);return}if(th(r)){w.current(r);return}if(nh(r)){C(e=>e.some(e=>e.id===r.id)?e:[...e,r]);return}if(rh(r)){let e=r.cwd.trim();e&&t.addItem({cwd:e,scopes:new Set(r.scopes??[`status`,`files`,`refs`])});return}if(r.type===`request_error`){Tn.error(r.error||`Request failed`);return}if(r.type===`extension_error`){Tn.error(r.error||`Extension error`);return}if(r.type===`extension_ui_request`){if(r.method===`notify`){let e=r.message||`Notification`;r.notifyType===`success`?Tn.success(e):r.notifyType===`warning`?Tn.warning(e):r.notifyType===`error`?Tn.error(e):Tn.info(e);return}O.current(r)}},t[27]=w,t[28]=u,t[29]=l,t[30]=f,t[31]=o,t[32]=k,t[33]=p,t[34]=O,t[35]=d,t[36]=c,t[37]=y,t[38]=b,t[39]=T,t[40]=x,t[41]=g,t[42]=_,t[43]=E,t[44]=C,t[45]=h,t[46]=S,t[47]=v,t[48]=_e):_e=t[48];let ve=_e,ye;t[49]!==a||t[50]!==ge||t[51]!==ve||t[52]!==me||t[53]!==A||t[54]!==n?(ye=()=>{if(!n)return;I.current=!1,R(!1),ae.current=0;let e=new Ro(e=>{let t=new Map;for(let n of e){let e=t.get(n.cwd)??new Set;for(let t of n.scopes)e.add(t);t.set(n.cwd,e)}let r=[];for(let[e,i]of t)i.has(`status`)&&r.push(A.invalidateQueries({queryKey:Gh.gitStatus(n,e),exact:!0,refetchType:`active`})),i.has(`files`)&&r.push(A.invalidateQueries({queryKey:Gh.gitFiles(n,e),exact:!0,refetchType:`active`}),A.invalidateQueries({queryKey:Gh.projectFileTree(n,e),exact:!0,refetchType:`active`}),A.invalidateQueries({queryKey:Gh.gitFileReviews(n,e),exact:!1,refetchType:`active`})),i.has(`refs`)&&r.push(A.invalidateQueries({queryKey:Gh.gitBranches(n,e),exact:!0,refetchType:`active`}),A.invalidateQueries({queryKey:Gh.gitCommits(n,e),exact:!1,refetchType:`active`}));Promise.all(r).catch(Jge)},{key:`pico.git.invalidations`,wait:100}),t=new EventSource(ph(`/events`,{contextId:n,sessionId:j.current,searchParams:{sidebarDirectory:a}}));return P.current=t,t.onopen=()=>{me(t)},t.onerror=()=>{ge(t)},t.onmessage=n=>{ve(t,e,n)},()=>{P.current===t&&(P.current=null),t.close(),e.flush(),e.cancel(),e.clear()}},t[49]=a,t[50]=ge,t[51]=ve,t[52]=me,t[53]=A,t[54]=n,t[55]=ye):ye=t[55];let be;t[56]!==a||t[57]!==V||t[58]!==ge||t[59]!==ve||t[60]!==me||t[61]!==A||t[62]!==n?(be=[a,V,ge,ve,me,A,n],t[56]=a,t[57]=V,t[58]=ge,t[59]=ve,t[60]=me,t[61]=A,t[62]=n,t[63]=be):be=t[63],q.useEffect(ye,be);let G,Se;t[64]!==i||t[65]!==L||t[66]!==p||t[67]!==m||t[68]!==r||t[69]!==ie||t[70]!==n?(G=()=>{if(!n||!r||i||!L||r===ie||p.current!==r)return;let e=new AbortController,t=m.current,a=Math.max(oe.current+1,Date.now()*1e3);return oe.current=a,mh(ph(`/api/session/select`,{contextId:n,sessionId:r,searchParams:{selectionNonce:a,sessionPath:t}}),{method:`POST`,signal:e.signal}).catch(t=>{e.signal.aborted||Tn.error(t instanceof Error?t.message:`Failed to select session`)}),()=>{e.abort()}},Se=[i,L,p,m,ie,n,r],t[64]=i,t[65]=L,t[66]=p,t[67]=m,t[68]=r,t[69]=ie,t[70]=n,t[71]=G,t[72]=Se):(G=t[71],Se=t[72]),q.useEffect(G,Se);let Ce,we;t[73]!==f||t[74]!==p||t[75]!==m||t[76]!==r||t[77]!==ce||t[78]!==ie?(Ce=()=>{if(ce||!ie)return;let e=p.current;if(e){ie===e&&(p.current=void 0,m.current=void 0);return}ie!==r&&f.current(ie,{replace:!0})},we=[f,p,m,r,ce,ie],t[73]=f,t[74]=p,t[75]=m,t[76]=r,t[77]=ce,t[78]=ie,t[79]=Ce,t[80]=we):(Ce=t[79],we=t[80]),q.useEffect(Ce,we)}function Jge(){}function Yge(e){return e.length===0?e:[]}function Xge(){}function Zge(e){return e+1}function Qge(e){return e.draft}function $ge(e){return e.sessionId}var e_e=500;function Q9(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return e.isContentEditable||t===`input`||t===`textarea`||e.closest(`[contenteditable="true"]`)!==null}function $9(e){return e instanceof HTMLTextAreaElement&&e.name===`prompt`}function t_e(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return e.selectionStart!==e.selectionEnd;if(e instanceof HTMLElement){let e=window.getSelection();return!!(e&&String(e).trim())}return!1}function n_e(e){let t=(0,Y.c)(35),{addDirectoryOpenRef:n,commandPaletteOpenRef:r,compactRunningRef:i,deleteOpenRef:a,forkOpenRef:o,gitCommitOpenRef:s,moveSessionDirectoryOpenRef:c,pendingUiRequestOpenRef:l,renameOpenRef:u,sessionSearchInputRef:d,sessionsOpenRef:f,settingsOpenRef:p,shortcutActionsRef:m,shortcutStateRef:h,treeOpenRef:g}=e,_=q.useRef(0),v,y,b,x,S,C,w;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s||t[6]!==c||t[7]!==l||t[8]!==u||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==m||t[13]!==h||t[14]!==g){let e=e=>{let t=h.current,i=r.current,m=n.current||u.current||a.current||o.current||s.current||c.current||g.current||f.current||p.current||l.current,_=document.activeElement,v=_ instanceof HTMLElement&&_.closest(`[data-conversation-viewport="true"]`)!==null,y=_ instanceof HTMLElement?_.dataset.sessionKey?.trim()??``:``,b=y?t.sidebarSessionEntriesByKey.get(y):void 0,x=e.target instanceof HTMLInputElement&&e.target===d.current;return{...t,activeElement:_,activeElementIsConversationViewport:v,blockingModalOpen:m,commandPaletteOpen:i,focusedSidebarSession:b,modalOpen:m||i,targetIsSessionSearch:x}},T=e=>{e&&m.current.closeCommandPalette()},E=t=>{let n=e(t);if(t.repeat||n.modalOpen||t.defaultPrevented)return;let r=Date.now();if(r-_.current<=e_e){_.current=0,t.preventDefault(),m.current.openTreeDialog();return}if(_.current=r,i.current){t.preventDefault(),m.current.abortCompact();return}n.sessionIsStreaming&&!Q9(t.target)&&(t.preventDefault(),m.current.abortSession())},D=t=>{let n=e(t);if(n.modalOpen||Q9(t.target)&&!n.targetIsSessionSearch||n.activeElementIsConversationViewport)return;let r=Array.from(document.querySelectorAll(`[data-sidebar-session-item]`)),i=n.activeElement instanceof HTMLElement?n.activeElement.closest(`[data-sidebar-session-item]`):null;if(r.length===0)return;let a=i?r.findIndex(e=>e===i):-1,o=t.key===`Home`?0:t.key===`End`?r.length-1:a>=0?Math.max(0,Math.min(r.length-1,a+(t.key===`ArrowDown`?1:-1))):t.key===`ArrowUp`?r.length-1:0;t.preventDefault(),r[o]?.focus()},O=t=>{let n=e(t);n.modalOpen||Q9(t.target)&&!n.targetIsSessionSearch||n.selectedSidebarSessions.length<=1||(t.preventDefault(),m.current.openDeleteDialog(n.selectedSidebarSessions))},k=t=>{let n=e(t);n.blockingModalOpen||t.defaultPrevented||(t.preventDefault(),T(n.commandPaletteOpen),m.current.focusPrompt())},A=t=>{let n=e(t);if(!(n.currentTab!==`session`||n.modalOpen||t.defaultPrevented||Q9(t.target)&&!$9(t.target))){if(t.preventDefault(),t.key===`ArrowLeft`){m.current.jumpToPreviousMessage();return}if(t.key===`ArrowRight`){m.current.jumpToNextMessage();return}if(t.key===`ArrowUp`){m.current.scrollConversationToTop();return}m.current.scrollConversationToBottom()}};v=t=>{let n=t.altKey&&t.code.startsWith(`Key`)?t.code.slice(3).toLowerCase():t.key.toLowerCase(),r=e(t);if(!(r.blockingModalOpen||t.defaultPrevented)){if(n===`\\`){t.preventDefault(),T(r.commandPaletteOpen),m.current.toggleGitPanel();return}if(n===`k`){t.preventDefault(),m.current.openCommandPalette();return}if(n===`p`){if(t.preventDefault(),T(r.commandPaletteOpen),t.altKey){m.current.pullGitChanges();return}if(t.shiftKey){m.current.forcePushGitChanges();return}m.current.pushGitChanges();return}if(n===`n`){t.preventDefault(),T(r.commandPaletteOpen),m.current.createSession();return}if(n===`s`){t.preventDefault(),T(r.commandPaletteOpen),m.current.openSessionsDialog();return}if(n===`e`){if(!r.sessionHasFile)return;t.preventDefault(),T(r.commandPaletteOpen),m.current.openRenameDialog();return}if(n===`f`){t.preventDefault(),T(r.commandPaletteOpen),m.current.openForkDialog();return}if(n===`d`){t.preventDefault(),T(r.commandPaletteOpen),m.current.openAddDirectoryDialog();return}if(n===`,`){t.preventDefault(),T(r.commandPaletteOpen),m.current.openSettingsDialog();return}if(n===`m`){if(!r.sessionHasAvailableModels&&!r.commandPaletteOpen)return;t.preventDefault(),T(r.commandPaletteOpen),m.current.focusModelSelector();return}if(n===`t`){t.preventDefault(),T(r.commandPaletteOpen),m.current.toggleHideThinking();return}if(n===`r`){t.preventDefault(),T(r.commandPaletteOpen),m.current.cycleThinkingLevel(t.shiftKey?-1:1);return}if(n===`o`){t.preventDefault(),T(r.commandPaletteOpen),m.current.toggleHideToolBlocks();return}if(n===`c`){if(!r.commandPaletteOpen&&t_e(t.target))return;t.preventDefault(),T(r.commandPaletteOpen),m.current.openCommitDialog();return}if(n===`x`){if(Q9(t.target)&&!$9(t.target)||!r.sessionHasFile)return;t.preventDefault(),T(r.commandPaletteOpen),m.current.openDeleteDialogForCurrentSession()}}},y={hotkey:`Escape`,callback:E,options:{meta:{name:`Abort active session`,description:`Abort compaction or the streaming assistant response.`}}},b=[{key:`ArrowDown`},{key:`ArrowUp`},{key:`Home`},{key:`End`},{key:`ArrowDown`,shift:!0},{key:`ArrowUp`,shift:!0},{key:`Home`,shift:!0},{key:`End`,shift:!0}].map(e=>({hotkey:e,callback:D,options:{meta:{name:`Move sidebar focus`,description:`Move keyboard focus through sidebar sessions.`}}})),x={hotkey:`Backspace`,callback:O,options:{meta:{name:`Delete selected sidebar sessions`,description:`Open the delete dialog for multiple selected sidebar sessions.`}}},S={hotkey:{key:`Enter`,ctrl:!0},callback:k,options:{meta:{name:`Focus prompt`,description:`Focus the prompt composer.`}}},C=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].map(e=>({hotkey:{key:e,ctrl:!0},callback:A,options:{meta:{name:`Navigate conversation`,description:`Jump between messages or to conversation boundaries.`}}})),w=[{key:`\\`},{key:`K`},{key:`P`},{key:`P`,shift:!0},{key:`N`},{key:`S`},{key:`E`},{key:`F`},{key:`D`},{key:`,`},{key:`M`},{key:`T`},{key:`R`},{key:`R`,shift:!0},{key:`V`},{key:`O`},{key:`C`},{key:`X`}].map(e=>({hotkey:{...e,ctrl:!0},callback:v,options:{meta:{name:`App shell shortcut`,description:`Run a Pico app shell command.`}}})),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=v,t[16]=y,t[17]=b,t[18]=x,t[19]=S,t[20]=C,t[21]=w}else v=t[15],y=t[16],b=t[17],x=t[18],S=t[19],C=t[20],w=t[21];let T;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(T={key:`P`,alt:!0},t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E={meta:{name:`App shell shortcut`,description:`Run a Pico app shell command.`}},t[23]=E):E=t[23];let D;t[24]===v?D=t[25]:(D={hotkey:T,callback:v,options:E},t[24]=v,t[25]=D);let O;t[26]!==y||t[27]!==b||t[28]!==x||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==D?(O=[y,...b,x,S,...C,...w,D],t[26]=y,t[27]=b,t[28]=x,t[29]=S,t[30]=C,t[31]=w,t[32]=D,t[33]=O):O=t[33];let k=O,A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A={conflictBehavior:`allow`,ignoreInputs:!1,preventDefault:!1,stopPropagation:!1},t[34]=A):A=t[34],ma(k,A)}var r_e=6;function i_e(e){return a_e(e)}function a_e({viewerContextId:e,sessionId:t,onSelectSession:n,sidebar:i,sidebarStore:a,sessionSearchInputRef:o,ref:s}){let c=En(),l=q.useRef(null);l.current||=An();let u=q.useRef(null);u.current||=_g(l.current);let f=u.current,p=q.useRef(f.state),m=q.useRef(null);m.current||=_g({currentTab:`session`,gitPanelOpen:!1,initialLoadingSessionId:t||null,loadingSessionId:null},mg);let g=m.current,_=q.useRef(null);_.current||=_g(ume());let v=_.current,y=q.useCallback(e=>{bg(g,`currentTab`,e)},[g]),x=q.useCallback(e=>{let t=vg(g.state.gitPanelOpen,e);bg(g,`gitPanelOpen`,t),Te(h,t?`1`:`0`)},[g]),S=q.useCallback(e=>{bg(g,`loadingSessionId`,e)},[g]),C=q.useRef(t),T=q.useRef(null);T.current||=_g({text:``,syncNonce:0});let E=T.current,D=q.useRef(null);D.current||=_g([]);let O=D.current,k=q.useRef([]),A=q.useRef([]),[M,N]=q.useState([]),P=q.useRef(null);P.current||=_g({autoScrollEnabled:!0,centerMessages:!1,hideToolBlocks:!1},mg);let F=P.current,I=q.useRef(F.state),L=q.useRef(F.state.hideToolBlocks),R=q.useCallback(e=>{let t=F.state,n=vg(t.hideToolBlocks,e);if(n===t.hideToolBlocks)return;let r={...t,hideToolBlocks:n};I.current=r,L.current=r.hideToolBlocks,yg(F,r)},[F]),B=q.useCallback(e=>{let t=F.state,n=vg(t.centerMessages,e);if(n===t.centerMessages)return;let r={...t,centerMessages:n};I.current=r,yg(F,r)},[F]),V=q.useCallback(e=>{let t=F.state,n=vg(t.autoScrollEnabled,e);if(n===t.autoScrollEnabled)return;let r={...t,autoScrollEnabled:n};I.current=r,yg(F,r)},[F]),H=q.useRef(null);H.current||=_g(!1);let U=H.current,ee=q.useRef(null);ee.current||=_g(null);let te=ee.current,ne=q.useRef(null);ne.current||=_g([]);let W=ne.current,ie=q.useRef(null);ie.current||=_g(!1);let ae=ie.current,se=q.useRef(null);se.current||=_g([]);let ce=se.current,le=q.useRef(null);le.current||=_g({desktopNotificationPermission:`unsupported`,sessionDoneDesktopNotificationsEnabled:!0,sessionDoneEvents:[],sessionDoneSoundEnabled:!0},mg);let de=le.current,fe=q.useCallback(e=>{bg(de,`sessionDoneEvents`,e)},[de]),pe=q.useCallback(e=>{bg(de,`sessionDoneSoundEnabled`,e)},[de]),he=q.useCallback(e=>{bg(de,`sessionDoneDesktopNotificationsEnabled`,e)},[de]),ge=q.useCallback(e=>{bg(de,`desktopNotificationPermission`,e)},[de]),_e=q.useRef(null);_e.current||=_g({draftSessionLoadingOwnerKey:null,storedDraftDirectory:``},mg);let ve=_e.current,ye=q.useCallback(e=>{bg(ve,`draftSessionLoadingOwnerKey`,e)},[ve]),be=q.useCallback(e=>{bg(ve,`storedDraftDirectory`,e)},[ve]),G=q.useRef(null);G.current||=_g([],ug);let Se=G.current,Ce=q.useCallback(e=>{let t=Se.state,n=vg(t,e);n!==t&&yg(Se,n)},[Se]),{isMobile:we,openMobile:Ee,openMobileSettled:De,setOpenMobile:Oe}=Xc(),ke=q.useRef(null),Ae=q.useRef(null),je=q.useRef(null);je.current||=_g(uge(e),lge);let Me=je.current,Ne=q.useCallback(e=>{let t=A.current,n=vg(t,e);if(n===t)return;A.current=n,N(n);let r=Me.state;yg(Me,{...r,composerDiffLineComments:r.disabled?[]:n})},[Me]),Pe=q.useRef(null);Pe.current||=_g(void 0);let Fe=Pe.current,Ie=q.useRef(null);Ie.current||=new Vo(e=>{yg(Fe,e)},{key:`pico.composer.context-usage`,wait:250,leading:!0,trailing:!0});let Le=Ie.current;q.useEffect(()=>()=>{Le.flush(),Le.cancel()},[Le]);let ze=q.useCallback(e=>{let t=E.state,n=vg(t,e);n!==t&&ta(()=>{yg(E,n);let e=Me.state;yg(Me,{...e,composerSkill:e.disabled?void 0:n.skillName,composerSyncNonce:n.syncNonce,composerText:e.disabled?``:n.text})})},[E,Me]),Be=q.useCallback(e=>{let t=O.state,n=vg(t,e);n!==t&&(k.current=n,ta(()=>{yg(O,n);let e=Me.state;yg(Me,{...e,composerImages:e.disabled?[]:n})}))},[O,Me]),Ve=q.useCallback(e=>{Le.maybeExecute(e)},[Le]),Ue=q.useCallback(e=>{let t=Me.state;yg(Me,{...t,isStreaming:t.disabled?!1:e})},[Me]),We=q.useRef(null),Ge=q.useRef(!1),Ke=q.useRef(null),qe=q.useRef(!1),Je=q.useRef(null),Ye=q.useRef(!1),Ze=q.useRef(null),Qe=q.useRef(null),$e=q.useRef(!1),tt=q.useRef(null),nt=q.useRef(!1),rt=q.useRef(null),it=q.useRef(!1),at=q.useRef(null),ot=q.useRef(!1),st=q.useRef(null),ct=q.useRef(!1),lt=q.useRef(null),ut=q.useRef(!1),dt=q.useRef(null),pt=q.useRef(!1),mt=q.useRef(null),ht=q.useRef(!1),gt=q.useRef(null),_t=q.useRef(!1),vt=q.useRef(null),yt=q.useRef(!1),bt=q.useRef(null),xt=q.useRef(``),St=q.useCallback((e,n=t)=>{let r=e.sessionId||(e.sessionKey?void 0:n),i=e.draft?``:r?.trim()||``,o=e.draft?``:(e.sessionFile||e.sessionPath||``).trim(),s=e.draft?``:og({sessionFile:o,sessionId:i})||e.sessionKey?.trim()||``;a.setSidebarState(e=>e.activeSidebarSessionId===i&&e.activeSidebarSessionKey===s&&e.activeSidebarSessionPath===o?e:{activeSidebarSessionId:i,activeSidebarSessionKey:s,activeSidebarSessionPath:o})},[t,a]),Ct=q.useCallback(e=>{let t=p.current,n=typeof e==`function`?e(t):e,r=f.state;Object.is(t,n)&&Object.is(r,n)||(p.current=n,yg(f,n),St(n))},[St,f]),wt=q.useRef(E.state.text),Tt=q.useRef(E.state.skillName),Et=q.useRef(void 0),Dt=q.useRef(void 0),Ot=q.useRef(e=>{});Ot.current=e=>{vt.current?.open(e)};let kt=q.useRef(new Set),At=q.useRef(!1),jt=q.useRef(null);jt.current||=IX(p.current.items);let Mt=jt.current,Nt=q.useRef(null);Nt.current||=_g(p.current.hiddenThinkingPreview||``);let Pt=Nt.current,Ft=q.useRef(null);Ft.current||=_g(null,gge);let It=Ft.current,Lt=q.useRef(!1),Rt=q.useRef(!1),zt=q.useCallback(e=>{Lt.current=e,e&&(Rt.current=!1)},[]),Bt=q.useCallback(e=>{let t=U.state,n=vg(t,e);n!==t&&ta(()=>{yg(U,n);let e=Me.state;yg(Me,{...e,awaitingFirstTurn:e.disabled?!1:n}),n&&!p.current.streaming?yg(It,{label:``}):!n&&It.state?.label===``&&yg(It,null)})},[U,Me,It]),Ht=q.useCallback(e=>{let t=ae.state,n=vg(t,e);n!==t&&ta(()=>{yg(ae,n);let e=Me.state;yg(Me,{...e,isSubmitting:e.disabled?!1:n})})},[Me,ae]),Ut=q.useCallback(()=>{let e=W.state.map((e,t)=>({pendingId:e.optimisticId||`pending-draft:${t}`,text:e.message,images:e.images,streamingBehavior:e.streamingBehavior})),t=Me.state;yg(Me,{...t,currentPendingMessages:t.disabled?[]:[...e,...ce.state]})},[Me,W,ce]),Wt=q.useCallback(e=>{let t=te.state,n=vg(t,e);n!==t&&ta(()=>{yg(te,n),n?yg(It,{label:`Waiting for new session…`}):It.state?.label===`Waiting for new session…`&&yg(It,null)})},[te,It]),Gt=q.useCallback(e=>{let t=W.state,n=vg(t,e);n!==t&&ta(()=>{yg(W,n),Ut()})},[W,Ut]),qt=q.useCallback(e=>{let t=ce.state,n=vg(t,e);n!==t&&ta(()=>{yg(ce,n),Ut()})},[ce,Ut]),Jt=q.useRef(null);Jt.current||=_ge({key:`pico.conversation.streaming-items`,wait:16,onLatest:e=>{Mt.setItems(e)}});let Yt=Jt.current,Xt=q.useCallback(e=>{if(e.some(e=>e.kind===`assistant`&&e.streaming)&&typeof window<`u`){Yt.add(e);return}Yt.cancel(),Mt.setItems(e)},[Yt,Mt]);q.useEffect(()=>()=>{Yt.flush(),Yt.cancel()},[Yt]);let Qt=q.useCallback((e,t)=>{t?.preserveExisting&&!e||yg(Pt,e)},[Pt]),$t=q.useCallback(e=>{yg(It,e)},[It]),en=q.useCallback(e=>{let t=dge(),n={kind:`user`,itemKey:`pending:${t}`,pendingId:t,text:e.message,images:e.images.map(e=>({...e})),queued:e.queued,streamingBehavior:e.streamingBehavior},r=p.current,i=fge(r.items,n);if(i!==r.items){let e={...r,items:i};p.current=e,Mt.setItems(i),Ct(e)}return t},[Mt]),tn=q.useCallback(e=>{if(!e)return;let t=p.current,n=pge(t.items,e);if(n===t.items)return;let r={...t,items:n};p.current=r,Mt.setItems(n),Ct(r)},[Mt]),{colorMode:nn,previewThemeFamily:rn,setColorMode:an,setThemeFamily:on,systemTheme:sn,themeFamily:cn}=wge(),{initialLoadingSessionId:ln,loadingSessionId:un}=_a(g,e=>({initialLoadingSessionId:e.initialLoadingSessionId,loadingSessionId:e.loadingSessionId}),{compare:mg}),{draftSessionLoadingOwnerKey:dn,storedDraftDirectory:fn}=_a(ve),pn=_a(f,e=>({cwd:e.cwd,draft:e.draft,sessionFile:e.sessionFile,sessionId:e.sessionId,sessionKey:e.sessionKey}),{compare:mg}),mn=_a(g,e=>e.gitPanelOpen),hn=(e,t)=>{e&&ta(()=>{x(!0),fme(v,e,t)})},gn=e=>{pme(v,e)},_n=e=>{mme(v,e)},vn=e=>{hme(v,e)},yn=()=>{gme(v)},bn=e=>{_me(v,e)},xn=()=>{let e=v.state.activeTab;if(we){V7(v,`review`),y(t=>t===`git`&&e===`review`?`session`:`git`);return}if(mn&&e===`review`){x(!1);return}ta(()=>{V7(v,`review`),x(!0)})};q.useEffect(()=>{U7(v)},[v,pn.cwd]),q.useEffect(()=>{pn.draft&&U7(v)},[v,pn.draft]),Mg(a,e=>e.derived.workspaceVersion);let{baseSidebarDirectories:Sn,directoryStateByPath:Cn,directoryIndexes:wn,sidebarSessions:K,selectedSidebarSessions:Dn,sidebarSessionEntriesByKey:On}=a.getWorkspaceSnapshot(),kn=Mg(a,e=>e.state.sessionsEvent?.directories||[],ug),jn=q.useRef(e=>{a.setSidebarSessionStatusByKey(t=>Ag(t,e))});jn.current=e=>{a.setSidebarSessionStatusByKey(t=>Ag(t,e))};let Mn=pn.sessionId||(pn.sessionKey?void 0:t),Nn=r({path:pn.sessionFile,id:Mn}),Pn=Mg(a,e=>Nn?e.state.pinnedSidebarSessionKeys.includes(Nn):!1),Fn=zne(pn),In=q.useRef(``);q.useLayoutEffect(()=>{In.current!==Fn&&(In.current=Fn,Le.cancel(),yg(Fe,p.current.contextUsage))},[Fe,Le,Fn]);let Ln=ln&&!pn.sessionKey?ln:null,Rn=un&&un!==pn.sessionId?un:Ln&&Ln!==pn.sessionId?Ln:null,zn=!!Rn,Bn=Rn?K.find(e=>e.id===Rn):void 0,Vn=Un(Bn),Hn=Vn===`New session`?`Loading session…`:Vn,Wn=zn?Bn?.cwd:pn.cwd;q.useEffect(()=>{let e=C.current;if(C.current=t,e===t)return;let n=p.current,r=t?Dt.current||a.state.derived.sidebarSessions.find(e=>e.id===t)?.path:void 0;St(t?n.draft||n.sessionId!==t?{sessionId:t,sessionPath:r}:n:{draft:!0},t),yg(g,e=>({...e,currentTab:e.currentTab===`git`?`session`:e.currentTab,initialLoadingSessionId:t?e.initialLoadingSessionId:null,loadingSessionId:t&&p.current.sessionId!==t?t:null}))},[g,St,t,a]),q.useEffect(()=>{we||y(e=>e===`git`?`session`:e)},[we,y]);let Gn=(e,t=p.current)=>{let n=gx(e),r=n.matched?n.text:e,i=n.matched?n.skillName:void 0;wt.current=r,Tt.current=i;let a=E.state;(a.text!==r||a.skillName!==i)&&yg(E,{...a,text:r,skillName:i}),et(t,_x({text:r,skillName:i}))},Kn=(e,t=p.current,n)=>{let r=gx(e),i=r.matched?r.text:e,a=r.matched?r.skillName:void 0;wt.current=i,Tt.current=a,ze(e=>{let t=e.text===i&&e.skillName===a,r=n?.forceSync===!0;return t&&!r?e:{text:i,skillName:a,syncNonce:r?e.syncNonce+1:e.syncNonce}}),et(t,_x({text:i,skillName:a}))},qn=fg(Kn),Jn=()=>{ta(()=>{x(Xe()),be(Er()||``),pe(re()),he(j()),R(d()),B(oe()),V(z()),Ce(He()),ge(Yhe())})};q.useEffect(()=>{Jn()},[]);let Yn=()=>{dt.current?.close(),mt.current?.close(),We.current?.open()},Xn=()=>{We.current?.close()},Zn=()=>{We.current?.close(),mt.current?.close(),dt.current?.open()},Qn=()=>{We.current?.close(),dt.current?.close(),mt.current?.open()},$n=()=>{We.current?.close(),dt.current?.close(),mt.current?.close(),lt.current?.open()},er=async t=>{await Promise.all([c.invalidateQueries({queryKey:Gh.gitStatus(e,t),exact:!0,refetchType:`active`}),c.invalidateQueries({queryKey:Gh.gitFiles(e,t),exact:!0,refetchType:`active`}),c.invalidateQueries({queryKey:Gh.gitBranches(e,t),exact:!0,refetchType:`active`}),c.invalidateQueries({queryKey:Gh.gitCommits(e,t),exact:!1,refetchType:`active`}),c.invalidateQueries({queryKey:Gh.projectFileTree(e,t),exact:!0,refetchType:`active`}),c.invalidateQueries({queryKey:Gh.gitFileReviews(e,t),exact:!1,refetchType:`active`})])},tr=ni({mutationKey:Gh.gitAction(e,p.current.cwd?.trim()||``,`push`),mutationFn:async t=>await mh(ph(`/api/git-push`,{contextId:e}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:t})}),onSuccess:async(t,n)=>{await c.invalidateQueries({queryKey:Gh.gitStatus(e,n),exact:!0,refetchType:`active`}),await er(n),wX({response:t})},onError:e=>{Tn.error(e instanceof Error?e.message:`Failed to push`)}}),nr=ni({mutationKey:Gh.gitAction(e,p.current.cwd?.trim()||``,`force-push`),mutationFn:async t=>await mh(ph(`/api/git-push`,{contextId:e}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:t,force:!0})}),onSuccess:async(t,n)=>{await c.invalidateQueries({queryKey:Gh.gitStatus(e,n),exact:!0,refetchType:`active`}),await er(n),wX({response:t,force:!0})},onError:e=>{Tn.error(e instanceof Error?e.message:`Failed to force push`)}}),rr=ni({mutationKey:Gh.gitAction(e,p.current.cwd?.trim()||``,`pull`),mutationFn:async t=>await mh(ph(`/api/git-pull`,{contextId:e}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({cwd:t})}),onSuccess:async(t,n)=>{await c.invalidateQueries({queryKey:Gh.gitStatus(e,n),exact:!0,refetchType:`active`}),await er(n),Tn.success(`Pulled changes`)},onError:e=>{Tn.error(e instanceof Error?e.message:`Failed to pull`)}}),ir=async e=>{let t=p.current.cwd?.trim()||``;if(!t){Tn.error(`Open a session in a repository before running Git actions.`);return}let n=e===`pull`?rr:e===`force-push`?nr:tr;tr.isPending||nr.isPending||rr.isPending||await n.mutateAsync(t).catch(()=>{})},ar=async()=>{await ir(`push`)},or=async()=>{await ir(`force-push`)},sr=async()=>{await ir(`pull`)},cr=()=>{if(we){y(e=>e===`git`?`session`:`git`);return}x(e=>!e)},ur=()=>{let e=p.current;e.sessionFile&&Qe.current?.open({path:e.sessionFile,title:e.sessionName||hg(e)})},dr=e=>{Qe.current?.openForEntry(e)},fr=e=>{tt.current?.open(e)},pr=e=>{rt.current?.open(e)},mr=()=>{let e=p.current;if(e.sessionFile)return{path:e.sessionFile,id:e.sessionId,cwd:e.cwd,title:hg(e),name:e.sessionName,modified:e.modified}},hr=()=>{let e=mr();e&&fr([e])},gr=()=>{Ke.current?.open()},_r=e=>{e.path&&(Ze.current=e,Je.current?.open())},vr=()=>{let e=mr();e&&_r(e)},yr=async()=>{await at.current?.open()},br=async()=>{await st.current?.open()},xr=()=>{Zn()},Sr=()=>{if(g.state.currentTab!==`session`&&y(`session`),we&&(Ee||De)){At.current=!0,Ee&&Oe(!1);return}window.requestAnimationFrame(()=>{Ae.current?.focusPrompt({preventScroll:!0})})},Cr=()=>{Ae.current?.openModelPicker()},wr=fg(Sr),Tr=q.useRef(null),Dr=()=>qe.current||_t.current||Ge.current||it.current||nt.current||ot.current||ut.current||$e.current||pt.current||ht.current||ct.current||yt.current?!0:typeof document>`u`?!1:!!document.querySelector(`[data-slot="dialog-content"][data-open], [data-slot="drawer-content"][data-state="open"]`);q.useEffect(()=>{let e=()=>{Tr.current!==null&&window.clearTimeout(Tr.current),Tr.current=window.setTimeout(()=>{Tr.current=null,!Dr()&&wr.current()},0)};return window.addEventListener(`pico:dialog-closed`,e),()=>{window.removeEventListener(`pico:dialog-closed`,e),Tr.current!==null&&(window.clearTimeout(Tr.current),Tr.current=null)}},[wr]);let Or=q.useRef({sessionId:``,nonce:0}),kr=q.useRef(null),Ar=q.useRef(null),jr=()=>{kr.current!==null&&window.clearTimeout(kr.current),kr.current=window.setTimeout(()=>{kr.current=null,!Dr()&&wr.current()},50)};q.useEffect(()=>()=>{kr.current!==null&&(window.clearTimeout(kr.current),kr.current=null)},[]),q.useEffect(()=>{if(!At.current||Ee||De)return;At.current=!1;let e=window.setTimeout(()=>{wr.current()},0);return()=>{window.clearTimeout(e)}},[wr,Ee,De]),q.useEffect(()=>{if(zn||Dr())return;let e=pn.sessionKey||pn.sessionId||`draft`;Ar.current!==e&&(Ar.current=e,wr.current())},[wr,zn,pn.sessionId,pn.sessionKey]),q.useEffect(()=>{let e=Or.current;!e.nonce||zn||Dr()||e.sessionId&&pn.sessionId!==e.sessionId||jr()},[zn,pn.sessionId]);let Mr=e=>{pe(e),Te(w,e?`1`:`0`),e&&C9()},Nr=async e=>{if(he(e),Te(Re,e?`1`:`0`),!e)return;let t=await Xhe();ge(t),t===`denied`?Tn.info(`Allow notifications for this site in your browser to receive desktop alerts.`):t===`unsupported`&&Tn.error(`Desktop notifications are unavailable in this browser.`)},Pr=q.useCallback((e,t)=>{let n=e?Bne(a.state.derived.sidebarSessionEntriesByKey,{sessionId:e,sessionPath:t?.sessionPath}):``;a.setSelectedSidebarSessionKeys(e=>n?ug(e,[n])?e:[n]:e.length===0?e:[]),a.setSidebarSessionSelectionAnchor(e=>e===n?e:n)},[a]),Fr=q.useCallback((e,t)=>{y(e=>e===`git`?`session`:e),Pr(e,t),St({draft:!e,sessionId:e,sessionPath:t?.sessionPath}),Et.current=e,Dt.current=t?.sessionPath?.trim()||void 0,e&&(Or.current={sessionId:e,nonce:Or.current.nonce+1}),S(t=>e?!p.current.draft&&p.current.sessionId===e?t:e:null),n?.(e,t)},[n,p,St,Pr]),Ir=fg(Fr);qge({viewerContextId:e,sessionId:t,draftSessionLoadingOwnerKey:dn,bootstrapSidebarDirectories:a.state.state.initialSidebarBootstrapDirectories,hideToolBlocksRef:L,sessionStore:f,sessionStateRef:p,composerTextRef:wt,composerSkillRef:Tt,replaceComposerDraftRef:qn,handleSelectSessionRef:Ir,pendingRouteSessionIdRef:Et,pendingRouteSessionPathRef:Dt,setSessionState:Ct,setConversationItems:Xt,setHiddenThinkingPreview:Qt,setWorkingState:$t,setCompactRunningState:zt,setComposerContextUsage:Ve,setComposerStreaming:Ue,setSessionsEvent:a.setSessionsEvent,setSessionDoneEvents:fe,applySidebarSessionStatusRef:jn,setComposerImages:Be,setPendingMessages:qt,pendingUiRequestHandlerRef:Ot,lastSyncedEditorTextRef:xt}),q.useEffect(()=>{let e=pn.cwd?.trim();e&&(Te(Zt,e),be(e))},[pn.cwd]),q.useEffect(()=>{let e=pn.cwd?.trim(),n=pn.sessionId?.trim();if(!t||!n||pn.draft||!e||n!==t)return;let r=`${n}\n${e}`;kt.current.has(r)||(kt.current.add(r),a.setSidebarDirectories(t=>{let n=me(t);if(n.includes(e))return t;let r=me([e,...n]);return Te(b,JSON.stringify(r)),r}))},[t,pn.cwd,pn.draft,pn.sessionId,a]);let Lr=pn.cwd?.trim()||Sn[0]||fn||``,Rr=q.useMemo(()=>{let e=[],t=new Set,n=(n,r)=>{let i=n.trim();!i||t.has(i)||(t.add(i),e.push({path:i,label:r}))};pn.cwd?.trim()&&n(pn.cwd,`Current session directory`),fn&&n(fn,`Draft directory`);for(let e of Sn)n(e,`Sidebar directory`);return e},[Sn,pn.cwd,fn]),zr=q.useMemo(()=>me([...Sn,...kn,pn.cwd||``,fn,...Array.from(Cn.keys()),...Object.values(wn).flatMap(e=>e.map(e=>e.cwd||``))]),[Sn,wn,Cn,pn.cwd,kn,fn]),Br=pn.cwd?.trim()||(Sn.length>0?Sn[0]??``:fn)||Lr,Vr=e=>{let t=e.trim();t&&Ce(e=>{let n=me([t,...e]).slice(0,8);return Te(lr,JSON.stringify(n)),n})},Hr=q.useCallback(e=>{},[]),Ur=q.useCallback(e=>{let t=p.current,n=(e?.id||t.sessionKey||`optimistic:${xe(t)}`).trim(),i=(e?.cwd||t.cwd||Lr).trim();if(!n||!i)return;let o=new Date().toISOString(),s={id:n,cwd:i,title:`New session`,modified:o,lastUserMessageAt:o,streaming:!0,unread:!1,optimistic:!0},c=r(s);a.setSidebarDirectories(e=>{let t=me(e);if(t.includes(i))return e;let n=me([i,...t]);return Te(b,JSON.stringify(n)),n});let l={...s,id:n,cwd:i};return a.setDirectoryIndexDataByPath(e=>Eg(e,l)),a.setSessionsEvent(e=>e&&{...e,directoryIndexes:Eg(e.directoryIndexes||{},l)}),c&&(a.setSelectedSidebarSessionKeys(e=>ug(e,[c])?e:[c]),a.setSidebarSessionSelectionAnchor(e=>e===c?e:c)),n},[Lr,p,a]),Wr=q.useCallback(e=>{let t=e?.trim()||``;if(!t)return;let n=r({id:t});a.setDirectoryIndexDataByPath(e=>Dg(e,t)),a.setSessionsEvent(e=>e?.directoryIndexes?{...e,directoryIndexes:Dg(e.directoryIndexes,t)}:e),n&&(a.setSelectedSidebarSessionKeys(e=>e.filter(e=>e!==n)),a.setSidebarSessionSelectionAnchor(e=>e===n?``:e))},[a]),Gr=q.useCallback(()=>{a.setSelectedSidebarSessionKeys(e=>e.length===0?e:[]),a.setSidebarSessionSelectionAnchor(e=>e&&``)},[a]),Kr=U.state,qr=ae.state,Jr=te.state,Yr=W.state,Xr=ce.state,{abortSession:Zr,addDirectoryPath:Qr,createSession:$r,editPendingMessage:ei,removePendingMessage:ti,reorderPending:ri,submitPrompt:ii}=Cge({viewerContextId:e,activeSessionId:Mn,defaultNewSessionDirectory:Lr,sessionStore:f,sessionStateRef:p,draftSessionLoadingOwnerKey:dn,pendingDraftPrompt:Jr,pendingDraftFollowUps:Yr,awaitingFirstTurn:Kr,pendingMessages:Xr,composerDiffLineCommentsRef:A,composerImagesRef:k,composerTextRef:wt,composerSkillRef:Tt,replaceComposerDraft:Kn,lastSyncedEditorTextRef:xt,rememberRecentDirectory:Vr,prefetchDirectorySessionsIndex:Hr,addOptimisticUserMessage:en,removeOptimisticUserMessage:tn,addOptimisticSidebarSession:Ur,removeOptimisticSidebarSession:Wr,setSidebarDirectories:a.setSidebarDirectories,setStoredDraftDirectory:be,setDraftSessionLoadingOwnerKey:ye,setPendingDraftPrompt:Wt,setPendingDraftFollowUps:Gt,setPendingMessages:qt,setAwaitingFirstTurn:Bt,setIsSubmitting:Ht,setComposerDiffLineComments:Ne,setComposerImages:Be}),ai=q.useCallback(e=>{let t=e.trim();if(!t)return;let n=p.current;if(!n.draft||n.items.length>0)return;Te(Zt,t),be(t),Vr(t);let r=N9({previous:n,cwd:t,ownerKey:xe({cwd:t})});p.current=r,Mt.setItems(r.items),Ct(r),et(r,_x({text:wt.current,skillName:Tt.current}))},[Mt,Vr,p,Ct,be]),oi=q.useCallback(async e=>{let t=await Qr(e);return typeof t==`string`&&ai(t),t},[Qr,ai]),si=q.useCallback(async(e,t)=>{let n=p.current,r=lg({cwdOverride:e,defaultDirectory:Lr,currentCwd:n.cwd}),i=xe({cwd:r}),a=`optimistic:${i}`,o=!!t?.closeMobileSidebar&&we&&Ee,s=$r(r);Fr(void 0),Gr(),o?(At.current=!0,Oe(!1)):Sr(),Bt(!1),qt(e=>e.length===0?e:[]);let c=N9({previous:n,cwd:r,ownerKey:i});p.current=c,Mt.setItems(c.items),Ct(c),!await s&&p.current.sessionKey===a&&(p.current=n,Mt.setItems(n.items),Ct(n))},[Gr,Mt,Lr,Sr,Fr,we,Ee,$r,p,Bt,Oe,qt,Ct]),ci=()=>typeof crypto<`u`&&typeof crypto.randomUUID==`function`?`diff-comment:${crypto.randomUUID()}`:`diff-comment:${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,li=e=>{let t=e.text.trim(),n=p.current.cwd?.trim()||``;!t||!n||(Ne(r=>[...r,{...e,id:ci(),cwd:n,text:t}]),Ae.current?.focusPrompt({preventScroll:!0}))},ui=async e=>{if(!e||e.length===0)return;let t=Array.from(e).filter(e=>e.type.startsWith(`image/`));if(t.length===0)return;let n=await Promise.all(t.slice(0,8).map(e=>hh(e)));Be(e=>[...e,...n].slice(0,8))},di=E.state,fi=O.state,pi=Yr.map((e,t)=>({pendingId:O9(e,t),text:e.message,images:e.images,streamingBehavior:e.streamingBehavior})),mi=pi.length>0||Xr.length>0?[...pi,...Xr]:j9,hi=zn,gi=hi?k9:M,_i=hi?j9:mi,vi=hi?A9:fi,yi=hi?``:di.text,bi=hi?void 0:di.skillName,xi=(e,t)=>{let n=Yr.find((t,n)=>O9(t,n)===e);return n?!t.trim()&&n.images.length===0?(Tn.error(`Enter a message or keep at least one image`),!0):(Gt(n=>n.map((n,r)=>O9(n,r)===e?{...n,message:t}:n)),!0):!1},Si=e=>Yr.some((t,n)=>O9(t,n)===e)?(Gt(t=>t.filter((t,n)=>O9(t,n)!==e)),!0):!1,Ci=(e,t)=>{let n=oge(Yr,e,t);return n?(Gt(n),!0):!1},wi=q.useCallback(e=>{if(zt(e),e){yg(It,{label:mge,cancelable:!0});return}if(Rt.current){Rt.current=!1,yg(It,{label:hge,error:!0});return}It.state?.label===`Compacting context...`&&yg(It,null)},[zt,It]),Ti=q.useCallback(()=>Rt.current,[]),{cycleThinkingLevel:Ei,deleteSessions:Di,moveSessionPath:Oi,renameSessionPath:ki,runClone:Ai,runCompact:ji,setModel:Mi,setThinkingBlocksHidden:Ni,setThinkingLevel:Pi,toggleHideThinking:Fi}=Oge({viewerContextId:e,activeSessionId:Mn,sessionStateRef:p,setSessionState:Ct,getDirectoryIndexDataByPath:()=>a.state.state.directoryIndexDataByPath,setDirectoryIndexDataByPath:a.setDirectoryIndexDataByPath,getSessionsEvent:()=>a.state.state.sessionsEvent,setSessionsEvent:a.setSessionsEvent,getSidebarSelection:()=>{let e=a.state.state;return{selectedSidebarSessionKeys:e.selectedSidebarSessionKeys,sidebarSessionSelectionAnchor:e.sidebarSessionSelectionAnchor}},optimisticallyClearActiveDeletedSession:e=>{let t=p.current;if(t.sessionFile!==e)return;let n=`delete:${e}`,r=`optimistic:${n}`;Fr(void 0,{replace:!0});let i=N9({previous:t,cwd:t.cwd,ownerKey:n});return p.current=i,Mt.setItems(i.items),Ct(i),()=>{p.current.sessionKey===r&&(t.sessionId&&Fr(t.sessionId,{replace:!0,sessionPath:t.sessionFile}),p.current=t,Mt.setItems(t.items),Ct(t))}},setSelectedSidebarSessionKeys:a.setSelectedSidebarSessionKeys,setSidebarSessionSelectionAnchor:a.setSidebarSessionSelectionAnchor,setPinnedSidebarSessionKeys:a.setPinnedSidebarSessionKeys,setCompactWorkingState:wi,isCompactAbortRequested:Ti}),Ii=async(e,t)=>{let n=await Oi(e,t);return n&&Vr(t),n},Li=async(t,n)=>{if(!e||!t.path)return!1;let r=t.path,i=!!t.unread,o=!!n,s=e=>{a.setSidebarSessionStatusByKey(n=>Ag(n,{type:`session_status`,sessionId:t.id,sessionPath:r,unread:e}))};s(o);try{return await mh(ph(`/api/session/read-state`,{contextId:e,sessionId:Mn}),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:r,unread:o})}),await c.invalidateQueries({queryKey:[`pico`,`directory-sessions-index`,e],refetchType:`active`}),Tn.success(o?`Marked session unread`:`Marked session read`),!0}catch(e){return s(i),Tn.error(e instanceof Error?e.message:`Failed to update session read state`),!1}},Ri=async e=>{let t=Ze.current;if(!t)return!1;let n=await Ii(t,e);return n&&(Ze.current=null),n},zi=async e=>{let t=p.current;return t.sessionFile?await Ii({path:t.sessionFile,id:t.sessionId,cwd:t.cwd,title:hg(t),name:t.sessionName,modified:t.modified},e):!1},Bi=e=>{R(e),Te(Kt,e?`1`:`0`)},Vi=()=>{let e=I.current.hideToolBlocks;Bi(!e),Tn.info(e?`Tools shown`:`Tools hidden`)},Hi=e=>{B(e),Te(eee,e?`1`:`0`)},Ui=e=>{V(e),Te(Vt,e?`1`:`0`)},Wi=(e=`login`)=>{gt.current?.open(e)},Gi=async(e,t)=>{let n=t.trim(),r=()=>{Kn(``,p.current,{forceSync:!0})};switch(e){case`login`:if(n){Tn.error(`/login does not take any arguments yet.`);return}r(),Wi(`login`);return;case`logout`:if(n){Tn.error(`/logout does not take any arguments yet.`);return}r(),Wi(`logout`);return;case`compact`:if(fi.length>0){Tn.error(`Built-in slash commands do not support images.`);return}r(),await ji();return;case`clone`:if(n){Tn.error(`/clone does not take any arguments.`);return}if(fi.length>0){Tn.error(`Built-in slash commands do not support images.`);return}r(),await Ai();return;case`rename`:if(!pn.sessionFile){Tn.error(`Start the session before renaming it.`);return}if(!n){r(),ur();return}r(),await ki(pn.sessionFile,n);return;case`delete`:if(!pn.sessionFile){Tn.error(`Start the session before deleting it.`);return}r(),hr();return;case`fork`:if(n){Tn.error(`/fork does not take any arguments.`);return}r(),await yr();return;case`tree`:if(n){Tn.error(`/tree does not take any arguments.`);return}r(),await br();return;case`hide-thinking`:r(),p.current.hideThinkingBlock||await Fi();return;case`show-thinking`:r(),p.current.hideThinkingBlock&&await Fi();return;case`hide-tools`:r(),Bi(!0);return;case`show-tools`:r(),Bi(!1);return;default:Tn.error(`Unsupported slash command: /${e}`)}},Ki=e=>{on(e)},qi=(e,t)=>{rn(e,t)},Ji=e=>{an(e)},Yi={activeSessionId:Mn,awaitingFirstTurn:hi?!1:Kr,centerMessages:I.current.centerMessages,composerDiffLineComments:gi,composerImages:vi,composerSkill:bi,composerSyncNonce:di.syncNonce,composerText:yi,currentPendingMessages:_i,disabled:hi,isStreaming:hi?!1:p.current.streaming,isSubmitting:hi?!1:qr,viewerContextId:e};q.useLayoutEffect(()=>{yg(Me,Yi)});let Xi=fg({abortSession:Zr,onPickImages:ui,removeDiffLineComment:e=>{Ne(t=>t.filter(t=>t.id!==e))},onRemoveComposerImage:e=>{Be(t=>t.filter((t,n)=>n!==e))},editPendingDraftFollowUp:xi,editPendingMessage:ei,removePendingDraftFollowUp:Si,removePendingMessage:ti,reorderPending:ri,reorderPendingDraftFollowUp:Ci,runBuiltinSlashCommand:Gi,setModel:Mi,setThinkingLevel:Pi,submitPrompt:ii,syncComposerDraft:Gn}),Zi=fg({gitPanelOpen:mn,hasAvailableModels:p.current.availableModels.length>0,isMobile:we,selectedSidebarSessions:Dn,sessionFile:pn.sessionFile}),Qi=fg(()=>{let e=Zi.current,t=p.current.hideThinkingBlock,n=p.current.thinkingLevel,r=[{id:`new-session`,group:`Sessions`,title:`New session`,description:`Create a new draft session`,shortcut:Ah(`Control+N`),keywords:[`create`,`draft`,`session`],onSelect:si},{id:`open-sessions`,group:`Sessions`,title:`Open sessions`,description:`Search and switch sessions`,shortcut:Ah(`Control+S`),keywords:[`session`,`search`,`switch`,`jump`],onSelect:Zn},{id:`open-git-view`,group:`Git`,title:e.isMobile?`Toggle right sidebar tab`:e.gitPanelOpen?`Close right sidebar`:`Open right sidebar`,description:e.isMobile?`Switch the mobile right sidebar tab on or off`:`Toggle the right sidebar`,shortcut:Ah(`Control+\\`),keywords:[`right`,`sidebar`,`git`,`changes`,`branch`,`commit`,`panel`],onSelect:cr},{id:`commit-changes`,group:`Git`,title:`Commit changes`,description:`Open the Git commit dialog`,shortcut:Ah(`Control+C`),keywords:[`git`,`commit`,`changes`,`stage`],onSelect:$n},{id:`push-changes`,group:`Git`,title:`Push changes`,description:`Push local commits to the remote`,shortcut:Ah(`Control+P`),keywords:[`git`,`push`,`remote`,`upstream`],onSelect:ar},{id:`force-push-changes`,group:`Git`,title:`Force push changes`,description:`Force push local commits with --force-with-lease`,shortcut:Ah(`Control+Shift+P`),keywords:[`git`,`force`,`push`,`remote`,`upstream`,`lease`],onSelect:or},{id:`pull-changes`,group:`Git`,title:`Pull changes`,description:`Pull remote changes into the current branch`,shortcut:Ah(`Alt+P`),keywords:[`git`,`pull`,`remote`,`upstream`],onSelect:sr},{id:`focus-prompt`,group:`Assistant`,title:`Focus prompt`,description:`Move focus to the prompt field`,shortcut:Ah(`Control+Enter`),keywords:[`prompt`,`composer`,`input`,`message`,`reply`],onSelect:Sr},{id:`set-model`,group:`Assistant`,title:`Set model`,description:`Open the model picker`,shortcut:Ah(`Control+M`),keywords:[`model`,`provider`,`picker`,`choose`],onSelect:()=>{if(!Zi.current.hasAvailableModels)throw Error(`No models are available right now.`);Cr()}},{id:`add-directory`,group:`Sidebar`,title:`Add Directory`,description:`Add a directory accordion to the sidebar`,shortcut:Ah(`Control+D`),keywords:[`workspace`,`sidebar`,`directory`,`folder`],onSelect:gr},{id:`tree-session`,group:`Sessions`,title:`Open tree`,description:`Jump to an earlier point in the current session tree`,shortcut:`Esc Esc`,keywords:[`tree`,`branch`,`history`,`navigate`],onSelect:br},{id:`fork-session`,group:`Sessions`,title:`Fork session`,description:`Create a new session from a previous user message`,shortcut:Ah(`Control+F`),keywords:[`fork`,`branch`,`draft`],onSelect:yr},{id:`clone-session`,group:`Sessions`,title:`Clone session`,description:`Duplicate the current active branch into a new session`,keywords:[`clone`,`branch`,`duplicate`,`session`],onSelect:Ai},{id:`compact-session`,group:`Sessions`,title:`Compact`,description:`Manually compact the session context with /compact`,keywords:[`compact`,`context`,`compress`,`summarize`],onSelect:ji},{id:`toggle-thinking`,group:`Assistant`,title:t?`Show thinking blocks`:`Hide thinking blocks`,description:t?`Show assistant thinking blocks`:`Hide assistant thinking blocks`,shortcut:Ah(`Control+T`),keywords:[`thinking`,`reasoning`,`visibility`,`show`,`hide`],onSelect:Fi},{id:`cycle-reasoning`,group:`Assistant`,title:`Next reasoning level`,description:`Current level: ${n}`,shortcut:Ah(`Control+R`),keywords:[`thinking`,`reasoning`,`level`,`cycle`,`next`],onSelect:()=>{Ei(1)}},{id:`previous-reasoning`,group:`Assistant`,title:`Previous reasoning level`,description:`Current level: ${n}`,shortcut:Ah(`Control+Shift+R`),keywords:[`thinking`,`reasoning`,`level`,`cycle`,`previous`,`back`],onSelect:()=>{Ei(-1)}},{id:`toggle-review-pane`,group:`Git`,title:`Toggle Review Pane`,description:`Toggle the review pane for changed files`,keywords:[`review`,`diff`,`file`,`changes`,`pane`],onSelect:xn},{id:`toggle-tools`,group:`Assistant`,title:I.current.hideToolBlocks?`Show tool calls`:`Hide tool calls`,description:I.current.hideToolBlocks?`Show assistant tool calls`:`Hide assistant tool calls`,shortcut:Ah(`Control+O`),keywords:[`tools`,`tool calls`,`visibility`,`show`,`hide`],onSelect:Vi},{id:`login-provider`,group:`App`,title:`Login to provider`,description:`Configure provider API key or subscription auth`,keywords:[`login`,`auth`,`api key`,`oauth`,`provider`],onSelect:()=>Wi(`login`)},{id:`logout-provider`,group:`App`,title:`Logout from provider`,description:`Remove stored provider credentials`,keywords:[`logout`,`auth`,`api key`,`oauth`,`provider`],onSelect:()=>Wi(`logout`)},{id:`open-settings`,group:`App`,title:`Open settings`,description:`Open app settings`,shortcut:Ah(`Control+,`),keywords:[`settings`,`theme`,`notifications`,`display`],onSelect:Qn}];return e.sessionFile&&(r.splice(1,0,{id:`rename-session`,group:`Sessions`,title:`Rename session`,description:`Rename the current session`,shortcut:Ah(`Control+E`),keywords:[`rename`,`title`,`name`],onSelect:ur}),r.push({id:`delete-session`,group:`Sessions`,title:`Delete session`,description:`Delete ${hg(p.current)}`,shortcut:Ah(`Control+X`),keywords:[`delete`,`remove`,`session`],onSelect:hr})),e.selectedSidebarSessions.length>0&&r.push({id:`delete-selected-sessions`,group:`Sidebar`,title:`Delete selected sidebar sessions`,description:`Delete ${e.selectedSidebarSessions.length} selected sidebar ${e.selectedSidebarSessions.length===1?`session`:`sessions`}`,keywords:[`delete`,`selected`,`sidebar`,`sessions`],onSelect:()=>{fr(Zi.current.selectedSidebarSessions)}}),r}),$i=q.useCallback(async()=>{Lt.current&&(Rt.current=!0,await Zr())},[Zr]),ea=fg({abortCompact:$i,abortSession:Zr,createSession:si,closeCommandPalette:Xn,forcePushGitChanges:or,focusModelSelector:Cr,focusPrompt:Sr,focusSessionSearch:xr,jumpToNextMessage:()=>{bt.current?.jumpToNextMessage()},jumpToPreviousMessage:()=>{bt.current?.jumpToPreviousMessage()},openAddDirectoryDialog:gr,openCommandPalette:Yn,openCommitDialog:$n,openDeleteDialog:fr,openDeleteDialogForCurrentSession:hr,openForkDialog:yr,openRenameDialog:ur,openSessionsDialog:Zn,openSettingsDialog:Qn,openTreeDialog:br,pullGitChanges:sr,pushGitChanges:ar,scrollConversationToBottom:()=>{bt.current?.scrollConversationToBottom()},scrollConversationToTop:()=>{bt.current?.scrollConversationToTop()},toggleGitPanel:cr,toggleHideThinking:Fi,toggleHideToolBlocks:Vi,cycleThinkingLevel:Ei}),na=fg({currentTab:we?g.state.currentTab:`session`,selectedSidebarSessions:Dn,sessionHasAvailableModels:p.current.availableModels.length>0,sessionHasFile:!!pn.sessionFile,sessionIsStreaming:p.current.streaming,sidebarSessionEntriesByKey:On}),ra=fg({createSession:si,onDeleteCurrentSession:hr,onForkSession:yr,onMoveCurrentSession:zi,onMoveCurrentSessionToAnyDirectory:vr,onRenameSession:ur,onRunCompact:ji,onToggleCurrentSessionPinned:()=>{let e=p.current,t=r({path:e.sessionFile,id:e.sessionId});t&&a.setPinnedSidebarSessionKeys(e=>{let n=ue(e),r=n.includes(t)?n.filter(e=>e!==t):[t,...n];return Te(ft,JSON.stringify(r)),r})},onToggleHideThinking:Fi,onToggleHideToolBlocks:Vi,onTreeSession:br});n_e({addDirectoryOpenRef:qe,commandPaletteOpenRef:Ge,compactRunningRef:Lt,deleteOpenRef:nt,forkOpenRef:ot,gitCommitOpenRef:ut,moveSessionDirectoryOpenRef:Ye,pendingUiRequestOpenRef:yt,renameOpenRef:$e,sessionSearchInputRef:o,sessionsOpenRef:pt,settingsOpenRef:ht,shortcutActionsRef:ea,shortcutStateRef:na,treeOpenRef:ct});let ia=q.useRef(null);return ia.current={stores:{appUi:g,composer:Me,contextUsage:Fe,conversationItems:Mt,displaySettings:F,draftFlow:ve,notification:de,rightSidebar:v,session:f,sidebar:a},refs:{composerImages:k,composerPanel:Ae,composerSkill:Tt,composerText:wt,conversationFrame:bt,sessionState:p},actions:{createSession:si,focusModelSelector:Cr,focusPrompt:Sr,focusSessionSearch:xr,openAddDirectoryDialog:gr,openCommandPalette:Yn,openDeleteDialog:fr,moveSessionToDirectory:Ii,openDeleteOldDirectorySessionsDialog:pr,openMoveSessionDirectoryDialogForEntry:_r,openRenameDialogForEntry:dr,openSessionsDialog:Zn,openSettingsDialog:Qn,setSessionUnread:Li,selectSession:Fr}},q.useImperativeHandle(s,()=>{let e=ia.current?.actions;return{createSession:e?.createSession??si,openAddDirectoryDialog:e?.openAddDirectoryDialog??gr,openCommandPalette:e?.openCommandPalette??Yn,openDeleteDialog:e?.openDeleteDialog??fr,openDeleteOldDirectorySessionsDialog:e?.openDeleteOldDirectorySessionsDialog??pr,moveSessionToDirectory:e?.moveSessionToDirectory??Ii,openMoveSessionDirectoryDialogForEntry:e?.openMoveSessionDirectoryDialogForEntry??_r,openRenameDialogForEntry:e?.openRenameDialogForEntry??dr,openSessionsDialog:e?.openSessionsDialog??Zn,openSettingsDialog:e?.openSettingsDialog??Qn,setSessionUnread:e?.setSessionUnread??Li,selectSession:e?.selectSession??Fr}},[si,Fr,gr,Yn,Ii,fr,pr,_r,dr,Zn,Qn,Li]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ege,{isSessionViewLoading:zn,loadingDisplaySessionTitle:Hn,notificationStore:de,sessionStore:f,sidebarStore:a,onSelectSession:Fr}),(0,J.jsx)(Rme,{actionsRef:ra,defaultNewSessionDirectory:Lr,displaySessionCwd:Wn,gitPanelOpen:mn,loadingDisplaySessionTitle:Hn,currentSessionPinned:Pn,displaySettingsStore:F,isSessionViewLoading:zn,newSessionDirectoryOptions:Rr,onToggleGitPanel:cr,sessionStore:f,viewerContextId:e}),(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[i,(0,J.jsx)(rl,{className:`min-h-0 overflow-hidden`,children:(0,J.jsx)(jme,{actionsRef:Xi,appUiStore:g,composerDiffLineComments:gi,composerPanelRef:Ae,contextUsageStore:Fe,conversationFrameRef:bt,conversationItemsStore:Mt,defaultNewSessionDirectory:Lr,displaySettingsStore:F,fileInputRef:ke,gitPanelOpen:mn,hiddenThinkingPreviewStore:Pt,isSessionViewLoading:zn,isSubmitting:qr,isMobile:we,newSessionDirectoryOptions:Rr,onCancelCompaction:$i,onCreateSession:e=>{si(e)},onOpenAddDirectoryDialog:gr,onCloseAllFileViewTabs:yn,onCloseFileViewTab:gn,onCloseFileViewTabsToRight:vn,onCloseOtherFileViewTabs:_n,onAddDiffLineComment:li,onOpenFileViewTab:hn,onReorderFileViewTabs:bn,rightSidebarStore:v,sessionStore:f,store:Me,viewerContextId:e,workingStateStore:It,awaitingFirstTurn:Kr,onValueChange:y})})]}),(0,J.jsx)(k_,{activeSessionId:Mn,addDirectoryDialogRef:Ke,addDirectoryOpenRef:qe,addDirectoryPath:oi,baseSidebarDirectories:Sn,commandPaletteCommandsRef:Qi,commandPaletteOpenRef:Ge,commandPaletteRef:We,currentSessionQueryScope:Fn,currentTheme:cn,currentThemeColorMode:nn,authDialogRef:gt,authOpenRef:_t,deleteDialogRef:tt,deleteOpenRef:nt,deleteSessions:Di,deleteOldDirectorySessionsDialogRef:rt,deleteOldDirectorySessionsOpenRef:it,notificationStore:de,forkDialogRef:at,forkOpenRef:ot,gitCommitDialogRef:lt,gitCommitOpenRef:ut,displaySettingsStore:F,knownDirectories:zr,moveSessionDirectoryDialogRef:Je,moveSessionDirectoryOpenRef:Ye,moveSessionDirectoryTargetToPath:Ri,onAutoScrollEnabledChange:Ui,onCenterMessagesChange:Hi,onHideThinkingBlocksChange:e=>{Ni(e)},onHideToolBlocksChange:Bi,onSessionDoneDesktopNotificationsEnabledChange:Nr,onSessionDoneSoundEnabledChange:Mr,onSessionDialogSelect:Fr,onThemeChange:Ki,onThemeColorModeChange:Ji,onThemePreviewChange:qi,systemTheme:sn,recentDirectoriesStore:Se,renameDialogRef:Qe,renameOpenRef:$e,renameSessionPath:ki,sessionCwd:pn.cwd,sessionsDialogDirectory:Br,sessionsDialogRef:dt,sessionsOpenRef:pt,sessionStore:f,settingsDialogRef:mt,settingsOpenRef:ht,sidebarStore:a,treeDialogRef:st,treeOpenRef:ct,uiRequestDialogRef:vt,uiRequestOpenRef:yt,viewerContextId:e})]})}function o_e({sessionId:e,onSelectSession:t}){let[n,r]=q.useState(``),i=q.useRef(null);i.current||=Qne();let a=i.current,o=q.useRef(null),c=q.useRef(null);return q.useEffect(()=>{let e=window.localStorage.getItem(`pico-context-id`)?.trim()||cn();Te(s,e),r(e);let t=me(zn().directories),n=t.slice(0,r_e),i=Ke();a.setSidebarState(e=>ug(e.sidebarDirectories,t)&&ug(e.initialSidebarBootstrapDirectories,n)&&ug(e.pinnedSidebarSessionKeys,i)?e:{sidebarDirectories:t,initialSidebarBootstrapDirectories:n,pinnedSidebarSessionKeys:i})},[a]),(0,J.jsx)($c,{className:`h-full flex-col overflow-hidden bg-background [--header-height:3rem]`,children:(0,J.jsx)(i_e,{ref:c,viewerContextId:n,sessionId:e,onSelectSession:t,sidebar:(0,J.jsx)(The,{viewerContextId:n,sidebarStore:a,sessionWorkspaceRef:c}),sidebarStore:a,sessionSearchInputRef:o})})}function s_e(){let e=(0,Y.c)(6),{session:t}=$n.useSearch(),n=$n.useNavigate(),r;e[0]!==n||e[1]!==t?(r=(e,r)=>{let i=e||void 0;i!==t&&n({search:e=>({...e,session:i}),replace:r?.replace??!1})},e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;return e[3]!==t||e[4]!==r?(i=(0,J.jsx)(o_e,{sessionId:t,onSelectSession:r}),e[3]=t,e[4]=r,e[5]=i):i=e[5],i}export{s_e as component};
|