@jean2/client 1.0.4 → 1.0.5
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/README.md +2 -2
- package/dist/assets/ServerContext-Dy9T5Mj8.js +1 -0
- package/dist/assets/SessionContent-DMPPyidM.js +11 -0
- package/dist/assets/{SessionMenuButton-vkh7M4zW.js → SessionMenuButton-DtN_qfRb.js} +1 -1
- package/dist/assets/_serverId-BOWHyoan.js +12 -0
- package/dist/assets/_sessionId-BfVgqUBK.js +1 -0
- package/dist/assets/_sessionId-Bp7Qrc4O.js +1 -0
- package/dist/assets/add-server-BU3oc_j3.js +1 -0
- package/dist/assets/index-Db3JxRbZ.js +10 -0
- package/dist/assets/index-DzEyMPKG.css +2 -0
- package/dist/assets/{mutation-CAoDu7x3.js → mutation-D4xtepYQ.js} +1 -1
- package/dist/assets/{overview-BqXC_X43.js → overview-DbKX71kj.js} +1 -1
- package/dist/assets/platform-cRBZ7eSy.js +1 -0
- package/dist/assets/{preload-helper-eKqpTzup.js → preload-helper-D844vhe4.js} +1 -1
- package/dist/assets/{queries-CFdMXU0x.js → queries-C0JoQFZb.js} +1 -1
- package/dist/assets/{routes-cgaNpRxR.js → routes-Ck6V8B0w.js} +1 -1
- package/dist/assets/{sidebar-C-dZ1XFl.js → sidebar-BqQ-fUFc.js} +1 -1
- package/dist/assets/{src-DMBD0Xgc.js → src-BALdofIU.js} +1 -1
- package/dist/assets/{workspace-CdMsk_3x.js → workspace-BzFUmInc.js} +1 -1
- package/dist/cli.mjs +21 -9
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/ServerContext-CH3cYgM3.js +0 -1
- package/dist/assets/SessionContent-CMU2K0ZO.js +0 -9
- package/dist/assets/_serverId-BCYw0-Oi.js +0 -12
- package/dist/assets/_sessionId-B6Q1fh9D.js +0 -1
- package/dist/assets/_sessionId-DErHwuR_.js +0 -1
- package/dist/assets/add-server-BdiLp0YW.js +0 -1
- package/dist/assets/index-BPY3JRFs.css +0 -2
- package/dist/assets/index-DFZki7uV.js +0 -10
- package/dist/assets/platform-BOMKRNFM.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,r as n,t as r}from"./compiler-runtime-DZXZ41-q.js";import{$ as i,H as a,I as o,L as s,P as c,Q as l,U as u,V as d,X as f,at as p,et as m,it as h,n as g,nt as _,ot as v,q as y,st as b,tt as x}from"./platform-BOMKRNFM.js";import{i as S,n as C,r as w,t as T}from"./classPrivateFieldGet2-BGlEuFdn.js";import{Q as E,Z as D,_ as O,b as k,f as A,h as j,j as M,p as N}from"./badge-Cjebg6Sp.js";import"./src-DMBD0Xgc.js";import{t as P}from"./createLucideIcon-CuVT3KNW.js";import{D as ee,M as te,a as ne,c as re,d as ie,l as ae,n as oe,o as se,r as F,s as ce,t as le,u as ue}from"./button--1wnt03c.js";var I,L,de,R,z,B,V,H,fe,U,W,G,K,q,J,Y,pe=(I=new WeakMap,L=new WeakMap,de=new WeakMap,R=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,fe=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,K=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakSet,class extends b{constructor(e,t){super(),s(this,Y),S(this,I,void 0),S(this,L,void 0),S(this,de,void 0),S(this,R,void 0),S(this,z,void 0),S(this,B,void 0),S(this,V,void 0),S(this,H,void 0),S(this,fe,void 0),S(this,U,void 0),S(this,W,void 0),S(this,G,void 0),S(this,K,void 0),S(this,q,void 0),S(this,J,new Set),this.options=t,C(I,this,e),C(H,this,null),C(V,this,a()),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(L,this).addObserver(this),we(T(L,this),this.options)?w(Y,this,me).call(this):this.updateResult(),w(Y,this,ve).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Te(T(L,this),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Te(T(L,this),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,w(Y,this,ye).call(this),w(Y,this,be).call(this),T(L,this).removeObserver(this)}setOptions(e){let t=this.options,n=T(L,this);if(this.options=T(I,this).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,T(L,this))!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);w(Y,this,xe).call(this),T(L,this).setOptions(this.options),t._defaulted&&!x(this.options,t)&&T(I,this).getQueryCache().notify({type:`observerOptionsUpdated`,query:T(L,this),observer:this});let r=this.hasListeners();r&&Ee(T(L,this),n,this.options,t)&&w(Y,this,me).call(this),this.updateResult(),r&&(T(L,this)!==n||i(this.options.enabled,T(L,this))!==i(t.enabled,T(L,this))||m(this.options.staleTime,T(L,this))!==m(t.staleTime,T(L,this)))&&w(Y,this,he).call(this);let a=w(Y,this,ge).call(this);r&&(T(L,this)!==n||i(this.options.enabled,T(L,this))!==i(t.enabled,T(L,this))||a!==T(q,this))&&w(Y,this,_e).call(this,a)}getOptimisticResult(e){let t=T(I,this).getQueryCache().build(T(I,this),e),n=this.createResult(t,e);return Oe(this,n)&&(C(R,this,n),C(B,this,this.options),C(z,this,T(L,this).state)),n}getCurrentResult(){return T(R,this)}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t==null||t(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&T(V,this).status===`pending`&&T(V,this).reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){T(J,this).add(e)}getCurrentQuery(){return T(L,this)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=T(I,this).defaultQueryOptions(e),n=T(I,this).getQueryCache().build(T(I,this),t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){var t;return w(Y,this,me).call(this,{...e,cancelRefetch:(t=e.cancelRefetch)==null?!0:t}).then(()=>(this.updateResult(),T(R,this)))}createResult(e,t){let n=T(L,this),r=this.options,s=T(R,this),c=T(z,this),u=T(B,this),d=e===n?T(de,this):e.state,{state:f}=e,p={...f},m=!1,h;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&we(e,t),s=i&&Ee(e,n,t,r);(a||s)&&(p={...p,...o(f.data,e.options)}),t._optimisticResults===`isRestoring`&&(p.fetchStatus=`idle`)}let{error:g,errorUpdatedAt:_,status:v}=p;h=p.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&v===`pending`){let e;if(s!=null&&s.isPlaceholderData&&t.placeholderData===(u==null?void 0:u.placeholderData))e=s.data,y=!0;else{var b;e=typeof t.placeholderData==`function`?t.placeholderData((b=T(W,this))==null?void 0:b.state.data,T(W,this)):t.placeholderData}e!==void 0&&(v=`success`,h=l(s==null?void 0:s.data,e,t),m=!0)}if(t.select&&h!==void 0&&!y)if(s&&h===(c==null?void 0:c.data)&&t.select===T(fe,this))h=T(U,this);else try{C(fe,this,t.select),h=t.select(h),h=l(s==null?void 0:s.data,h,t),C(U,this,h),C(H,this,null)}catch(e){C(H,this,e)}T(H,this)&&(g=T(H,this),h=T(U,this),_=Date.now(),v=`error`);let x=p.fetchStatus===`fetching`,S=v===`pending`,w=v===`error`,E=S&&x,D=h!==void 0,O={status:v,fetchStatus:p.fetchStatus,isPending:S,isSuccess:v===`success`,isError:w,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:p.dataUpdatedAt,error:g,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:x,isRefetching:x&&!S,isLoadingError:w&&!D,isPaused:p.fetchStatus===`paused`,isPlaceholderData:m,isRefetchError:w&&D,isStale:De(e,t),refetch:this.refetch,promise:T(V,this),isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},o=()=>{i(C(V,this,O.promise=a()))},s=T(V,this);switch(s.status){case`pending`:e.queryHash===n.queryHash&&i(s);break;case`fulfilled`:(r||O.data!==s.value)&&o();break;case`rejected`:(!r||O.error!==s.reason)&&o();break}}return O}updateResult(){let e=T(R,this),t=this.createResult(T(L,this),this.options);C(z,this,T(L,this).state),C(B,this,this.options),T(z,this).data!==void 0&&C(W,this,T(L,this)),!x(t,e)&&(C(R,this,t),w(Y,this,Se).call(this,{listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!T(J,this).size)return!0;let r=new Set(n==null?T(J,this):n);return this.options.throwOnError&&r.add(`error`),Object.keys(T(R,this)).some(t=>{let n=t;return T(R,this)[n]!==e[n]&&r.has(n)})})()}))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&w(Y,this,ve).call(this)}});function me(e){w(Y,this,xe).call(this);let t=T(L,this).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(f)),t}function he(){w(Y,this,ye).call(this);let e=m(this.options.staleTime,T(L,this));if(u.isServer()||T(R,this).isStale||!y(e))return;let t=h(T(R,this).dataUpdatedAt,e)+1;C(G,this,p.setTimeout(()=>{T(R,this).isStale||this.updateResult()},t))}function ge(){var e;return(e=typeof this.options.refetchInterval==`function`?this.options.refetchInterval(T(L,this)):this.options.refetchInterval)==null?!1:e}function _e(e){w(Y,this,be).call(this),C(q,this,e),!(u.isServer()||i(this.options.enabled,T(L,this))===!1||!y(T(q,this))||T(q,this)===0)&&C(K,this,p.setInterval(()=>{(this.options.refetchIntervalInBackground||v.isFocused())&&w(Y,this,me).call(this)},T(q,this)))}function ve(){w(Y,this,he).call(this),w(Y,this,_e).call(this,w(Y,this,ge).call(this))}function ye(){T(G,this)!==void 0&&(p.clearTimeout(T(G,this)),C(G,this,void 0))}function be(){T(K,this)!==void 0&&(p.clearInterval(T(K,this)),C(K,this,void 0))}function xe(){let e=T(I,this).getQueryCache().build(T(I,this),this.options);if(e===T(L,this))return;let t=T(L,this);C(L,this,e),C(de,this,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))}function Se(e){d.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(T(R,this))}),T(I,this).getQueryCache().notify({query:T(L,this),type:`observerResultsUpdated`})})}function Ce(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&i(t.retryOnMount,e)===!1)}function we(e,t){return Ce(e,t)||e.state.data!==void 0&&Te(e,t,t.refetchOnMount)}function Te(e,t,n){if(i(t.enabled,e)!==!1&&m(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&De(e,t)}return!1}function Ee(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&De(e,n)}function De(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(m(t.staleTime,e))}function Oe(e,t){return!x(e.getCurrentResult(),t)}var X=e(),Z=t(n(),1),ke=Z.createContext(!1),Ae=()=>Z.useContext(ke);ke.Provider;function je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Me=Z.createContext(je()),Ne=()=>Z.useContext(Me),Pe=(e,t,n)=>{let r=n!=null&&n.state.error&&typeof e.throwOnError==`function`?_(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Fe=e=>{Z.useEffect(()=>{e.clearReset()},[e])},Ie=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||_(n,[e.error,r])),Le=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e==null?t:e,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))}},Re=(e,t)=>e.isLoading&&e.isFetching&&!t,ze=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Be=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ve(e,t,n){var r,i,a,o;let s=Ae(),l=Ne(),p=c(n),m=p.defaultQueryOptions(e);(r=p.getDefaultOptions().queries)==null||(i=r._experimental_beforeQuery)==null||i.call(r,m);let h=p.getQueryCache().get(m.queryHash);m._optimisticResults=s?`isRestoring`:`optimistic`,Le(m),Pe(m,l,h),Fe(l);let g=!p.getQueryCache().get(m.queryHash),[_]=Z.useState(()=>new t(p,m)),v=_.getOptimisticResult(m),y=!s&&e.subscribed!==!1;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=y?_.subscribe(d.batchCalls(e)):f;return _.updateResult(),t},[_,y]),()=>_.getCurrentResult(),()=>_.getCurrentResult()),Z.useEffect(()=>{_.setOptions(m)},[m,_]),ze(m,v))throw Be(m,_,l);if(Ie({result:v,errorResetBoundary:l,throwOnError:m.throwOnError,query:h,suspense:m.suspense}))throw v.error;if((a=p.getDefaultOptions().queries)==null||(o=a._experimental_afterQuery)==null||o.call(a,m,v),m.experimental_prefetchInRender&&!u.isServer()&&Re(v,s)){let e=g?Be(m,_,l):h==null?void 0:h.promise;e==null||e.catch(f).finally(()=>{_.updateResult()})}return m.notifyOnChangeProps?v:_.trackResult(v)}function He(e,t){return Ve(e,pe,t)}var Ue=P(`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`}]]),We=P(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ge=P(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ke=P(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),qe=5e3,Je=M(e=>({completionState:new Map,setCompletion:(t,n)=>e(e=>{let r=new Map(e.completionState);return r.set(t,n),{completionState:r}}),clearCompletion:t=>e(e=>{let n=new Map(e.completionState);return n.delete(t),{completionState:n}}),clearAllCompletions:()=>e({completionState:new Map})})),Ye=e=>t=>t.completionState.get(e),Xe=qe,Ze={sessions:{all:[`sessions`],byWorkspace:e=>[`sessions`,`workspace`,e],grouped:(e,t)=>[`sessions`,`grouped`,{workspaceIds:[...e].sort(),status:t}]},tools:{all:[`tools`],envVars:[`tools`,`envVars`]},config:{models:[`config`,`models`],preconfigs:[`config`,`preconfigs`],prompts:[`config`,`prompts`],providers:{all:[`providers`],credentials:[`providers`,`credentials`]}},mcp:{status:e=>[`mcp`,`status`,e]},files:{browse:(e,t,n)=>[`files`,`browse`,e,t==null?`.`:t,n],browseFs:e=>[`files`,`browseFs`,e],drives:[`files`,`drives`],parent:e=>[`files`,`parent`,e],preview:(e,t)=>[`files`,`preview`,e,t]},serverInfo:[`serverInfo`]},Q=r();function Qe(e){return E(e)}function $e(e){if(typeof window>`u`)return e;try{let t=localStorage.getItem(D.SESSIONS);if(t===null)return e;let n=JSON.parse(t);return typeof n.width!=`number`||isNaN(n.width)?e:Qe(n.width)}catch{return e}}function et(e){if(!(typeof window>`u`))try{let t=Qe(e);localStorage.setItem(D.SESSIONS,JSON.stringify({width:t}))}catch(e){console.warn(`Error saving sessions panel width:`,e)}}function tt(e){if(typeof window>`u`)return e;try{let t=localStorage.getItem(D.FILES);if(t===null)return e;let n=JSON.parse(t);return typeof n.width!=`number`||isNaN(n.width)?e:Qe(n.width)}catch{return e}}function nt(e){if(!(typeof window>`u`))try{let t=Qe(e);localStorage.setItem(D.FILES,JSON.stringify({width:t}))}catch(e){console.warn(`Error saving files panel width:`,e)}}var rt=()=>$e(256),it=()=>tt(256),$=M(e=>({showFilesPanel:!1,showTerminalPanel:!1,sessionsPanelWidth:rt(),filesPanelWidth:it(),setShowFilesPanel:t=>e({showFilesPanel:t}),setShowTerminalPanel:t=>e({showTerminalPanel:t}),setSessionsPanelWidth:t=>{let n=E(t);et(n),e({sessionsPanelWidth:n})},setFilesPanelWidth:t=>{let n=E(t);nt(n),e({filesPanelWidth:n})}}));function at(e){let t=(0,Q.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,X.jsx)(ue,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function ot(e){let t=(0,Q.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,X.jsx)(ae,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function st(e){let t=(0,Q.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=F(`fixed inset-0 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,X.jsx)(re,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ct(e){let t=(0,Q.c)(24),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,side:o,showCloseButton:s,style:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=o===void 0?`right`:o,l=s===void 0?!0:s,u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(st,{}),t[7]=u):u=t[7];let d;t[8]===r?d=t[9]:(d=F(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t 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=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=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,r),t[8]=r,t[9]=d);let f=g()?`90px`:`0px`,p;t[10]===c?p=t[11]:(p=c===`left`||c===`right`?{top:`calc(env(safe-area-inset-top, 0px) + ${f})`,bottom:`env(safe-area-inset-bottom, 0px)`,height:`calc(100vh - env(safe-area-inset-top, 0px) - ${f} - env(safe-area-inset-bottom, 0px))`}:c===`top`?{top:`calc(env(safe-area-inset-top, 0px) + ${f})`}:c===`bottom`?{bottom:`env(safe-area-inset-bottom, 0px)`}:void 0,t[10]=c,t[11]=p);let m=p,h;t[12]!==m||t[13]!==a?(h=m?{...m,...a}:a,t[12]=m,t[13]=a,t[14]=h):h=t[14];let _=h,v;t[15]===l?v=t[16]:(v=l&&(0,X.jsx)(ne,{"data-slot":`sheet-close`,asChild:!0,children:(0,X.jsxs)(le,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,X.jsx)(te,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}),t[15]=l,t[16]=v);let y;return t[17]!==n||t[18]!==i||t[19]!==c||t[20]!==d||t[21]!==_||t[22]!==v?(y=(0,X.jsxs)(ot,{children:[u,(0,X.jsxs)(se,{"data-slot":`sheet-content`,"data-side":c,className:d,style:_,...i,children:[n,v]})]}),t[17]=n,t[18]=i,t[19]=c,t[20]=d,t[21]=_,t[22]=v,t[23]=y):y=t[23],y}function lt(e){let t=(0,Q.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=F(`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,X.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ut(e){let t=(0,Q.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=F(`text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ie,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dt(e){let t=(0,Q.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=F(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ce,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ft=`sidebar_state`,pt=3600*24*7,mt=`16rem`,ht=`18rem`,gt=`3rem`,_t=Z.createContext(null);function vt(){let e=Z.useContext(_t);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function yt(e){var t;let n=(0,Q.c)(35),r,i,a,o,s,c,l,u;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],l=n[7],u=n[8]):({defaultOpen:u,open:a,onOpenChange:c,className:i,style:l,children:r,panelId:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c,n[7]=l,n[8]=u);let d=u===void 0?!0:u,f=k(),[p,m]=Z.useState(!1),[h,g]=Z.useState(d),_=(t=a)==null?h:t,v;n[9]!==_||n[10]!==c?(v=e=>{let t=typeof e==`function`?e(_):e;c?c(t):g(t),document.cookie=`${ft}=${t}; path=/; max-age=${pt}`},n[9]=_,n[10]=c,n[11]=v):v=n[11];let y=v,b;n[12]!==f||n[13]!==y?(b=()=>f?m(xt):y(bt),n[12]=f,n[13]=y,n[14]=b):b=n[14];let x=b,S=_?`expanded`:`collapsed`,C;n[15]!==f||n[16]!==_||n[17]!==p||n[18]!==y||n[19]!==S||n[20]!==x?(C={state:S,open:_,setOpen:y,isMobile:f,openMobile:p,setOpenMobile:m,toggleSidebar:x},n[15]=f,n[16]=_,n[17]=p,n[18]=y,n[19]=S,n[20]=x,n[21]=C):C=n[21];let w=C,T;n[22]===l?T=n[23]:(T={"--sidebar-width":mt,"--sidebar-width-icon":gt,...l},n[22]=l,n[23]=T);let E=T,D;n[24]===i?D=n[25]:(D=F(`overflow-hidden group/sidebar-wrapper flex h-full w-full has-data-[variant=inset]:bg-sidebar`,i),n[24]=i,n[25]=D);let O;n[26]!==r||n[27]!==o||n[28]!==s||n[29]!==E||n[30]!==D?(O=(0,X.jsx)(`div`,{"data-slot":`sidebar-wrapper`,"data-panel-id":o,style:E,className:D,...s,children:r}),n[26]=r,n[27]=o,n[28]=s,n[29]=E,n[30]=D,n[31]=O):O=n[31];let A;return n[32]!==w||n[33]!==O?(A=(0,X.jsx)(_t.Provider,{value:w,children:O}),n[32]=w,n[33]=O,n[34]=A):A=n[34],A}function bt(e){return!e}function xt(e){return!e}function St(e){let t=(0,Q.c)(53),n,r,i,a,o,s,c,l;if(t[0]!==e){let{side:u,variant:d,collapsible:f,className:p,children:m,dir:h,isOpen:g,onOpenChange:_,...v}=e;s=u,c=d,l=f,r=p,n=m,i=h,a=g,o=v,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8];let u=s===void 0?`left`:s,d=c===void 0?`sidebar`:c,f=l===void 0?`offcanvas`:l,{isMobile:p,state:m,openMobile:h,setOpenMobile:g}=vt(),_=a===void 0?void 0:a,v=_===void 0?m:_?`expanded`:`collapsed`;if(f===`none`){let e;t[9]===r?e=t[10]:(e=F(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[9]=r,t[10]=e);let i;return t[11]!==n||t[12]!==o||t[13]!==e?(i=(0,X.jsx)(`div`,{"data-slot":`sidebar`,className:e,...o,children:n}),t[11]=n,t[12]=o,t[13]=e,t[14]=i):i=t[14],i}if(p){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e={"--sidebar-width":ht},t[15]=e):e=t[15];let r;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(lt,{className:`sr-only`,children:[(0,X.jsx)(ut,{children:`Sidebar`}),(0,X.jsx)(dt,{children:`Displays the mobile sidebar.`})]}),t[16]=r):r=t[16];let a;t[17]===n?a=t[18]:(a=(0,X.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:n}),t[17]=n,t[18]=a);let s;t[19]!==i||t[20]!==u||t[21]!==a?(s=(0,X.jsxs)(ct,{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:u,children:[r,a]}),t[19]=i,t[20]=u,t[21]=a,t[22]=s):s=t[22];let c;return t[23]!==h||t[24]!==o||t[25]!==g||t[26]!==s?(c=(0,X.jsx)(at,{open:h,onOpenChange:g,...o,children:s}),t[23]=h,t[24]=o,t[25]=g,t[26]=s,t[27]=c):c=t[27],c}let y=v===`collapsed`?f:``,b=_!==void 0&&!_&&`w-0`,x=d===`floating`||d===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,S;t[28]!==b||t[29]!==x?(S=F(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,b,`group-data-[side=right]:rotate-180`,x),t[28]=b,t[29]=x,t[30]=S):S=t[30];let C;t[31]===S?C=t[32]:(C=(0,X.jsx)(`div`,{"data-slot":`sidebar-gap`,className:S}),t[31]=S,t[32]=C);let w=u===`left`&&_!==void 0&&!_&&`left-[calc(var(--sidebar-width)*-1)]`,T=u===`right`&&_!==void 0&&!_&&`right-[calc(var(--sidebar-width)*-1)]`,E=d===`floating`||d===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,D;t[33]!==r||t[34]!==T||t[35]!==E||t[36]!==w?(D=F(`fixed z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear 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`,w,T,E,r),t[33]=r,t[34]=T,t[35]=E,t[36]=w,t[37]=D):D=t[37];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O={top:`calc(var(--header-height, 0px) + env(safe-area-inset-top, 0px))`,bottom:`env(safe-area-inset-bottom, 0px)`,height:`calc(100vh - var(--header-height, 0px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))`},t[38]=O):O=t[38];let k;t[39]===n?k=t[40]:(k=(0,X.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[39]=n,t[40]=k);let A;t[41]!==o||t[42]!==u||t[43]!==D||t[44]!==k?(A=(0,X.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":u,className:D,style:O,...o,children:k}),t[41]=o,t[42]=u,t[43]=D,t[44]=k,t[45]=A):A=t[45];let j;return t[46]!==v||t[47]!==u||t[48]!==A||t[49]!==y||t[50]!==C||t[51]!==d?(j=(0,X.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":v,"data-collapsible":y,"data-variant":d,"data-side":u,"data-slot":`sidebar`,children:[C,A]}),t[46]=v,t[47]=u,t[48]=A,t[49]=y,t[50]=C,t[51]=d,t[52]=j):j=t[52],j}function Ct(e){let t=(0,Q.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=F(`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,X.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 wt(e){let t=(0,Q.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=F(`mx-2 w-auto bg-sidebar-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(O,{"data-slot":`sidebar-separator`,"data-sidebar":`separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Tt=Z.forwardRef((e,t)=>{let n=(0,Q.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`no-scrollbar flex min-h-0 min-w-0 w-full flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:a,ref:t,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});function Et(e){let t=(0,Q.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=F(`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,X.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 Dt(e){let t=(0,Q.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?ee:`div`,o;t[4]===n?o=t[5]:(o=F(`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:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,X.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Ot(e){let t=(0,Q.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=F(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.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 kt(e){let t=(0,Q.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=F(`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,X.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 At(e){let t=(0,Q.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=F(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.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 jt=oe(`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:bg-sidebar-accent hover:text-sidebar-accent-foreground focus:ring-1 focus:ring-inset 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 data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function Mt(e){let t=(0,Q.c)(28),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]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?ee:`button`,{isMobile:m,state:h}=vt(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=F(jt({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,X.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,X.jsx)(j,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,X.jsx)(N,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,X.jsxs)(A,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function Nt(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?ee:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=F(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus:ring-1 focus:ring-inset md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,X.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function Pt(e){let t=(0,Q.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=F(`ml-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border pl-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ft(e){let t=(0,Q.c)(29),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({side:a,panelId:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=k(),s=$(zt),c=$(Rt),l=$(Lt),u=$(It),d=r===`sessions`?s:l,f=r===`sessions`?c:u,[p,m]=Z.useState(!1),h=Z.useRef(!1),g=Z.useRef(0),_=Z.useRef(0),v=Z.useRef(0),y=Z.useRef(null),b=Z.useRef(null),x;t[5]!==o||t[6]!==r?(x=e=>{if(o)return;e.preventDefault(),e.stopPropagation(),h.current=!0,m(!0),g.current=e.clientX,_.current=v.current,document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`;let t=document.querySelector(`[data-panel-id="${r}"]`);y.current=t,t&&(b.current=t.style.getPropertyValue(`--sidebar-width`)||null,t.classList.add(`no-transition`))},t[5]=o,t[6]=r,t[7]=x):x=t[7];let S=x,C,w;t[8]===d?(C=t[9],w=t[10]):(C=()=>{v.current=d},w=[d],t[8]=d,t[9]=C,t[10]=w),Z.useEffect(C,w);let T,D;if(t[11]!==r||t[12]!==f||t[13]!==a?(T=()=>{let e=e=>{if(!h.current)return;let t=a===`left`?e.clientX-g.current:g.current-e.clientX,n=E(_.current+t);v.current=n;let i=y.current||document.querySelector(`[data-panel-id="${r}"]`);i&&(i.style.setProperty(`--sidebar-width`,`${Math.round(n)}px`),y.current=i);let o=document.querySelector(`[data-panel-gap="${r}"]`);o&&(o.style.width=`${Math.round(n)}px`)},t=()=>{if(!h.current)return;h.current=!1,m(!1),document.body.style.cursor=``,document.body.style.userSelect=``;let e=y.current||document.querySelector(`[data-panel-id="${r}"]`);e&&(e.classList.remove(`no-transition`),b.current===null?e.style.removeProperty(`--sidebar-width`):e.style.setProperty(`--sidebar-width`,b.current));let t=document.querySelector(`[data-panel-gap="${r}"]`);t&&(t.classList.add(`no-transition`),t.style.width=`${Math.round(v.current)}px`,requestAnimationFrame(()=>{t==null||t.classList.remove(`no-transition`)})),f(Math.round(v.current))};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},D=[f,a,r],t[11]=r,t[12]=f,t[13]=a,t[14]=T,t[15]=D):(T=t[14],D=t[15]),Z.useEffect(T,D),o)return null;let O=a===`left`?`absolute top-0 right-0`:`absolute top-0 left-0`,A;t[16]!==n||t[17]!==O?(A=F(`z-30 flex h-full w-2 cursor-ew-resize items-center justify-center group/sidebar-resize`,O,n),t[16]=n,t[17]=O,t[18]=A):A=t[18];let j=p?`bg-primary`:`group-active/sidebar-resize:bg-primary`,M;t[19]===j?M=t[20]:(M=F(`h-8 w-0.5 rounded-full transition-colors duration-100`,`bg-transparent group-hover/sidebar-resize:bg-border`,j),t[19]=j,t[20]=M);let N;t[21]===M?N=t[22]:(N=(0,X.jsx)(`div`,{className:M}),t[21]=M,t[22]=N);let P;return t[23]!==S||t[24]!==r||t[25]!==i||t[26]!==A||t[27]!==N?(P=(0,X.jsx)(`div`,{"data-slot":`panel-resize-handle`,"data-panel-id":r,className:A,onMouseDown:S,...i,children:N}),t[23]=S,t[24]=r,t[25]=i,t[26]=A,t[27]=N,t[28]=P):P=t[28],P}function It(e){return e.setFilesPanelWidth}function Lt(e){return e.filesPanelWidth}function Rt(e){return e.setSessionsPanelWidth}function zt(e){return e.sessionsPanelWidth}function Bt(e){let t=(0,Q.c)(6),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;return t[3]!==n||t[4]!==r?(i=(0,X.jsx)(Ft,{side:`left`,panelId:`sessions`,className:n,...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}export{He as A,Xe as C,Ge as D,Ke as E,We as O,Ze as S,Je as T,at as _,Et as a,ut as b,Ct as c,Mt as d,At as f,vt as g,wt as h,Tt as i,Ue as k,kt as l,yt as m,Bt as n,Ot as o,Pt as p,St as r,Dt as s,Ft as t,Nt as u,ct as v,Ye as w,$ as x,lt as y};
|
|
1
|
+
import{n as e,o as t,r as n,t as r}from"./compiler-runtime-DZXZ41-q.js";import{$ as i,H as a,I as o,L as s,P as c,Q as l,U as u,V as d,X as f,at as p,et as m,it as h,n as g,nt as _,ot as v,q as y,st as b,tt as x}from"./platform-cRBZ7eSy.js";import{i as S,n as C,r as w,t as T}from"./classPrivateFieldGet2-BGlEuFdn.js";import{Q as E,Z as D,_ as O,b as k,f as A,h as j,j as M,p as N}from"./badge-Cjebg6Sp.js";import"./src-BALdofIU.js";import{t as P}from"./createLucideIcon-CuVT3KNW.js";import{D as ee,M as te,a as ne,c as re,d as ie,l as ae,n as oe,o as se,r as F,s as ce,t as le,u as ue}from"./button--1wnt03c.js";var I,L,de,R,z,B,V,H,fe,U,W,G,K,q,J,Y,pe=(I=new WeakMap,L=new WeakMap,de=new WeakMap,R=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap,fe=new WeakMap,U=new WeakMap,W=new WeakMap,G=new WeakMap,K=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakSet,class extends b{constructor(e,t){super(),s(this,Y),S(this,I,void 0),S(this,L,void 0),S(this,de,void 0),S(this,R,void 0),S(this,z,void 0),S(this,B,void 0),S(this,V,void 0),S(this,H,void 0),S(this,fe,void 0),S(this,U,void 0),S(this,W,void 0),S(this,G,void 0),S(this,K,void 0),S(this,q,void 0),S(this,J,new Set),this.options=t,C(I,this,e),C(H,this,null),C(V,this,a()),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(T(L,this).addObserver(this),we(T(L,this),this.options)?w(Y,this,me).call(this):this.updateResult(),w(Y,this,ve).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Te(T(L,this),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Te(T(L,this),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,w(Y,this,ye).call(this),w(Y,this,be).call(this),T(L,this).removeObserver(this)}setOptions(e){let t=this.options,n=T(L,this);if(this.options=T(I,this).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,T(L,this))!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);w(Y,this,xe).call(this),T(L,this).setOptions(this.options),t._defaulted&&!x(this.options,t)&&T(I,this).getQueryCache().notify({type:`observerOptionsUpdated`,query:T(L,this),observer:this});let r=this.hasListeners();r&&Ee(T(L,this),n,this.options,t)&&w(Y,this,me).call(this),this.updateResult(),r&&(T(L,this)!==n||i(this.options.enabled,T(L,this))!==i(t.enabled,T(L,this))||m(this.options.staleTime,T(L,this))!==m(t.staleTime,T(L,this)))&&w(Y,this,he).call(this);let a=w(Y,this,ge).call(this);r&&(T(L,this)!==n||i(this.options.enabled,T(L,this))!==i(t.enabled,T(L,this))||a!==T(q,this))&&w(Y,this,_e).call(this,a)}getOptimisticResult(e){let t=T(I,this).getQueryCache().build(T(I,this),e),n=this.createResult(t,e);return Oe(this,n)&&(C(R,this,n),C(B,this,this.options),C(z,this,T(L,this).state)),n}getCurrentResult(){return T(R,this)}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t==null||t(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&T(V,this).status===`pending`&&T(V,this).reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){T(J,this).add(e)}getCurrentQuery(){return T(L,this)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=T(I,this).defaultQueryOptions(e),n=T(I,this).getQueryCache().build(T(I,this),t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){var t;return w(Y,this,me).call(this,{...e,cancelRefetch:(t=e.cancelRefetch)==null?!0:t}).then(()=>(this.updateResult(),T(R,this)))}createResult(e,t){let n=T(L,this),r=this.options,s=T(R,this),c=T(z,this),u=T(B,this),d=e===n?T(de,this):e.state,{state:f}=e,p={...f},m=!1,h;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&we(e,t),s=i&&Ee(e,n,t,r);(a||s)&&(p={...p,...o(f.data,e.options)}),t._optimisticResults===`isRestoring`&&(p.fetchStatus=`idle`)}let{error:g,errorUpdatedAt:_,status:v}=p;h=p.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&v===`pending`){let e;if(s!=null&&s.isPlaceholderData&&t.placeholderData===(u==null?void 0:u.placeholderData))e=s.data,y=!0;else{var b;e=typeof t.placeholderData==`function`?t.placeholderData((b=T(W,this))==null?void 0:b.state.data,T(W,this)):t.placeholderData}e!==void 0&&(v=`success`,h=l(s==null?void 0:s.data,e,t),m=!0)}if(t.select&&h!==void 0&&!y)if(s&&h===(c==null?void 0:c.data)&&t.select===T(fe,this))h=T(U,this);else try{C(fe,this,t.select),h=t.select(h),h=l(s==null?void 0:s.data,h,t),C(U,this,h),C(H,this,null)}catch(e){C(H,this,e)}T(H,this)&&(g=T(H,this),h=T(U,this),_=Date.now(),v=`error`);let x=p.fetchStatus===`fetching`,S=v===`pending`,w=v===`error`,E=S&&x,D=h!==void 0,O={status:v,fetchStatus:p.fetchStatus,isPending:S,isSuccess:v===`success`,isError:w,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:p.dataUpdatedAt,error:g,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>d.dataUpdateCount||p.errorUpdateCount>d.errorUpdateCount,isFetching:x,isRefetching:x&&!S,isLoadingError:w&&!D,isPaused:p.fetchStatus===`paused`,isPlaceholderData:m,isRefetchError:w&&D,isStale:De(e,t),refetch:this.refetch,promise:T(V,this),isEnabled:i(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},o=()=>{i(C(V,this,O.promise=a()))},s=T(V,this);switch(s.status){case`pending`:e.queryHash===n.queryHash&&i(s);break;case`fulfilled`:(r||O.data!==s.value)&&o();break;case`rejected`:(!r||O.error!==s.reason)&&o();break}}return O}updateResult(){let e=T(R,this),t=this.createResult(T(L,this),this.options);C(z,this,T(L,this).state),C(B,this,this.options),T(z,this).data!==void 0&&C(W,this,T(L,this)),!x(t,e)&&(C(R,this,t),w(Y,this,Se).call(this,{listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!T(J,this).size)return!0;let r=new Set(n==null?T(J,this):n);return this.options.throwOnError&&r.add(`error`),Object.keys(T(R,this)).some(t=>{let n=t;return T(R,this)[n]!==e[n]&&r.has(n)})})()}))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&w(Y,this,ve).call(this)}});function me(e){w(Y,this,xe).call(this);let t=T(L,this).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(f)),t}function he(){w(Y,this,ye).call(this);let e=m(this.options.staleTime,T(L,this));if(u.isServer()||T(R,this).isStale||!y(e))return;let t=h(T(R,this).dataUpdatedAt,e)+1;C(G,this,p.setTimeout(()=>{T(R,this).isStale||this.updateResult()},t))}function ge(){var e;return(e=typeof this.options.refetchInterval==`function`?this.options.refetchInterval(T(L,this)):this.options.refetchInterval)==null?!1:e}function _e(e){w(Y,this,be).call(this),C(q,this,e),!(u.isServer()||i(this.options.enabled,T(L,this))===!1||!y(T(q,this))||T(q,this)===0)&&C(K,this,p.setInterval(()=>{(this.options.refetchIntervalInBackground||v.isFocused())&&w(Y,this,me).call(this)},T(q,this)))}function ve(){w(Y,this,he).call(this),w(Y,this,_e).call(this,w(Y,this,ge).call(this))}function ye(){T(G,this)!==void 0&&(p.clearTimeout(T(G,this)),C(G,this,void 0))}function be(){T(K,this)!==void 0&&(p.clearInterval(T(K,this)),C(K,this,void 0))}function xe(){let e=T(I,this).getQueryCache().build(T(I,this),this.options);if(e===T(L,this))return;let t=T(L,this);C(L,this,e),C(de,this,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))}function Se(e){d.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(T(R,this))}),T(I,this).getQueryCache().notify({query:T(L,this),type:`observerResultsUpdated`})})}function Ce(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&i(t.retryOnMount,e)===!1)}function we(e,t){return Ce(e,t)||e.state.data!==void 0&&Te(e,t,t.refetchOnMount)}function Te(e,t,n){if(i(t.enabled,e)!==!1&&m(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&De(e,t)}return!1}function Ee(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&De(e,n)}function De(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(m(t.staleTime,e))}function Oe(e,t){return!x(e.getCurrentResult(),t)}var X=e(),Z=t(n(),1),ke=Z.createContext(!1),Ae=()=>Z.useContext(ke);ke.Provider;function je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Me=Z.createContext(je()),Ne=()=>Z.useContext(Me),Pe=(e,t,n)=>{let r=n!=null&&n.state.error&&typeof e.throwOnError==`function`?_(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Fe=e=>{Z.useEffect(()=>{e.clearReset()},[e])},Ie=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||_(n,[e.error,r])),Le=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e==null?t:e,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))}},Re=(e,t)=>e.isLoading&&e.isFetching&&!t,ze=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Be=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ve(e,t,n){var r,i,a,o;let s=Ae(),l=Ne(),p=c(n),m=p.defaultQueryOptions(e);(r=p.getDefaultOptions().queries)==null||(i=r._experimental_beforeQuery)==null||i.call(r,m);let h=p.getQueryCache().get(m.queryHash);m._optimisticResults=s?`isRestoring`:`optimistic`,Le(m),Pe(m,l,h),Fe(l);let g=!p.getQueryCache().get(m.queryHash),[_]=Z.useState(()=>new t(p,m)),v=_.getOptimisticResult(m),y=!s&&e.subscribed!==!1;if(Z.useSyncExternalStore(Z.useCallback(e=>{let t=y?_.subscribe(d.batchCalls(e)):f;return _.updateResult(),t},[_,y]),()=>_.getCurrentResult(),()=>_.getCurrentResult()),Z.useEffect(()=>{_.setOptions(m)},[m,_]),ze(m,v))throw Be(m,_,l);if(Ie({result:v,errorResetBoundary:l,throwOnError:m.throwOnError,query:h,suspense:m.suspense}))throw v.error;if((a=p.getDefaultOptions().queries)==null||(o=a._experimental_afterQuery)==null||o.call(a,m,v),m.experimental_prefetchInRender&&!u.isServer()&&Re(v,s)){let e=g?Be(m,_,l):h==null?void 0:h.promise;e==null||e.catch(f).finally(()=>{_.updateResult()})}return m.notifyOnChangeProps?v:_.trackResult(v)}function He(e,t){return Ve(e,pe,t)}var Ue=P(`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`}]]),We=P(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ge=P(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ke=P(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),qe=5e3,Je=M(e=>({completionState:new Map,setCompletion:(t,n)=>e(e=>{let r=new Map(e.completionState);return r.set(t,n),{completionState:r}}),clearCompletion:t=>e(e=>{let n=new Map(e.completionState);return n.delete(t),{completionState:n}}),clearAllCompletions:()=>e({completionState:new Map})})),Ye=e=>t=>t.completionState.get(e),Xe=qe,Ze={sessions:{all:[`sessions`],byWorkspace:e=>[`sessions`,`workspace`,e],grouped:(e,t)=>[`sessions`,`grouped`,{workspaceIds:[...e].sort(),status:t}]},tools:{all:[`tools`],envVars:[`tools`,`envVars`]},config:{models:[`config`,`models`],preconfigs:[`config`,`preconfigs`],prompts:[`config`,`prompts`],providers:{all:[`providers`],credentials:[`providers`,`credentials`]}},mcp:{status:e=>[`mcp`,`status`,e]},files:{browse:(e,t,n)=>[`files`,`browse`,e,t==null?`.`:t,n],browseFs:e=>[`files`,`browseFs`,e],drives:[`files`,`drives`],parent:e=>[`files`,`parent`,e],preview:(e,t)=>[`files`,`preview`,e,t]},serverInfo:[`serverInfo`]},Q=r();function Qe(e){return E(e)}function $e(e){if(typeof window>`u`)return e;try{let t=localStorage.getItem(D.SESSIONS);if(t===null)return e;let n=JSON.parse(t);return typeof n.width!=`number`||isNaN(n.width)?e:Qe(n.width)}catch{return e}}function et(e){if(!(typeof window>`u`))try{let t=Qe(e);localStorage.setItem(D.SESSIONS,JSON.stringify({width:t}))}catch(e){console.warn(`Error saving sessions panel width:`,e)}}function tt(e){if(typeof window>`u`)return e;try{let t=localStorage.getItem(D.FILES);if(t===null)return e;let n=JSON.parse(t);return typeof n.width!=`number`||isNaN(n.width)?e:Qe(n.width)}catch{return e}}function nt(e){if(!(typeof window>`u`))try{let t=Qe(e);localStorage.setItem(D.FILES,JSON.stringify({width:t}))}catch(e){console.warn(`Error saving files panel width:`,e)}}var rt=()=>$e(256),it=()=>tt(256),$=M(e=>({showFilesPanel:!1,showTerminalPanel:!1,sessionsPanelWidth:rt(),filesPanelWidth:it(),setShowFilesPanel:t=>e({showFilesPanel:t}),setShowTerminalPanel:t=>e({showTerminalPanel:t}),setSessionsPanelWidth:t=>{let n=E(t);et(n),e({sessionsPanelWidth:n})},setFilesPanelWidth:t=>{let n=E(t);nt(n),e({filesPanelWidth:n})}}));function at(e){let t=(0,Q.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,X.jsx)(ue,{"data-slot":`sheet`,...n}),t[2]=n,t[3]=r),r}function ot(e){let t=(0,Q.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,X.jsx)(ae,{"data-slot":`sheet-portal`,...n}),t[2]=n,t[3]=r),r}function st(e){let t=(0,Q.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=F(`fixed inset-0 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,X.jsx)(re,{"data-slot":`sheet-overlay`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ct(e){let t=(0,Q.c)(24),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,side:o,showCloseButton:s,style:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=o===void 0?`right`:o,l=s===void 0?!0:s,u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(st,{}),t[7]=u):u=t[7];let d;t[8]===r?d=t[9]:(d=F(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t 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=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=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,r),t[8]=r,t[9]=d);let f=g()?`90px`:`0px`,p;t[10]===c?p=t[11]:(p=c===`left`||c===`right`?{top:`calc(env(safe-area-inset-top, 0px) + ${f})`,bottom:`env(safe-area-inset-bottom, 0px)`,height:`calc(100vh - env(safe-area-inset-top, 0px) - ${f} - env(safe-area-inset-bottom, 0px))`}:c===`top`?{top:`calc(env(safe-area-inset-top, 0px) + ${f})`}:c===`bottom`?{bottom:`env(safe-area-inset-bottom, 0px)`}:void 0,t[10]=c,t[11]=p);let m=p,h;t[12]!==m||t[13]!==a?(h=m?{...m,...a}:a,t[12]=m,t[13]=a,t[14]=h):h=t[14];let _=h,v;t[15]===l?v=t[16]:(v=l&&(0,X.jsx)(ne,{"data-slot":`sheet-close`,asChild:!0,children:(0,X.jsxs)(le,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,X.jsx)(te,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}),t[15]=l,t[16]=v);let y;return t[17]!==n||t[18]!==i||t[19]!==c||t[20]!==d||t[21]!==_||t[22]!==v?(y=(0,X.jsxs)(ot,{children:[u,(0,X.jsxs)(se,{"data-slot":`sheet-content`,"data-side":c,className:d,style:_,...i,children:[n,v]})]}),t[17]=n,t[18]=i,t[19]=c,t[20]=d,t[21]=_,t[22]=v,t[23]=y):y=t[23],y}function lt(e){let t=(0,Q.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=F(`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,X.jsx)(`div`,{"data-slot":`sheet-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ut(e){let t=(0,Q.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=F(`text-base font-medium text-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ie,{"data-slot":`sheet-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dt(e){let t=(0,Q.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=F(`text-sm text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ce,{"data-slot":`sheet-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var ft=`sidebar_state`,pt=3600*24*7,mt=`16rem`,ht=`18rem`,gt=`3rem`,_t=Z.createContext(null);function vt(){let e=Z.useContext(_t);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}function yt(e){var t;let n=(0,Q.c)(35),r,i,a,o,s,c,l,u;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],l=n[7],u=n[8]):({defaultOpen:u,open:a,onOpenChange:c,className:i,style:l,children:r,panelId:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c,n[7]=l,n[8]=u);let d=u===void 0?!0:u,f=k(),[p,m]=Z.useState(!1),[h,g]=Z.useState(d),_=(t=a)==null?h:t,v;n[9]!==_||n[10]!==c?(v=e=>{let t=typeof e==`function`?e(_):e;c?c(t):g(t),document.cookie=`${ft}=${t}; path=/; max-age=${pt}`},n[9]=_,n[10]=c,n[11]=v):v=n[11];let y=v,b;n[12]!==f||n[13]!==y?(b=()=>f?m(xt):y(bt),n[12]=f,n[13]=y,n[14]=b):b=n[14];let x=b,S=_?`expanded`:`collapsed`,C;n[15]!==f||n[16]!==_||n[17]!==p||n[18]!==y||n[19]!==S||n[20]!==x?(C={state:S,open:_,setOpen:y,isMobile:f,openMobile:p,setOpenMobile:m,toggleSidebar:x},n[15]=f,n[16]=_,n[17]=p,n[18]=y,n[19]=S,n[20]=x,n[21]=C):C=n[21];let w=C,T;n[22]===l?T=n[23]:(T={"--sidebar-width":mt,"--sidebar-width-icon":gt,...l},n[22]=l,n[23]=T);let E=T,D;n[24]===i?D=n[25]:(D=F(`overflow-hidden group/sidebar-wrapper flex h-full w-full has-data-[variant=inset]:bg-sidebar`,i),n[24]=i,n[25]=D);let O;n[26]!==r||n[27]!==o||n[28]!==s||n[29]!==E||n[30]!==D?(O=(0,X.jsx)(`div`,{"data-slot":`sidebar-wrapper`,"data-panel-id":o,style:E,className:D,...s,children:r}),n[26]=r,n[27]=o,n[28]=s,n[29]=E,n[30]=D,n[31]=O):O=n[31];let A;return n[32]!==w||n[33]!==O?(A=(0,X.jsx)(_t.Provider,{value:w,children:O}),n[32]=w,n[33]=O,n[34]=A):A=n[34],A}function bt(e){return!e}function xt(e){return!e}function St(e){let t=(0,Q.c)(53),n,r,i,a,o,s,c,l;if(t[0]!==e){let{side:u,variant:d,collapsible:f,className:p,children:m,dir:h,isOpen:g,onOpenChange:_,...v}=e;s=u,c=d,l=f,r=p,n=m,i=h,a=g,o=v,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8];let u=s===void 0?`left`:s,d=c===void 0?`sidebar`:c,f=l===void 0?`offcanvas`:l,{isMobile:p,state:m,openMobile:h,setOpenMobile:g}=vt(),_=a===void 0?void 0:a,v=_===void 0?m:_?`expanded`:`collapsed`;if(f===`none`){let e;t[9]===r?e=t[10]:(e=F(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),t[9]=r,t[10]=e);let i;return t[11]!==n||t[12]!==o||t[13]!==e?(i=(0,X.jsx)(`div`,{"data-slot":`sidebar`,className:e,...o,children:n}),t[11]=n,t[12]=o,t[13]=e,t[14]=i):i=t[14],i}if(p){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e={"--sidebar-width":ht},t[15]=e):e=t[15];let r;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(lt,{className:`sr-only`,children:[(0,X.jsx)(ut,{children:`Sidebar`}),(0,X.jsx)(dt,{children:`Displays the mobile sidebar.`})]}),t[16]=r):r=t[16];let a;t[17]===n?a=t[18]:(a=(0,X.jsx)(`div`,{className:`flex h-full w-full flex-col`,children:n}),t[17]=n,t[18]=a);let s;t[19]!==i||t[20]!==u||t[21]!==a?(s=(0,X.jsxs)(ct,{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:u,children:[r,a]}),t[19]=i,t[20]=u,t[21]=a,t[22]=s):s=t[22];let c;return t[23]!==h||t[24]!==o||t[25]!==g||t[26]!==s?(c=(0,X.jsx)(at,{open:h,onOpenChange:g,...o,children:s}),t[23]=h,t[24]=o,t[25]=g,t[26]=s,t[27]=c):c=t[27],c}let y=v===`collapsed`?f:``,b=_!==void 0&&!_&&`w-0`,x=d===`floating`||d===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon)`,S;t[28]!==b||t[29]!==x?(S=F(`relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,b,`group-data-[side=right]:rotate-180`,x),t[28]=b,t[29]=x,t[30]=S):S=t[30];let C;t[31]===S?C=t[32]:(C=(0,X.jsx)(`div`,{"data-slot":`sidebar-gap`,className:S}),t[31]=S,t[32]=C);let w=u===`left`&&_!==void 0&&!_&&`left-[calc(var(--sidebar-width)*-1)]`,T=u===`right`&&_!==void 0&&!_&&`right-[calc(var(--sidebar-width)*-1)]`,E=d===`floating`||d===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]`:`group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l`,D;t[33]!==r||t[34]!==T||t[35]!==E||t[36]!==w?(D=F(`fixed z-10 hidden w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear 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`,w,T,E,r),t[33]=r,t[34]=T,t[35]=E,t[36]=w,t[37]=D):D=t[37];let O;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(O={top:`calc(var(--header-height, 0px) + env(safe-area-inset-top, 0px))`,bottom:`env(safe-area-inset-bottom, 0px)`,height:`calc(100vh - var(--header-height, 0px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))`},t[38]=O):O=t[38];let k;t[39]===n?k=t[40]:(k=(0,X.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[39]=n,t[40]=k);let A;t[41]!==o||t[42]!==u||t[43]!==D||t[44]!==k?(A=(0,X.jsx)(`div`,{"data-slot":`sidebar-container`,"data-side":u,className:D,style:O,...o,children:k}),t[41]=o,t[42]=u,t[43]=D,t[44]=k,t[45]=A):A=t[45];let j;return t[46]!==v||t[47]!==u||t[48]!==A||t[49]!==y||t[50]!==C||t[51]!==d?(j=(0,X.jsxs)(`div`,{className:`group peer hidden text-sidebar-foreground md:block`,"data-state":v,"data-collapsible":y,"data-variant":d,"data-side":u,"data-slot":`sidebar`,children:[C,A]}),t[46]=v,t[47]=u,t[48]=A,t[49]=y,t[50]=C,t[51]=d,t[52]=j):j=t[52],j}function Ct(e){let t=(0,Q.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=F(`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,X.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 wt(e){let t=(0,Q.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=F(`mx-2 w-auto bg-sidebar-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(O,{"data-slot":`sidebar-separator`,"data-sidebar":`separator`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Tt=Z.forwardRef((e,t)=>{let n=(0,Q.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`no-scrollbar flex min-h-0 min-w-0 w-full flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,X.jsx)(`div`,{"data-slot":`sidebar-content`,"data-sidebar":`content`,className:a,ref:t,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});function Et(e){let t=(0,Q.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=F(`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,X.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 Dt(e){let t=(0,Q.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,asChild:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i!==void 0&&i?ee:`div`,o;t[4]===n?o=t[5]:(o=F(`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:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,n),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==r||t[8]!==o?(s=(0,X.jsx)(a,{"data-slot":`sidebar-group-label`,"data-sidebar":`group-label`,className:o,...r}),t[6]=a,t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function Ot(e){let t=(0,Q.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=F(`w-full text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.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 kt(e){let t=(0,Q.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=F(`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,X.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 At(e){let t=(0,Q.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=F(`group/menu-item relative`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.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 jt=oe(`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:bg-sidebar-accent hover:text-sidebar-accent-foreground focus:ring-1 focus:ring-inset 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 data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:p-0!`}},defaultVariants:{variant:`default`,size:`default`}});function Mt(e){let t=(0,Q.c)(28),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]):({asChild:i,isActive:a,variant:o,size:s,tooltip:c,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=i===void 0?!1:i,u=a===void 0?!1:a,d=o===void 0?`default`:o,f=s===void 0?`default`:s,p=l?ee:`button`,{isMobile:m,state:h}=vt(),g;t[8]!==n||t[9]!==f||t[10]!==d?(g=F(jt({variant:d,size:f}),n),t[8]=n,t[9]=f,t[10]=d,t[11]=g):g=t[11];let _;t[12]!==p||t[13]!==u||t[14]!==r||t[15]!==f||t[16]!==g?(_=(0,X.jsx)(p,{"data-slot":`sidebar-menu-button`,"data-sidebar":`menu-button`,"data-size":f,"data-active":u,className:g,...r}),t[12]=p,t[13]=u,t[14]=r,t[15]=f,t[16]=g,t[17]=_):_=t[17];let v=_;if(!c)return v;if(typeof c==`string`){let e;t[18]===c?e=t[19]:(e={children:c},t[18]=c,t[19]=e),c=e}let y;t[20]===v?y=t[21]:(y=(0,X.jsx)(j,{asChild:!0,children:v}),t[20]=v,t[21]=y);let b=h!==`collapsed`||m,x;t[22]!==b||t[23]!==c?(x=(0,X.jsx)(N,{side:`right`,align:`center`,hidden:b,...c}),t[22]=b,t[23]=c,t[24]=x):x=t[24];let S;return t[25]!==y||t[26]!==x?(S=(0,X.jsxs)(A,{children:[y,x]}),t[25]=y,t[26]=x,t[27]=S):S=t[27],S}function Nt(e){let t=(0,Q.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,asChild:i,showOnHover:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?!1:i,s=a===void 0?!1:a,c=o?ee:`button`,l=s&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0`,u;t[5]!==n||t[6]!==l?(u=F(`absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus:ring-1 focus:ring-inset md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0`,l,n),t[5]=n,t[6]=l,t[7]=u):u=t[7];let d;return t[8]!==c||t[9]!==r||t[10]!==u?(d=(0,X.jsx)(c,{"data-slot":`sidebar-menu-action`,"data-sidebar":`menu-action`,className:u,...r}),t[8]=c,t[9]=r,t[10]=u,t[11]=d):d=t[11],d}function Pt(e){let t=(0,Q.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=F(`ml-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border pl-2.5 py-0.5 group-data-[collapsible=icon]:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`ul`,{"data-slot":`sidebar-menu-sub`,"data-sidebar":`menu-sub`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Ft(e){let t=(0,Q.c)(29),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({side:a,panelId:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=k(),s=$(zt),c=$(Rt),l=$(Lt),u=$(It),d=r===`sessions`?s:l,f=r===`sessions`?c:u,[p,m]=Z.useState(!1),h=Z.useRef(!1),g=Z.useRef(0),_=Z.useRef(0),v=Z.useRef(0),y=Z.useRef(null),b=Z.useRef(null),x;t[5]!==o||t[6]!==r?(x=e=>{if(o)return;e.preventDefault(),e.stopPropagation(),h.current=!0,m(!0),g.current=e.clientX,_.current=v.current,document.body.style.cursor=`ew-resize`,document.body.style.userSelect=`none`;let t=document.querySelector(`[data-panel-id="${r}"]`);y.current=t,t&&(b.current=t.style.getPropertyValue(`--sidebar-width`)||null,t.classList.add(`no-transition`))},t[5]=o,t[6]=r,t[7]=x):x=t[7];let S=x,C,w;t[8]===d?(C=t[9],w=t[10]):(C=()=>{v.current=d},w=[d],t[8]=d,t[9]=C,t[10]=w),Z.useEffect(C,w);let T,D;if(t[11]!==r||t[12]!==f||t[13]!==a?(T=()=>{let e=e=>{if(!h.current)return;let t=a===`left`?e.clientX-g.current:g.current-e.clientX,n=E(_.current+t);v.current=n;let i=y.current||document.querySelector(`[data-panel-id="${r}"]`);i&&(i.style.setProperty(`--sidebar-width`,`${Math.round(n)}px`),y.current=i);let o=document.querySelector(`[data-panel-gap="${r}"]`);o&&(o.style.width=`${Math.round(n)}px`)},t=()=>{if(!h.current)return;h.current=!1,m(!1),document.body.style.cursor=``,document.body.style.userSelect=``;let e=y.current||document.querySelector(`[data-panel-id="${r}"]`);e&&(e.classList.remove(`no-transition`),b.current===null?e.style.removeProperty(`--sidebar-width`):e.style.setProperty(`--sidebar-width`,b.current));let t=document.querySelector(`[data-panel-gap="${r}"]`);t&&(t.classList.add(`no-transition`),t.style.width=`${Math.round(v.current)}px`,requestAnimationFrame(()=>{t==null||t.classList.remove(`no-transition`)})),f(Math.round(v.current))};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},D=[f,a,r],t[11]=r,t[12]=f,t[13]=a,t[14]=T,t[15]=D):(T=t[14],D=t[15]),Z.useEffect(T,D),o)return null;let O=a===`left`?`absolute top-0 right-0`:`absolute top-0 left-0`,A;t[16]!==n||t[17]!==O?(A=F(`z-30 flex h-full w-2 cursor-ew-resize items-center justify-center group/sidebar-resize`,O,n),t[16]=n,t[17]=O,t[18]=A):A=t[18];let j=p?`bg-primary`:`group-active/sidebar-resize:bg-primary`,M;t[19]===j?M=t[20]:(M=F(`h-8 w-0.5 rounded-full transition-colors duration-100`,`bg-transparent group-hover/sidebar-resize:bg-border`,j),t[19]=j,t[20]=M);let N;t[21]===M?N=t[22]:(N=(0,X.jsx)(`div`,{className:M}),t[21]=M,t[22]=N);let P;return t[23]!==S||t[24]!==r||t[25]!==i||t[26]!==A||t[27]!==N?(P=(0,X.jsx)(`div`,{"data-slot":`panel-resize-handle`,"data-panel-id":r,className:A,onMouseDown:S,...i,children:N}),t[23]=S,t[24]=r,t[25]=i,t[26]=A,t[27]=N,t[28]=P):P=t[28],P}function It(e){return e.setFilesPanelWidth}function Lt(e){return e.filesPanelWidth}function Rt(e){return e.setSessionsPanelWidth}function zt(e){return e.sessionsPanelWidth}function Bt(e){let t=(0,Q.c)(6),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;return t[3]!==n||t[4]!==r?(i=(0,X.jsx)(Ft,{side:`left`,panelId:`sessions`,className:n,...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}export{He as A,Xe as C,Ge as D,Ke as E,We as O,Ze as S,Je as T,at as _,Et as a,ut as b,Ct as c,Mt as d,At as f,vt as g,wt as h,Tt as i,Ue as k,kt as l,yt as m,Bt as n,Ot as o,Pt as p,St as r,Dt as s,Ft as t,Nt as u,ct as v,Ye as w,$ as x,lt as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=class{constructor(){r(this,`listeners`,new Map)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this.listeners.get(e);return n&&(n.delete(t),n.size===0&&this.listeners.delete(e)),this}emit(e,...t){let n=this.listeners.get(e);if(!n||n.size===0)return!1;for(let r of n)try{r(...t)}catch(t){console.error(`Error in event handler for "${e}":`,t)}return!0}removeAllListeners(e){return e===void 0?this.listeners.clear():this.listeners.delete(e),this}listenerCount(e){var t,n;return(t=(n=this.listeners.get(e))==null?void 0:n.size)==null?0:t}eventNames(){return Array.from(this.listeners.keys())}};function a(e,t){switch(t.type){case`client.registered`:e.emit(`client.registered`,t.client,t.connectionId,t.serverTime);break;case`client.rejected`:e.emit(`client.rejected`,t.code,t.message);break;case`session.created`:e.emit(`session.created`,t.session);break;case`session.resumed`:e.emit(`session.resumed`,t.session,t.messages,t.usage,t.isRunning,t.control);break;case`session.control.updated`:e.emit(`session.control.updated`,t.control,t.reason);break;case`session.action_rejected`:e.emit(`session.action_rejected`,t.sessionId,t.action,t.code,t.message,t.control);break;case`session.closed`:e.emit(`session.closed`,t.sessionId);break;case`session.reopened`:e.emit(`session.reopened`,t.session);break;case`session.deleted`:e.emit(`session.deleted`,t.sessionId);break;case`session.updated`:e.emit(`session.updated`,t.session);break;case`session.renamed`:e.emit(`session.renamed`,t.session);break;case`session.interrupted`:e.emit(`session.interrupted`,t.sessionId,t.result);break;case`session.reverted`:e.emit(`session.reverted`,t.sessionId,t.revertedTo,t.removed);break;case`session.forked`:e.emit(`session.forked`,t.originalSessionId,t.forkedSession,t.messages);break;case`session.state`:e.emit(`session.state`,t.sessionId,t.messages);break;case`message.created`:e.emit(`message.created`,t.message);break;case`message.updated`:e.emit(`message.updated`,t.message);break;case`part.created`:e.emit(`part.created`,t.sessionId,t.part);break;case`part.updated`:e.emit(`part.updated`,t.sessionId,t.part);break;case`part.append`:e.emit(`part.append`,t.sessionId,t.partId,t.field,t.delta);break;case`chat.usage`:e.emit(`chat.usage`,t.sessionId,t.usage,t.model,t.variant);break;case`compaction.complete`:e.emit(`compaction.complete`,t.sessionId,t.tokensUsed);break;case`permission.list`:e.emit(`permission.list`,t.workspaceId,t.grants);break;case`permission.revoked`:e.emit(`permission.revoked`,t.grantId);break;case`permission.all_revoked`:e.emit(`permission.all_revoked`,t.workspaceId,t.count);break;case`queue.list`:e.emit(`queue.list`,t.sessionId,t.messages);break;case`queue.added`:e.emit(`queue.added`,t.sessionId,t.message);break;case`queue.removed`:e.emit(`queue.removed`,t.sessionId,t.queueId);break;case`queue.sending`:e.emit(`queue.sending`,t.sessionId,t.queueId);break;case`provider.status`:e.emit(`provider.status`,t.provider,t.connected,t.authorizationUrl,t.error);break;case`provider.connected`:e.emit(`provider.connected`,t.provider,t.connected,t.connectedAt,t.accountId);break;case`ask.request`:e.emit(`ask.request`,t.sessionId,t.toolCallId,t.toolName,t.ask,t.requestId,t.authority);break;case`ask.response_rejected`:e.emit(`ask.response_rejected`,t.sessionId,t.toolCallId,t.requestId,t.code,t.message);break;case`ask.timeout`:e.emit(`ask.timeout`,t.sessionId,t.toolCallId,t.requestId);break;case`ask.pending_sync`:e.emit(`ask.pending_sync`,t.sessionId,t.requests);break;case`error`:e.emit(`error`,t.code,t.message);break;case`error.rate_limit`:e.emit(`error.rate_limit`,t.code,t.message,t.retryAfterMs),e.emit(`error`,t.code,t.message);break;case`error.server`:e.emit(`error.server`,t.code,t.message,t.retryAfterMs),e.emit(`error`,t.code,t.message);break;case`error.timeout`:e.emit(`error.timeout`,t.code,t.message,t.retryAfterMs),e.emit(`error`,t.code,t.message);break;case`error.auth`:e.emit(`error.auth`,t.code,t.message),e.emit(`error`,t.code,t.message);break;case`error.invalid_request`:e.emit(`error.invalid_request`,t.code,t.message),e.emit(`error`,t.code,t.message);break;case`error.context_overflow`:e.emit(`error.context_overflow`,t.code,t.message),e.emit(`error`,t.code,t.message);break;case`ping`:return;default:console.warn(`Unknown server message type: ${t.type}`);break}e.emit(`*`,{source:`server`,type:t.type,raw:t})}var o=class extends Error{constructor(e,t){super(e,t),this.name=`Jean2Error`}},s=class extends o{constructor(e,t){super(e,t),this.name=`ConnectionError`}},c=class extends o{constructor(e,t){super(e,t),this.name=`AuthError`}},l=class extends o{constructor(e,t,n){super(e,n),r(this,`retryAfterMs`,void 0),this.name=`RateLimitError`,this.retryAfterMs=t}},u=class extends o{constructor(e,t,n){super(e,n),r(this,`statusCode`,void 0),this.name=`ServerError`,this.statusCode=t}},d=class extends o{constructor(e,t=400,n){super(e,n),r(this,`statusCode`,void 0),this.name=`ValidationError`,this.statusCode=t}},f=class e{constructor(e){r(this,`_ws`,null),r(this,`config`,void 0),r(this,`_state`,`disconnected`),r(this,`onOpen`,null),r(this,`onMessage`,null),r(this,`onClose`,null),r(this,`onError`,null),r(this,`heartbeatTimer`,null),r(this,`missedHeartbeats`,0),this.config=e}async connect(){return new Promise((e,t)=>{var n,r;let i=(n=this.config.wsConstructor)==null?globalThis.WebSocket:n,a=this.buildWsUrl();this._state=`connecting`,this._ws=new i(a);let o=(r=this.config.connectionTimeout)==null?1e4:r,c=setTimeout(()=>{var e;(e=this._ws)==null||e.close(1e3,`Connection timeout`),t(new s(`Connection timeout (${o}ms)`))},o);this._ws.onopen=()=>{var t;clearTimeout(c),this._state=`connected`,this.startHeartbeatMonitor(),(t=this.onOpen)==null||t.call(this),e()},this._ws.onmessage=e=>{try{var t;let n=JSON.parse(String(e.data));if(n.type===`ping`){this.resetHeartbeat(),this.send({type:`pong`});return}this.resetHeartbeat(),(t=this.onMessage)==null||t.call(this,n)}catch(e){var n;let t=e instanceof Error?e.message:String(e);(n=this.onError)==null||n.call(this,Error(`Failed to parse WebSocket message: ${t}`))}},this._ws.onclose=e=>{var n;clearTimeout(c),this.stopHeartbeatMonitor(),this._state=`disconnected`,this._ws!==null&&t(new s(`Connection closed before open: code=${e.code}, reason=${e.reason}`)),this._ws=null,(n=this.onClose)==null||n.call(this,e.code,e.reason,e.wasClean)},this._ws.onerror=()=>{var e;clearTimeout(c),(e=this.onError)==null||e.call(this,Error(`WebSocket error`)),t(new s(`WebSocket error`))}})}send(e){if(!this._ws||this._ws.readyState!==WebSocket.OPEN)throw new s(`WebSocket is not connected`);this._ws.send(JSON.stringify(e))}async disconnect(){if(!this._ws)return;let e=this._ws;if(e.readyState===WebSocket.CLOSING||e.readyState===WebSocket.CLOSED){this._state=`disconnected`,this._ws=null;return}return new Promise(t=>{this._state=`disconnecting`;let n=()=>{e.removeEventListener(`close`,n),t()};e.addEventListener(`close`,n),e.close(1e3,`Client disconnect`)})}dispose(){this.stopHeartbeatMonitor(),this.onOpen=null,this.onMessage=null,this.onClose=null,this.onError=null,this._ws&&(this._ws.onopen=null,this._ws.onmessage=null,this._ws.onclose=null,this._ws.onerror=null,this._ws.close(),this._ws=null),this._state=`disconnected`}get connected(){return this._state===`connected`}get readyState(){var e,t;return(e=(t=this._ws)==null?void 0:t.readyState)==null?WebSocket.CLOSED:e}get ws(){return this._ws}resetHeartbeat(){this.missedHeartbeats=0}startHeartbeatMonitor(){this.stopHeartbeatMonitor(),this.missedHeartbeats=0,this.heartbeatTimer=setInterval(()=>{this.missedHeartbeats++,this.missedHeartbeats>=4&&(this.stopHeartbeatMonitor(),this._ws&&this._ws.close(1e3,`Heartbeat timeout`))},e.HEARTBEAT_TIMEOUT_MS)}stopHeartbeatMonitor(){this.heartbeatTimer!==null&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}buildWsUrl(){let e=this.config.url.startsWith(`https`)?`wss`:`ws`,t=this.config.url.replace(/^https?:\/\//,``);return this.config.token?`${e}://${t}/ws?token=${encodeURIComponent(this.config.token)}`:`${e}://${t}/ws`}};r(f,`HEARTBEAT_TIMEOUT_MS`,12e4);var p=class{constructor(e){r(this,`baseUrl`,void 0),r(this,`token`,void 0);let t=e.apiBase||`/api`;this.baseUrl=`${e.url.startsWith(`https`)?`https`:`http`}://${e.url.replace(/^https?:\/\//,``)}${t}`,this.token=e.token}async request(e,t={}){let{method:n=`GET`,body:r,headers:i={},signal:a,params:o}=t,s=`${this.baseUrl}${e}`;if(o){let e=new URLSearchParams(o);s+=`?${e.toString()}`}let f={...i};r!==void 0&&!(r instanceof FormData)&&(f[`Content-Type`]=`application/json`),this.token&&(f.Authorization=`Bearer ${this.token}`);let p=await fetch(s,{method:n,headers:f,body:r instanceof FormData?r:r?JSON.stringify(r):void 0,signal:a});if(p.status===401)throw new c(`Authentication failed. Your token may be invalid or expired.`);if(p.status===429){let e=p.headers.get(`Retry-After`);throw new l(`Too many requests`,e?parseInt(e,10)*1e3:void 0)}if(!p.ok){let e=`HTTP ${p.status}`;try{let t=await p.json();t.message&&(e=t.message)}catch{}throw p.status>=500?new u(e,p.status):new d(e,p.status)}let m=p.headers.get(`Content-Type`);return m!=null&&m.includes(`application/json`)?p.json():p}get(e,t){return this.request(e,{...t,method:`GET`})}post(e,t,n){return this.request(e,{...n,method:`POST`,body:t})}put(e,t,n){return this.request(e,{...n,method:`PUT`,body:t})}patch(e,t,n){return this.request(e,{...n,method:`PATCH`,body:t})}delete(e,t){return this.request(e,{...t,method:`DELETE`})}static async verifyToken(e,t){let n=e.startsWith(`https`)?`https`:`http`,r=e.replace(/^https?:\/\//,``);try{let e={};return t&&(e.Authorization=`Bearer ${t}`),(await fetch(`${n}://${r}/api/auth/verify`,{headers:e})).status===200}catch(e){throw new s(`Failed to reach server for auth verification: ${e instanceof Error?e.message:String(e)}`)}}},m=class{constructor(e){this.send=e}create(e){this.send({type:`session.create`,...e})}resume(e){this.send({type:`session.resume`,sessionId:e})}close(e){this.send({type:`session.close`,sessionId:e})}update(e,t){this.send({type:`session.update`,sessionId:e,...t})}updateModel(e,t){this.send({type:`session.update_model`,sessionId:e,...t})}reopen(e){this.send({type:`session.reopen`,sessionId:e})}delete(e){this.send({type:`session.delete`,sessionId:e})}rename(e,t){this.send({type:`session.rename`,sessionId:e,title:t})}compact(e){this.send({type:`session.compact`,sessionId:e})}revert(e,t){this.send({type:`session.revert`,sessionId:e,messageId:t})}fork(e,t,n){this.send({type:`session.fork`,sessionId:e,messageId:t,title:n})}interrupt(e,t){this.send({type:`session.interrupt`,sessionId:e,reason:t})}},h=class{constructor(e){this._send=e}send(e,t,n){let r={type:`chat.message`,sessionId:e,content:t};n!=null&&n.attachments&&n.attachments.length>0&&(r.attachments=n.attachments),this._send(r)}},g=class{constructor(e){this.send=e}list(e,t){this.send({type:`permission.list`,workspaceId:e,includeRevoked:t})}revoke(e){this.send({type:`permission.revoke`,grantId:e})}revokeAll(e){this.send({type:`permission.revoke_all`,workspaceId:e})}},_=class{constructor(e){this.send=e}add(e,t,n){let r=n;this.send({type:`queue.add`,sessionId:e,content:t,...r&&r.length>0?{attachments:r}:{}})}remove(e){this.send({type:`queue.remove`,queueId:e})}},v=class{constructor(e){this.send=e}connect(e){this.send({type:`provider.connect`,provider:e})}disconnect(e){this.send({type:`provider.disconnect`,provider:e})}},y=class{constructor(e){r(this,`send`,void 0),this.send=e}claim(e){this.send({type:`session.control.claim`,sessionId:e})}release(e){this.send({type:`session.control.release`,sessionId:e})}requestTakeover(e){this.send({type:`session.control.request_takeover`,sessionId:e})}respondTakeover(e,t,n){this.send({type:`session.control.respond_takeover`,sessionId:e,requesterClientId:t,decision:n})}},b={INPUT:1,RESIZE:2,CLOSE:3,OUTPUT:4,EXIT:5,ERROR:6,INIT_ACK:7,TITLE:8};function x(e,t){let n=new Uint8Array(1+t.length);return n[0]=e,n.set(t,1),n}var S=class extends i{constructor(e,t,n){super(),r(this,`ws`,void 0),r(this,`_session`,void 0),r(this,`_closed`,!1),r(this,`_disposed`,!1),r(this,`_preInitOutput`,[]),this.ws=e,this._session=t,n&&(this._preInitOutput=n),this.ws.binaryType=`arraybuffer`,this.ws.onmessage=this.handleMessage.bind(this),this.ws.onclose=this.handleClose.bind(this),this.ws.onerror=this.handleError.bind(this)}on(e,t){let n=super.on(e,t);return e===`output`&&this.flushPreInitOutput(),n}flushPreInitOutput(){if(this._preInitOutput.length===0)return;let e=this._preInitOutput;this._preInitOutput=[];for(let t of e){if(this._closed)break;this.emit(`output`,t)}}handleMessage(e){if(this._closed)return;let t=new Uint8Array(e.data);if(t.length<1)return;let n=t[0],r=t.slice(1);switch(n){case b.OUTPUT:this.emit(`output`,r);break;case b.EXIT:{let e=0;if(r.length>0)try{let t=JSON.parse(new TextDecoder().decode(r));e=typeof t.exitCode==`number`?t.exitCode:0}catch{e=0}this._session={...this._session,status:`exited`,exitCode:e},this.emit(`exit`,e);break}case b.TITLE:{let e=`Terminal`;if(r.length>0)try{let t=JSON.parse(new TextDecoder().decode(r));e=typeof t.title==`string`?t.title:`Terminal`}catch{e=`Terminal`}this._session={...this._session,title:e},this.emit(`title`,e);break}case b.ERROR:{let e=new TextDecoder().decode(r),t=Error(e||`Terminal error`);this.emit(`error`,t);break}case b.CLOSE:this.doClose();break;default:break}}handleClose(e){this._closed||(this._closed=!0,this.emit(`close`))}handleError(){if(!this._closed){let e=Error(`WebSocket error`);this.emit(`error`,e)}}doClose(){if(!this._closed){this._closed=!0;try{this.ws.close(1e3,`Client close`)}catch{}this.emit(`close`),this.cleanupHandlers()}}cleanupHandlers(){this._disposed||(this._disposed=!0,this.ws.onmessage=null,this.ws.onclose=null,this.ws.onerror=null)}dispatchFrame(e){this.handleMessage({data:e.buffer})}write(e){if(this._closed||this.ws.readyState!==WebSocket.OPEN)return;let t;t=typeof e==`string`?new TextEncoder().encode(e):e,this.ws.send(x(b.INPUT,t))}resize(e,t){if(this._closed||this.ws.readyState!==WebSocket.OPEN)return;let n=JSON.stringify({cols:e,rows:t}),r=new TextEncoder().encode(n);this.ws.send(x(b.RESIZE,r))}close(){this._closed||(this.ws.readyState===WebSocket.OPEN&&this.ws.send(x(b.CLOSE,new Uint8Array)),this.doClose())}dispose(){if(this.cleanupHandlers(),!this._closed){this._closed=!0;try{this.ws.close(1e3,`Disposed`)}catch{}}this.removeAllListeners()}get session(){return this._session}get sessionId(){return this._session.sessionId}get pid(){return this._session.pid}get cwd(){return this._session.cwd}get shell(){return this._session.shell}get cols(){return this._session.cols}get rows(){return this._session.rows}get title(){return this._session.title}get status(){return this._session.status}get exitCode(){return this._session.exitCode}get isReconnect(){return this._session.isReconnect}get closed(){return this._closed}},C=class extends i{constructor(e){super(),r(this,`ws`,void 0),r(this,`_closed`,!1),r(this,`_disposed`,!1),this.ws=e,this.ws.onmessage=this.handleMessage.bind(this),this.ws.onclose=this.handleClose.bind(this),this.ws.onerror=this.handleError.bind(this)}handleMessage(e){if(this._closed)return;let t=e.data;if(typeof t!=`string`)return;let n;try{n=JSON.parse(t)}catch{return}switch(n.type){case`snapshot`:this.emit(`snapshot`,n.sessions);break;case`created`:this.emit(`created`,n.session);break;case`destroyed`:this.emit(`destroyed`,n.sessionId);break;case`exited`:this.emit(`exited`,n.sessionId,n.exitCode);break;case`title_changed`:this.emit(`title_changed`,n.sessionId,n.title);break;case`status_changed`:this.emit(`status_changed`,n.sessionId,n.status);break}}handleClose(e){this._closed||(this._closed=!0,this.emit(`close`))}handleError(){if(!this._closed){let e=Error(`WebSocket error`);this.emit(`error`,e)}}close(){if(!this._closed){this._closed=!0;try{this.ws.close(1e3,`Client close`)}catch{}this.cleanupHandlers()}}dispose(){if(this.cleanupHandlers(),this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)try{this.ws.close(1e3,`Disposed`)}catch{}this._closed||(this._closed=!0,this.emit(`close`)),this.removeAllListeners()}cleanupHandlers(){this._disposed||(this._disposed=!0,this.ws.onmessage=null,this.ws.onclose=null,this.ws.onerror=null)}get closed(){return this._closed}},w=class{constructor(e){r(this,`config`,void 0),this.config={connectTimeout:1e4,...e}}async connect(e){var t;let n=(t=this.config.wsConstructor)==null?globalThis.WebSocket:t,r=this.config.url.startsWith(`https`)?`wss`:`ws`,i=this.config.url.replace(/^https?:\/\//,``),a=new URLSearchParams({cwd:e.cwd,workspaceId:e.workspaceId});this.config.token&&a.set(`token`,this.config.token),e.shell&&a.set(`shell`,e.shell),e.sessionId&&a.set(`sessionId`,e.sessionId);let o=`${r}://${i}/ws/terminal?${a.toString()}`;return new Promise((e,t)=>{var r;let i=new n(o);i.binaryType=`arraybuffer`;let a=(r=this.config.connectTimeout)==null?1e4:r,c=!1,l=t=>{c||(c=!0,clearTimeout(d),e(t))},u=e=>{c||(c=!0,clearTimeout(d),t(e))},d=setTimeout(()=>{i.close(),u(new s(`Terminal connection timeout (${a}ms)`))},a);i.onopen=()=>{};let f=[];i.onmessage=e=>{let t=new Uint8Array(e.data);if(t.length<1)return;let n=t[0],r=t.slice(1);if(n===b.INIT_ACK)try{let e=new S(i,JSON.parse(new TextDecoder().decode(r)),f.filter(e=>e.opcode===b.OUTPUT).map(e=>e.data));for(let t of f)t.opcode!==b.OUTPUT&&e.dispatchFrame(t.data);l(e)}catch(e){i.close(),u(new s(`Failed to parse terminal init: ${e instanceof Error?e.message:String(e)}`))}else if(n===b.ERROR){i.close();let e=`Terminal connection failed`;try{e=JSON.parse(new TextDecoder().decode(r)).message||e}catch{}u(new s(e))}else f.push({opcode:n,data:t})},i.onerror=()=>{i.close(),u(new s(`Terminal WebSocket error`))},i.onclose=()=>{u(new s(`Terminal connection closed before init`))}})}async subscribeEvents(e){var t;let n=(t=this.config.wsConstructor)==null?globalThis.WebSocket:t,r=this.config.url.startsWith(`https`)?`wss`:`ws`,i=this.config.url.replace(/^https?:\/\//,``),a=new URLSearchParams({workspaceId:e});this.config.token&&a.set(`token`,this.config.token);let o=`${r}://${i}/ws/terminal/events?${a.toString()}`;return new Promise((e,t)=>{var r;let i=new n(o),a=(r=this.config.connectTimeout)==null?1e4:r,c=!1,l=t=>{c||(c=!0,clearTimeout(d),e(t))},u=e=>{c||(c=!0,clearTimeout(d),t(e))},d=setTimeout(()=>{i.close(),u(new s(`Terminal events subscription timeout (${a}ms)`))},a);i.onopen=()=>{};let f=null;i.onmessage=e=>{if(c)return;let t=e.data;if(typeof t!=`string`)return;let n;try{n=JSON.parse(t)}catch{return}n.type===`snapshot`&&(f||(f=new C(i)),l({conn:f,initialSessions:n.sessions}))},i.onerror=()=>{i.close(),u(new s(`Terminal events WebSocket error`))},i.onclose=()=>{c||u(new s(`Terminal events connection closed before snapshot`))}})}},T=class{constructor(e){this.http=e}async list(e){return this.http.get(`/sessions`,{params:e!=null&&e.status?{status:e.status}:void 0,signal:e==null?void 0:e.signal})}async create(e){let{signal:t,...n}=e==null?{}:e;return this.http.post(`/sessions`,n,{signal:t})}async get(e,t){return this.http.get(`/sessions/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async update(e,t,n){return this.http.put(`/sessions/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async delete(e,t){return this.http.delete(`/sessions/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async listMessages(e,t){return this.http.get(`/sessions/${encodeURIComponent(e)}/messages`,{signal:t==null?void 0:t.signal})}async listGrouped(e){let t={workspaceIds:e.workspaceIds.join(`,`)};return e.status&&(t.status=e.status),e.rootOnly&&(t.rootOnly=`true`),this.http.get(`/sessions/grouped`,{params:t,signal:e.signal})}async listByWorkspace(e){let t={};return e.status&&(t.status=e.status),e.rootOnly&&(t.rootOnly=`true`),this.http.get(`/workspaces/${encodeURIComponent(e.workspaceId)}/sessions`,{params:t,signal:e.signal})}},E=class{constructor(e){this.http=e}async list(e){return this.http.get(`/workspaces`,{signal:e==null?void 0:e.signal})}async create(e){let{signal:t,...n}=e==null?{}:e;return this.http.post(`/workspaces`,n,{signal:t})}async get(e,t){return this.http.get(`/workspaces/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async update(e,t,n){return this.http.patch(`/workspaces/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async delete(e,t){return this.http.delete(`/workspaces/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async listSessions(e,t){return this.http.get(`/workspaces/${encodeURIComponent(e)}/sessions`,{signal:t==null?void 0:t.signal})}},D=class{constructor(e){this.http=e}async list(e){return this.http.get(`/models`,{signal:e==null?void 0:e.signal})}},O=class{constructor(e){this.http=e}async list(e){return this.http.get(`/tools`,{signal:e==null?void 0:e.signal})}async get(e,t){return this.http.get(`/tools/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async listEnvVars(e){return this.http.get(`/tools/env`,{signal:e==null?void 0:e.signal})}async setEnvVar(e,t,n){return this.http.put(`/tools/env/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async clearEnvVar(e,t){return this.http.delete(`/tools/env/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}},k=class{constructor(e){this.http=e}async list(e){return this.http.get(`/providers`,{signal:e==null?void 0:e.signal})}async getStatus(e,t){return this.http.get(`/providers/${encodeURIComponent(e)}/status`,{signal:t==null?void 0:t.signal})}async connect(e,t){return this.http.post(`/providers/${encodeURIComponent(e)}/connect`,void 0,{signal:t==null?void 0:t.signal})}async disconnect(e,t){return this.http.delete(`/providers/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async listCredentials(e){return this.http.get(`/config/providers`,{signal:e==null?void 0:e.signal})}async setCredential(e,t,n){return this.http.put(`/config/providers/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async clearCredential(e,t){return this.http.delete(`/config/providers/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}},A=class{constructor(e){this.http=e}async list(e){return this.http.get(`/preconfigs`,{signal:e==null?void 0:e.signal})}async create(e){let{signal:t,...n}=e==null?{}:e;return this.http.post(`/preconfigs`,n,{signal:t})}async get(e,t){return this.http.get(`/preconfigs/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async update(e,t,n){return this.http.put(`/preconfigs/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async delete(e,t){return this.http.delete(`/preconfigs/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}},j=class{constructor(e){this.http=e}async list(e){return this.http.get(`/prompts`,{signal:e==null?void 0:e.signal})}},M=class{constructor(e){this.http=e}async browse(e,t,n){let r={};return t!==void 0&&(r.path=t),(n==null?void 0:n.showHidden)!==void 0&&(r.showHidden=String(n.showHidden)),(n==null?void 0:n.limit)!==void 0&&(r.limit=String(n.limit)),this.http.get(`/workspaces/${encodeURIComponent(e)}/files`,{params:Object.keys(r).length>0?r:void 0,signal:n==null?void 0:n.signal})}async search(e,t,n){let r={search:t};return(n==null?void 0:n.limit)!==void 0&&(r.limit=String(n.limit)),(n==null?void 0:n.showHidden)!==void 0&&(r.showHidden=String(n.showHidden)),this.http.get(`/workspaces/${encodeURIComponent(e)}/files`,{params:r,signal:n==null?void 0:n.signal})}async preview(e,t,n){return this.http.get(`/workspaces/${encodeURIComponent(e)}/file-preview`,{params:{path:t},signal:n==null?void 0:n.signal})}async browseFs(e,t){return this.http.get(`/fs/browse`,{params:e===void 0?void 0:{path:e},signal:t==null?void 0:t.signal})}async parent(e,t){return this.http.get(`/fs/parent`,{params:{path:e},signal:t==null?void 0:t.signal})}async drives(e){return this.http.get(`/fs/drives`,{signal:e==null?void 0:e.signal})}},N=class{constructor(e){this.http=e}async list(e,t){return this.http.get(`/sessions/${encodeURIComponent(e)}/attachments`,{signal:t==null?void 0:t.signal})}async upload(e,t,n){let r=new FormData;r.append(`file`,t);let{signal:i}=n==null?{}:n;return this.http.post(`/sessions/${encodeURIComponent(e)}/attachments`,r,{signal:i})}getUrl(e,t,n){return`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content?key=${encodeURIComponent(n)}`}},P=class{constructor(e){this.http=e}async list(e,t){return this.http.get(`/workspaces/${encodeURIComponent(e)}/terminals`,{signal:t==null?void 0:t.signal})}async create(e,t){let{signal:n,body:r}=t==null?{}:t;return this.http.post(`/workspaces/${encodeURIComponent(e)}/terminals`,r==null?{}:r,{signal:n})}async get(e,t,n){return this.http.get(`/workspaces/${encodeURIComponent(e)}/terminals/${encodeURIComponent(t)}`,{signal:n==null?void 0:n.signal})}async delete(e,t,n){return this.http.delete(`/workspaces/${encodeURIComponent(e)}/terminals/${encodeURIComponent(t)}`,{signal:n==null?void 0:n.signal})}},F=class{constructor(e){this.http=e}async getStatus(e,t){return this.http.get(`/workspaces/${encodeURIComponent(e)}/mcp/status`,{signal:t==null?void 0:t.signal})}async connect(e,t,n){let{signal:r}=n==null?{}:n;return this.http.post(`/workspaces/${encodeURIComponent(e)}/mcp/connect`,{name:t},{signal:r})}async disconnect(e,t,n){let{signal:r}=n==null?{}:n;return this.http.post(`/workspaces/${encodeURIComponent(e)}/mcp/disconnect`,{name:t},{signal:r})}async startAuth(e,t,n){let{signal:r}=n==null?{}:n;return this.http.post(`/workspaces/${encodeURIComponent(e)}/mcp/auth`,{name:t},{signal:r})}async finishAuth(e,t,n,r){let{signal:i}=r==null?{}:r;return this.http.post(`/workspaces/${encodeURIComponent(e)}/mcp/auth/callback`,{name:t,code:n},{signal:i})}},I=class{constructor(e){this.http=e}async get(e){return this.http.get(`/config/models`,{signal:e==null?void 0:e.signal})}async createProvider(e,t){return this.http.post(`/config/models/providers`,e,{signal:t==null?void 0:t.signal})}async updateProvider(e,t,n){return this.http.put(`/config/models/providers/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async deleteProvider(e,t){return this.http.delete(`/config/models/providers/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async createModel(e,t,n){return this.http.post(`/config/models/providers/${encodeURIComponent(e)}/models`,t,{signal:n==null?void 0:n.signal})}async updateModel(e,t,n,r){return this.http.put(`/config/models/providers/${encodeURIComponent(e)}/models/${encodeURIComponent(t)}`,n,{signal:r==null?void 0:r.signal})}async deleteModel(e,t,n){return this.http.delete(`/config/models/providers/${encodeURIComponent(e)}/models/${encodeURIComponent(t)}`,{signal:n==null?void 0:n.signal})}async setDefaults(e,t){return this.http.put(`/config/models/defaults`,e,{signal:t==null?void 0:t.signal})}},L=class{constructor(e){this.http=e}async list(e){return this.http.get(`/config/prompts`,{signal:e==null?void 0:e.signal})}async get(e,t){return this.http.get(`/config/prompts/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async create(e,t){return this.http.post(`/config/prompts`,e,{signal:t==null?void 0:t.signal})}async update(e,t,n){return this.http.put(`/config/prompts/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async delete(e,t){return this.http.delete(`/config/prompts/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}},R=class{constructor(e){r(this,`models`,void 0),r(this,`prompts`,void 0),this.models=new I(e),this.prompts=new L(e)}},z=class{constructor(e){r(this,`sessions`,void 0),r(this,`workspaces`,void 0),r(this,`models`,void 0),r(this,`tools`,void 0),r(this,`providers`,void 0),r(this,`preconfigs`,void 0),r(this,`prompts`,void 0),r(this,`files`,void 0),r(this,`attachments`,void 0),r(this,`terminals`,void 0),r(this,`mcp`,void 0),r(this,`config`,void 0),this.sessions=new T(e),this.workspaces=new E(e),this.models=new D(e),this.tools=new O(e),this.providers=new k(e),this.preconfigs=new A(e),this.prompts=new j(e),this.files=new M(e),this.attachments=new N(e),this.terminals=new P(e),this.mcp=new F(e),this.config=new R(e)}async loadAll(e){let[t,n,r,i,a]=await Promise.all([this.workspaces.list(e),this.preconfigs.list(e),this.prompts.list(e),this.models.list(e),this.providers.list(e)]);return{workspaces:t.workspaces,preconfigs:n.preconfigs,prompts:r.prompts,models:i.models,defaultModel:i.defaultModel,defaultProvider:i.defaultProvider,providers:a.providers}}},B=class extends i{constructor(e){super(),r(this,`config`,void 0),r(this,`transport`,void 0),r(this,`_httpClient`,void 0),r(this,`_state`,`disconnected`),r(this,`_connectionId`,null),r(this,`_registeredClient`,null),r(this,`sessions`,void 0),r(this,`chat`,void 0),r(this,`permissions`,void 0),r(this,`queue`,void 0),r(this,`providers`,void 0),r(this,`control`,void 0),r(this,`http`,void 0),r(this,`terminal`,void 0),this.config=e,this.transport=new f({url:e.url,token:e.token,wsConstructor:e.wsConstructor,connectionTimeout:e.connectionTimeout}),this._httpClient=new p({url:e.url,token:e.token,apiBase:e.apiBase});let t=this.transport.send.bind(this.transport);this.sessions=new m(t),this.chat=new h(t),this.permissions=new g(t),this.queue=new _(t),this.providers=new v(t),this.control=new y(t),this.http=new z(this._httpClient),this.terminal=new w({url:e.url,token:e.token,wsConstructor:e.wsConstructor}),this.transport.onOpen=()=>{this._state=`connected`,this._connectionId=null,this._registeredClient=null,this.config.clientDescriptor&&this.send({type:`client.register`,client:this.config.clientDescriptor}),this.emit(`connected`),this.emit(`*`,{source:`lifecycle`,type:`connected`,payload:void 0})},this.transport.onMessage=e=>{e.type===`client.registered`&&(this._connectionId=e.connectionId,this._registeredClient=e.client),a(this,e)},this.transport.onClose=(e,t,n)=>{let r=this._state;this._state=`disconnected`,r!==`disconnected`&&(this.emit(`disconnected`,{code:e,reason:t,wasClean:n}),this.emit(`*`,{source:`lifecycle`,type:`disconnected`,payload:{code:e,reason:t,wasClean:n}}))},this.transport.onError=e=>{this.emit(`error.connection`,e),this.emit(`*`,{source:`lifecycle`,type:`error.connection`,payload:e})}}async connect(){this._state=`connecting`,await this.transport.connect()}async disconnect(){this._state=`disconnecting`,await this.transport.disconnect()}async dispose(){await this.disconnect(),this.transport.dispose(),this.removeAllListeners()}get state(){return this._state}get connected(){return this._state===`connected`}get ws(){return this.transport.ws}get httpClient(){return this._httpClient}get connectionId(){return this._connectionId}get registeredClient(){return this._registeredClient}get clientId(){var e,t;return(e=(t=this._registeredClient)==null?void 0:t.clientId)==null?null:e}send(e){this.transport.send(e)}};export{z as n,p as r,B as t};
|
|
1
|
+
function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=class{constructor(){r(this,`listeners`,new Map)}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this.listeners.get(e);return n&&(n.delete(t),n.size===0&&this.listeners.delete(e)),this}emit(e,...t){let n=this.listeners.get(e);if(!n||n.size===0)return!1;for(let r of n)try{r(...t)}catch(t){console.error(`Error in event handler for "${e}":`,t)}return!0}removeAllListeners(e){return e===void 0?this.listeners.clear():this.listeners.delete(e),this}listenerCount(e){var t,n;return(t=(n=this.listeners.get(e))==null?void 0:n.size)==null?0:t}eventNames(){return Array.from(this.listeners.keys())}};function a(e,t){switch(t.type){case`client.registered`:e.emit(`client.registered`,t.client,t.connectionId,t.serverTime);break;case`client.rejected`:e.emit(`client.rejected`,t.code,t.message);break;case`session.created`:e.emit(`session.created`,t.session);break;case`session.resumed`:e.emit(`session.resumed`,t.session,t.messages,t.usage,t.isRunning,t.control);break;case`session.control.updated`:e.emit(`session.control.updated`,t.control,t.reason);break;case`session.action_rejected`:e.emit(`session.action_rejected`,t.sessionId,t.action,t.code,t.message,t.control);break;case`session.closed`:e.emit(`session.closed`,t.sessionId);break;case`session.reopened`:e.emit(`session.reopened`,t.session);break;case`session.deleted`:e.emit(`session.deleted`,t.sessionId);break;case`session.updated`:e.emit(`session.updated`,t.session);break;case`session.renamed`:e.emit(`session.renamed`,t.session);break;case`session.interrupted`:e.emit(`session.interrupted`,t.sessionId,t.result);break;case`session.reverted`:e.emit(`session.reverted`,t.sessionId,t.revertedTo,t.removed);break;case`session.forked`:e.emit(`session.forked`,t.originalSessionId,t.forkedSession,t.messages);break;case`session.state`:e.emit(`session.state`,t.sessionId,t.messages);break;case`message.created`:e.emit(`message.created`,t.message);break;case`message.updated`:e.emit(`message.updated`,t.message);break;case`part.created`:e.emit(`part.created`,t.sessionId,t.part);break;case`part.updated`:e.emit(`part.updated`,t.sessionId,t.part);break;case`part.append`:e.emit(`part.append`,t.sessionId,t.partId,t.field,t.delta);break;case`chat.usage`:e.emit(`chat.usage`,t.sessionId,t.usage,t.model,t.variant);break;case`compaction.complete`:e.emit(`compaction.complete`,t.sessionId,t.tokensUsed);break;case`permission.list`:e.emit(`permission.list`,t.workspaceId,t.grants);break;case`permission.revoked`:e.emit(`permission.revoked`,t.grantId);break;case`permission.all_revoked`:e.emit(`permission.all_revoked`,t.workspaceId,t.count);break;case`queue.list`:e.emit(`queue.list`,t.sessionId,t.messages);break;case`queue.added`:e.emit(`queue.added`,t.sessionId,t.message);break;case`queue.removed`:e.emit(`queue.removed`,t.sessionId,t.queueId);break;case`queue.sending`:e.emit(`queue.sending`,t.sessionId,t.queueId);break;case`provider.status`:e.emit(`provider.status`,t.provider,t.connected,t.authorizationUrl,t.error);break;case`provider.connected`:e.emit(`provider.connected`,t.provider,t.connected,t.connectedAt,t.accountId);break;case`ask.request`:e.emit(`ask.request`,t.sessionId,t.toolCallId,t.toolName,t.ask,t.requestId,t.authority);break;case`ask.response_rejected`:e.emit(`ask.response_rejected`,t.sessionId,t.toolCallId,t.requestId,t.code,t.message);break;case`ask.timeout`:e.emit(`ask.timeout`,t.sessionId,t.toolCallId,t.requestId);break;case`ask.pending_sync`:e.emit(`ask.pending_sync`,t.sessionId,t.requests);break;case`error`:e.emit(`error`,t.code,t.message);break;case`error.rate_limit`:e.emit(`error.rate_limit`,t.code,t.message,t.retryAfterMs),e.emit(`error`,t.code,t.message);break;case`error.server`:e.emit(`error.server`,t.code,t.message,t.retryAfterMs),e.emit(`error`,t.code,t.message);break;case`error.timeout`:e.emit(`error.timeout`,t.code,t.message,t.retryAfterMs),e.emit(`error`,t.code,t.message);break;case`error.auth`:e.emit(`error.auth`,t.code,t.message),e.emit(`error`,t.code,t.message);break;case`error.invalid_request`:e.emit(`error.invalid_request`,t.code,t.message),e.emit(`error`,t.code,t.message);break;case`error.context_overflow`:e.emit(`error.context_overflow`,t.code,t.message),e.emit(`error`,t.code,t.message);break;case`ping`:return;default:console.warn(`Unknown server message type: ${t.type}`);break}e.emit(`*`,{source:`server`,type:t.type,raw:t})}var o=class extends Error{constructor(e,t){super(e,t),this.name=`Jean2Error`}},s=class extends o{constructor(e,t){super(e,t),this.name=`ConnectionError`}},c=class extends o{constructor(e,t){super(e,t),this.name=`AuthError`}},l=class extends o{constructor(e,t,n){super(e,n),r(this,`retryAfterMs`,void 0),this.name=`RateLimitError`,this.retryAfterMs=t}},u=class extends o{constructor(e,t,n){super(e,n),r(this,`statusCode`,void 0),this.name=`ServerError`,this.statusCode=t}},d=class extends o{constructor(e,t=400,n){super(e,n),r(this,`statusCode`,void 0),this.name=`ValidationError`,this.statusCode=t}},f=class e{constructor(e){r(this,`_ws`,null),r(this,`config`,void 0),r(this,`_state`,`disconnected`),r(this,`onOpen`,null),r(this,`onMessage`,null),r(this,`onClose`,null),r(this,`onError`,null),r(this,`heartbeatTimer`,null),r(this,`missedHeartbeats`,0),this.config=e}async connect(){return new Promise((e,t)=>{var n,r;let i=(n=this.config.wsConstructor)==null?globalThis.WebSocket:n,a=this.buildWsUrl();this._state=`connecting`,this._ws=new i(a);let o=(r=this.config.connectionTimeout)==null?1e4:r,c=setTimeout(()=>{var e;(e=this._ws)==null||e.close(1e3,`Connection timeout`),t(new s(`Connection timeout (${o}ms)`))},o);this._ws.onopen=()=>{var t;clearTimeout(c),this._state=`connected`,this.startHeartbeatMonitor(),(t=this.onOpen)==null||t.call(this),e()},this._ws.onmessage=e=>{try{var t;let n=JSON.parse(String(e.data));if(n.type===`ping`){this.resetHeartbeat(),this.send({type:`pong`});return}this.resetHeartbeat(),(t=this.onMessage)==null||t.call(this,n)}catch(e){var n;let t=e instanceof Error?e.message:String(e);(n=this.onError)==null||n.call(this,Error(`Failed to parse WebSocket message: ${t}`))}},this._ws.onclose=e=>{var n;clearTimeout(c),this.stopHeartbeatMonitor(),this._state=`disconnected`,this._ws!==null&&t(new s(`Connection closed before open: code=${e.code}, reason=${e.reason}`)),this._ws=null,(n=this.onClose)==null||n.call(this,e.code,e.reason,e.wasClean)},this._ws.onerror=()=>{var e;clearTimeout(c),(e=this.onError)==null||e.call(this,Error(`WebSocket error`)),t(new s(`WebSocket error`))}})}send(e){if(!this._ws||this._ws.readyState!==WebSocket.OPEN)throw new s(`WebSocket is not connected`);this._ws.send(JSON.stringify(e))}async disconnect(){if(!this._ws)return;let e=this._ws;if(e.readyState===WebSocket.CLOSING||e.readyState===WebSocket.CLOSED){this._state=`disconnected`,this._ws=null;return}return new Promise(t=>{this._state=`disconnecting`;let n=()=>{e.removeEventListener(`close`,n),t()};e.addEventListener(`close`,n),e.close(1e3,`Client disconnect`)})}dispose(){this.stopHeartbeatMonitor(),this.onOpen=null,this.onMessage=null,this.onClose=null,this.onError=null,this._ws&&(this._ws.onopen=null,this._ws.onmessage=null,this._ws.onclose=null,this._ws.onerror=null,this._ws.close(),this._ws=null),this._state=`disconnected`}get connected(){return this._state===`connected`}get readyState(){var e,t;return(e=(t=this._ws)==null?void 0:t.readyState)==null?WebSocket.CLOSED:e}get ws(){return this._ws}resetHeartbeat(){this.missedHeartbeats=0}startHeartbeatMonitor(){this.stopHeartbeatMonitor(),this.missedHeartbeats=0,this.heartbeatTimer=setInterval(()=>{this.missedHeartbeats++,this.missedHeartbeats>=4&&(this.stopHeartbeatMonitor(),this._ws&&this._ws.close(1e3,`Heartbeat timeout`))},e.HEARTBEAT_TIMEOUT_MS)}stopHeartbeatMonitor(){this.heartbeatTimer!==null&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)}buildWsUrl(){let e=this.config.url.startsWith(`https`)?`wss`:`ws`,t=this.config.url.replace(/^https?:\/\//,``);return this.config.token?`${e}://${t}/ws?token=${encodeURIComponent(this.config.token)}`:`${e}://${t}/ws`}};r(f,`HEARTBEAT_TIMEOUT_MS`,12e4);var p=class{constructor(e){r(this,`baseUrl`,void 0),r(this,`token`,void 0);let t=e.apiBase||`/api`;this.baseUrl=`${e.url.startsWith(`https`)?`https`:`http`}://${e.url.replace(/^https?:\/\//,``)}${t}`,this.token=e.token}async request(e,t={}){let{method:n=`GET`,body:r,headers:i={},signal:a,params:o}=t,s=`${this.baseUrl}${e}`;if(o){let e=new URLSearchParams(o);s+=`?${e.toString()}`}let f={...i};r!==void 0&&!(r instanceof FormData)&&(f[`Content-Type`]=`application/json`),this.token&&(f.Authorization=`Bearer ${this.token}`);let p=await fetch(s,{method:n,headers:f,body:r instanceof FormData?r:r?JSON.stringify(r):void 0,signal:a});if(p.status===401)throw new c(`Authentication failed. Your token may be invalid or expired.`);if(p.status===429){let e=p.headers.get(`Retry-After`);throw new l(`Too many requests`,e?parseInt(e,10)*1e3:void 0)}if(!p.ok){let e=`HTTP ${p.status}`;try{let t=await p.json();t.message&&(e=t.message)}catch{}throw p.status>=500?new u(e,p.status):new d(e,p.status)}let m=p.headers.get(`Content-Type`);return m!=null&&m.includes(`application/json`)?p.json():p}get(e,t){return this.request(e,{...t,method:`GET`})}post(e,t,n){return this.request(e,{...n,method:`POST`,body:t})}put(e,t,n){return this.request(e,{...n,method:`PUT`,body:t})}patch(e,t,n){return this.request(e,{...n,method:`PATCH`,body:t})}delete(e,t){return this.request(e,{...t,method:`DELETE`})}static async verifyToken(e,t){let n=e.startsWith(`https`)?`https`:`http`,r=e.replace(/^https?:\/\//,``);try{let e={};return t&&(e.Authorization=`Bearer ${t}`),(await fetch(`${n}://${r}/api/auth/verify`,{headers:e})).status===200}catch(e){throw new s(`Failed to reach server for auth verification: ${e instanceof Error?e.message:String(e)}`)}}},m=class{constructor(e){this.send=e}create(e){this.send({type:`session.create`,...e})}resume(e){this.send({type:`session.resume`,sessionId:e})}close(e){this.send({type:`session.close`,sessionId:e})}update(e,t){this.send({type:`session.update`,sessionId:e,...t})}updateModel(e,t){this.send({type:`session.update_model`,sessionId:e,...t})}reopen(e){this.send({type:`session.reopen`,sessionId:e})}delete(e){this.send({type:`session.delete`,sessionId:e})}rename(e,t){this.send({type:`session.rename`,sessionId:e,title:t})}compact(e){this.send({type:`session.compact`,sessionId:e})}revert(e,t){this.send({type:`session.revert`,sessionId:e,messageId:t})}fork(e,t,n){this.send({type:`session.fork`,sessionId:e,messageId:t,title:n})}interrupt(e,t){this.send({type:`session.interrupt`,sessionId:e,reason:t})}},h=class{constructor(e){this._send=e}send(e,t,n){let r={type:`chat.message`,sessionId:e,content:t};n!=null&&n.attachments&&n.attachments.length>0&&(r.attachments=n.attachments),this._send(r)}},g=class{constructor(e){this.send=e}list(e,t){this.send({type:`permission.list`,workspaceId:e,includeRevoked:t})}revoke(e){this.send({type:`permission.revoke`,grantId:e})}revokeAll(e){this.send({type:`permission.revoke_all`,workspaceId:e})}},_=class{constructor(e){this.send=e}add(e,t,n){let r=n;this.send({type:`queue.add`,sessionId:e,content:t,...r&&r.length>0?{attachments:r}:{}})}remove(e){this.send({type:`queue.remove`,queueId:e})}},v=class{constructor(e){this.send=e}connect(e){this.send({type:`provider.connect`,provider:e})}disconnect(e){this.send({type:`provider.disconnect`,provider:e})}},y=class{constructor(e){r(this,`send`,void 0),this.send=e}claim(e){this.send({type:`session.control.claim`,sessionId:e})}release(e){this.send({type:`session.control.release`,sessionId:e})}requestTakeover(e){this.send({type:`session.control.request_takeover`,sessionId:e})}respondTakeover(e,t,n){this.send({type:`session.control.respond_takeover`,sessionId:e,requesterClientId:t,decision:n})}},b={INPUT:1,RESIZE:2,CLOSE:3,OUTPUT:4,EXIT:5,ERROR:6,INIT_ACK:7,TITLE:8};function x(e,t){let n=new Uint8Array(1+t.length);return n[0]=e,n.set(t,1),n}var S=class extends i{constructor(e,t,n){super(),r(this,`ws`,void 0),r(this,`_session`,void 0),r(this,`_closed`,!1),r(this,`_disposed`,!1),r(this,`_preInitOutput`,[]),this.ws=e,this._session=t,n&&(this._preInitOutput=n),this.ws.binaryType=`arraybuffer`,this.ws.onmessage=this.handleMessage.bind(this),this.ws.onclose=this.handleClose.bind(this),this.ws.onerror=this.handleError.bind(this)}on(e,t){let n=super.on(e,t);return e===`output`&&this.flushPreInitOutput(),n}flushPreInitOutput(){if(this._preInitOutput.length===0)return;let e=this._preInitOutput;this._preInitOutput=[];for(let t of e){if(this._closed)break;this.emit(`output`,t)}}handleMessage(e){if(this._closed)return;let t=new Uint8Array(e.data);if(t.length<1)return;let n=t[0],r=t.slice(1);switch(n){case b.OUTPUT:this.emit(`output`,r);break;case b.EXIT:{let e=0;if(r.length>0)try{let t=JSON.parse(new TextDecoder().decode(r));e=typeof t.exitCode==`number`?t.exitCode:0}catch{e=0}this._session={...this._session,status:`exited`,exitCode:e},this.emit(`exit`,e);break}case b.TITLE:{let e=`Terminal`;if(r.length>0)try{let t=JSON.parse(new TextDecoder().decode(r));e=typeof t.title==`string`?t.title:`Terminal`}catch{e=`Terminal`}this._session={...this._session,title:e},this.emit(`title`,e);break}case b.ERROR:{let e=new TextDecoder().decode(r),t=Error(e||`Terminal error`);this.emit(`error`,t);break}case b.CLOSE:this.doClose();break;default:break}}handleClose(e){this._closed||(this._closed=!0,this.emit(`close`))}handleError(){if(!this._closed){let e=Error(`WebSocket error`);this.emit(`error`,e)}}doClose(){if(!this._closed){this._closed=!0;try{this.ws.close(1e3,`Client close`)}catch{}this.emit(`close`),this.cleanupHandlers()}}cleanupHandlers(){this._disposed||(this._disposed=!0,this.ws.onmessage=null,this.ws.onclose=null,this.ws.onerror=null)}dispatchFrame(e){this.handleMessage({data:e.buffer})}write(e){if(this._closed||this.ws.readyState!==WebSocket.OPEN)return;let t;t=typeof e==`string`?new TextEncoder().encode(e):e,this.ws.send(x(b.INPUT,t))}resize(e,t){if(this._closed||this.ws.readyState!==WebSocket.OPEN)return;let n=JSON.stringify({cols:e,rows:t}),r=new TextEncoder().encode(n);this.ws.send(x(b.RESIZE,r))}close(){this._closed||(this.ws.readyState===WebSocket.OPEN&&this.ws.send(x(b.CLOSE,new Uint8Array)),this.doClose())}dispose(){if(this.cleanupHandlers(),!this._closed){this._closed=!0;try{this.ws.close(1e3,`Disposed`)}catch{}}this.removeAllListeners()}get session(){return this._session}get sessionId(){return this._session.sessionId}get pid(){return this._session.pid}get cwd(){return this._session.cwd}get shell(){return this._session.shell}get cols(){return this._session.cols}get rows(){return this._session.rows}get title(){return this._session.title}get status(){return this._session.status}get exitCode(){return this._session.exitCode}get isReconnect(){return this._session.isReconnect}get closed(){return this._closed}},C=class extends i{constructor(e){super(),r(this,`ws`,void 0),r(this,`_closed`,!1),r(this,`_disposed`,!1),this.ws=e,this.ws.onmessage=this.handleMessage.bind(this),this.ws.onclose=this.handleClose.bind(this),this.ws.onerror=this.handleError.bind(this)}handleMessage(e){if(this._closed)return;let t=e.data;if(typeof t!=`string`)return;let n;try{n=JSON.parse(t)}catch{return}switch(n.type){case`snapshot`:this.emit(`snapshot`,n.sessions);break;case`created`:this.emit(`created`,n.session);break;case`destroyed`:this.emit(`destroyed`,n.sessionId);break;case`exited`:this.emit(`exited`,n.sessionId,n.exitCode);break;case`title_changed`:this.emit(`title_changed`,n.sessionId,n.title);break;case`status_changed`:this.emit(`status_changed`,n.sessionId,n.status);break}}handleClose(e){this._closed||(this._closed=!0,this.emit(`close`))}handleError(){if(!this._closed){let e=Error(`WebSocket error`);this.emit(`error`,e)}}close(){if(!this._closed){this._closed=!0;try{this.ws.close(1e3,`Client close`)}catch{}this.cleanupHandlers()}}dispose(){if(this.cleanupHandlers(),this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)try{this.ws.close(1e3,`Disposed`)}catch{}this._closed||(this._closed=!0,this.emit(`close`)),this.removeAllListeners()}cleanupHandlers(){this._disposed||(this._disposed=!0,this.ws.onmessage=null,this.ws.onclose=null,this.ws.onerror=null)}get closed(){return this._closed}},w=class{constructor(e){r(this,`config`,void 0),this.config={connectTimeout:1e4,...e}}async connect(e){var t;let n=(t=this.config.wsConstructor)==null?globalThis.WebSocket:t,r=this.config.url.startsWith(`https`)?`wss`:`ws`,i=this.config.url.replace(/^https?:\/\//,``),a=new URLSearchParams({cwd:e.cwd,workspaceId:e.workspaceId});this.config.token&&a.set(`token`,this.config.token),e.shell&&a.set(`shell`,e.shell),e.sessionId&&a.set(`sessionId`,e.sessionId);let o=`${r}://${i}/ws/terminal?${a.toString()}`;return new Promise((e,t)=>{var r;let i=new n(o);i.binaryType=`arraybuffer`;let a=(r=this.config.connectTimeout)==null?1e4:r,c=!1,l=t=>{c||(c=!0,clearTimeout(d),e(t))},u=e=>{c||(c=!0,clearTimeout(d),t(e))},d=setTimeout(()=>{i.close(),u(new s(`Terminal connection timeout (${a}ms)`))},a);i.onopen=()=>{};let f=[];i.onmessage=e=>{let t=new Uint8Array(e.data);if(t.length<1)return;let n=t[0],r=t.slice(1);if(n===b.INIT_ACK)try{let e=new S(i,JSON.parse(new TextDecoder().decode(r)),f.filter(e=>e.opcode===b.OUTPUT).map(e=>e.data));for(let t of f)t.opcode!==b.OUTPUT&&e.dispatchFrame(t.data);l(e)}catch(e){i.close(),u(new s(`Failed to parse terminal init: ${e instanceof Error?e.message:String(e)}`))}else if(n===b.ERROR){i.close();let e=`Terminal connection failed`;try{e=JSON.parse(new TextDecoder().decode(r)).message||e}catch{}u(new s(e))}else f.push({opcode:n,data:t})},i.onerror=()=>{i.close(),u(new s(`Terminal WebSocket error`))},i.onclose=()=>{u(new s(`Terminal connection closed before init`))}})}async subscribeEvents(e){var t;let n=(t=this.config.wsConstructor)==null?globalThis.WebSocket:t,r=this.config.url.startsWith(`https`)?`wss`:`ws`,i=this.config.url.replace(/^https?:\/\//,``),a=new URLSearchParams({workspaceId:e});this.config.token&&a.set(`token`,this.config.token);let o=`${r}://${i}/ws/terminal/events?${a.toString()}`;return new Promise((e,t)=>{var r;let i=new n(o),a=(r=this.config.connectTimeout)==null?1e4:r,c=!1,l=t=>{c||(c=!0,clearTimeout(d),e(t))},u=e=>{c||(c=!0,clearTimeout(d),t(e))},d=setTimeout(()=>{i.close(),u(new s(`Terminal events subscription timeout (${a}ms)`))},a);i.onopen=()=>{};let f=null;i.onmessage=e=>{if(c)return;let t=e.data;if(typeof t!=`string`)return;let n;try{n=JSON.parse(t)}catch{return}n.type===`snapshot`&&(f||(f=new C(i)),l({conn:f,initialSessions:n.sessions}))},i.onerror=()=>{i.close(),u(new s(`Terminal events WebSocket error`))},i.onclose=()=>{c||u(new s(`Terminal events connection closed before snapshot`))}})}},T=class{constructor(e){this.http=e}async list(e){return this.http.get(`/sessions`,{params:e!=null&&e.status?{status:e.status}:void 0,signal:e==null?void 0:e.signal})}async create(e){let{signal:t,...n}=e==null?{}:e;return this.http.post(`/sessions`,n,{signal:t})}async get(e,t){return this.http.get(`/sessions/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async update(e,t,n){return this.http.put(`/sessions/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async delete(e,t){return this.http.delete(`/sessions/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async listMessages(e,t){return this.http.get(`/sessions/${encodeURIComponent(e)}/messages`,{signal:t==null?void 0:t.signal})}async listGrouped(e){let t={workspaceIds:e.workspaceIds.join(`,`)};return e.status&&(t.status=e.status),e.rootOnly&&(t.rootOnly=`true`),this.http.get(`/sessions/grouped`,{params:t,signal:e.signal})}async listByWorkspace(e){let t={};return e.status&&(t.status=e.status),e.rootOnly&&(t.rootOnly=`true`),this.http.get(`/workspaces/${encodeURIComponent(e.workspaceId)}/sessions`,{params:t,signal:e.signal})}},E=class{constructor(e){this.http=e}async list(e){return this.http.get(`/workspaces`,{signal:e==null?void 0:e.signal})}async create(e){let{signal:t,...n}=e==null?{}:e;return this.http.post(`/workspaces`,n,{signal:t})}async get(e,t){return this.http.get(`/workspaces/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async update(e,t,n){return this.http.patch(`/workspaces/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async delete(e,t){return this.http.delete(`/workspaces/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async listSessions(e,t){return this.http.get(`/workspaces/${encodeURIComponent(e)}/sessions`,{signal:t==null?void 0:t.signal})}},D=class{constructor(e){this.http=e}async list(e){return this.http.get(`/models`,{signal:e==null?void 0:e.signal})}},O=class{constructor(e){this.http=e}async list(e){return this.http.get(`/tools`,{signal:e==null?void 0:e.signal})}async get(e,t){return this.http.get(`/tools/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async listEnvVars(e){return this.http.get(`/tools/env`,{signal:e==null?void 0:e.signal})}async setEnvVar(e,t,n){return this.http.put(`/tools/env/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async clearEnvVar(e,t){return this.http.delete(`/tools/env/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}},k=class{constructor(e){this.http=e}async list(e){return this.http.get(`/providers`,{signal:e==null?void 0:e.signal})}async getStatus(e,t){return this.http.get(`/providers/${encodeURIComponent(e)}/status`,{signal:t==null?void 0:t.signal})}async connect(e,t){return this.http.post(`/providers/${encodeURIComponent(e)}/connect`,void 0,{signal:t==null?void 0:t.signal})}async disconnect(e,t){return this.http.delete(`/providers/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async listCredentials(e){return this.http.get(`/config/providers`,{signal:e==null?void 0:e.signal})}async setCredential(e,t,n){return this.http.put(`/config/providers/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async clearCredential(e,t){return this.http.delete(`/config/providers/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}},A=class{constructor(e){this.http=e}async list(e){return this.http.get(`/preconfigs`,{signal:e==null?void 0:e.signal})}async create(e){let{signal:t,...n}=e==null?{}:e;return this.http.post(`/preconfigs`,n,{signal:t})}async get(e,t){return this.http.get(`/preconfigs/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async update(e,t,n){return this.http.put(`/preconfigs/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async delete(e,t){return this.http.delete(`/preconfigs/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}},j=class{constructor(e){this.http=e}async list(e){return this.http.get(`/prompts`,{signal:e==null?void 0:e.signal})}},M=class{constructor(e){this.http=e}async browse(e,t,n){let r={};return t!==void 0&&(r.path=t),(n==null?void 0:n.showHidden)!==void 0&&(r.showHidden=String(n.showHidden)),(n==null?void 0:n.limit)!==void 0&&(r.limit=String(n.limit)),this.http.get(`/workspaces/${encodeURIComponent(e)}/files`,{params:Object.keys(r).length>0?r:void 0,signal:n==null?void 0:n.signal})}async search(e,t,n){let r={search:t};return(n==null?void 0:n.limit)!==void 0&&(r.limit=String(n.limit)),(n==null?void 0:n.showHidden)!==void 0&&(r.showHidden=String(n.showHidden)),this.http.get(`/workspaces/${encodeURIComponent(e)}/files`,{params:r,signal:n==null?void 0:n.signal})}async preview(e,t,n){return this.http.get(`/workspaces/${encodeURIComponent(e)}/file-preview`,{params:{path:t},signal:n==null?void 0:n.signal})}async browseFs(e,t){return this.http.get(`/fs/browse`,{params:e===void 0?void 0:{path:e},signal:t==null?void 0:t.signal})}async parent(e,t){return this.http.get(`/fs/parent`,{params:{path:e},signal:t==null?void 0:t.signal})}async drives(e){return this.http.get(`/fs/drives`,{signal:e==null?void 0:e.signal})}},N=class{constructor(e){this.http=e}async list(e,t){return this.http.get(`/sessions/${encodeURIComponent(e)}/attachments`,{signal:t==null?void 0:t.signal})}async upload(e,t,n){let r=new FormData;r.append(`file`,t);let{signal:i}=n==null?{}:n;return this.http.post(`/sessions/${encodeURIComponent(e)}/attachments`,r,{signal:i})}getUrl(e,t,n){return`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content?key=${encodeURIComponent(n)}`}},P=class{constructor(e){this.http=e}async list(e,t){return this.http.get(`/workspaces/${encodeURIComponent(e)}/terminals`,{signal:t==null?void 0:t.signal})}async create(e,t){let{signal:n,body:r}=t==null?{}:t;return this.http.post(`/workspaces/${encodeURIComponent(e)}/terminals`,r==null?{}:r,{signal:n})}async get(e,t,n){return this.http.get(`/workspaces/${encodeURIComponent(e)}/terminals/${encodeURIComponent(t)}`,{signal:n==null?void 0:n.signal})}async delete(e,t,n){return this.http.delete(`/workspaces/${encodeURIComponent(e)}/terminals/${encodeURIComponent(t)}`,{signal:n==null?void 0:n.signal})}},F=class{constructor(e){this.http=e}async getStatus(e,t){return this.http.get(`/workspaces/${encodeURIComponent(e)}/mcp/status`,{signal:t==null?void 0:t.signal})}async connect(e,t,n){let{signal:r}=n==null?{}:n;return this.http.post(`/workspaces/${encodeURIComponent(e)}/mcp/connect`,{name:t},{signal:r})}async disconnect(e,t,n){let{signal:r}=n==null?{}:n;return this.http.post(`/workspaces/${encodeURIComponent(e)}/mcp/disconnect`,{name:t},{signal:r})}async startAuth(e,t,n){let{signal:r}=n==null?{}:n;return this.http.post(`/workspaces/${encodeURIComponent(e)}/mcp/auth`,{name:t},{signal:r})}async finishAuth(e,t,n,r){let{signal:i}=r==null?{}:r;return this.http.post(`/workspaces/${encodeURIComponent(e)}/mcp/auth/callback`,{name:t,code:n},{signal:i})}},I=class{constructor(e){this.http=e}async get(e){return this.http.get(`/config/models`,{signal:e==null?void 0:e.signal})}async createProvider(e,t){return this.http.post(`/config/models/providers`,e,{signal:t==null?void 0:t.signal})}async updateProvider(e,t,n){return this.http.put(`/config/models/providers/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async deleteProvider(e,t){return this.http.delete(`/config/models/providers/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async createModel(e,t,n){return this.http.post(`/config/models/providers/${encodeURIComponent(e)}/models`,t,{signal:n==null?void 0:n.signal})}async updateModel(e,t,n,r){return this.http.put(`/config/models/providers/${encodeURIComponent(e)}/models/${encodeURIComponent(t)}`,n,{signal:r==null?void 0:r.signal})}async deleteModel(e,t,n){return this.http.delete(`/config/models/providers/${encodeURIComponent(e)}/models/${encodeURIComponent(t)}`,{signal:n==null?void 0:n.signal})}async setDefaults(e,t){return this.http.put(`/config/models/defaults`,e,{signal:t==null?void 0:t.signal})}async sync(e=`merge`,t){return this.http.post(`/config/models/sync`,{mode:e},{signal:t==null?void 0:t.signal})}},L=class{constructor(e){this.http=e}async list(e){return this.http.get(`/config/prompts`,{signal:e==null?void 0:e.signal})}async get(e,t){return this.http.get(`/config/prompts/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}async create(e,t){return this.http.post(`/config/prompts`,e,{signal:t==null?void 0:t.signal})}async update(e,t,n){return this.http.put(`/config/prompts/${encodeURIComponent(e)}`,t,{signal:n==null?void 0:n.signal})}async delete(e,t){return this.http.delete(`/config/prompts/${encodeURIComponent(e)}`,{signal:t==null?void 0:t.signal})}},R=class{constructor(e){r(this,`models`,void 0),r(this,`prompts`,void 0),this.models=new I(e),this.prompts=new L(e)}},z=class{constructor(e){r(this,`sessions`,void 0),r(this,`workspaces`,void 0),r(this,`models`,void 0),r(this,`tools`,void 0),r(this,`providers`,void 0),r(this,`preconfigs`,void 0),r(this,`prompts`,void 0),r(this,`files`,void 0),r(this,`attachments`,void 0),r(this,`terminals`,void 0),r(this,`mcp`,void 0),r(this,`config`,void 0),this.sessions=new T(e),this.workspaces=new E(e),this.models=new D(e),this.tools=new O(e),this.providers=new k(e),this.preconfigs=new A(e),this.prompts=new j(e),this.files=new M(e),this.attachments=new N(e),this.terminals=new P(e),this.mcp=new F(e),this.config=new R(e)}async loadAll(e){let[t,n,r,i,a]=await Promise.all([this.workspaces.list(e),this.preconfigs.list(e),this.prompts.list(e),this.models.list(e),this.providers.list(e)]);return{workspaces:t.workspaces,preconfigs:n.preconfigs,prompts:r.prompts,models:i.models,defaultModel:i.defaultModel,defaultProvider:i.defaultProvider,providers:a.providers}}},B=class extends i{constructor(e){super(),r(this,`config`,void 0),r(this,`transport`,void 0),r(this,`_httpClient`,void 0),r(this,`_state`,`disconnected`),r(this,`_connectionId`,null),r(this,`_registeredClient`,null),r(this,`sessions`,void 0),r(this,`chat`,void 0),r(this,`permissions`,void 0),r(this,`queue`,void 0),r(this,`providers`,void 0),r(this,`control`,void 0),r(this,`http`,void 0),r(this,`terminal`,void 0),this.config=e,this.transport=new f({url:e.url,token:e.token,wsConstructor:e.wsConstructor,connectionTimeout:e.connectionTimeout}),this._httpClient=new p({url:e.url,token:e.token,apiBase:e.apiBase});let t=this.transport.send.bind(this.transport);this.sessions=new m(t),this.chat=new h(t),this.permissions=new g(t),this.queue=new _(t),this.providers=new v(t),this.control=new y(t),this.http=new z(this._httpClient),this.terminal=new w({url:e.url,token:e.token,wsConstructor:e.wsConstructor}),this.transport.onOpen=()=>{this._state=`connected`,this._connectionId=null,this._registeredClient=null,this.config.clientDescriptor&&this.send({type:`client.register`,client:this.config.clientDescriptor}),this.emit(`connected`),this.emit(`*`,{source:`lifecycle`,type:`connected`,payload:void 0})},this.transport.onMessage=e=>{e.type===`client.registered`&&(this._connectionId=e.connectionId,this._registeredClient=e.client),a(this,e)},this.transport.onClose=(e,t,n)=>{let r=this._state;this._state=`disconnected`,r!==`disconnected`&&(this.emit(`disconnected`,{code:e,reason:t,wasClean:n}),this.emit(`*`,{source:`lifecycle`,type:`disconnected`,payload:{code:e,reason:t,wasClean:n}}))},this.transport.onError=e=>{this.emit(`error.connection`,e),this.emit(`*`,{source:`lifecycle`,type:`error.connection`,payload:e})}}async connect(){this._state=`connecting`,await this.transport.connect()}async disconnect(){this._state=`disconnecting`,await this.transport.disconnect()}async dispose(){await this.disconnect(),this.transport.dispose(),this.removeAllListeners()}get state(){return this._state}get connected(){return this._state===`connected`}get ws(){return this.transport.ws}get httpClient(){return this._httpClient}get connectionId(){return this._connectionId}get registeredClient(){return this._registeredClient}get clientId(){var e,t;return(e=(t=this._registeredClient)==null?void 0:t.clientId)==null?null:e}send(e){this.transport.send(e)}};export{z as n,p as r,B as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,r as n,t as r}from"./compiler-runtime-DZXZ41-q.js";import{o as i}from"./platform-BOMKRNFM.js";import{A as a,D as o,S as s,a as c,c as l,d as u,f as d,k as f,l as p,o as m,s as h}from"./sidebar-C-dZ1XFl.js";import{I as g,L as _,i as v,r as y,t as b}from"./queries-CFdMXU0x.js";import{A as x,D as S,J as C,T as w,U as ee,W as T,a as E,c as D,d as te,i as ne,n as O,q as k,r as A,s as j,t as re,v as ie}from"./badge-Cjebg6Sp.js";import{t as M}from"./createLucideIcon-CuVT3KNW.js";import{t as N}from"./archive-pL5uw9sg.js";import{a as ae,i as P,n as F,o as I,r as L,s as R,t as oe}from"./SessionMenuButton-vkh7M4zW.js";import{a as z,c as B,d as V,i as H,l as U,m as W,o as G,p as K,r as q,s as J,t as Y,u as X}from"./popover-C8mm1NWm.js";import{F as se,M as Z,N as ce,r as le,t as ue}from"./button--1wnt03c.js";import{a as de,o as fe,r as pe,s as me,t as he}from"./dialog-BNCh4KEM.js";import{t as ge}from"./confirmation-dialog-CFCxzDEX.js";var _e=M(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ve=M(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),ye=r(),Q=t(n(),1);function be(e){var t;let n=(0,ye.c)(20),{sdkClient:r,workspaceId:i,connected:o}=e,c=x(xe),l;n[0]===i?l=n[1]:(l=s.sessions.byWorkspace(i==null?``:i),n[0]=i,n[1]=l);let u;n[2]!==r||n[3]!==i?(u=()=>r.http.sessions.listByWorkspace({workspaceId:i}),n[2]=r,n[3]=i,n[4]=u):u=n[4];let d=!!r&&o&&!!i,f;n[5]!==l||n[6]!==u||n[7]!==d?(f={queryKey:l,queryFn:u,enabled:d,staleTime:1e4},n[5]=l,n[6]=u,n[7]=d,n[8]=f):f=n[8];let{isLoading:p,error:m,data:h}=a(f),g,_;n[9]!==c||n[10]!==i?(g=()=>{i||c([])},_=[i,c],n[9]=c,n[10]=i,n[11]=g,n[12]=_):(g=n[11],_=n[12]),(0,Q.useEffect)(g,_);let v,y;n[13]!==h||n[14]!==c?(v=()=>{h!=null&&h.sessions&&c(h.sessions)},y=[h,c],n[13]=h,n[14]=c,n[15]=v,n[16]=y):(v=n[15],y=n[16]),(0,Q.useEffect)(v,y);let b=(t=m==null?void 0:m.message)==null?null:t,S;return n[17]!==p||n[18]!==b?(S={isLoading:p,error:b},n[17]=p,n[18]=b,n[19]=S):S=n[19],S}function xe(e){return e.setSessions}function Se(...e){return e.map((e,t)=>t===0?e.replace(/\/+$/,``):e.replace(/^\/+|\/+$/g,``)).filter(Boolean).join(`/`)}var $=e();function Ce(e){var t,n,r,i;let a=(0,ye.c)(83),{open:o,onOpenChange:s,onSelect:c,initialPath:l,title:u,sdkClient:d}=e,f=u===void 0?`Select Folder`:u,[p,m]=(0,Q.useState)(l||``),[h,_]=(0,Q.useState)(l||``),[x,S]=(0,Q.useState)(0),[w,E]=(0,Q.useState)(``),[D,te]=(0,Q.useState)(!1),[ne,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useRef)(null),{data:j,isLoading:re,error:M,refetch:N}=b(d,h,o),{data:ae}=y(d),{error:P,refetch:F}=v(d,p,!1),I;if(a[0]!==(ae==null?void 0:ae.drives)){var L;I=(L=ae==null?void 0:ae.drives)==null?[]:L,a[0]=ae==null?void 0:ae.drives,a[1]=I}else I=a[1];let R=I,oe=(t=j==null||(n=j.files)==null?void 0:n.filter(De))==null?[]:t,z=(r=j==null?void 0:j.isRoot)==null?!1:r,B=re||ne,V=M||P,H;a[2]===w?H=a[3]:(H=e=>e.name.toLowerCase().includes(w.toLowerCase()),a[2]=w,a[3]=H);let U=oe.filter(H),W=(i=U[x])==null?null:i,G;a[4]===p?G=a[5]:(G=e=>Se(p,e.name),a[4]=p,a[5]=G);let q=G,J=W?q(W):p,Y=!W,X;a[6]!==z||a[7]!==F||a[8]!==d?(X=()=>{!d||z||(O(!0),F().then(e=>{e.data&&(m(e.data.currentPath),_(e.data.currentPath),S(0),E(``)),O(!1)}).catch(()=>{O(!1)}))},a[6]=z,a[7]=F,a[8]=d,a[9]=X):X=a[9];let se=X,Z;a[10]===q?Z=a[11]:(Z=e=>{let t=q(e);m(t),_(t),S(0),E(``),te(!1)},a[10]=q,a[11]=Z);let ce=Z,ge=()=>{J&&(c(J),s(!1))},be=e=>{if(U.length!==0)bb85:switch(e.key){case`ArrowDown`:e.preventDefault(),S(e=>Math.min(e+1,U.length-1));break bb85;case`ArrowRight`:U[x]&&(e.preventDefault(),ce(U[x]));break bb85;case`ArrowUp`:e.preventDefault(),S(Ee);break bb85;case`Enter`:e.preventDefault(),ge();break bb85;case`Escape`:w&&(e.preventDefault(),E(``))}},xe,Ce;a[12]!==l||a[13]!==o?(xe=()=>{if(o){let e=l||``;m(e),_(e),S(0),E(``)}},Ce=[o,l],a[12]=l,a[13]=o,a[14]=xe,a[15]=Ce):(xe=a[14],Ce=a[15]),(0,Q.useEffect)(xe,Ce);let Oe;a[16]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{S(0)},a[16]=Oe):Oe=a[16];let ke;a[17]===w?ke=a[18]:(ke=[w],a[17]=w,a[18]=ke),(0,Q.useEffect)(Oe,ke),(0,Q.useEffect)(()=>{if(A.current&&U.length>0){let e=A.current.children[x];e&&e.scrollIntoView({block:`nearest`})}},[x,U.length]);let Ae,je;a[19]===o?(Ae=a[20],je=a[21]):(Ae=()=>{o&&setTimeout(()=>{var e;return(e=k.current)==null?void 0:e.focus()},100)},je=[o],a[19]=o,a[20]=Ae,a[21]=je),(0,Q.useEffect)(Ae,je);let Me;a[22]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>{te(!1)},a[22]=Me):Me=a[22];let Ne;a[23]===p?Ne=a[24]:(Ne=[p],a[23]=p,a[24]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=Te,Fe=he,Ie=pe,Le;a[25]===f?Le=a[26]:(Le=(0,$.jsx)(fe,{children:(0,$.jsx)(me,{children:f})}),a[25]=f,a[26]=Le);let Re=B||!p||z,ze;a[27]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,$.jsx)(_e,{className:`w-4 h-4`}),a[27]=ze):ze=a[27];let Be;a[28]!==se||a[29]!==Re?(Be=(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,className:`h-7 w-7 flex-shrink-0`,onClick:se,disabled:Re,children:ze}),a[28]=se,a[29]=Re,a[30]=Be):Be=a[30];let Ve;a[31]!==p||a[32]!==R||a[33]!==B||a[34]!==D?(Ve=R.length>1&&(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,className:`h-7 w-7 flex-shrink-0`,onClick:()=>te(we),disabled:B,children:(0,$.jsx)(ve,{className:`w-4 h-4`})}),D&&(0,$.jsx)(`div`,{className:`absolute top-full left-0 mt-1 bg-popover border rounded-md shadow-md z-50 min-w-[120px]`,children:R.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{m(e),_(e),te(!1),S(0),E(``)},className:le(`flex items-center gap-2 w-full px-3 py-1.5 text-sm text-left hover:bg-muted`,p===e&&`bg-primary/20 text-primary font-medium`),children:[(0,$.jsx)(T,{className:`w-3.5 h-3.5 text-amber-500`}),e]},e))})]}),a[31]=p,a[32]=R,a[33]=B,a[34]=D,a[35]=Ve):Ve=a[35];let He=W?(0,$.jsx)(`span`,{className:`text-primary`,children:Pe(q(W),45)}):Pe(p)||`Home`,Ue;a[36]!==He||a[37]!==J?(Ue=(0,$.jsx)(`span`,{className:`flex-1 text-sm font-mono truncate`,title:J,children:He}),a[36]=He,a[37]=J,a[38]=Ue):Ue=a[38];let We;a[39]!==Be||a[40]!==Ve||a[41]!==Ue?(We=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-muted rounded-md`,children:[Be,Ve,Ue]}),a[39]=Be,a[40]=Ve,a[41]=Ue,a[42]=We):We=a[42];let Ge;a[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(K,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground`}),a[43]=Ge):Ge=a[43];let Ke;a[44]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=e=>E(e.target.value),a[44]=Ke):Ke=a[44];let qe;a[45]===w?qe=a[46]:(qe=(0,$.jsxs)(`div`,{className:`relative`,children:[Ge,(0,$.jsx)(ie,{ref:k,placeholder:`Filter folders...`,value:w,onChange:Ke,className:`pl-8`})]}),a[45]=w,a[46]=qe);let Je;a[47]!==p||a[48]!==V||a[49]!==U||a[50]!==ce||a[51]!==B||a[52]!==N||a[53]!==w||a[54]!==x?(Je=(0,$.jsx)(g,{className:`h-64 border rounded-md`,children:B?(0,$.jsxs)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:[(0,$.jsx)(ee,{className:`w-4 h-4 animate-spin mr-2`}),`Loading...`]}):V?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`text-destructive`,children:V.message}),(0,$.jsx)(ue,{variant:`ghost`,size:`sm`,onClick:()=>{_(p),N()},className:`mt-2`,children:`Retry`})]}):U.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground text-sm`,children:[(0,$.jsx)(T,{className:`w-8 h-8 mb-2 opacity-50`}),w?`No matching folders`:`No folders in this directory`]}):(0,$.jsx)(`div`,{className:`p-1`,ref:A,children:U.map((e,t)=>(0,$.jsxs)(`button`,{onClick:()=>S(t),onDoubleClick:()=>ce(e),className:le(`flex items-center gap-2 w-full px-2 py-1.5 rounded text-sm text-left`,`hover:bg-muted`,t===x&&`bg-primary/20 text-primary font-medium ring-1 ring-primary/50`),children:[(0,$.jsx)(T,{className:`w-4 h-4 text-amber-500 flex-shrink-0`}),(0,$.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),t===x&&(0,$.jsx)(C,{className:`w-4 h-4 text-primary`})]},e.path))})}),a[47]=p,a[48]=V,a[49]=U,a[50]=ce,a[51]=B,a[52]=N,a[53]=w,a[54]=x,a[55]=Je):Je=a[55];let Ye;a[56]===V?Ye=a[57]:(Ye=V&&(0,$.jsx)(`p`,{className:`text-xs text-destructive`,children:V.message}),a[56]=V,a[57]=Ye);let Xe;a[58]!==We||a[59]!==qe||a[60]!==Je||a[61]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[We,qe,Je,Ye]}),a[58]=We,a[59]=qe,a[60]=Je,a[61]=Ye,a[62]=Xe):Xe=a[62];let Ze;a[63]===s?Ze=a[64]:(Ze=(0,$.jsx)(ue,{variant:`outline`,onClick:()=>s(!1),children:`Cancel`}),a[63]=s,a[64]=Ze);let Qe=!J||B,$e=Y?`Use This Folder`:`Add Selected Folder`,et;a[65]!==ge||a[66]!==Qe||a[67]!==$e?(et=(0,$.jsx)(ue,{onClick:ge,disabled:Qe,children:$e}),a[65]=ge,a[66]=Qe,a[67]=$e,a[68]=et):et=a[68];let tt;a[69]!==Ze||a[70]!==et?(tt=(0,$.jsxs)(de,{children:[Ze,et]}),a[69]=Ze,a[70]=et,a[71]=tt):tt=a[71];let nt;a[72]!==Ie||a[73]!==be||a[74]!==Le||a[75]!==Xe||a[76]!==tt?(nt=(0,$.jsxs)(Ie,{className:`sm:max-w-lg`,onKeyDown:be,children:[Le,Xe,tt]}),a[72]=Ie,a[73]=be,a[74]=Le,a[75]=Xe,a[76]=tt,a[77]=nt):nt=a[77];let rt;return a[78]!==Fe||a[79]!==s||a[80]!==o||a[81]!==nt?(rt=(0,$.jsx)(Fe,{open:o,onOpenChange:s,children:nt}),a[78]=Fe,a[79]=s,a[80]=o,a[81]=nt,a[82]=rt):rt=a[82],rt}function we(e){return!e}function Te(e,t){let n=t===void 0?50:t;if(e.length<=n)return e;let r=e.split(/[/\\]/);return r.length<=2?e:`.../`+r.slice(-2).join(`/`)}function Ee(e){return Math.max(e-1,0)}function De(e){return e.type===`directory`}function Oe(e){let t=(0,ye.c)(67),{workspaces:n,activeWorkspace:r,onSelectWorkspace:i,onCreateVirtualWorkspace:a,onCreatePhysicalWorkspace:s,isWorkspaceFavorited:c,onToggleFavorite:l,onDeleteWorkspace:u,onRenameWorkspace:d,sdkClient:p}=e,[m,h]=(0,Q.useState)(!1),[g,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[w,ee]=(0,Q.useState)(``),ne=(0,Q.useRef)(null),O,k;t[0]===x?(O=t[1],k=t[2]):(O=()=>{x&&ne.current&&(ne.current.focus(),ne.current.select())},k=[x],t[0]=x,t[1]=O,t[2]=k),(0,Q.useEffect)(O,k);let A;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{ee(e.name),S(e.id)},t[3]=A):A=t[3];let re=A,ie;t[4]!==d||t[5]!==w||t[6]!==x?(ie=()=>{let e=w.trim();e&&x&&d(x,e),S(null)},t[4]=d,t[5]=w,t[6]=x,t[7]=ie):ie=t[7];let M=ie,N;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{S(null)},t[8]=N):N=t[8];let ae=N,P;t[9]===(r==null?void 0:r.isVirtual)?P=t[10]:(P=r!=null&&r.isVirtual?(0,$.jsx)(R,{className:`size-4 flex-shrink-0 text-muted-foreground`}):(0,$.jsx)(T,{className:`size-4 flex-shrink-0 text-muted-foreground`}),t[9]=r==null?void 0:r.isVirtual,t[10]=P);let F=(r==null?void 0:r.name)||`Select workspace`,I;t[11]===F?I=t[12]:(I=(0,$.jsx)(`span`,{className:`truncate`,children:F}),t[11]=F,t[12]=I);let L;t[13]!==P||t[14]!==I?(L=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 overflow-hidden`,children:[P,I]}),t[13]=P,t[14]=I,t[15]=L):L=t[15];let oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(W,{className:`ml-auto size-4 shrink-0 opacity-50`}),t[16]=oe):oe=t[16];let K;t[17]!==m||t[18]!==L?(K=(0,$.jsx)(H,{asChild:!0,children:(0,$.jsxs)(ue,{variant:`outline`,role:`combobox`,"aria-expanded":m,"aria-label":`Select workspace`,className:`w-full justify-between h-9`,children:[L,oe]})}),t[17]=m,t[18]=L,t[19]=K):K=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,$.jsx)(B,{placeholder:`Search workspace...`}),t[20]=Z):Z=t[20];let de;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(G,{children:`No workspace found.`}),t[21]=de):de=t[21];let fe;t[22]!==(r==null?void 0:r.id)||t[23]!==M||t[24]!==c||t[25]!==i||t[26]!==l||t[27]!==w||t[28]!==x||t[29]!==n?(fe=n.map(e=>(0,$.jsxs)(U,{showCheck:!1,onSelect:()=>{x!==e.id&&(i(e),h(!1))},children:[(0,$.jsx)(`div`,{className:`flex-1 min-w-0 flex items-center gap-2`,children:x===e.id?(0,$.jsx)(`input`,{ref:ne,type:`text`,value:w,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),M()):e.key===`Escape`?(e.preventDefault(),ae()):[`ArrowUp`,`ArrowDown`].includes(e.key)&&e.stopPropagation()},onBlur:M,onClick:Ae,className:`flex-1 min-w-0 h-6 px-1 text-sm bg-background border border-input rounded focus:outline-none focus:ring-2 focus:ring-ring`}):(0,$.jsxs)($.Fragment,{children:[e.isVirtual?(0,$.jsx)(R,{className:`size-4 flex-shrink-0 text-muted-foreground`}):(0,$.jsx)(T,{className:`size-4 flex-shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]})}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,$.jsx)(`button`,{className:`p-1 rounded hover:bg-secondary transition-colors`,onClick:t=>{t.stopPropagation(),l(e.id,e.name)},title:c(e.id)?`Remove from favorites`:`Add to favorites`,children:c(e.id)?(0,$.jsx)(_,{className:`size-4 fill-primary text-primary`}):(0,$.jsx)(_,{className:`size-4 text-muted-foreground`})}),(0,$.jsx)(C,{className:le(`size-4`,(r==null?void 0:r.id)===e.id?`opacity-100`:`opacity-0`)}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsxs)(`button`,{className:`p-1 rounded hover:bg-secondary transition-colors`,onClick:ke,children:[(0,$.jsx)(f,{className:`size-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Workspace actions`})]})}),(0,$.jsxs)(j,{align:`end`,children:[(0,$.jsxs)(D,{onClick:t=>{t.stopPropagation(),re(e)},children:[(0,$.jsx)(o,{className:`size-4`}),`Rename`]}),(0,$.jsxs)(D,{onClick:t=>{t.stopPropagation(),b(e)},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(ce,{className:`size-4`}),`Delete`]})]})]})]})]},e.id)),t[22]=r==null?void 0:r.id,t[23]=M,t[24]=c,t[25]=i,t[26]=l,t[27]=w,t[28]=x,t[29]=n,t[30]=fe):fe=t[30];let pe;t[31]===fe?pe=t[32]:(pe=(0,$.jsx)(J,{heading:`Workspaces`,children:fe}),t[31]=fe,t[32]=pe);let me;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(V,{}),t[33]=me):me=t[33];let he;t[34]===a?he=t[35]:(he=()=>{a(),h(!1)},t[34]=a,t[35]=he);let _e;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(se,{className:`size-4`,"data-icon":`inline-start`}),t[36]=_e):_e=t[36];let ve;t[37]===he?ve=t[38]:(ve=(0,$.jsxs)(U,{onSelect:he,children:[_e,`Create virtual workspace`]}),t[37]=he,t[38]=ve);let be;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,$.jsxs)(U,{onSelect:()=>{h(!1),v(!0)},children:[(0,$.jsx)(T,{className:`size-4`,"data-icon":`inline-start`}),`Add existing folder`]}),t[39]=be):be=t[39];let xe;t[40]===ve?xe=t[41]:(xe=(0,$.jsxs)(J,{children:[ve,be]}),t[40]=ve,t[41]=xe);let Se;t[42]!==pe||t[43]!==xe?(Se=(0,$.jsx)(q,{className:`w-[240px] p-0 max-h-[80vh]`,children:(0,$.jsxs)(z,{children:[Z,(0,$.jsxs)(X,{className:`max-h-[50vh] overflow-y-auto`,children:[de,pe,me,xe]})]})}),t[42]=pe,t[43]=xe,t[44]=Se):Se=t[44];let we;t[45]!==m||t[46]!==K||t[47]!==Se?(we=(0,$.jsxs)(Y,{open:m,onOpenChange:h,children:[K,Se]}),t[45]=m,t[46]=K,t[47]=Se,t[48]=we):we=t[48];let Te;t[49]===s?Te=t[50]:(Te=e=>{s(e),v(!1)},t[49]=s,t[50]=Te);let Ee;t[51]!==p||t[52]!==g||t[53]!==Te?(Ee=(0,$.jsx)(Ce,{open:g,onOpenChange:v,onSelect:Te,title:`Select Workspace Folder`,sdkClient:p}),t[51]=p,t[52]=g,t[53]=Te,t[54]=Ee):Ee=t[54];let De=y!==null,Oe;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>!e&&b(null),t[55]=Oe):Oe=t[55];let je=y?`Are you sure you want to delete "${y.name}"? This will permanently remove the workspace and all associated Jean data, including sessions, messages, and temporary files. The actual files in "${y.name}" on disk will not be deleted.`:``,Me;t[56]!==u||t[57]!==y?(Me=()=>{y&&(u(y.id),b(null))},t[56]=u,t[57]=y,t[58]=Me):Me=t[58];let Ne;t[59]!==De||t[60]!==je||t[61]!==Me?(Ne=(0,$.jsx)(ge,{open:De,onOpenChange:Oe,title:`Delete Workspace`,description:je,confirmLabel:`Delete`,variant:`destructive`,onConfirm:Me}),t[59]=De,t[60]=je,t[61]=Me,t[62]=Ne):Ne=t[62];let Pe;return t[63]!==we||t[64]!==Ee||t[65]!==Ne?(Pe=(0,$.jsxs)($.Fragment,{children:[we,Ee,Ne]}),t[63]=we,t[64]=Ee,t[65]=Ne,t[66]=Pe):Pe=t[66],Pe}function ke(e){return e.stopPropagation()}function Ae(e){return e.stopPropagation()}function je(e){let t=(0,ye.c)(56),{activeSessions:n,archivedSessions:r,childrenMap:i,sessionDerivedValues:a,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRenameSession:g,onBulkCloseSessions:_,onBulkDeleteSessions:v}=e,[y,b]=(0,Q.useState)(!1),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=new Set,t[0]=x):x=t[0];let[S,C]=(0,Q.useState)(x),[w,ee]=(0,Q.useState)(!1),T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[1]=T):T=t[1];let ie=T,M;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{b(Ie),C(new Set)},t[2]=M):M=t[2];let ae=M,P;t[3]===n?P=t[4]:(P=()=>{C(new Set(n.map(Fe)))},t[3]=n,t[4]=P);let F=P,L;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{C(new Set)},t[5]=L):L=t[5];let R=L,z;t[6]!==_||t[7]!==S?(z=()=>{S.size>0&&(_(S),C(new Set),b(!1))},t[6]=_,t[7]=S,t[8]=z):z=t[8];let B=z,V;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{b(!1),C(new Set)},t[9]=V):V=t[9];let H=V,U;t[10]!==r||t[11]!==v?(U=()=>{let e=new Set(r.map(Pe));e.size>0&&v(e),ee(!1)},t[10]=r,t[11]=v,t[12]=U):U=t[12];let W=U,G,K;t[13]===y?(G=t[14],K=t[15]):(K=()=>{if(!y)return;let e=e=>{e.key===`Escape`&&H()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},G=[y,H],t[13]=y,t[14]=G,t[15]=K),(0,Q.useEffect)(K,G);let q;t[16]!==n||t[17]!==i||t[18]!==o||t[19]!==l||t[20]!==d||t[21]!==g||t[22]!==u||t[23]!==s||t[24]!==F||t[25]!==S||t[26]!==y||t[27]!==a?(q=(0,$.jsx)(O,{defaultOpen:!0,className:`group/collapsible`,children:(0,$.jsxs)(c,{children:[(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(ne,{asChild:!0,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(k,{className:`size-3 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`}),`Active`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S.size>0?(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S.size===n.length?R():F()},className:`hover:underline cursor-pointer`,children:S.size===n.length?`Deselect all`:`Select all`}):(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F()},className:`hover:underline cursor-pointer`,children:`Select all`})}),(0,$.jsx)(re,{variant:`secondary`,children:n.length}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Ne,className:`p-1 rounded-md hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors`,title:`Session actions`,children:(0,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(j,{align:`end`,className:`min-w-48`,children:y?(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),H()},children:[(0,$.jsx)(Z,{className:`size-4`}),`Cancel selection`]}):(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),ae()},children:[(0,$.jsx)(I,{className:`size-4`}),`Select to archive`]})})]})]})]})})}),(0,$.jsx)(A,{children:(0,$.jsx)(m,{children:(0,$.jsx)(p,{children:n.map(e=>(0,$.jsx)(oe,{session:e,childrenMap:i,sessionDerivedValues:a,isActive:o===e.id,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRename:g,selectionMode:y,selected:S.has(e.id),onToggleSelect:ie},e.id))})})})]})}),t[16]=n,t[17]=i,t[18]=o,t[19]=l,t[20]=d,t[21]=g,t[22]=u,t[23]=s,t[24]=F,t[25]=S,t[26]=y,t[27]=a,t[28]=q):q=t[28];let J;t[29]!==r||t[30]!==i||t[31]!==o||t[32]!==l||t[33]!==d||t[34]!==g||t[35]!==u||t[36]!==s||t[37]!==a?(J=r.length>0&&(0,$.jsx)(O,{defaultOpen:!0,className:`group/collapsible`,children:(0,$.jsxs)(c,{children:[(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(ne,{asChild:!0,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(k,{className:`size-3 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`}),`Archived`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(re,{variant:`secondary`,children:r.length}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Me,className:`p-1 rounded-md hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors`,title:`Archived actions`,children:(0,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(j,{align:`end`,className:`min-w-48`,children:(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),ee(!0)},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(ce,{className:`size-4`}),`Delete all`]})})]})]})]})})}),(0,$.jsx)(A,{children:(0,$.jsx)(m,{children:(0,$.jsx)(p,{children:r.map(e=>(0,$.jsx)(oe,{session:e,childrenMap:i,sessionDerivedValues:a,isActive:o===e.id,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRename:g},e.id))})})})]})}),t[29]=r,t[30]=i,t[31]=o,t[32]=l,t[33]=d,t[34]=g,t[35]=u,t[36]=s,t[37]=a,t[38]=J):J=t[38];let Y;t[39]!==n.length||t[40]!==r.length?(Y=n.length===0&&r.length===0&&(0,$.jsxs)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:[`No sessions yet.`,(0,$.jsx)(`br`,{}),`Start a new chat to begin.`]}),t[39]=n.length,t[40]=r.length,t[41]=Y):Y=t[41];let X;t[42]!==B||t[43]!==S.size||t[44]!==y?(X=y&&S.size>0&&(0,$.jsxs)(`div`,{className:`sticky bottom-0 bg-sidebar border-t px-2 py-1.5 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate min-w-0`,children:[S.size,` selected`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,$.jsx)(ue,{variant:`outline`,size:`icon`,onClick:B,title:`Archive`,className:`size-7`,children:(0,$.jsx)(N,{className:`size-4`})}),(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,onClick:H,title:`Cancel`,className:`size-7`,children:(0,$.jsx)(Z,{className:`size-4`})})]})]}),t[42]=B,t[43]=S.size,t[44]=y,t[45]=X):X=t[45];let se=`This will permanently delete ${r.length} archived session${r.length===1?``:`s`}. This action cannot be undone.`,le;t[46]!==w||t[47]!==W||t[48]!==se?(le=(0,$.jsx)(ge,{open:w,onOpenChange:ee,title:`Delete all archived sessions?`,description:se,confirmLabel:`Delete all`,variant:`destructive`,onConfirm:W}),t[46]=w,t[47]=W,t[48]=se,t[49]=le):le=t[49];let de;return t[50]!==q||t[51]!==J||t[52]!==Y||t[53]!==X||t[54]!==le?(de=(0,$.jsxs)($.Fragment,{children:[q,J,Y,X,le]}),t[50]=q,t[51]=J,t[52]=Y,t[53]=X,t[54]=le,t[55]=de):de=t[55],de}function Me(e){return e.stopPropagation()}function Ne(e){return e.stopPropagation()}function Pe(e){return e.id}function Fe(e){return e.id}function Ie(e){return!e}function Le(){var e,t,n;let r=(0,ye.c)(61),a=w(),o=F(),{sidebarRef:s,chatInputRef:c,terminalPanelRef:f}=S(),{sdkClient:m,primaryPreconfigs:h,createSession:g,resumeSession:_,closeSession:v,reopenSession:y,permanentlyDeleteSession:b,handleRenameSession:x,selectWorkspace:C,handleCreateVirtualWorkspace:ee,handleCreatePhysicalWorkspace:T,deleteWorkspace:E,renameWorkspace:D}=a,te=(e=(t=o.activeWorkspace)==null?void 0:t.id)==null?null:e,ne;r[0]!==m||r[1]!==o.connected||r[2]!==te?(ne={sdkClient:m,workspaceId:te,connected:o.connected},r[0]=m,r[1]=o.connected,r[2]=te,r[3]=ne):ne=r[3],be(ne);let O=o.activeSessions,k=o.archivedSessions,A;r[4]!==E||r[5]!==T||r[6]!==ee||r[7]!==D||r[8]!==m||r[9]!==C||r[10]!==o.activeWorkspace||r[11]!==o.handleToggleWorkspaceFavorite||r[12]!==o.isWorkspaceFavorited||r[13]!==o.workspaces?(A=(0,$.jsx)(`div`,{className:`p-2 space-y-2`,children:(0,$.jsx)(Oe,{workspaces:o.workspaces,activeWorkspace:o.activeWorkspace,onSelectWorkspace:C,onCreateVirtualWorkspace:ee,onCreatePhysicalWorkspace:T,isWorkspaceFavorited:o.isWorkspaceFavorited,onToggleFavorite:o.handleToggleWorkspaceFavorite,onDeleteWorkspace:E,onRenameWorkspace:D,sdkClient:m})}),r[4]=E,r[5]=T,r[6]=ee,r[7]=D,r[8]=m,r[9]=C,r[10]=o.activeWorkspace,r[11]=o.handleToggleWorkspaceFavorite,r[12]=o.isWorkspaceFavorited,r[13]=o.workspaces,r[14]=A):A=r[14];let j;if(r[15]!==g||r[16]!==((n=h[0])==null?void 0:n.id)){var re;j=()=>{var e;return g((e=h[0])==null?void 0:e.id)},r[15]=g,r[16]=(re=h[0])==null?void 0:re.id,r[17]=j}else j=r[17];let ie=!o.connected,M,N;r[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(se,{className:`size-4`,"data-icon":`inline-start`}),N=(0,$.jsx)(`span`,{children:`New Chat`}),r[18]=M,r[19]=N):(M=r[18],N=r[19]);let I;r[20]!==j||r[21]!==ie?(I=(0,$.jsx)(p,{children:(0,$.jsx)(d,{children:(0,$.jsxs)(u,{onClick:j,disabled:ie,className:`w-full`,children:[M,N]})})}),r[20]=j,r[21]=ie,r[22]=I):I=r[22];let R;r[23]!==A||r[24]!==I?(R=(0,$.jsxs)(l,{children:[A,I]}),r[23]=A,r[24]=I,r[25]=R):R=r[25];let oe=R,z;r[26]===v?z=r[27]:(z=e=>{e.forEach(e=>v(e))},r[26]=v,r[27]=z);let B=z,V;r[28]===b?V=r[29]:(V=e=>{e.forEach(e=>b(e))},r[28]=b,r[29]=V);let H=V,U;r[30]!==O||r[31]!==k||r[32]!==v||r[33]!==B||r[34]!==H||r[35]!==x||r[36]!==b||r[37]!==y||r[38]!==_||r[39]!==o.childrenMap||r[40]!==o.currentSessionId||r[41]!==o.sessionDerivedValues?(U=(0,$.jsx)(je,{activeSessions:O,archivedSessions:k,childrenMap:o.childrenMap,sessionDerivedValues:o.sessionDerivedValues,currentSessionId:o.currentSessionId,onResumeSession:_,onCloseSession:v,onReopenSession:y,onDeleteSession:b,onRenameSession:x,onBulkCloseSessions:B,onBulkDeleteSessions:H}),r[30]=O,r[31]=k,r[32]=v,r[33]=B,r[34]=H,r[35]=x,r[36]=b,r[37]=y,r[38]=_,r[39]=o.childrenMap,r[40]=o.currentSessionId,r[41]=o.sessionDerivedValues,r[42]=U):U=r[42];let W=U,G;r[43]!==c||r[44]!==o.currentSessionId?(G=()=>{if(o.currentSessionId){var e;(e=c.current)==null||e.focus()}},r[43]=c,r[44]=o.currentSessionId,r[45]=G):G=r[45];let K;r[46]!==W||r[47]!==o.currentSessionId||r[48]!==oe||r[49]!==s||r[50]!==G?(K=(0,$.jsx)(ae,{ref:s,header:oe,currentSessionId:o.currentSessionId,onEscape:G,children:W}),r[46]=W,r[47]=o.currentSessionId,r[48]=oe,r[49]=s,r[50]=G,r[51]=K):K=r[51];let q;r[52]===Symbol.for(`react.memo_cache_sentinel`)?(q={paddingTop:`calc(0.5rem + env(safe-area-inset-top, 0px))`,paddingBottom:`calc(0.5rem + env(safe-area-inset-bottom, 0px))`},r[52]=q):q=r[52];let J,Y;r[53]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(P,{}),Y=(0,$.jsx)(i,{}),r[53]=J,r[54]=Y):(J=r[53],Y=r[54]);let X;r[55]!==m||r[56]!==f?(X=(0,$.jsx)(`main`,{className:`flex-1 flex flex-col overflow-hidden min-h-0 p-2`,style:q,children:(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden min-h-0 rounded-xl bg-background shadow-sm ring-1 ring-border`,children:[J,Y,(0,$.jsx)(L,{sdkClient:m,terminalPanelRef:f})]})}),r[55]=m,r[56]=f,r[57]=X):X=r[57];let Z;return r[58]!==K||r[59]!==X?(Z=(0,$.jsxs)($.Fragment,{children:[K,X]}),r[58]=K,r[59]=X,r[60]=Z):Z=r[60],Z}var Re=Le;export{Re as component};
|
|
1
|
+
import{n as e,o as t,r as n,t as r}from"./compiler-runtime-DZXZ41-q.js";import{o as i}from"./platform-cRBZ7eSy.js";import{A as a,D as o,S as s,a as c,c as l,d as u,f as d,k as f,l as p,o as m,s as h}from"./sidebar-BqQ-fUFc.js";import{L as g,R as _,i as v,r as y,t as b}from"./queries-C0JoQFZb.js";import{A as x,D as S,J as C,T as w,U as ee,W as T,a as E,c as D,d as te,i as ne,n as O,q as k,r as A,s as j,t as re,v as ie}from"./badge-Cjebg6Sp.js";import{t as M}from"./createLucideIcon-CuVT3KNW.js";import{t as N}from"./archive-pL5uw9sg.js";import{a as ae,i as P,n as F,o as I,r as L,s as R,t as oe}from"./SessionMenuButton-DtN_qfRb.js";import{a as z,c as B,d as V,i as H,l as U,m as W,o as G,p as K,r as q,s as J,t as Y,u as X}from"./popover-C8mm1NWm.js";import{F as se,M as Z,N as ce,r as le,t as ue}from"./button--1wnt03c.js";import{a as de,o as fe,r as pe,s as me,t as he}from"./dialog-BNCh4KEM.js";import{t as ge}from"./confirmation-dialog-CFCxzDEX.js";var _e=M(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ve=M(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),ye=r(),Q=t(n(),1);function be(e){var t;let n=(0,ye.c)(20),{sdkClient:r,workspaceId:i,connected:o}=e,c=x(xe),l;n[0]===i?l=n[1]:(l=s.sessions.byWorkspace(i==null?``:i),n[0]=i,n[1]=l);let u;n[2]!==r||n[3]!==i?(u=()=>r.http.sessions.listByWorkspace({workspaceId:i}),n[2]=r,n[3]=i,n[4]=u):u=n[4];let d=!!r&&o&&!!i,f;n[5]!==l||n[6]!==u||n[7]!==d?(f={queryKey:l,queryFn:u,enabled:d,staleTime:1e4},n[5]=l,n[6]=u,n[7]=d,n[8]=f):f=n[8];let{isLoading:p,error:m,data:h}=a(f),g,_;n[9]!==c||n[10]!==i?(g=()=>{i||c([])},_=[i,c],n[9]=c,n[10]=i,n[11]=g,n[12]=_):(g=n[11],_=n[12]),(0,Q.useEffect)(g,_);let v,y;n[13]!==h||n[14]!==c?(v=()=>{h!=null&&h.sessions&&c(h.sessions)},y=[h,c],n[13]=h,n[14]=c,n[15]=v,n[16]=y):(v=n[15],y=n[16]),(0,Q.useEffect)(v,y);let b=(t=m==null?void 0:m.message)==null?null:t,S;return n[17]!==p||n[18]!==b?(S={isLoading:p,error:b},n[17]=p,n[18]=b,n[19]=S):S=n[19],S}function xe(e){return e.setSessions}function Se(...e){return e.map((e,t)=>t===0?e.replace(/\/+$/,``):e.replace(/^\/+|\/+$/g,``)).filter(Boolean).join(`/`)}var $=e();function Ce(e){var t,n,r,i;let a=(0,ye.c)(83),{open:o,onOpenChange:s,onSelect:c,initialPath:l,title:u,sdkClient:d}=e,f=u===void 0?`Select Folder`:u,[p,m]=(0,Q.useState)(l||``),[h,_]=(0,Q.useState)(l||``),[x,S]=(0,Q.useState)(0),[w,E]=(0,Q.useState)(``),[D,te]=(0,Q.useState)(!1),[ne,O]=(0,Q.useState)(!1),k=(0,Q.useRef)(null),A=(0,Q.useRef)(null),{data:j,isLoading:re,error:M,refetch:N}=b(d,h,o),{data:ae}=y(d),{error:P,refetch:F}=v(d,p,!1),I;if(a[0]!==(ae==null?void 0:ae.drives)){var L;I=(L=ae==null?void 0:ae.drives)==null?[]:L,a[0]=ae==null?void 0:ae.drives,a[1]=I}else I=a[1];let R=I,oe=(t=j==null||(n=j.files)==null?void 0:n.filter(De))==null?[]:t,z=(r=j==null?void 0:j.isRoot)==null?!1:r,B=re||ne,V=M||P,H;a[2]===w?H=a[3]:(H=e=>e.name.toLowerCase().includes(w.toLowerCase()),a[2]=w,a[3]=H);let U=oe.filter(H),W=(i=U[x])==null?null:i,G;a[4]===p?G=a[5]:(G=e=>Se(p,e.name),a[4]=p,a[5]=G);let q=G,J=W?q(W):p,Y=!W,X;a[6]!==z||a[7]!==F||a[8]!==d?(X=()=>{!d||z||(O(!0),F().then(e=>{e.data&&(m(e.data.currentPath),_(e.data.currentPath),S(0),E(``)),O(!1)}).catch(()=>{O(!1)}))},a[6]=z,a[7]=F,a[8]=d,a[9]=X):X=a[9];let se=X,Z;a[10]===q?Z=a[11]:(Z=e=>{let t=q(e);m(t),_(t),S(0),E(``),te(!1)},a[10]=q,a[11]=Z);let ce=Z,ge=()=>{J&&(c(J),s(!1))},be=e=>{if(U.length!==0)bb85:switch(e.key){case`ArrowDown`:e.preventDefault(),S(e=>Math.min(e+1,U.length-1));break bb85;case`ArrowRight`:U[x]&&(e.preventDefault(),ce(U[x]));break bb85;case`ArrowUp`:e.preventDefault(),S(Ee);break bb85;case`Enter`:e.preventDefault(),ge();break bb85;case`Escape`:w&&(e.preventDefault(),E(``))}},xe,Ce;a[12]!==l||a[13]!==o?(xe=()=>{if(o){let e=l||``;m(e),_(e),S(0),E(``)}},Ce=[o,l],a[12]=l,a[13]=o,a[14]=xe,a[15]=Ce):(xe=a[14],Ce=a[15]),(0,Q.useEffect)(xe,Ce);let Oe;a[16]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=()=>{S(0)},a[16]=Oe):Oe=a[16];let ke;a[17]===w?ke=a[18]:(ke=[w],a[17]=w,a[18]=ke),(0,Q.useEffect)(Oe,ke),(0,Q.useEffect)(()=>{if(A.current&&U.length>0){let e=A.current.children[x];e&&e.scrollIntoView({block:`nearest`})}},[x,U.length]);let Ae,je;a[19]===o?(Ae=a[20],je=a[21]):(Ae=()=>{o&&setTimeout(()=>{var e;return(e=k.current)==null?void 0:e.focus()},100)},je=[o],a[19]=o,a[20]=Ae,a[21]=je),(0,Q.useEffect)(Ae,je);let Me;a[22]===Symbol.for(`react.memo_cache_sentinel`)?(Me=()=>{te(!1)},a[22]=Me):Me=a[22];let Ne;a[23]===p?Ne=a[24]:(Ne=[p],a[23]=p,a[24]=Ne),(0,Q.useEffect)(Me,Ne);let Pe=Te,Fe=he,Ie=pe,Le;a[25]===f?Le=a[26]:(Le=(0,$.jsx)(fe,{children:(0,$.jsx)(me,{children:f})}),a[25]=f,a[26]=Le);let Re=B||!p||z,ze;a[27]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,$.jsx)(_e,{className:`w-4 h-4`}),a[27]=ze):ze=a[27];let Be;a[28]!==se||a[29]!==Re?(Be=(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,className:`h-7 w-7 flex-shrink-0`,onClick:se,disabled:Re,children:ze}),a[28]=se,a[29]=Re,a[30]=Be):Be=a[30];let Ve;a[31]!==p||a[32]!==R||a[33]!==B||a[34]!==D?(Ve=R.length>1&&(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,className:`h-7 w-7 flex-shrink-0`,onClick:()=>te(we),disabled:B,children:(0,$.jsx)(ve,{className:`w-4 h-4`})}),D&&(0,$.jsx)(`div`,{className:`absolute top-full left-0 mt-1 bg-popover border rounded-md shadow-md z-50 min-w-[120px]`,children:R.map(e=>(0,$.jsxs)(`button`,{onClick:()=>{m(e),_(e),te(!1),S(0),E(``)},className:le(`flex items-center gap-2 w-full px-3 py-1.5 text-sm text-left hover:bg-muted`,p===e&&`bg-primary/20 text-primary font-medium`),children:[(0,$.jsx)(T,{className:`w-3.5 h-3.5 text-amber-500`}),e]},e))})]}),a[31]=p,a[32]=R,a[33]=B,a[34]=D,a[35]=Ve):Ve=a[35];let He=W?(0,$.jsx)(`span`,{className:`text-primary`,children:Pe(q(W),45)}):Pe(p)||`Home`,Ue;a[36]!==He||a[37]!==J?(Ue=(0,$.jsx)(`span`,{className:`flex-1 text-sm font-mono truncate`,title:J,children:He}),a[36]=He,a[37]=J,a[38]=Ue):Ue=a[38];let We;a[39]!==Be||a[40]!==Ve||a[41]!==Ue?(We=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 bg-muted rounded-md`,children:[Be,Ve,Ue]}),a[39]=Be,a[40]=Ve,a[41]=Ue,a[42]=We):We=a[42];let Ge;a[43]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,$.jsx)(K,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground`}),a[43]=Ge):Ge=a[43];let Ke;a[44]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=e=>E(e.target.value),a[44]=Ke):Ke=a[44];let qe;a[45]===w?qe=a[46]:(qe=(0,$.jsxs)(`div`,{className:`relative`,children:[Ge,(0,$.jsx)(ie,{ref:k,placeholder:`Filter folders...`,value:w,onChange:Ke,className:`pl-8`})]}),a[45]=w,a[46]=qe);let Je;a[47]!==p||a[48]!==V||a[49]!==U||a[50]!==ce||a[51]!==B||a[52]!==N||a[53]!==w||a[54]!==x?(Je=(0,$.jsx)(g,{className:`h-64 border rounded-md`,children:B?(0,$.jsxs)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:[(0,$.jsx)(ee,{className:`w-4 h-4 animate-spin mr-2`}),`Loading...`]}):V?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`text-destructive`,children:V.message}),(0,$.jsx)(ue,{variant:`ghost`,size:`sm`,onClick:()=>{_(p),N()},className:`mt-2`,children:`Retry`})]}):U.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground text-sm`,children:[(0,$.jsx)(T,{className:`w-8 h-8 mb-2 opacity-50`}),w?`No matching folders`:`No folders in this directory`]}):(0,$.jsx)(`div`,{className:`p-1`,ref:A,children:U.map((e,t)=>(0,$.jsxs)(`button`,{onClick:()=>S(t),onDoubleClick:()=>ce(e),className:le(`flex items-center gap-2 w-full px-2 py-1.5 rounded text-sm text-left`,`hover:bg-muted`,t===x&&`bg-primary/20 text-primary font-medium ring-1 ring-primary/50`),children:[(0,$.jsx)(T,{className:`w-4 h-4 text-amber-500 flex-shrink-0`}),(0,$.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),t===x&&(0,$.jsx)(C,{className:`w-4 h-4 text-primary`})]},e.path))})}),a[47]=p,a[48]=V,a[49]=U,a[50]=ce,a[51]=B,a[52]=N,a[53]=w,a[54]=x,a[55]=Je):Je=a[55];let Ye;a[56]===V?Ye=a[57]:(Ye=V&&(0,$.jsx)(`p`,{className:`text-xs text-destructive`,children:V.message}),a[56]=V,a[57]=Ye);let Xe;a[58]!==We||a[59]!==qe||a[60]!==Je||a[61]!==Ye?(Xe=(0,$.jsxs)(`div`,{className:`space-y-3`,children:[We,qe,Je,Ye]}),a[58]=We,a[59]=qe,a[60]=Je,a[61]=Ye,a[62]=Xe):Xe=a[62];let Ze;a[63]===s?Ze=a[64]:(Ze=(0,$.jsx)(ue,{variant:`outline`,onClick:()=>s(!1),children:`Cancel`}),a[63]=s,a[64]=Ze);let Qe=!J||B,$e=Y?`Use This Folder`:`Add Selected Folder`,et;a[65]!==ge||a[66]!==Qe||a[67]!==$e?(et=(0,$.jsx)(ue,{onClick:ge,disabled:Qe,children:$e}),a[65]=ge,a[66]=Qe,a[67]=$e,a[68]=et):et=a[68];let tt;a[69]!==Ze||a[70]!==et?(tt=(0,$.jsxs)(de,{children:[Ze,et]}),a[69]=Ze,a[70]=et,a[71]=tt):tt=a[71];let nt;a[72]!==Ie||a[73]!==be||a[74]!==Le||a[75]!==Xe||a[76]!==tt?(nt=(0,$.jsxs)(Ie,{className:`sm:max-w-lg`,onKeyDown:be,children:[Le,Xe,tt]}),a[72]=Ie,a[73]=be,a[74]=Le,a[75]=Xe,a[76]=tt,a[77]=nt):nt=a[77];let rt;return a[78]!==Fe||a[79]!==s||a[80]!==o||a[81]!==nt?(rt=(0,$.jsx)(Fe,{open:o,onOpenChange:s,children:nt}),a[78]=Fe,a[79]=s,a[80]=o,a[81]=nt,a[82]=rt):rt=a[82],rt}function we(e){return!e}function Te(e,t){let n=t===void 0?50:t;if(e.length<=n)return e;let r=e.split(/[/\\]/);return r.length<=2?e:`.../`+r.slice(-2).join(`/`)}function Ee(e){return Math.max(e-1,0)}function De(e){return e.type===`directory`}function Oe(e){let t=(0,ye.c)(67),{workspaces:n,activeWorkspace:r,onSelectWorkspace:i,onCreateVirtualWorkspace:a,onCreatePhysicalWorkspace:s,isWorkspaceFavorited:c,onToggleFavorite:l,onDeleteWorkspace:u,onRenameWorkspace:d,sdkClient:p}=e,[m,h]=(0,Q.useState)(!1),[g,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(null),[w,ee]=(0,Q.useState)(``),ne=(0,Q.useRef)(null),O,k;t[0]===x?(O=t[1],k=t[2]):(O=()=>{x&&ne.current&&(ne.current.focus(),ne.current.select())},k=[x],t[0]=x,t[1]=O,t[2]=k),(0,Q.useEffect)(O,k);let A;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{ee(e.name),S(e.id)},t[3]=A):A=t[3];let re=A,ie;t[4]!==d||t[5]!==w||t[6]!==x?(ie=()=>{let e=w.trim();e&&x&&d(x,e),S(null)},t[4]=d,t[5]=w,t[6]=x,t[7]=ie):ie=t[7];let M=ie,N;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(N=()=>{S(null)},t[8]=N):N=t[8];let ae=N,P;t[9]===(r==null?void 0:r.isVirtual)?P=t[10]:(P=r!=null&&r.isVirtual?(0,$.jsx)(R,{className:`size-4 flex-shrink-0 text-muted-foreground`}):(0,$.jsx)(T,{className:`size-4 flex-shrink-0 text-muted-foreground`}),t[9]=r==null?void 0:r.isVirtual,t[10]=P);let F=(r==null?void 0:r.name)||`Select workspace`,I;t[11]===F?I=t[12]:(I=(0,$.jsx)(`span`,{className:`truncate`,children:F}),t[11]=F,t[12]=I);let L;t[13]!==P||t[14]!==I?(L=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 overflow-hidden`,children:[P,I]}),t[13]=P,t[14]=I,t[15]=L):L=t[15];let oe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(W,{className:`ml-auto size-4 shrink-0 opacity-50`}),t[16]=oe):oe=t[16];let K;t[17]!==m||t[18]!==L?(K=(0,$.jsx)(H,{asChild:!0,children:(0,$.jsxs)(ue,{variant:`outline`,role:`combobox`,"aria-expanded":m,"aria-label":`Select workspace`,className:`w-full justify-between h-9`,children:[L,oe]})}),t[17]=m,t[18]=L,t[19]=K):K=t[19];let Z;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,$.jsx)(B,{placeholder:`Search workspace...`}),t[20]=Z):Z=t[20];let de;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(G,{children:`No workspace found.`}),t[21]=de):de=t[21];let fe;t[22]!==(r==null?void 0:r.id)||t[23]!==M||t[24]!==c||t[25]!==i||t[26]!==l||t[27]!==w||t[28]!==x||t[29]!==n?(fe=n.map(e=>(0,$.jsxs)(U,{showCheck:!1,onSelect:()=>{x!==e.id&&(i(e),h(!1))},children:[(0,$.jsx)(`div`,{className:`flex-1 min-w-0 flex items-center gap-2`,children:x===e.id?(0,$.jsx)(`input`,{ref:ne,type:`text`,value:w,onChange:e=>ee(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),M()):e.key===`Escape`?(e.preventDefault(),ae()):[`ArrowUp`,`ArrowDown`].includes(e.key)&&e.stopPropagation()},onBlur:M,onClick:Ae,className:`flex-1 min-w-0 h-6 px-1 text-sm bg-background border border-input rounded focus:outline-none focus:ring-2 focus:ring-ring`}):(0,$.jsxs)($.Fragment,{children:[e.isVirtual?(0,$.jsx)(R,{className:`size-4 flex-shrink-0 text-muted-foreground`}):(0,$.jsx)(T,{className:`size-4 flex-shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name})]})}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,$.jsx)(`button`,{className:`p-1 rounded hover:bg-secondary transition-colors`,onClick:t=>{t.stopPropagation(),l(e.id,e.name)},title:c(e.id)?`Remove from favorites`:`Add to favorites`,children:c(e.id)?(0,$.jsx)(_,{className:`size-4 fill-primary text-primary`}):(0,$.jsx)(_,{className:`size-4 text-muted-foreground`})}),(0,$.jsx)(C,{className:le(`size-4`,(r==null?void 0:r.id)===e.id?`opacity-100`:`opacity-0`)}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsxs)(`button`,{className:`p-1 rounded hover:bg-secondary transition-colors`,onClick:ke,children:[(0,$.jsx)(f,{className:`size-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Workspace actions`})]})}),(0,$.jsxs)(j,{align:`end`,children:[(0,$.jsxs)(D,{onClick:t=>{t.stopPropagation(),re(e)},children:[(0,$.jsx)(o,{className:`size-4`}),`Rename`]}),(0,$.jsxs)(D,{onClick:t=>{t.stopPropagation(),b(e)},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(ce,{className:`size-4`}),`Delete`]})]})]})]})]},e.id)),t[22]=r==null?void 0:r.id,t[23]=M,t[24]=c,t[25]=i,t[26]=l,t[27]=w,t[28]=x,t[29]=n,t[30]=fe):fe=t[30];let pe;t[31]===fe?pe=t[32]:(pe=(0,$.jsx)(J,{heading:`Workspaces`,children:fe}),t[31]=fe,t[32]=pe);let me;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(V,{}),t[33]=me):me=t[33];let he;t[34]===a?he=t[35]:(he=()=>{a(),h(!1)},t[34]=a,t[35]=he);let _e;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,$.jsx)(se,{className:`size-4`,"data-icon":`inline-start`}),t[36]=_e):_e=t[36];let ve;t[37]===he?ve=t[38]:(ve=(0,$.jsxs)(U,{onSelect:he,children:[_e,`Create virtual workspace`]}),t[37]=he,t[38]=ve);let be;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(be=(0,$.jsxs)(U,{onSelect:()=>{h(!1),v(!0)},children:[(0,$.jsx)(T,{className:`size-4`,"data-icon":`inline-start`}),`Add existing folder`]}),t[39]=be):be=t[39];let xe;t[40]===ve?xe=t[41]:(xe=(0,$.jsxs)(J,{children:[ve,be]}),t[40]=ve,t[41]=xe);let Se;t[42]!==pe||t[43]!==xe?(Se=(0,$.jsx)(q,{className:`w-[240px] p-0 max-h-[80vh]`,children:(0,$.jsxs)(z,{children:[Z,(0,$.jsxs)(X,{className:`max-h-[50vh] overflow-y-auto`,children:[de,pe,me,xe]})]})}),t[42]=pe,t[43]=xe,t[44]=Se):Se=t[44];let we;t[45]!==m||t[46]!==K||t[47]!==Se?(we=(0,$.jsxs)(Y,{open:m,onOpenChange:h,children:[K,Se]}),t[45]=m,t[46]=K,t[47]=Se,t[48]=we):we=t[48];let Te;t[49]===s?Te=t[50]:(Te=e=>{s(e),v(!1)},t[49]=s,t[50]=Te);let Ee;t[51]!==p||t[52]!==g||t[53]!==Te?(Ee=(0,$.jsx)(Ce,{open:g,onOpenChange:v,onSelect:Te,title:`Select Workspace Folder`,sdkClient:p}),t[51]=p,t[52]=g,t[53]=Te,t[54]=Ee):Ee=t[54];let De=y!==null,Oe;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=e=>!e&&b(null),t[55]=Oe):Oe=t[55];let je=y?`Are you sure you want to delete "${y.name}"? This will permanently remove the workspace and all associated Jean data, including sessions, messages, and temporary files. The actual files in "${y.name}" on disk will not be deleted.`:``,Me;t[56]!==u||t[57]!==y?(Me=()=>{y&&(u(y.id),b(null))},t[56]=u,t[57]=y,t[58]=Me):Me=t[58];let Ne;t[59]!==De||t[60]!==je||t[61]!==Me?(Ne=(0,$.jsx)(ge,{open:De,onOpenChange:Oe,title:`Delete Workspace`,description:je,confirmLabel:`Delete`,variant:`destructive`,onConfirm:Me}),t[59]=De,t[60]=je,t[61]=Me,t[62]=Ne):Ne=t[62];let Pe;return t[63]!==we||t[64]!==Ee||t[65]!==Ne?(Pe=(0,$.jsxs)($.Fragment,{children:[we,Ee,Ne]}),t[63]=we,t[64]=Ee,t[65]=Ne,t[66]=Pe):Pe=t[66],Pe}function ke(e){return e.stopPropagation()}function Ae(e){return e.stopPropagation()}function je(e){let t=(0,ye.c)(56),{activeSessions:n,archivedSessions:r,childrenMap:i,sessionDerivedValues:a,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRenameSession:g,onBulkCloseSessions:_,onBulkDeleteSessions:v}=e,[y,b]=(0,Q.useState)(!1),x;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(x=new Set,t[0]=x):x=t[0];let[S,C]=(0,Q.useState)(x),[w,ee]=(0,Q.useState)(!1),T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>{C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[1]=T):T=t[1];let ie=T,M;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{b(Ie),C(new Set)},t[2]=M):M=t[2];let ae=M,P;t[3]===n?P=t[4]:(P=()=>{C(new Set(n.map(Fe)))},t[3]=n,t[4]=P);let F=P,L;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(L=()=>{C(new Set)},t[5]=L):L=t[5];let R=L,z;t[6]!==_||t[7]!==S?(z=()=>{S.size>0&&(_(S),C(new Set),b(!1))},t[6]=_,t[7]=S,t[8]=z):z=t[8];let B=z,V;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>{b(!1),C(new Set)},t[9]=V):V=t[9];let H=V,U;t[10]!==r||t[11]!==v?(U=()=>{let e=new Set(r.map(Pe));e.size>0&&v(e),ee(!1)},t[10]=r,t[11]=v,t[12]=U):U=t[12];let W=U,G,K;t[13]===y?(G=t[14],K=t[15]):(K=()=>{if(!y)return;let e=e=>{e.key===`Escape`&&H()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},G=[y,H],t[13]=y,t[14]=G,t[15]=K),(0,Q.useEffect)(K,G);let q;t[16]!==n||t[17]!==i||t[18]!==o||t[19]!==l||t[20]!==d||t[21]!==g||t[22]!==u||t[23]!==s||t[24]!==F||t[25]!==S||t[26]!==y||t[27]!==a?(q=(0,$.jsx)(O,{defaultOpen:!0,className:`group/collapsible`,children:(0,$.jsxs)(c,{children:[(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(ne,{asChild:!0,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(k,{className:`size-3 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`}),`Active`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S.size>0?(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),S.size===n.length?R():F()},className:`hover:underline cursor-pointer`,children:S.size===n.length?`Deselect all`:`Select all`}):(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),F()},className:`hover:underline cursor-pointer`,children:`Select all`})}),(0,$.jsx)(re,{variant:`secondary`,children:n.length}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Ne,className:`p-1 rounded-md hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors`,title:`Session actions`,children:(0,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(j,{align:`end`,className:`min-w-48`,children:y?(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),H()},children:[(0,$.jsx)(Z,{className:`size-4`}),`Cancel selection`]}):(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),ae()},children:[(0,$.jsx)(I,{className:`size-4`}),`Select to archive`]})})]})]})]})})}),(0,$.jsx)(A,{children:(0,$.jsx)(m,{children:(0,$.jsx)(p,{children:n.map(e=>(0,$.jsx)(oe,{session:e,childrenMap:i,sessionDerivedValues:a,isActive:o===e.id,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRename:g,selectionMode:y,selected:S.has(e.id),onToggleSelect:ie},e.id))})})})]})}),t[16]=n,t[17]=i,t[18]=o,t[19]=l,t[20]=d,t[21]=g,t[22]=u,t[23]=s,t[24]=F,t[25]=S,t[26]=y,t[27]=a,t[28]=q):q=t[28];let J;t[29]!==r||t[30]!==i||t[31]!==o||t[32]!==l||t[33]!==d||t[34]!==g||t[35]!==u||t[36]!==s||t[37]!==a?(J=r.length>0&&(0,$.jsx)(O,{defaultOpen:!0,className:`group/collapsible`,children:(0,$.jsxs)(c,{children:[(0,$.jsx)(h,{asChild:!0,children:(0,$.jsx)(ne,{asChild:!0,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between w-full`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(k,{className:`size-3 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90`}),`Archived`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(re,{variant:`secondary`,children:r.length}),(0,$.jsxs)(E,{children:[(0,$.jsx)(te,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:Me,className:`p-1 rounded-md hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors`,title:`Archived actions`,children:(0,$.jsx)(f,{className:`size-4`})})}),(0,$.jsx)(j,{align:`end`,className:`min-w-48`,children:(0,$.jsxs)(D,{onClick:e=>{e.stopPropagation(),ee(!0)},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(ce,{className:`size-4`}),`Delete all`]})})]})]})]})})}),(0,$.jsx)(A,{children:(0,$.jsx)(m,{children:(0,$.jsx)(p,{children:r.map(e=>(0,$.jsx)(oe,{session:e,childrenMap:i,sessionDerivedValues:a,isActive:o===e.id,currentSessionId:o,onResumeSession:s,onCloseSession:l,onReopenSession:u,onDeleteSession:d,onRename:g},e.id))})})})]})}),t[29]=r,t[30]=i,t[31]=o,t[32]=l,t[33]=d,t[34]=g,t[35]=u,t[36]=s,t[37]=a,t[38]=J):J=t[38];let Y;t[39]!==n.length||t[40]!==r.length?(Y=n.length===0&&r.length===0&&(0,$.jsxs)(`div`,{className:`p-4 text-center text-sm text-muted-foreground`,children:[`No sessions yet.`,(0,$.jsx)(`br`,{}),`Start a new chat to begin.`]}),t[39]=n.length,t[40]=r.length,t[41]=Y):Y=t[41];let X;t[42]!==B||t[43]!==S.size||t[44]!==y?(X=y&&S.size>0&&(0,$.jsxs)(`div`,{className:`sticky bottom-0 bg-sidebar border-t px-2 py-1.5 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground truncate min-w-0`,children:[S.size,` selected`]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,$.jsx)(ue,{variant:`outline`,size:`icon`,onClick:B,title:`Archive`,className:`size-7`,children:(0,$.jsx)(N,{className:`size-4`})}),(0,$.jsx)(ue,{variant:`ghost`,size:`icon`,onClick:H,title:`Cancel`,className:`size-7`,children:(0,$.jsx)(Z,{className:`size-4`})})]})]}),t[42]=B,t[43]=S.size,t[44]=y,t[45]=X):X=t[45];let se=`This will permanently delete ${r.length} archived session${r.length===1?``:`s`}. This action cannot be undone.`,le;t[46]!==w||t[47]!==W||t[48]!==se?(le=(0,$.jsx)(ge,{open:w,onOpenChange:ee,title:`Delete all archived sessions?`,description:se,confirmLabel:`Delete all`,variant:`destructive`,onConfirm:W}),t[46]=w,t[47]=W,t[48]=se,t[49]=le):le=t[49];let de;return t[50]!==q||t[51]!==J||t[52]!==Y||t[53]!==X||t[54]!==le?(de=(0,$.jsxs)($.Fragment,{children:[q,J,Y,X,le]}),t[50]=q,t[51]=J,t[52]=Y,t[53]=X,t[54]=le,t[55]=de):de=t[55],de}function Me(e){return e.stopPropagation()}function Ne(e){return e.stopPropagation()}function Pe(e){return e.id}function Fe(e){return e.id}function Ie(e){return!e}function Le(){var e,t,n;let r=(0,ye.c)(61),a=w(),o=F(),{sidebarRef:s,chatInputRef:c,terminalPanelRef:f}=S(),{sdkClient:m,primaryPreconfigs:h,createSession:g,resumeSession:_,closeSession:v,reopenSession:y,permanentlyDeleteSession:b,handleRenameSession:x,selectWorkspace:C,handleCreateVirtualWorkspace:ee,handleCreatePhysicalWorkspace:T,deleteWorkspace:E,renameWorkspace:D}=a,te=(e=(t=o.activeWorkspace)==null?void 0:t.id)==null?null:e,ne;r[0]!==m||r[1]!==o.connected||r[2]!==te?(ne={sdkClient:m,workspaceId:te,connected:o.connected},r[0]=m,r[1]=o.connected,r[2]=te,r[3]=ne):ne=r[3],be(ne);let O=o.activeSessions,k=o.archivedSessions,A;r[4]!==E||r[5]!==T||r[6]!==ee||r[7]!==D||r[8]!==m||r[9]!==C||r[10]!==o.activeWorkspace||r[11]!==o.handleToggleWorkspaceFavorite||r[12]!==o.isWorkspaceFavorited||r[13]!==o.workspaces?(A=(0,$.jsx)(`div`,{className:`p-2 space-y-2`,children:(0,$.jsx)(Oe,{workspaces:o.workspaces,activeWorkspace:o.activeWorkspace,onSelectWorkspace:C,onCreateVirtualWorkspace:ee,onCreatePhysicalWorkspace:T,isWorkspaceFavorited:o.isWorkspaceFavorited,onToggleFavorite:o.handleToggleWorkspaceFavorite,onDeleteWorkspace:E,onRenameWorkspace:D,sdkClient:m})}),r[4]=E,r[5]=T,r[6]=ee,r[7]=D,r[8]=m,r[9]=C,r[10]=o.activeWorkspace,r[11]=o.handleToggleWorkspaceFavorite,r[12]=o.isWorkspaceFavorited,r[13]=o.workspaces,r[14]=A):A=r[14];let j;if(r[15]!==g||r[16]!==((n=h[0])==null?void 0:n.id)){var re;j=()=>{var e;return g((e=h[0])==null?void 0:e.id)},r[15]=g,r[16]=(re=h[0])==null?void 0:re.id,r[17]=j}else j=r[17];let ie=!o.connected,M,N;r[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(se,{className:`size-4`,"data-icon":`inline-start`}),N=(0,$.jsx)(`span`,{children:`New Chat`}),r[18]=M,r[19]=N):(M=r[18],N=r[19]);let I;r[20]!==j||r[21]!==ie?(I=(0,$.jsx)(p,{children:(0,$.jsx)(d,{children:(0,$.jsxs)(u,{onClick:j,disabled:ie,className:`w-full`,children:[M,N]})})}),r[20]=j,r[21]=ie,r[22]=I):I=r[22];let R;r[23]!==A||r[24]!==I?(R=(0,$.jsxs)(l,{children:[A,I]}),r[23]=A,r[24]=I,r[25]=R):R=r[25];let oe=R,z;r[26]===v?z=r[27]:(z=e=>{e.forEach(e=>v(e))},r[26]=v,r[27]=z);let B=z,V;r[28]===b?V=r[29]:(V=e=>{e.forEach(e=>b(e))},r[28]=b,r[29]=V);let H=V,U;r[30]!==O||r[31]!==k||r[32]!==v||r[33]!==B||r[34]!==H||r[35]!==x||r[36]!==b||r[37]!==y||r[38]!==_||r[39]!==o.childrenMap||r[40]!==o.currentSessionId||r[41]!==o.sessionDerivedValues?(U=(0,$.jsx)(je,{activeSessions:O,archivedSessions:k,childrenMap:o.childrenMap,sessionDerivedValues:o.sessionDerivedValues,currentSessionId:o.currentSessionId,onResumeSession:_,onCloseSession:v,onReopenSession:y,onDeleteSession:b,onRenameSession:x,onBulkCloseSessions:B,onBulkDeleteSessions:H}),r[30]=O,r[31]=k,r[32]=v,r[33]=B,r[34]=H,r[35]=x,r[36]=b,r[37]=y,r[38]=_,r[39]=o.childrenMap,r[40]=o.currentSessionId,r[41]=o.sessionDerivedValues,r[42]=U):U=r[42];let W=U,G;r[43]!==c||r[44]!==o.currentSessionId?(G=()=>{if(o.currentSessionId){var e;(e=c.current)==null||e.focus()}},r[43]=c,r[44]=o.currentSessionId,r[45]=G):G=r[45];let K;r[46]!==W||r[47]!==o.currentSessionId||r[48]!==oe||r[49]!==s||r[50]!==G?(K=(0,$.jsx)(ae,{ref:s,header:oe,currentSessionId:o.currentSessionId,onEscape:G,children:W}),r[46]=W,r[47]=o.currentSessionId,r[48]=oe,r[49]=s,r[50]=G,r[51]=K):K=r[51];let q;r[52]===Symbol.for(`react.memo_cache_sentinel`)?(q={paddingTop:`calc(0.5rem + env(safe-area-inset-top, 0px))`,paddingBottom:`calc(0.5rem + env(safe-area-inset-bottom, 0px))`},r[52]=q):q=r[52];let J,Y;r[53]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,$.jsx)(P,{}),Y=(0,$.jsx)(i,{}),r[53]=J,r[54]=Y):(J=r[53],Y=r[54]);let X;r[55]!==m||r[56]!==f?(X=(0,$.jsx)(`main`,{className:`flex-1 flex flex-col overflow-hidden min-h-0 p-2`,style:q,children:(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden min-h-0 rounded-xl bg-background shadow-sm ring-1 ring-border`,children:[J,Y,(0,$.jsx)(L,{sdkClient:m,terminalPanelRef:f})]})}),r[55]=m,r[56]=f,r[57]=X):X=r[57];let Z;return r[58]!==K||r[59]!==X?(Z=(0,$.jsxs)($.Fragment,{children:[K,X]}),r[58]=K,r[59]=X,r[60]=Z):Z=r[60],Z}var Re=Le;export{Re as component};
|
package/dist/cli.mjs
CHANGED
|
@@ -6,7 +6,6 @@ import fs from "node:fs";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
|
-
import open from "open";
|
|
10
9
|
var __filename = fileURLToPath(import.meta.url);
|
|
11
10
|
var __dirname = path.dirname(__filename);
|
|
12
11
|
var distPath = __dirname;
|
|
@@ -56,13 +55,28 @@ var server = http.createServer((req, res) => {
|
|
|
56
55
|
}
|
|
57
56
|
const filePath = path.join(distPath, urlPath);
|
|
58
57
|
fs.stat(filePath, (err, stats) => {
|
|
59
|
-
if (err
|
|
60
|
-
const
|
|
61
|
-
serveFile(res,
|
|
58
|
+
if (!err && stats.isFile()) {
|
|
59
|
+
const contentType = getContentType(filePath);
|
|
60
|
+
serveFile(res, filePath, contentType);
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
|
-
const
|
|
65
|
-
|
|
63
|
+
const ext = path.extname(urlPath).toLowerCase();
|
|
64
|
+
if (ext && ext !== ".html") {
|
|
65
|
+
const filename = path.basename(urlPath);
|
|
66
|
+
const assetPath = path.join(distPath, "assets", filename);
|
|
67
|
+
fs.stat(assetPath, (err2, stats2) => {
|
|
68
|
+
if (!err2 && stats2.isFile()) {
|
|
69
|
+
const contentType = getContentType(assetPath);
|
|
70
|
+
serveFile(res, assetPath, contentType);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const indexPath2 = path.join(distPath, "index.html");
|
|
74
|
+
serveFile(res, indexPath2, "text/html");
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const indexPath = path.join(distPath, "index.html");
|
|
79
|
+
serveFile(res, indexPath, "text/html");
|
|
66
80
|
});
|
|
67
81
|
});
|
|
68
82
|
server.on("error", (err) => {
|
|
@@ -70,9 +84,7 @@ server.on("error", (err) => {
|
|
|
70
84
|
process.exit(1);
|
|
71
85
|
});
|
|
72
86
|
server.listen(PORT, () => {
|
|
73
|
-
|
|
74
|
-
console.log(`Jean2 client running at ${url}`);
|
|
75
|
-
open(url);
|
|
87
|
+
console.log(`Jean2 client running at http://localhost:${PORT}`);
|
|
76
88
|
});
|
|
77
89
|
function shutdown() {
|
|
78
90
|
console.log("\nShutting down...");
|
package/dist/index.html
CHANGED
|
@@ -38,19 +38,19 @@
|
|
|
38
38
|
root.classList.add(mode, scheme);
|
|
39
39
|
})();
|
|
40
40
|
</script>
|
|
41
|
-
<script type="module" crossorigin src="./assets/index-
|
|
41
|
+
<script type="module" crossorigin src="./assets/index-Db3JxRbZ.js"></script>
|
|
42
42
|
<link rel="modulepreload" crossorigin href="./assets/classPrivateFieldGet2-BGlEuFdn.js">
|
|
43
43
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-DZXZ41-q.js">
|
|
44
44
|
<link rel="modulepreload" crossorigin href="./assets/useRouter-C67ywEA3.js">
|
|
45
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
46
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
47
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
48
|
-
<link rel="modulepreload" crossorigin href="./assets/mutation-
|
|
49
|
-
<link rel="modulepreload" crossorigin href="./assets/preload-helper-
|
|
45
|
+
<link rel="modulepreload" crossorigin href="./assets/src-BALdofIU.js">
|
|
46
|
+
<link rel="modulepreload" crossorigin href="./assets/ServerContext-Dy9T5Mj8.js">
|
|
47
|
+
<link rel="modulepreload" crossorigin href="./assets/platform-cRBZ7eSy.js">
|
|
48
|
+
<link rel="modulepreload" crossorigin href="./assets/mutation-D4xtepYQ.js">
|
|
49
|
+
<link rel="modulepreload" crossorigin href="./assets/preload-helper-D844vhe4.js">
|
|
50
50
|
<link rel="modulepreload" crossorigin href="./assets/useNavigate-Ckup4lZi.js">
|
|
51
51
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-DHWV5rS5.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="./assets/ThemeProvider-Da23NPAS.js">
|
|
53
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
53
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DzEyMPKG.css">
|
|
54
54
|
</head>
|
|
55
55
|
<body>
|
|
56
56
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t,r as n,t as r}from"./compiler-runtime-DZXZ41-q.js";var i=t(n(),1),a=i.use,o=typeof window<`u`?i.useLayoutEffect:i.useEffect;function s(e){let t=i.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function c(e,t,n={},r={}){i.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function l(e){let t=i.useRef(null);return i.useImperativeHandle(e,()=>t.current,[]),t}var u=r(),d={SERVERS:`jean2_servers`,QUICK_CONNECTIONS:`jean2_quick_connections`};function f(){try{let e=localStorage.getItem(d.SERVERS);return e?JSON.parse(e):[]}catch(e){return console.error(`Error reading saved servers from localStorage:`,e),[]}}function p(e){try{let t=f();t.push(e),localStorage.setItem(d.SERVERS,JSON.stringify(t))}catch(e){console.error(`Error saving server to localStorage:`,e)}}function m(e,t){try{let n=f(),r=n.findIndex(t=>t.id===e);if(r===-1){console.error(`Server not found:`,e);return}n[r]={...n[r],...t},localStorage.setItem(d.SERVERS,JSON.stringify(n))}catch(e){console.error(`Error updating server in localStorage:`,e)}}function h(e){try{let t=f().filter(t=>t.id!==e);localStorage.setItem(d.SERVERS,JSON.stringify(t));let n=g().filter(t=>t.serverId!==e);localStorage.setItem(d.QUICK_CONNECTIONS,JSON.stringify(n))}catch(e){console.error(`Error deleting server from localStorage:`,e)}}function g(){try{let e=localStorage.getItem(d.QUICK_CONNECTIONS);return e?JSON.parse(e):[]}catch(e){return console.error(`Error reading quick connections from localStorage:`,e),[]}}function _(e){let t=g(),n=t.reduce((e,t)=>Math.max(e,t.order),-1),r={...e,id:crypto.randomUUID(),order:n+1};t.push(r);try{localStorage.setItem(d.QUICK_CONNECTIONS,JSON.stringify(t))}catch(e){console.error(`Error saving quick connection to localStorage:`,e)}return r}function v(e){try{let t=g().filter(t=>t.id!==e);localStorage.setItem(d.QUICK_CONNECTIONS,JSON.stringify(t))}catch(e){console.error(`Error removing quick connection from localStorage:`,e)}}function y(e){try{let t=g().filter(t=>t.workspaceId!==e);localStorage.setItem(d.QUICK_CONNECTIONS,JSON.stringify(t))}catch(e){console.error(`Error removing quick connections for workspace from localStorage:`,e)}}function b(e){try{let t=g(),n=new Map(t.map(e=>[e.id,e]));e.forEach((e,t)=>{let r=n.get(e);r&&(r.order=t)}),localStorage.setItem(d.QUICK_CONNECTIONS,JSON.stringify(t))}catch(e){console.error(`Error reordering quick connections in localStorage:`,e)}}function x(e){return e.length<12?e:`${e.slice(0,4)}...${e.slice(-4)}`}function S(e){let t=e.trim(),n=/^https:\/\//i.test(t),r=t.replace(/^(https?:\/\/|wss?:\/\/)/i,``);return r=r.replace(/\/+$/,``),n&&(r=`https://${r}`),r}var C=e(),w=(0,i.createContext)(null),T=e=>{let t=(0,u.c)(18),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[a,o]=(0,i.useState)(r),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[1]=s):s=t[1];let[c,l]=(0,i.useState)(s),[d,x]=(0,i.useState)(!1),T,E;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{let e=f(),t=g();o(e),l(t),x(!0)},E=[],t[2]=T,t[3]=E):(T=t[2],E=t[3]),(0,i.useEffect)(T,E);let D;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(e,t,n)=>{let r=S(t),i={id:crypto.randomUUID(),name:e,url:r,...n?{token:n}:{},createdAt:new Date().toISOString()};return p(i),o(f()),i},t[4]=D):D=t[4];let O=D,k;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=(e,t)=>{m(e,{...t,...t.url&&{url:S(t.url)}}),o(f())},t[5]=k):k=t[5];let A=k,j;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{h(e),o(f()),l(g())},t[6]=j):j=t[6];let M=j,N;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(N=(e,t,n,r)=>{_({serverId:e,serverName:t,workspaceId:n,workspaceName:r}),l(g())},t[7]=N):N=t[7];let P=N,F;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{v(e),l(g())},t[8]=F):F=t[8];let I=F,L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{y(e),l(g())},t[9]=L):L=t[9];let R=L,z;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{b(e),l(g())},t[10]=z):z=t[10];let B=z,V;t[11]!==d||t[12]!==c||t[13]!==a?(V={servers:a,quickConnections:c,isHydrated:d,addServer:O,editServer:A,removeServer:M,addToQuickConnections:P,removeFromQuickConnections:I,removeFromQuickConnectionsByWorkspace:R,reorderQuick:B},t[11]=d,t[12]=c,t[13]=a,t[14]=V):V=t[14];let H=V,U;return t[15]!==n||t[16]!==H?(U=(0,C.jsx)(w.Provider,{value:H,children:n}),t[15]=n,t[16]=H,t[17]=U):U=t[17],U},E=()=>{let e=(0,i.useContext)(w);if(e===null)throw Error(`useServerContext must be used within a ServerProvider`);return e};export{f as a,c,S as i,o as l,E as n,a as o,x as r,l as s,T as t,s as u};
|