@puddle-code/cli 0.4.9 → 0.4.11
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/CHANGELOG.md +8 -47
- package/README.md +1 -1
- package/dist/host-control.mjs +13 -6
- package/dist/index.js +25 -9
- package/dist/public/assets/App-Btf7WD40.js +26 -0
- package/dist/public/assets/{CompilationCommandForm-CipGdjjH.js → CompilationCommandForm-DQjUhaHj.js} +1 -1
- package/dist/public/assets/Dashboard-CEjiJV52.js +1 -0
- package/dist/public/assets/EditorTabClose-CQnXn4Ha.js +1 -0
- package/dist/public/assets/FindWidget-Bh_7yWNg.js +1 -0
- package/dist/public/assets/LazyTerminal-Bw9C4Swp.js +2 -0
- package/dist/public/assets/{NotebookWidget-Bcavj7Lb.js → NotebookWidget-C25iz3Cj.js} +1 -1
- package/dist/public/assets/PaneEditorBody-BdoKPslR.js +284 -0
- package/dist/public/assets/{PdfViewer-Cr5306nr.js → PdfViewer-BH-FXEVV.js} +1 -1
- package/dist/public/assets/{ReleaseNotesDialog-CbFYKoYM.js → ReleaseNotesDialog-Pa1yagZd.js} +1 -1
- package/dist/public/assets/Ripple-DAeJ5ylo.css +1 -0
- package/dist/public/assets/Ripple-sD2osFo9.js +7 -0
- package/dist/public/assets/SettingsDialog-2WaxsH3h.js +8 -0
- package/dist/public/assets/Terminal-D8s2Y67v.js +65 -0
- package/dist/public/assets/Workspace-B8WZOpOl.js +20 -0
- package/dist/public/assets/{Workspace-Bf0VMnaa.css → Workspace-CuAYZ1-B.css} +1 -1
- package/dist/public/assets/{_virtual_notebook-widget-runtime-Dro422xS.js → _virtual_notebook-widget-runtime-CVsZLTbL.js} +88 -88
- package/dist/public/assets/{api-B90WKMKj.js → api-CULxlzTe.js} +1 -1
- package/dist/public/assets/archive-i9DnVa-v.js +1 -0
- package/dist/public/assets/arrow-down-CtYa-Aya.js +1 -0
- package/dist/public/assets/{auth-CdosKReE.js → auth-C3ruG3fE.js} +1 -1
- package/dist/public/assets/button-DtByPSFL.js +1 -0
- package/dist/public/assets/client-settings-BdKglwtW.js +1 -0
- package/dist/public/assets/command-CN8HRRWf.js +1 -0
- package/dist/public/assets/{context-CG70lLa4.js → context-D1MuDP6X.js} +1 -1
- package/dist/public/assets/desktop-Bl69_YmL.js +1 -0
- package/dist/public/assets/dialog-DtvE8ATK.js +41 -0
- package/dist/public/assets/{dist-Dge3wHdO.js → dist-BeQvHdsz.js} +1 -1
- package/dist/public/assets/dist-DZg8Dwbr.js +1 -0
- package/dist/public/assets/dist-KPX-s1ou.js +1 -0
- package/dist/public/assets/dist-a682-VMb.js +1 -0
- package/dist/public/assets/{errors-tuvbq1a_.js → errors-efDAjyqa.js} +1 -1
- package/dist/public/assets/expanding-content-DOZTeXd_.js +1 -0
- package/dist/public/assets/forward-link-CAXhnLYS.js +1 -0
- package/dist/public/assets/{index-Doe7MhnI.js → index-BuNmxuXx.js} +3 -3
- package/dist/public/assets/index-CHGSBAX2.css +2 -0
- package/dist/public/assets/link-buffer-CsjuZOHH.js +1 -0
- package/dist/public/assets/{markdown-CMSzQtLp.js → markdown-BlvTv1jG.js} +1 -1
- package/dist/public/assets/media-refresh-store-DCt4XZrY.js +1 -0
- package/dist/public/assets/motion-Bd_MB9cH.js +1 -0
- package/dist/public/assets/notification-delivery-BkhZwpcS.js +1 -0
- package/dist/public/assets/popover-4DSuF34m.js +1 -0
- package/dist/public/assets/preferences-CbkHsty9.js +1 -0
- package/dist/public/assets/{protocol-support-TSI4Ig6W.js → protocol-support-BwRR1kRO.js} +1 -1
- package/dist/public/assets/render-rich-content-DF6NaC_6.js +4 -0
- package/dist/public/assets/{scroll-restoration-6GVbekSz.js → scroll-restoration-wdDB8mmu.js} +1 -1
- package/dist/public/assets/select-D099Wd2u.js +1 -0
- package/dist/public/assets/session-order-s2zUuZaO.js +1 -0
- package/dist/public/assets/square-terminal-CIkfNq3I.js +1 -0
- package/dist/public/assets/switch-AY03lzhq.js +1 -0
- package/dist/public/assets/use-ui-state-BpnVbZPm.js +1 -0
- package/dist/public/assets/{view-state-store-DbQ7YOPe.js → view-state-store-DVvLMbeY.js} +1 -1
- package/dist/public/assets/waves-horizontal-CLDJf7Dd.js +1 -0
- package/dist/public/assets/whole-word-BJjKpISQ.js +1 -0
- package/dist/public/assets/ws-CS9chtfK.js +1 -0
- package/dist/public/assets/x-DV6-RYI2.js +1 -0
- package/dist/public/index.html +4 -4
- package/dist/pudl.js +13 -6
- package/package.json +1 -1
- package/dist/public/assets/App-UQXXCAJF.js +0 -65
- package/dist/public/assets/Dashboard-6pSi_1fH.js +0 -1
- package/dist/public/assets/EditorTabClose-TixDVxvl.js +0 -1
- package/dist/public/assets/FindWidget-DG1YP6Zx.js +0 -1
- package/dist/public/assets/LazyTerminal-B88WIvyh.js +0 -2
- package/dist/public/assets/NewProjectDialog-C1TVzOvJ.js +0 -1
- package/dist/public/assets/PaneEditorBody-DRA4WG0A.js +0 -284
- package/dist/public/assets/SettingsDialog-BvaE3Ue8.js +0 -8
- package/dist/public/assets/Terminal-Bo8hyZj7.js +0 -67
- package/dist/public/assets/Workspace-Bf2zQC6v.js +0 -20
- package/dist/public/assets/button-C_Rvtcwg.js +0 -1
- package/dist/public/assets/chevron-right-BEy-IXEZ.js +0 -1
- package/dist/public/assets/client-settings-DhfHheKR.js +0 -1
- package/dist/public/assets/command-BV8ZEhQz.js +0 -1
- package/dist/public/assets/context-menu-D3ZhKA9s.js +0 -1
- package/dist/public/assets/dialog-D-Axqpzg.js +0 -41
- package/dist/public/assets/dist-BmSuHjIq.js +0 -1
- package/dist/public/assets/dist-Cq-O0n8n.js +0 -1
- package/dist/public/assets/forward-link-BspnTVuc.js +0 -1
- package/dist/public/assets/index-4XrK4Fes.css +0 -2
- package/dist/public/assets/media-refresh-store-CiyvSvEu.js +0 -1
- package/dist/public/assets/motion-OSLfKoC0.js +0 -1
- package/dist/public/assets/notification-delivery-CegOQxcZ.js +0 -1
- package/dist/public/assets/popover-D-jcaKGN.js +0 -1
- package/dist/public/assets/select-p5KTVHbg.js +0 -1
- package/dist/public/assets/selection-actions-CvYaucrm.js +0 -1
- package/dist/public/assets/session-order-CiDVvIU5.js +0 -1
- package/dist/public/assets/switch-oBD5uCTu.js +0 -1
- package/dist/public/assets/use-ui-state-D4FsRK2R.js +0 -1
- package/dist/public/assets/ws-Cp1eCJaM.js +0 -1
- package/dist/public/assets/x-Dq6POV20.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./auth-CdosKReE.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{n as r}from"./api-B90WKMKj.js";var i={major:26,minor:3};function a(e,t,n=i){return e?.major===n.major&&(e.major>t.major||e.major===t.major&&e.minor>=t.minor)}var o=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},s=new class extends o{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l=new class{#e=c;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function u(e){setTimeout(e,0)}var d=typeof window>`u`||`Deno`in globalThis;function f(){}function p(e,t){return typeof e==`function`?e(t):e}function m(e){return typeof e==`number`&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){return typeof e==`function`?e(t):e}function v(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==b(o,t.options))return!1}else if(!S(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function y(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(x(t.options.mutationKey)!==x(a))return!1}else if(!S(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function b(e,t){return(t?.queryKeyHashFn||x)(e)}function x(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function S(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>S(e[n],t[n])):!1}var ee=Object.prototype.hasOwnProperty;function C(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=C(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function ne(e){return new Promise(t=>{l.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:C(e,t)}function re(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=Symbol();function ae(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function k(e,t){return typeof e==`function`?e(...t):!!e}function oe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var A=(()=>{let e=()=>d;return{isServer(){return e()},setIsServer(t){e=t}}})();function j(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var se=u;function ce(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=se,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var M=ce(),N=new class extends o{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function le(e){return Math.min(1e3*2**e,3e4)}function P(e){return(e??`online`)!==`online`||N.isOnline()}var F=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function I(e){let t=!1,n=0,r,i=j(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new F(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>s.isFocused()&&(e.networkMode===`always`||N.isOnline())&&e.canRun(),d=()=>P(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(A.isServer()?0:3),o=e.retryDelay??le,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ne(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var L=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#e=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(A.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(l.clearTimeout(this.#e),this.#e=void 0)}};function ue(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{oe(e,()=>t.signal,()=>n=!0)},u=ae(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ie:re;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?z:R,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:R(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function R(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function z(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function de(e,t){return t?R(e,t)!=null:!1}function fe(e,t){return!t||!e.getPreviousPageParam?!1:z(e,t)!=null}var pe=class extends L{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ge(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ge(this.options);e.data!==void 0&&(this.setState(he(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(f).catch(f):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>_(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>g(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!h(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ae(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ue(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=I({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof F&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof F){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...me(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...he(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),M.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function me(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:P(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function he(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ge(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var _e=class extends o{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=j(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ye(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return B(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return B(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof _(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&V(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||_(this.options.enabled,this.#t)!==_(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||_(this.options.enabled,this.#t)!==_(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return be(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(A.isServer()||this.#r.isStale||!m(e))return;let t=h(this.#r.dataUpdatedAt,e)+1;this.#d=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(A.isServer()||_(this.options.enabled,this.#t)===!1||!m(this.#p)||this.#p===0)&&(this.#f=l.setInterval(()=>{(this.options.refetchIntervalInBackground||s.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(l.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(l.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ye(e,t),o=i&&V(e,n,t,r);(a||o)&&(l={...l,...me(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&g,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:H(e,t),refetch:this.refetch,promise:this.#o,isEnabled:_(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=j();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!w(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){M.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ve(e,t){return _(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&_(t.retryOnMount,e)===!1)}function ye(e,t){return ve(e,t)||e.state.data!==void 0&&B(e,t,t.refetchOnMount)}function B(e,t,n){if(_(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&H(e,t)}return!1}function V(e,t,n,r){return(e!==t||_(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&H(e,n)}function H(e,t){return _(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function be(e,t){return!w(e.getCurrentResult(),t)}var xe=class extends L{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||U(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=I({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),M.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function U(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Se=class extends o{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),w(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&x(t.mutationKey)!==x(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??U();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){M.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},W=e(t(),1),Ce=n(),G=W.createContext(void 0),K=e=>{let t=W.useContext(G);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},we=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Ce.jsx)(G.Provider,{value:e,children:t})),q=W.createContext(!1),Te=()=>W.useContext(q);q.Provider;function Ee(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var De=W.createContext(Ee()),Oe=()=>W.useContext(De),ke=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?k(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ae=e=>{W.useEffect(()=>{e.clearReset()},[e])},je=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||k(n,[e.error,r])),Me=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ne=(e,t)=>e.isLoading&&e.isFetching&&!t,Pe=(e,t)=>e?.suspense&&t.isPending,Fe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ie(e,t,n){let r=Te(),i=Oe(),a=K(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Me(o),ke(o,i,s),Ae(i);let l=!a.getQueryCache().get(o.queryHash),[u]=W.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),p=!r&&c;if(W.useSyncExternalStore(W.useCallback(e=>{let t=p?u.subscribe(M.batchCalls(e)):f;return u.updateResult(),t},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),W.useEffect(()=>{u.setOptions(o)},[o,u]),Pe(o,d))throw Fe(o,u,i);if(je({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!A.isServer()&&Ne(d,r)&&(l?Fe(o,u,i):s?.promise)?.catch(f).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function J(e,t){return Ie(e,_e,t)}function Y(e,t){let n=K(t),[r]=W.useState(()=>new Se(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(M.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((e,t)=>{r.mutate(e,t).catch(f)},[r]);if(i.error&&k(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Le=12,X=typeof document<`u`?document.hasFocus():!0;typeof window<`u`&&(window.addEventListener(`focus`,()=>{X=!0}),window.addEventListener(`blur`,()=>{X=!1}),s.setEventListener(e=>{let t=()=>e(void 0);return window.addEventListener(`visibilitychange`,t,!1),window.addEventListener(`focus`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t),window.removeEventListener(`focus`,t)}}));function Z(e){return()=>X?e:e*Le}function Re(){return J({queryKey:[`profiles`],queryFn:()=>r(`GET`,`/api/profiles`)})}function ze(e){return J({queryKey:[`profile-settings`,e],queryFn:()=>r(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function Be(e){return J({queryKey:[`accounts`,e],queryFn:()=>r(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function Ve(e){return J({queryKey:[`account-usage`,e],queryFn:()=>r(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function He(){return J({queryKey:[`repos`],queryFn:()=>r(`GET`,`/api/repos`)})}function Ue(e,t=!0){return J({queryKey:[`projects`,e??`all`],queryFn:()=>r(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`),enabled:t})}function We(e){return J({queryKey:[`project`,e],queryFn:()=>r(`GET`,`/api/projects/${e}`),enabled:e!==void 0,placeholderData:e=>e})}function Ge(e){return r(`POST`,`/api/projects/${e}/conversations/refresh`)}function Ke(e){return J({queryKey:[`sessions`,e],queryFn:()=>r(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var qe={queryKey:[`sessions`,`all`],queryFn:()=>r(`GET`,`/api/sessions`)};function Je(e=!0){return J({...qe,enabled:e})}function Ye(e){return e.fetchQuery({...qe,staleTime:0})}function Xe(){return J({queryKey:[`config`],queryFn:()=>r(`GET`,`/api/config`)})}function Ze(e){return J({queryKey:[`repo-branches`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function Qe(e,t=1e4){return J({queryKey:[`repo-worktrees`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:t})}function $e(e,t){let n=K();return Y({mutationFn:t=>r(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function et(e,t){let n=K();return Y({mutationFn:({name:t,confirm:n})=>{let i=new URLSearchParams({name:t});return n&&i.set(`confirm`,`1`),r(`DELETE`,`/api/repos/${e}/branches?${i.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function tt(e){return J({queryKey:[`fs-dirs`,e],queryFn:()=>r(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function nt(){return J({queryKey:[`version`],queryFn:()=>r(`GET`,`/api/version`),staleTime:1/0})}function rt(){return J({queryKey:[`host`],queryFn:()=>r(`GET`,`/api/host`),staleTime:1/0})}function it(e){return e?e.displayName||e.hostname:void 0}function at(){return J({queryKey:[`agents`],queryFn:()=>r(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function ot(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function st(e){let t=K();return Y({mutationFn:t=>r(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function ct(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function lt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function ut(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function dt(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function ft(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function pt(){return Y({mutationFn:e=>r(`POST`,`/api/accounts/${e}/login`)})}function mt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function ht(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function gt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function _t(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function vt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/projects/${e}`,t),onSuccess:t=>{e.setQueryData([`project`,t.id],e=>e&&{...e,project:t}),e.invalidateQueries({queryKey:[`projects`]})}})}function yt(e,t){return J({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>r(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function bt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function xt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function St(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Ct(e,t){return J({queryKey:[`layouts`,e,t??`none`],queryFn:()=>r(`GET`,`/api/layouts?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function wt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/layouts`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Tt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/layouts/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Et(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/layouts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Q(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function Dt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions`,e),onSuccess:t=>Q(e,t)})}function Ot(e){let t=K();return Y({mutationFn:t=>r(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>Q(t,e)})}function kt(){let e=K();return Y({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>Q(e,t)})}function At(){let e=K();return Y({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{Q(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function jt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>Q(e,t)})}function Mt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>Q(e,t)})}function Nt(){let e=K();return Y({mutationFn:({sessionId:e,title:t})=>r(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>Q(e,t)})}function Pt(){let e=K();return Y({mutationFn:e=>r(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function Ft(e){try{return await r(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function It(e,t){return r(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function Lt(e,t){return J({queryKey:[`ports`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:Z(5e3),refetchIntervalInBackground:!1})}function Rt(e,t){return J({queryKey:[`session-env`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:Z(5e3),refetchIntervalInBackground:!1})}function zt(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var Bt=e=>a(e,{major:25,minor:15});function $(e,t,n){return!e||e.major>t||e.major===t&&e.minor>=n}var Vt=e=>e!==void 0&&$(e,21,3),Ht=e=>e!==void 0&&$(e,24,5);function Ut(e){return $(e,17,1)}function Wt(e){return $(e,17,3)}var Gt=e=>e!==void 0&&$(e,24,4),Kt=e=>$(e,10,3),qt=e=>$(e,12,3),Jt=e=>$(e,12,4),Yt=e=>$(e,15,3),Xt=e=>e!==void 0&&$(e,16,3),Zt=e=>$(e,16,4),Qt=e=>$(e,14,1),$t=e=>e!==void 0&&$(e,24,6),en=e=>e!==void 0&&$(e,25,1),tn=e=>e!==void 0&&$(e,25,2),nn=e=>e!==void 0&&$(e,25,3),rn=e=>e!==void 0&&$(e,25,4),an=e=>e!==void 0&&$(e,26,3);export{Pt as $,zt as A,de as At,dt as B,S as Bt,It as C,J as Ct,at as D,xe as Dt,Be as E,K as Et,_t as F,x as Ft,tt as G,o as Gt,Et as H,g as Ht,mt as I,b as It,rt as J,gt as K,a as Kt,bt as L,y as Lt,ft as M,N as Mt,wt as N,M as Nt,Je as O,_e as Ot,ot as P,p as Pt,lt as Q,Dt as R,v as Rt,it as S,Y as St,Ve as T,we as Tt,ut as U,O as Ut,et as V,C as Vt,St as W,s as Wt,pt as X,Ct as Y,kt as Z,Bt as _,Rt as _t,Xt as a,xt as at,Ye as b,Mt as bt,Vt as c,We as ct,tn as d,Nt as dt,Tt as et,nn as f,Ze as ft,Ht as g,Ot as gt,rn as h,yt as ht,Ut as i,ht as it,Xe as j,fe as jt,jt as k,pe as kt,Zt as l,Ue as lt,an as m,He as mt,Gt as n,st as nt,Qt as o,ze as ot,$t as p,Qe as pt,At as q,Wt as r,vt as rt,Jt as s,Re as st,qt as t,ct as tt,en as u,$e as ut,Yt as v,Lt as vt,Ge as w,Ie as wt,Ft as x,Z as xt,Kt as y,Ke as yt,nt as z,f as zt};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./auth-C3ruG3fE.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{n as r}from"./api-CULxlzTe.js";var i={major:26,minor:6};function a(e,t,n=i){return e?.major===n.major&&(e.major>t.major||e.major===t.major&&e.minor>=t.minor)}var o=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},s=new class extends o{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},c={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},l=new class{#e=c;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function u(e){setTimeout(e,0)}var d=typeof window>`u`||`Deno`in globalThis;function f(){}function p(e,t){return typeof e==`function`?e(t):e}function m(e){return typeof e==`number`&&e>=0&&e!==1/0}function h(e,t){return Math.max(e+(t||0)-Date.now(),0)}function g(e,t){return typeof e==`function`?e(t):e}function _(e,t){return typeof e==`function`?e(t):e}function v(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==b(o,t.options))return!1}else if(!S(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function y(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(x(t.options.mutationKey)!==x(a))return!1}else if(!S(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function b(e,t){return(t?.queryKeyHashFn||x)(e)}function x(e){return JSON.stringify(e,(e,t)=>T(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function S(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>S(e[n],t[n])):!1}var ee=Object.prototype.hasOwnProperty;function C(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(T(e)&&T(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=C(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function w(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function T(e){if(!E(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!E(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function E(e){return Object.prototype.toString.call(e)===`[object Object]`}function ne(e){return new Promise(t=>{l.setTimeout(t,e)})}function D(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:C(e,t)}function re(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var O=Symbol();function ae(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===O?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function k(e,t){return typeof e==`function`?e(...t):!!e}function oe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var A=(()=>{let e=()=>d;return{isServer(){return e()},setIsServer(t){e=t}}})();function j(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var se=u;function ce(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=se,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var M=ce(),N=new class extends o{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function le(e){return Math.min(1e3*2**e,3e4)}function P(e){return(e??`online`)!==`online`||N.isOnline()}var F=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function I(e){let t=!1,n=0,r,i=j(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new F(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>s.isFocused()&&(e.networkMode===`always`||N.isOnline())&&e.canRun(),d=()=>P(e.networkMode)&&e.canRun(),f=e=>{a()||(r?.(),i.resolve(e))},p=e=>{a()||(r?.(),i.reject(e))},m=()=>new Promise(t=>{r=e=>{(a()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),h=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(a())return;let i=e.retry??(A.isServer()?0:3),o=e.retryDelay??le,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ne(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),i)}}var L=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#e=l.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(A.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(l.clearTimeout(this.#e),this.#e=void 0)}};function ue(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{oe(e,()=>t.signal,()=>n=!0)},u=ae(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ie:re;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?z:R,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:R(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function R(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function z(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function de(e,t){return t?R(e,t)!=null:!1}function fe(e,t){return!t||!e.getPreviousPageParam?!1:z(e,t)!=null}var pe=class extends L{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ge(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=ge(this.options);e.data!==void 0&&(this.setState(he(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=D(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(f).catch(f):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>_(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===O||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>g(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!h(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ae(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?ue(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=I({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof F&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof F){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...me(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...he(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),M.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function me(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:P(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function he(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function ge(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var _e=class extends o{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=j(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ye(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return B(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return B(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof _(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!w(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&V(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||_(this.options.enabled,this.#t)!==_(t.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||_(this.options.enabled,this.#t)!==_(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return be(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(f)),t}#g(){this.#b();let e=g(this.options.staleTime,this.#t);if(A.isServer()||this.#r.isStale||!m(e))return;let t=h(this.#r.dataUpdatedAt,e)+1;this.#d=l.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(A.isServer()||_(this.options.enabled,this.#t)===!1||!m(this.#p)||this.#p===0)&&(this.#f=l.setInterval(()=>{(this.options.refetchIntervalInBackground||s.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(l.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(l.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ye(e,t),o=i&&V(e,n,t,r);(a||o)&&(l={...l,...me(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=D(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=D(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,v=m===`pending`,y=m===`error`,b=v&&g,x=d!==void 0,S={status:m,fetchStatus:l.fetchStatus,isPending:v,isSuccess:m===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:H(e,t),refetch:this.refetch,promise:this.#o,isEnabled:_(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{let e=this.#o=S.promise=j();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!w(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){M.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function ve(e,t){return _(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&_(t.retryOnMount,e)===!1)}function ye(e,t){return ve(e,t)||e.state.data!==void 0&&B(e,t,t.refetchOnMount)}function B(e,t,n){if(_(t.enabled,e)!==!1&&g(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&H(e,t)}return!1}function V(e,t,n,r){return(e!==t||_(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&H(e,n)}function H(e,t){return _(t.enabled,e)!==!1&&e.isStaleByTime(g(t.staleTime,e))}function be(e,t){return!w(e.getCurrentResult(),t)}var xe=class extends L{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||U(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=I({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),M.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function U(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Se=class extends o{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),w(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&x(t.mutationKey)!==x(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??U();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){M.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},W=e(t(),1),Ce=n(),G=W.createContext(void 0),K=e=>{let t=W.useContext(G);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},we=({client:e,children:t})=>(W.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,Ce.jsx)(G.Provider,{value:e,children:t})),q=W.createContext(!1),Te=()=>W.useContext(q);q.Provider;function Ee(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var De=W.createContext(Ee()),Oe=()=>W.useContext(De),ke=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?k(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Ae=e=>{W.useEffect(()=>{e.clearReset()},[e])},je=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||k(n,[e.error,r])),Me=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ne=(e,t)=>e.isLoading&&e.isFetching&&!t,Pe=(e,t)=>e?.suspense&&t.isPending,Fe=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ie(e,t,n){let r=Te(),i=Oe(),a=K(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Me(o),ke(o,i,s),Ae(i);let l=!a.getQueryCache().get(o.queryHash),[u]=W.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),p=!r&&c;if(W.useSyncExternalStore(W.useCallback(e=>{let t=p?u.subscribe(M.batchCalls(e)):f;return u.updateResult(),t},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),W.useEffect(()=>{u.setOptions(o)},[o,u]),Pe(o,d))throw Fe(o,u,i);if(je({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!A.isServer()&&Ne(d,r)&&(l?Fe(o,u,i):s?.promise)?.catch(f).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function J(e,t){return Ie(e,_e,t)}function Y(e,t){let n=K(t),[r]=W.useState(()=>new Se(n,e));W.useEffect(()=>{r.setOptions(e)},[r,e]);let i=W.useSyncExternalStore(W.useCallback(e=>r.subscribe(M.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=W.useCallback((e,t)=>{r.mutate(e,t).catch(f)},[r]);if(i.error&&k(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var Le=12,X=typeof document<`u`?document.hasFocus():!0;typeof window<`u`&&(window.addEventListener(`focus`,()=>{X=!0}),window.addEventListener(`blur`,()=>{X=!1}),s.setEventListener(e=>{let t=()=>e(void 0);return window.addEventListener(`visibilitychange`,t,!1),window.addEventListener(`focus`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t),window.removeEventListener(`focus`,t)}}));function Z(e){return()=>X?e:e*Le}function Re(){return J({queryKey:[`profiles`],queryFn:()=>r(`GET`,`/api/profiles`)})}function ze(e){return J({queryKey:[`profile-settings`,e],queryFn:()=>r(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function Be(e){return J({queryKey:[`accounts`,e],queryFn:()=>r(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function Ve(e){return J({queryKey:[`account-usage`,e],queryFn:()=>r(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function He(){return J({queryKey:[`repos`],queryFn:()=>r(`GET`,`/api/repos`)})}function Ue(e,t=!0){return J({queryKey:[`projects`,e??`all`],queryFn:()=>r(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`),enabled:t})}function We(e){return J({queryKey:[`project`,e],queryFn:()=>r(`GET`,`/api/projects/${e}`),enabled:e!==void 0,placeholderData:e=>e})}function Ge(e){return r(`POST`,`/api/projects/${e}/conversations/refresh`)}function Ke(e){return J({queryKey:[`sessions`,e],queryFn:()=>r(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}var qe={queryKey:[`sessions`,`all`],queryFn:()=>r(`GET`,`/api/sessions`)};function Je(e=!0){return J({...qe,enabled:e})}function Ye(e){return e.fetchQuery({...qe,staleTime:0})}function Xe(){return J({queryKey:[`config`],queryFn:()=>r(`GET`,`/api/config`)})}function Ze(e){return J({queryKey:[`repo-branches`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function Qe(e,t=1e4){return J({queryKey:[`repo-worktrees`,e],queryFn:()=>r(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:t})}function $e(e,t){let n=K();return Y({mutationFn:t=>r(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function et(e,t){let n=K();return Y({mutationFn:({name:t,confirm:n})=>{let i=new URLSearchParams({name:t});return n&&i.set(`confirm`,`1`),r(`DELETE`,`/api/repos/${e}/branches?${i.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function tt(e){return J({queryKey:[`fs-dirs`,e],queryFn:()=>r(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function nt(){return J({queryKey:[`version`],queryFn:()=>r(`GET`,`/api/version`),staleTime:1/0})}function rt(){return J({queryKey:[`host`],queryFn:()=>r(`GET`,`/api/host`),staleTime:1/0})}function it(e){return e?e.displayName||e.hostname:void 0}function at(){return J({queryKey:[`agents`],queryFn:()=>r(`GET`,`/api/agents`),staleTime:3e4,refetchOnWindowFocus:!0})}function ot(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function st(e){let t=K();return Y({mutationFn:t=>r(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function ct(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function lt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function ut(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function dt(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function ft(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function pt(){return Y({mutationFn:e=>r(`POST`,`/api/accounts/${e}/login`)})}function mt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function ht(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function gt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function _t(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function vt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/projects/${e}`,t),onSuccess:t=>{e.setQueryData([`project`,t.id],e=>e&&{...e,project:t}),e.invalidateQueries({queryKey:[`projects`]})}})}function yt(e,t){return J({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>r(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function bt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function xt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function St(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Ct(e,t){return J({queryKey:[`layouts`,e,t??`none`],queryFn:()=>r(`GET`,`/api/layouts?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function wt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/layouts`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Tt(){let e=K();return Y({mutationFn:({id:e,...t})=>r(`PATCH`,`/api/layouts/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Et(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/layouts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`layouts`]})})}function Q(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function Dt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions`,e),onSuccess:t=>Q(e,t)})}function Ot(e){let t=K();return Y({mutationFn:t=>r(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>Q(t,e)})}function kt(){let e=K();return Y({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>Q(e,t)})}function At(){let e=K();return Y({mutationFn:({sessionId:e,accountId:t})=>r(`POST`,`/api/sessions/${e}/handoff`,{account_id:t}),onSuccess:(t,{sessionId:n})=>{Q(e,t),e.invalidateQueries({queryKey:[`session`,n]})}})}function jt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>Q(e,t)})}function Mt(){let e=K();return Y({mutationFn:e=>r(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>Q(e,t)})}function Nt(){let e=K();return Y({mutationFn:({sessionId:e,title:t})=>r(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>Q(e,t)})}function Pt(){let e=K();return Y({mutationFn:e=>r(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function Ft(e){try{return await r(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function It(e,t){return r(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function Lt(e,t){return J({queryKey:[`ports`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:Z(5e3),refetchIntervalInBackground:!1})}function Rt(e,t){return J({queryKey:[`session-env`,e],queryFn:()=>r(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:Z(5e3),refetchIntervalInBackground:!1})}function zt(){let e=K();return Y({mutationFn:e=>r(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var Bt=e=>a(e,{major:25,minor:15});function $(e,t,n){return!e||e.major>t||e.major===t&&e.minor>=n}var Vt=e=>e!==void 0&&$(e,21,3),Ht=e=>e!==void 0&&$(e,24,5);function Ut(e){return $(e,17,1)}function Wt(e){return $(e,17,3)}var Gt=e=>e!==void 0&&$(e,24,4),Kt=e=>$(e,10,3),qt=e=>$(e,12,3),Jt=e=>$(e,12,4),Yt=e=>$(e,15,3),Xt=e=>e!==void 0&&$(e,16,3),Zt=e=>$(e,16,4),Qt=e=>$(e,14,1),$t=e=>e!==void 0&&$(e,24,6),en=e=>e!==void 0&&$(e,25,1),tn=e=>e!==void 0&&$(e,25,2),nn=e=>e!==void 0&&$(e,25,3),rn=e=>e!==void 0&&$(e,25,4),an=e=>e!==void 0&&$(e,26,3),on=e=>a(e,{major:26,minor:4}),sn=e=>a(e,{major:26,minor:5}),cn=e=>a(e,{major:26,minor:6});export{pt as $,at as A,xe as At,bt as B,y as Bt,Ye as C,Mt as Ct,Ge as D,Ie as Dt,It as E,J as Et,ft as F,N as Ft,Et as G,g as Gt,nt as H,f as Ht,wt as I,M as It,tt as J,o as Jt,ut as K,O as Kt,ot as L,p as Lt,jt as M,pe as Mt,zt as N,de as Nt,Ve as O,we as Ot,Xe as P,fe as Pt,Ct as Q,_t as R,x as Rt,Kt as S,Ke as St,it as T,Y as Tt,dt as U,S as Ut,Dt as V,v as Vt,et as W,C as Wt,At as X,gt as Y,a as Yt,rt as Z,an as _,He as _t,Xt as a,st as at,Bt as b,Rt as bt,Qt as c,xt as ct,on as d,We as dt,kt as et,Zt as f,Ue as ft,$t as g,Qe as gt,nn as h,Ze as ht,Ut as i,ct as it,Je as j,_e as jt,Be as k,K as kt,Jt as l,ze as lt,tn as m,Nt as mt,Gt as n,Pt as nt,sn as o,vt as ot,en as p,$e as pt,St as q,s as qt,Wt as r,Tt as rt,cn as s,ht as st,qt as t,lt as tt,Vt as u,Re as ut,rn as v,yt as vt,Ft as w,Z as wt,Yt as x,Lt as xt,Ht as y,Ot as yt,mt as z,b as zt};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-mermaid-TizVRNLQ.js","assets/rolldown-runtime-QTnfLwEv.js","assets/theme-swfNLod9.js","assets/preload-helper-Czpn1I53.js","assets/math-CSw6sgCC.js","assets/math-delimiters-BCnTi7Ii.js","assets/purify.es-D8QhFVkO.js","assets/katex.min-ZqdHjttS.js","assets/katex-Dz-67XSV.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-Czpn1I53.js";import{r as t}from"./math-delimiters-BCnTi7Ii.js";import{n}from"./link-buffer-CsjuZOHH.js";var r=new Set([`localhost`,`127.0.0.1`,`::1`,`[::1]`]);function i(e,t,n){if(!n)return e;let i;try{i=new URL(e)}catch{return e}return i.protocol!==`http:`&&i.protocol!==`https:`||!r.has(i.hostname)?e:`/forward/${t}/${i.port===``?i.protocol===`https:`?`443`:`80`:i.port}?path=${encodeURIComponent(i.pathname+i.search+i.hash)}`}var a=128,o=32768,s=32,c=/^\s*(`{3,}|~{3,})(.*)$/,l=/^\s*(?:flowchart|graph)\s+(?:TB|TD|BT|RL|LR)\s*;?\s*$/,u=/^\s*sequenceDiagram\s*$/;function d(e,t){let n=e.trim();return n===``||/^(?:%%|end\b)/.test(n)?!0:t?/^(?:participant|actor|create|destroy|activate|deactivate|note|loop|alt|else|opt|par|and|critical|option|break|rect|autonumber)\b/i.test(n)||/^\S+\s*(?:--?|<<-)[<>x)+-]*>/.test(n):/^(?:subgraph|direction|style|classDef|class|linkStyle)\b/.test(n)||/^[\w-]+\s*(?:\[|\(|\{|>|@\{|<*[-=.]+[->ox| ])/.test(n)}function f(e,r,i,f){if(r<1||f<1)return[];let p=Math.min(a,Math.max(0,Math.floor((o/(r+1)-f)/2))),m=Math.max(0,i-p),h=Math.min(e.length,i+f+p),g=[],_=0;for(let t=m;t<h;t++){let i=n(e,t,r);if(!i)break;let a=e.getLine(t+1)?.isWrapped?i.text.length:i.text.trimEnd().length;if(_+=a+1,_>o)break;let s=g.at(-1);i.isWrapped&&s?(s.text+=i.text.slice(0,a),s.cells.push(...i.cells.slice(0,a))):g.push({text:i.text.slice(0,a),cells:i.cells.slice(0,a)})}let v=[],y=(t,n,r,a)=>{let o=a[0],c=a.at(-1);if(!o||!c||!n.trim()||v.length>=s||c.row<i||o.row>=i+f)return;let l=e.getLine(c.row)?.getCell(c.col)?.getWidth()??1;v.push({kind:t,source:n.trim(),display:r,start:o,end:{row:c.row,col:c.col+Math.max(1,l)-1}})};for(let e=0;e<g.length&&v.length<s;e++){let n=g[e],r=c.exec(n.text);if(r){let t=e+1;for(;t<g.length;){let e=c.exec(g[t].text);if(e&&!e[2].trim()&&e[1][0]===r[1][0]&&e[1].length>=r[1].length)break;t++}if(t===g.length)break;let n=r[2].trim().split(/\s+/)[0].toLowerCase();if([`mermaid`,`math`,`latex`,`tex`].includes(n)){let r=g.slice(e+1,t).map(e=>e.text).join(`
|
|
3
|
+
`);y(n===`mermaid`?`mermaid`:`math`,r,!0,g.slice(e,t+1).flatMap(e=>e.cells))}e=t;continue}let i=u.test(n.text);if(l.test(n.text)||i){let t=e+1;for(;t<g.length&&d(g[t].text,i);)t++;for(;t>e+1&&!g[t-1].text.trim();)t--;if(t>e+1){let n=g.slice(e,t);y(`mermaid`,n.map(e=>e.text).join(`
|
|
4
|
+
`),!0,n.flatMap(e=>e.cells)),e=t-1;continue}}let a=n.text.trim();if(a.startsWith(`$$`)||a.startsWith(`\\[`)){let n=a,r=e,i=t(n);for(;!i&&r+1<g.length&&(n+=`\n${g[++r].text.trim()}`,i=t(n),!/\n\s*\n/.test(n)););if(i?.display&&i.length===n.length){y(`math`,i.tex,!0,g.slice(e,r+1).flatMap(e=>e.cells)),e=r;continue}if(a===`$$`||a===`\\[`)continue}for(let e=0;e<n.text.length;e++){if(n.text[e]==="`"){let t=/^`+/.exec(n.text.slice(e))[0],r=n.text.indexOf(t,e+t.length);if(r<0)break;e=r+t.length-1;continue}let r=t(n.text,e);if(r){let t=n.cells.slice(e,e+r.length);(t[0]?.row===t.at(-1)?.row||n.text.trim()===n.text.slice(e,e+r.length))&&y(`math`,r.tex,r.display,t),e+=r.length-1}else n.text[e]===`\\`&&e++}}return v}async function p(t,n,r,i,a=!1){if(n.kind===`mermaid`){let{renderMermaidDiagrams:o}=await e(async()=>{let{renderMermaidDiagrams:e}=await import(`./markdown-mermaid-TizVRNLQ.js`).then(e=>e.t);return{renderMermaidDiagrams:e}},__vite__mapDeps([0,1,2,3]));if(i.aborted)return;let s=document.createElement(`div`);if(s.setAttribute(`data-puddle-mermaid`,``),s.textContent=n.source,t.replaceChildren(s),await o(t,r,i,a),!i.aborted&&!s.querySelector(`svg`))throw Error(`Unable to render Mermaid diagram`)}else{let[{renderMathHtml:r},{default:a}]=await Promise.all([e(()=>import(`./math-CSw6sgCC.js`).then(e=>e.n),__vite__mapDeps([4,1,5])),e(()=>import(`./purify.es-D8QhFVkO.js`).then(e=>e.n),__vite__mapDeps([6,1])),e(()=>import(`./katex.min-ZqdHjttS.js`).then(e=>e.t),__vite__mapDeps([7,1,8]))]);if(i.aborted)return;if(t.innerHTML=a.sanitize(r(n.source,n.display)),t.querySelector(`.katex-error`))throw Error(`Unable to render LaTeX`)}}export{f as n,i as r,p as t};
|
package/dist/public/assets/{scroll-restoration-6GVbekSz.js → scroll-restoration-wdDB8mmu.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./view-state-store-
|
|
1
|
+
import{t as e}from"./view-state-store-DVvLMbeY.js";var t=new e;function n(e,n,r,i=()=>!0){let a=t.get(r),o=-1,s=-1,c=()=>({height:Math.max(0,e.scrollHeight-e.clientHeight),width:Math.max(0,e.scrollWidth-e.clientWidth)}),l=()=>{!i()||!e.clientHeight||!e.clientWidth||({height:o,width:s}=c(),a&&(e.scrollTop=a.height?a.top/a.height*o:0,e.scrollLeft=a.width?a.left/a.width*s:0))},u=()=>{if(!i()||!e.clientHeight||!e.clientWidth)return;let n=c();({height:o,width:s}=n),a={top:e.scrollTop,left:e.scrollLeft,...n},t.set(r,a)},d=()=>{if(!i()||!e.clientHeight||!e.clientWidth)return;let t=c();if(t.height!==o||t.width!==s){l();return}u()};l(),e.addEventListener(`scroll`,d,{passive:!0});let f=new ResizeObserver(l);f.observe(e),f.observe(n);let p=new MutationObserver(l);return p.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-scroll-ready`]}),{capture:u,dispose:()=>{d(),e.removeEventListener(`scroll`,d),f.disconnect(),p.disconnect()}}}export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{n as i,t as a}from"./createLucideIcon-C9A1vLE-.js";import{C as o,E as s,S as c,T as l,_ as u,b as d,f,g as p,h as m,m as h,p as g,v as _,x as v,y}from"./dialog-DtvE8ATK.js";import{a as b,n as x}from"./dist-DZg8Dwbr.js";import{_ as S,b as C,c as w,d as T,f as E,g as D,n as O,t as k,u as A,v as j,y as ee}from"./dist-a682-VMb.js";import{a as te,t as M}from"./dist-BeQvHdsz.js";import{t as N}from"./chevron-down-HQLVE6o5.js";var P=a(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),F=e(t(),1),I=e(n(),1);function L(e,[t,n]){return Math.min(n,Math.max(t,e))}var R=r(),z=[` `,`Enter`,`ArrowUp`,`ArrowDown`],B=[` `,`Enter`],V=`Select`,[H,U,ne]=O(V),[W,re]=l(V,[ne,C]),G=C(),[ie,K]=W(V),[ae,oe]=W(V),se=`SelectProvider`;function ce(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:m,form:h,internal_do_not_use_render:g}=e,_=G(t),[v,b]=F.useState(null),[x,S]=F.useState(null),[C,w]=F.useState(!1),T=k(l),[E,D]=p({prop:r,defaultProp:i??!1,onChange:a,caller:V}),[O,A]=p({prop:o,defaultProp:s,onChange:c,caller:V}),j=F.useRef(null),te=F.useRef(O);F.useEffect(()=>{let e=h?v?.ownerDocument.getElementById(h):v?.form;if(e instanceof HTMLFormElement){let t=()=>A(te.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,v,A]);let M=!v||!!h||!!v.closest(`form`),[N,P]=F.useState(new Set),I=y(),L=Array.from(N).map(e=>e.props.value).join(`;`),z=F.useCallback(e=>{P(t=>new Set(t).add(e))},[]),B=F.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),U={required:m,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:I,value:O,onValueChange:A,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:j,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:N,nativeSelectKey:L,isFormControl:M};return(0,R.jsx)(ee,{..._,children:(0,R.jsx)(ie,{scope:t,...U,children:(0,R.jsx)(H.Provider,{scope:t,children:(0,R.jsx)(ae,{scope:t,onNativeOptionAdd:z,onNativeOptionRemove:B,children:nt(g)?g(U):n})})})})}ce.displayName=se;var le=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,R.jsx)(ce,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[n,e?(0,R.jsx)(tt,{__scopeSelect:t}):null]})})};le.displayName=V;var ue=`SelectTrigger`,de=F.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=G(n),c=K(ue,n),l=c.disabled||r,u=b(t,c.onTriggerChange),d=U(n),f=F.useRef(`touch`),[p,m,h]=rt(e=>{let t=d().filter(e=>!e.disabled),n=it(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,R.jsx)(D,{asChild:!0,...a,children:(0,R.jsx)(o.button,{type:`button`,role:`combobox`,"aria-controls":c.open?c.contentId:void 0,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":$(c.value)?``:void 0,...i,ref:u,onClick:s(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:s(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:s(i.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&z.includes(e.key)&&(g(),e.preventDefault())})})})});de.displayName=ue;var fe=`SelectValue`,pe=F.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:s=``,...c}=e,l=K(fe,n),{onValueNodeHasChildrenChange:u}=l,f=a!==void 0,p=b(t,l.onValueNodeChange);d(()=>{u(f)},[u,f]);let m=$(l.value);return(0,R.jsx)(o.span,{...c,asChild:!m&&c.asChild,ref:p,style:{pointerEvents:`none`},children:(0,R.jsx)(F.Fragment,{children:m?s:a},m?`placeholder`:`value`)})});pe.displayName=fe;var me=`SelectIcon`,he=F.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,R.jsx)(o.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});he.displayName=me;var ge=`SelectPortal`,[_e,ve]=W(ge,{forceMount:void 0}),ye=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,R.jsx)(_e,{scope:e.__scopeSelect,forceMount:n,children:(0,R.jsx)(_,{asChild:!0,...r})})};ye.displayName=ge;var q=`SelectContent`,be=F.forwardRef((e,t)=>{let n=ve(q,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=K(q,e.__scopeSelect),[o,s]=F.useState();return d(()=>{s(new DocumentFragment)},[]),(0,R.jsx)(u,{present:r||a.open,children:({present:e})=>e?(0,R.jsx)(Te,{...i,ref:t}):(0,R.jsx)(xe,{...i,fragment:o})})});be.displayName=q;var xe=F.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?I.createPortal((0,R.jsx)(Se,{scope:n,children:(0,R.jsx)(H.Slot,{scope:n,children:(0,R.jsx)(`div`,{ref:t,children:r})})}),i):null});xe.displayName=`SelectContentFragment`;var J=10,[Se,Y]=W(q),Ce=`SelectContentImpl`,we=x(`SelectContent.RemoveScroll`),Te=F.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:_,collisionPadding:y,sticky:x,hideWhenDetached:S,avoidCollisions:C,...w}=e,T=K(q,n),[E,D]=F.useState(null),[O,k]=F.useState(null),A=b(t,D),[j,ee]=F.useState(null),[te,M]=F.useState(null),N=U(n),[P,I]=F.useState(!1),L=F.useRef(!1);F.useEffect(()=>{if(E)return g(E)},[E]),m();let z=F.useCallback(e=>{let[t,...n]=N().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,O]),B=F.useCallback(()=>z([j,E]),[z,j,E]);F.useEffect(()=>{P&&B()},[P,B]);let{onOpenChange:V,triggerPointerDownPosRef:H}=T;F.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(H.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(H.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||V(!1),document.removeEventListener(`pointermove`,t),H.current=null};return H.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,V,H]),F.useEffect(()=>{let e=()=>V(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[V]);let[ne,W]=rt(e=>{let t=N().filter(e=>!e.disabled),n=it(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=F.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(L.current=!0))},[T.value]),G=F.useCallback(()=>E?.focus(),[E]),ie=F.useCallback((e,t,n)=>{let r=!L.current&&!n;(T.value!==void 0&&T.value===t||r)&&M(e)},[T.value]),ae=r===`popper`?X:De,oe=ae===X?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:_,collisionPadding:y,sticky:x,hideWhenDetached:S,avoidCollisions:C}:{};return(0,R.jsx)(Se,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:G,itemTextRefCallback:ie,focusSelectedItem:B,selectedItemText:te,position:r,isPositioned:P,searchRef:ne,children:(0,R.jsx)(f,{as:we,allowPinchZoom:!0,children:(0,R.jsx)(h,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:s(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,R.jsx)(v,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,R.jsx)(ae,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...oe,onPlaced:()=>I(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:s(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&W(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});Te.displayName=Ce;var Ee=`SelectItemAlignedPosition`,De=F.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=K(q,n),s=Y(q,n),[c,l]=F.useState(null),[u,f]=F.useState(null),p=b(t,f),m=U(n),h=F.useRef(!1),g=F.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:x}=s,S=F.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&u&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-J,d=L(a,[J,Math.max(J,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-J,d=L(a,[J,Math.max(J,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let o=m(),s=window.innerHeight-J*2,l=_.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+p+l+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-J,D=s-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}c.style.margin=`${J}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,c,u,_,v,y,a.dir,r]);d(()=>S(),[S]);let[C,w]=F.useState();return d(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,R.jsx)(ke,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:F.useCallback(e=>{e&&g.current===!0&&(S(),x?.(),g.current=!1)},[S,x]),children:(0,R.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,R.jsx)(o.div,{...i,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});De.displayName=Ee;var Oe=`SelectPopperPosition`,X=F.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=J,...a}=e,o=G(n);return(0,R.jsx)(j,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});X.displayName=Oe;var[ke,Ae]=W(q,{}),je=`SelectViewport`,Me=F.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Y(je,n),c=Ae(je,n),l=b(t,a.onViewportChange),u=F.useRef(0);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,R.jsx)(H.Slot,{scope:n,children:(0,R.jsx)(o.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:s(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-J*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})});Me.displayName=je;var Ne=`SelectGroup`,[Pe,Fe]=W(Ne),Ie=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=y();return(0,R.jsx)(Pe,{scope:n,id:i,children:(0,R.jsx)(o.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ie.displayName=Ne;var Le=`SelectLabel`,Re=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Fe(Le,n);return(0,R.jsx)(o.div,{id:i.id,...r,ref:t})});Re.displayName=Le;var Z=`SelectItem`,[ze,Be]=W(Z),Ve=F.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...l}=e,u=K(Z,n),d=Y(Z,n),f=u.value===r,[p,m]=F.useState(a??``),[h,g]=F.useState(!1),_=b(t,c(e=>d.itemRefCallback?.(e,r,i))),v=y(),x=F.useRef(`touch`),S=()=>{i||(u.onValueChange(r),u.onOpenChange(!1))};return(0,R.jsx)(ze,{scope:n,value:r,disabled:i,textId:v,isSelected:f,onItemTextChange:F.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,R.jsx)(H.ItemSlot,{scope:n,value:r,disabled:i,textValue:p,children:(0,R.jsx)(o.div,{role:`option`,"aria-labelledby":v,"data-highlighted":h?``:void 0,"aria-selected":f&&h,"data-state":f?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...l,ref:_,onFocus:s(l.onFocus,()=>g(!0)),onBlur:s(l.onBlur,()=>g(!1)),onClick:s(l.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:s(l.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:s(l.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:s(l.onPointerMove,e=>{x.current=e.pointerType,i?d.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:s(l.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:s(l.onKeyDown,e=>{i||e.target!==e.currentTarget||d.searchRef?.current!==``&&e.key===` `||(B.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Ve.displayName=Z;var Q=`SelectItemText`,He=F.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,s=K(Q,n),l=Y(Q,n),u=Be(Q,n),f=oe(Q,n),[p,m]=F.useState(null),h=c(e=>l.itemTextRefCallback?.(e,u.value,u.disabled)),g=b(t,m,u.onItemTextChange,h),_=p?.textContent,v=F.useMemo(()=>(0,R.jsx)(`option`,{value:u.value,disabled:u.disabled,children:_},u.value),[u.disabled,u.value,_]),{onNativeOptionAdd:y,onNativeOptionRemove:x}=f;return d(()=>(y(v),()=>x(v)),[y,x,v]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(o.span,{id:u.textId,...a,ref:g}),u.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?I.createPortal(a.children,s.valueNode):null]})});He.displayName=Q;var Ue=`SelectItemIndicator`,We=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Be(Ue,n).isSelected?(0,R.jsx)(o.span,{"aria-hidden":!0,...r,ref:t}):null});We.displayName=Ue;var Ge=`SelectScrollUpButton`,Ke=F.forwardRef((e,t)=>{let n=Y(Ge,e.__scopeSelect),r=Ae(Ge,e.__scopeSelect),[i,a]=F.useState(!1),o=b(t,r.onScrollButtonChange);return d(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(Ye,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Ke.displayName=Ge;var qe=`SelectScrollDownButton`,Je=F.forwardRef((e,t)=>{let n=Y(qe,e.__scopeSelect),r=Ae(qe,e.__scopeSelect),[i,a]=F.useState(!1),o=b(t,r.onScrollButtonChange);return d(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,R.jsx)(Ye,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Je.displayName=qe;var Ye=F.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Y(`SelectScrollButton`,n),c=F.useRef(null),l=U(n),u=F.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return F.useEffect(()=>()=>u(),[u]),d(()=>{l().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[l]),(0,R.jsx)(o.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:s(i.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(r,50))}),onPointerMove:s(i.onPointerMove,()=>{a.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(r,50))}),onPointerLeave:s(i.onPointerLeave,()=>{u()})})}),Xe=`SelectSeparator`,Ze=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,R.jsx)(o.div,{"aria-hidden":!0,...r,ref:t})});Ze.displayName=Xe;var Qe=`SelectArrow`,$e=F.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=G(n);return Y(Qe,n).position===`popper`?(0,R.jsx)(S,{...i,...r,ref:t}):null});$e.displayName=Qe;var et=`SelectBubbleInput`,tt=F.forwardRef(({__scopeSelect:e,...t},n)=>{let r=K(et,e),{value:i,onValueChange:a,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,m=F.useRef(null),h=b(n,m),g=i??``,_=M(g),v=Array.from(f).some(e=>(e.props.value??``)===``);return F.useEffect(()=>{let e=m.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(_!==g&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,g),e.dispatchEvent(t)}},[_,g]),(0,R.jsxs)(o.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>a(e.target.value),...t,style:{...te,...t.style},ref:h,defaultValue:g,children:[$(i)&&!v?(0,R.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});tt.displayName=et;function nt(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function rt(e){let t=c(e),n=F.useRef(``),r=F.useRef(0),i=F.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=F.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return F.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function it(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=at(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function at(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ot=le,st=pe;function ct({className:e,children:t,...n}){return(0,R.jsxs)(de,{className:i(`flex h-[var(--ui-field-height)] w-full cursor-pointer items-center justify-between gap-2 px-2.5 [&>span]:truncate`,w,e),...n,children:[t,(0,R.jsx)(he,{asChild:!0,children:(0,R.jsx)(N,{className:`size-3.5 shrink-0 text-fg-muted`})})]})}function lt({className:e,children:t,position:n=`popper`,...r}){return(0,R.jsx)(ye,{children:(0,R.jsx)(be,{position:n,sideOffset:4,className:i(`z-50 max-h-72 min-w-[var(--radix-select-trigger-width)] max-w-[var(--radix-select-content-available-width)] overflow-y-auto`,E,`overlay-select-motion`,e),...r,children:(0,R.jsx)(Me,{children:t})})})}function ut({className:e,children:t,detail:n,...r}){return(0,R.jsxs)(Ve,{className:i(T,A,`py-1.5 pl-7 pr-2`,e),...r,children:[(0,R.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,R.jsx)(We,{children:(0,R.jsx)(P,{className:`size-3.5`})})}),(0,R.jsx)(He,{children:t}),n]})}export{st as a,ct as i,lt as n,P as o,ut as r,ot as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./auth-C3ruG3fE.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{n as i,t as a}from"./motion-Bd_MB9cH.js";import{n as o,t as s}from"./createLucideIcon-C9A1vLE-.js";import{C as c,E as l,T as u,g as d}from"./dialog-DtvE8ATK.js";import{d as f,f as p,r as m,u as h}from"./dist-a682-VMb.js";import{_ as g,a as _,c as v,d as y,f as b,g as x,h as S,i as ee,l as C,m as te,n as ne,o as re,p as ie,r as ae,s as oe,t as se,u as ce}from"./dist-KPX-s1ou.js";var le=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,ue=/^[\\/]{2}/;function de(e,t){return t+e.replace(/\\/g,`/`)}var fe=`popstate`;function pe(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function me(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return _e(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:E(t)}return ve(t,n,null,e)}function w(e,t){if(e===!1||e==null)throw Error(t)}function T(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function he(){return Math.random().toString(36).substring(2,10)}function ge(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function _e(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?D(t):t,state:n,key:t&&t.key||r||he(),mask:i}}function E({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function D(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ve(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=pe(e)?e:_e(h.location,e,t);n&&n(r,e),l=u()+1;let d=ge(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=pe(e)?e:_e(h.location,e,t);n&&n(r,e),l=u();let i=ge(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return ye(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(fe,d),c=e,()=>{i.removeEventListener(fe,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function ye(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),w(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:E(t);return i=i.replace(/ $/,`%20`),!n&&ue.test(i)&&(i=r+i),new URL(i,r)}var O=e(t(),1);function be(e,t,n=`/`){return xe(e,t,n,!1)}function xe(e,t,n,r,i){let a=A((typeof t==`string`?D(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Ce(e),s=null,c=Ve(a);for(let e=0;s==null&&e<o.length;++e)s=Re(o[e],c,r);return s}function Se(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function Ce(e){let t=we(e);return Ee(t),t}function we(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;w(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=j([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(w(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),we(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:Ie(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Be(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Te(e.path))a(e,t,!0,n)}),t}function Te(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Te(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Ee(e){e.sort((e,t)=>e.score===t.score?Le(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var De=/^:[\w-]+$/,Oe=/^:[\w-]+/,ke=3.5,Ae=3,je=2,Me=1,Ne=10,Pe=-2,Fe=e=>e===`*`;function Ie(e,t){let n=e.split(`/`),r=n.length;return n.some(Fe)&&(r+=Pe),t&&(r+=je),n.filter(e=>!Fe(e)).reduce((e,t)=>e+(De.test(t)?Ae:Oe.test(t)?ke:t===``?Me:Ne),r)}function Le(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Re(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?ze(u,l,s.matcher,s.compiledParams):k(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=k({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:j([a,d.pathname]),pathnameBase:Xe(j([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=j([a,d.pathnameBase]))}return o}function k(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Be(e.path,e.caseSensitive,e.end);return ze(e,t,n,r)}function ze(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Be(e,t=!1,n=!0){T(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Ve(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return T(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function A(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function He(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?D(e):e,a;return n?(n=Je(n),a=n.startsWith(`/`)?Ue(n.substring(1),`/`):Ue(n,t)):a=t,{pathname:a,search:Ze(r),hash:Qe(i)}}function Ue(e,t){let n=Ye(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function We(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ge(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Ke(e){let t=Ge(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function qe(e,t,n,r=!1){let i;typeof e==`string`?i=D(e):(i={...e},w(!i.pathname||!i.pathname.includes(`?`),We(`?`,`pathname`,`search`,i)),w(!i.pathname||!i.pathname.includes(`#`),We(`#`,`pathname`,`hash`,i)),w(!i.search||!i.search.includes(`#`),We(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=He(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Je=e=>e.replace(/[\\/]{2,}/g,`/`),j=e=>Je(e.join(`/`)),Ye=e=>e.replace(/\/+$/,``),Xe=e=>Ye(e).replace(/^\/*/,`/`),Ze=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Qe=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,$e=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function et(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function tt(e){return j(e.map(e=>e.route.path).filter(Boolean))||`/`}var nt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function rt(e,t){let n=e;if(typeof n!=`string`||!le.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(nt)try{let e=new URL(window.location.href),r=ue.test(n)?new URL(de(n,e.protocol)):new URL(n),a=A(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{T(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var it=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(it);var at=[`GET`,...it];new Set(at);var ot=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function st(e){try{return ot.includes(new URL(e).protocol)}catch{return!1}}var M=O.createContext(null);M.displayName=`DataRouter`;var N=O.createContext(null);N.displayName=`DataRouterState`;var ct=O.createContext(!1);function lt(){return O.useContext(ct)}var ut=O.createContext({isTransitioning:!1});ut.displayName=`ViewTransition`;var dt=O.createContext(new Map);dt.displayName=`Fetchers`;var ft=O.createContext(null);ft.displayName=`Await`;var P=O.createContext(null);P.displayName=`Navigation`;var F=O.createContext(null);F.displayName=`Location`;var I=O.createContext({outlet:null,matches:[],isDataRoute:!1});I.displayName=`Route`;var pt=O.createContext(null);pt.displayName=`RouteError`;var mt=`REACT_ROUTER_ERROR`,ht=`REDIRECT`,gt=`ROUTE_ERROR_RESPONSE`;function _t(e){if(e.startsWith(`${mt}:${ht}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function vt(e){if(e.startsWith(`${mt}:${gt}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new $e(t.status,t.statusText,t.data)}catch{}}function yt(e,{relative:t}={}){w(L(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=O.useContext(P),{hash:i,pathname:a,search:o}=z(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:j([n,a])),r.createHref({pathname:s,search:o,hash:i})}function L(){return O.useContext(F)!=null}function R(){return w(L(),`useLocation() may be used only in the context of a <Router> component.`),O.useContext(F).location}var bt=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function xt(){let{isDataRoute:e}=O.useContext(I);return e?Ut():St()}function St(){w(L(),`useNavigate() may be used only in the context of a <Router> component.`);let e=O.useContext(M),{basename:t,navigator:n}=O.useContext(P),{matches:r}=O.useContext(I),{pathname:i}=R(),a=JSON.stringify(Ke(r)),o=O.useRef(!1);return O.useLayoutEffect(()=>{o.current=!0}),O.useCallback((r,s={})=>{if(T(o.current,bt),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=qe(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:j([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Ct=O.createContext(null);function wt(e){let t=O.useContext(I).outlet;return O.useMemo(()=>t&&O.createElement(Ct.Provider,{value:e},t),[t,e])}function Tt(){let{matches:e}=O.useContext(I);return e[e.length-1]?.params??{}}function z(e,{relative:t}={}){let{matches:n}=O.useContext(I),{pathname:r}=R(),i=JSON.stringify(Ke(n));return O.useMemo(()=>qe(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Et(e,t){return Dt(e,t)}function Dt(e,t,n){w(L(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=O.useContext(P),{matches:i}=O.useContext(I),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=R(),l;if(t){let e=typeof t==`string`?D(t):t;w(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):be(e,{pathname:d}),p=Pt(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:j([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:j([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?O.createElement(F.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function Ot(){let e=Ht(),t=et(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return O.createElement(O.Fragment,null,O.createElement(`h2`,null,`Unexpected Application Error!`),O.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?O.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var kt=O.createElement(Ot,null),At=class extends O.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=ct;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=vt(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:O.createElement(I.Provider,{value:this.props.routeContext},O.createElement(pt.Provider,{value:e,children:this.props.component}));return this.context?O.createElement(Mt,{error:e},t):t}},jt=new WeakMap;function Mt({children:e,error:t}){let{basename:n}=O.useContext(P);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=_t(t.digest);if(e){let r=jt.get(t);if(r)throw r;let i=rt(e.location,n),a=i.absoluteURL||i.to;if(st(a))throw Error(`Invalid redirect location`);if(nt&&!jt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw jt.set(t,n),n}return O.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function Nt({routeContext:e,match:t,children:n}){let r=O.useContext(M);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),O.createElement(I.Provider,{value:e},n)}function Pt(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);w(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:tt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||kt,o&&(s<0&&c===0?(Gt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?O.createElement(n.route.Component,null):n.route.element?n.route.element:e,O.createElement(Nt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?O.createElement(At,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function Ft(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function It(e){let t=O.useContext(M);return w(t,Ft(e)),t}function Lt(e){let t=O.useContext(N);return w(t,Ft(e)),t}function Rt(e){let t=O.useContext(I);return w(t,Ft(e)),t}function B(e){let t=Rt(e),n=t.matches[t.matches.length-1];return w(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function zt(){return B(`useRouteId`)}function Bt(){let e=Lt(`useNavigation`);return O.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function Vt(){let{matches:e,loaderData:t}=Lt(`useMatches`);return O.useMemo(()=>e.map(e=>Se(e,t)),[e,t])}function Ht(){let e=O.useContext(pt),t=Lt(`useRouteError`),n=B(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Ut(){let{router:e}=It(`useNavigate`),t=B(`useNavigate`),n=O.useRef(!1);return O.useLayoutEffect(()=>{n.current=!0}),O.useCallback(async(r,i={})=>{T(n.current,bt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Wt={};function Gt(e,t,n){!t&&!Wt[e]&&(Wt[e]=!0,T(!1,n))}O.memo(Kt);function Kt({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Dt(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function qt(e){return wt(e.context)}function Jt(e){w(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Yt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){w(!L(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=O.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=D(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=O.useMemo(()=>{let e=A(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return T(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:O.createElement(P.Provider,{value:c},O.createElement(F.Provider,{children:t,value:h}))}function Xt({children:e,location:t}){return Et(V(e),t)}O.Component;function V(e,t=[]){let n=[];return O.Children.forEach(e,(e,r)=>{if(!O.isValidElement(e))return;let i=[...t,r];if(e.type===O.Fragment){n.push.apply(n,V(e.props.children,i));return}w(e.type===Jt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;w(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=V(a.children,i)),n.push(o)}),n}var H=`application/x-www-form-urlencoded`;function U(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Zt(e){return U(e)&&e.tagName.toLowerCase()===`button`}function Qt(e){return U(e)&&e.tagName.toLowerCase()===`form`}function $t(e){return U(e)&&e.tagName.toLowerCase()===`input`}function en(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tn(e,t){return e.button===0&&(!t||t===`_self`)&&!en(e)}var W=null;function nn(){if(W===null)try{new FormData(document.createElement(`form`),0),W=!1}catch{W=!0}return W}var rn=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function an(e){return e!=null&&!rn.has(e)?(T(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${H}"`),null):e}function on(e,t){let n,r,i,a,o;if(Qt(e)){let o=e.getAttribute(`action`);r=o?A(o,t):null,n=e.getAttribute(`method`)||`get`,i=an(e.getAttribute(`enctype`))||H,a=new FormData(e)}else if(Zt(e)||$t(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?A(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=an(e.getAttribute(`formenctype`))||an(o.getAttribute(`enctype`))||H,a=new FormData(o,e),!nn()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(U(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=H,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function sn(e,t){if(e===!1||e==null)throw Error(t)}var cn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},ln=/[&><\u2028\u2029]/g;function un(e){return e.replace(ln,e=>cn[e])}function dn(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname.endsWith(`/`)?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}async function fn(e,t){if(e.id in t)return t[e.id];try{let n=await r(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function pn(e){return e!=null&&typeof e.page==`string`}function mn(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function hn(e,t,n){return bn((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await fn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(mn).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function gn(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function _n(e,t,{includeHydrateFallback:n}={}){return vn(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function vn(e){return[...new Set(e)]}function yn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function bn(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!pn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(yn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function xn(){let e=O.useContext(M);return sn(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Sn(){let e=O.useContext(N);return sn(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var G=O.createContext(void 0);G.displayName=`FrameworkContext`;function Cn(){let e=O.useContext(G);return sn(e,`You must render this element inside a <HydratedRouter> element`),e}function wn(e,t){let n=O.useContext(G),[r,i]=O.useState(!1),[a,o]=O.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=O.useRef(null);O.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),O.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:K(s,p),onBlur:K(c,m),onMouseEnter:K(l,p),onMouseLeave:K(u,m),onTouchStart:K(d,p)}]:[a,f,{}]:[!1,f,{}]}function K(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Tn({page:e,...t}){let n=lt(),{nonce:r}=Cn(),{router:i}=xn(),a=O.useMemo(()=>be(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?O.createElement(Dn,{page:e,matches:a,...t}):O.createElement(On,{page:e,matches:a,...t})):null}function En(e){let{manifest:t,routeModules:n}=Cn(),[r,i]=O.useState([]);return O.useEffect(()=>{let r=!1;return hn(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Dn({page:e,matches:t,...n}){let r=R(),i=O.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=dn(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return O.createElement(O.Fragment,null,i.map(e=>O.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function On({page:e,matches:t,...n}){let r=R(),{manifest:i,routeModules:a}=Cn(),{loaderData:o,matches:s}=Sn(),c=O.useMemo(()=>gn(e,t,s,i,r,`data`),[e,t,s,i,r]),l=O.useMemo(()=>gn(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=O.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];!t||!t.hasLoader||(!c.some(t=>t.route.id===e.route.id)&&e.route.id in o&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let l=dn(e,`data`);return s&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[o,r,i,c,t,e,a]),d=O.useMemo(()=>_n(l,i),[l,i]),f=En(l);return O.createElement(O.Fragment,null,u.map(e=>O.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>O.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>O.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function kn(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var An=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{An&&(window.__reactRouterVersion=`8.2.0`)}catch{}function jn({basename:e,children:t,useTransitions:n,window:r}){let i=O.useRef(null);i.current??=me({window:r,v5Compat:!0});let a=i.current,[o,s]=O.useState({action:a.action,location:a.location}),c=O.useCallback(e=>{n===!1?s(e):O.startTransition(()=>s(e))},[n]);return O.useLayoutEffect(()=>a.listen(c),[a,c]),O.createElement(Yt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function Mn({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=O.useState({action:n.action,location:n.location}),o=O.useCallback(e=>{r===!1?a(e):O.startTransition(()=>a(e))},[r]);return O.useLayoutEffect(()=>n.listen(o),[n,o]),O.createElement(Yt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}Mn.displayName=`unstable_HistoryRouter`;var Nn=O.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=O.useContext(P),v=typeof l==`string`&&le.test(l),y=rt(l,h);l=y.to;let b=yt(l,{relative:r}),x=R(),S=null;if(o){let e=qe(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:j([h,e.pathname])),S=g.createHref(e)}let[ee,C,te]=wn(n,p),ne=Bn(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function re(t){e&&e(t),t.defaultPrevented||ne(t)}let ie=!(y.isExternal||i),ae=O.createElement(`a`,{...p,...te,href:(ie?S:void 0)||y.absoluteURL||b,onClick:ie?re:e,ref:kn(m,C),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return ee&&!v?O.createElement(O.Fragment,null,ae,O.createElement(Tn,{page:b})):ae});Nn.displayName=`Link`;var Pn=O.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=z(a,{relative:c.relative}),d=R(),f=O.useContext(N),{navigator:p,basename:m}=O.useContext(P),h=f!=null&&Jn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=A(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},ee=b?e:void 0,C;C=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let te=typeof i==`function`?i(S):i;return O.createElement(Nn,{...c,"aria-current":ee,className:C,ref:l,style:te,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Pn.displayName=`NavLink`;var Fn=O.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=O.useContext(P),g=Un(),_=Wn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&le.test(s);return O.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?O.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Fn.displayName=`Form`;function In({getKey:e,storageKey:t,...n}){let r=O.useContext(G),{basename:i}=O.useContext(P),a=R(),o=Vt();Kn({getKey:e,storageKey:t});let s=O.useMemo(()=>{if(!r||!e)return null;let t=Gn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),O.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${un(JSON.stringify(t||q))}, ${un(JSON.stringify(s))})`}})}In.displayName=`ScrollRestoration`;function Ln(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Rn(e){let t=O.useContext(M);return w(t,Ln(e)),t}function zn(e){let t=O.useContext(N);return w(t,Ln(e)),t}function Bn(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=xt(),d=R(),f=z(e,{relative:o});return O.useCallback(p=>{if(tn(p,t)){p.preventDefault();let t=n===void 0?E(d)===E(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?O.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var Vn=0,Hn=()=>`__${String(++Vn)}__`;function Un(){let{router:e}=Rn(`useSubmit`),{basename:t}=O.useContext(P),n=zt(),r=e.fetch,i=e.navigate;return O.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=on(e,t);a.navigate===!1?await r(a.fetcherKey||Hn(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Wn(e,{relative:t}={}){let{basename:n}=O.useContext(P),r=O.useContext(I);w(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...z(e||`.`,{relative:t})},o=R();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:j([n,a.pathname])),E(a)}var q=`react-router-scroll-positions`,J={};function Gn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:A(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Kn({getKey:e,storageKey:t}={}){let{router:n}=Rn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=zn(`useScrollRestoration`),{basename:a}=O.useContext(P),o=R(),s=Vt(),c=Bt();O.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),qn(O.useCallback(()=>{if(c.state===`idle`){let t=Gn(o,s,a,e);J[t]=window.scrollY}try{sessionStorage.setItem(t||q,JSON.stringify(J))}catch(e){T(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(O.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||q);e&&(J=JSON.parse(e))}catch{}},[t]),O.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(J,()=>window.scrollY,e?(t,n)=>Gn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),O.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{T(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function qn(e,t){let{capture:n}=t||{};O.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Jn(e,{relative:t}={}){let n=O.useContext(ut);w(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Rn(`useViewTransitionState`),i=z(e,{relative:t});if(!n.isTransitioning)return!1;let a=A(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=A(n.nextLocation.pathname,r)||n.nextLocation.pathname;return k(i.pathname,o)!=null||k(i.pathname,a)!=null}var Yn=0,Y=new Set,Xn=()=>Yn>0;function Zn(e,t,n){if(a()||!t){e();return}for(let e of Y)e.cancel();Y.clear();let r=new Map([...document.querySelectorAll(`[data-workspace-pane]`)].filter(e=>!e.closest(`[data-motion-snapshot]`)).map(e=>[e.dataset.workspacePane,e.getBoundingClientRect()]));Yn++;try{e()}finally{requestAnimationFrame(()=>{if(Yn--,a())return;let e=n();if(!e)return;let i=e.closest(`[data-workspace-pane]`),o=(e,t,n)=>{let r=e.getBoundingClientRect();if(!r.width||!r.height)return;let i=t.left-r.left,a=t.top-r.top,o=Math.max(.02,t.width/r.width),s=Math.max(.02,t.height/r.height),c=e.animate((n?[{transform:`translate(${i}px, ${a}px) scale(${o}, ${s})`,opacity:.4,offset:0},{transform:`translate(${i*.25}px, ${a*.35}px) scale(${o+(1-o)*.85}, ${s+(1-s)*.5})`,opacity:1,offset:.55},{transform:`none`,opacity:1,offset:1}]:[{transform:`translate(${i}px, ${a}px)`,width:`${t.width}px`,height:`${t.height}px`},{transform:`none`,width:`${r.width}px`,height:`${r.height}px`}]).map(e=>({...e,transformOrigin:`top left`})),{duration:320,easing:`cubic-bezier(0.2, 0.7, 0.2, 1)`});c.effect?.updateTiming({fill:`none`}),Y.add(c),c.finished.then(()=>Y.delete(c),()=>Y.delete(c))};for(let e of document.querySelectorAll(`[data-workspace-pane]`)){if(e.closest(`[data-motion-snapshot]`))continue;let n=r.get(e.dataset.workspacePane);if(e===i&&!n)o(e,t,!0);else if(n){let t=e.getBoundingClientRect();(n.x!==t.x||n.y!==t.y||n.width!==t.width||n.height!==t.height)&&o(e,n,!1)}}i&&e!==i&&r.has(i.dataset.workspacePane)&&o(e,t,!0);let s=new MutationObserver(()=>{if(a())for(let e of Y)e.cancel()});s.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-reduce-motion`]}),Promise.allSettled([...Y].map(e=>e.finished)).then(()=>s.disconnect())})}}var X=n(),Qn=class extends O.Component{live=(0,O.createRef)();layers=(0,O.createRef)();animations=[];clear=()=>{this.animations.forEach(e=>e.cancel()),this.animations=[],this.layers.current?.replaceChildren()};getSnapshotBeforeUpdate(e){if(e.motionKey===this.props.motionKey||e.presentKeys?.includes(this.props.motionKey)&&this.props.presentKeys?.includes(e.motionKey)||e.preview&&this.props.preview||this.props.reduced||Xn())return null;let t=this.live.current;if(!t||!t.getBoundingClientRect().width)return null;let n=t.cloneNode(!0),r=t.querySelectorAll(`canvas`);n.querySelectorAll(`canvas`).forEach((e,t)=>{let n=r[t];if(!(!n||!n.width||!n.height))try{e.getContext(`2d`)?.drawImage(n,0,0)}catch{}}),n.querySelectorAll(`[data-motion-snapshot]`).forEach(e=>e.remove()),n.querySelectorAll(`iframe, audio, video, object, embed`).forEach(e=>e.remove());for(let e of[n,...n.querySelectorAll(`*`)])for(let t of e.getAttributeNames())(t===`id`||t===`autofocus`||t.startsWith(`data-`))&&e.removeAttribute(t);n.inert=!0,n.setAttribute(`aria-hidden`,`true`),n.dataset.motionSnapshot=``;let i=getComputedStyle(t),a=t.getBoundingClientRect();return n.style.width=`${a.width}px`,n.style.height=`${a.height}px`,n.style.opacity=i.opacity,n.style.scale=i.scale,n}componentDidUpdate(e,t,n){if(this.props.reduced||Xn()||e.motionKey!==this.props.motionKey&&e.presentKeys?.includes(this.props.motionKey)&&this.props.presentKeys?.includes(e.motionKey)||e.preview&&this.props.preview&&e.motionKey!==this.props.motionKey){this.clear();return}if(e.motionKey===this.props.motionKey)return;this.clear();let r=this.live.current;if(!r)return;n&&(this.layers.current?.append(n),this.animations.push(n.animate([{opacity:n.style.opacity,scale:n.style.scale},{opacity:0,scale:`0.97`}],{duration:180,easing:`ease-in`,fill:`forwards`})));let i=r.animate([{opacity:0,scale:`0.97`},{opacity:1,scale:`1`}],{duration:180,easing:`ease-out`});this.animations.push(i),i.finished.then(()=>{this.animations.includes(i)&&this.clear()},()=>{})}componentWillUnmount(){this.clear()}render(){return(0,X.jsxs)(`div`,{className:o(`relative min-h-0 min-w-0`,this.props.className),"data-content-motion":!0,children:[(0,X.jsx)(`div`,{ref:this.live,className:`size-full min-h-0 min-w-0`,children:this.props.children}),(0,X.jsx)(`div`,{ref:this.layers,className:`pointer-events-none absolute inset-0 z-30 overflow-hidden`,inert:!0,"aria-hidden":`true`})]})}};function $n(e){return(0,X.jsx)(Qn,{...e,reduced:i()})}var er=s(`corner-left-up`,[[`path`,{d:`M14 9 9 4 4 9`,key:`1af5af`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),Z=`ContextMenu`,[tr,nr]=u(Z,[g]),Q=g(),[rr,ir]=tr(Z),ar=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=O.useRef(!1);{let e=O.useRef(!1);O.useEffect(()=>{i===!0&&!s.current&&!e.current&&(e.current=!0,console.warn("ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport."))},[i])}let[c,l]=d({prop:i,defaultProp:!1,onChange:r,caller:Z}),u=Q(t);return(0,X.jsx)(rr,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,X.jsx)(b,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})};ar.displayName=Z;var or=`ContextMenuTrigger`,sr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=ir(or,n),o=Q(n),[s,u]=O.useState({x:0,y:0}),d=O.useMemo(()=>({current:{getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...s})}}),[s]),f=O.useRef(0),p=O.useCallback(()=>window.clearTimeout(f.current),[]),m=e=>{a.hasInteractedRef.current=!0,u({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)};return O.useEffect(()=>p,[p]),O.useEffect(()=>void(r&&p()),[r,p]),(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(se,{...o,virtualRef:d}),(0,X.jsx)(c.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:l(e.onContextMenu,e=>{p(),m(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:l(e.onPointerDown,$(e=>{p(),a.open&&a.onOpenChange(!1),f.current=window.setTimeout(()=>m(e),700)})),onPointerMove:r?e.onPointerMove:l(e.onPointerMove,$(p)),onPointerCancel:r?e.onPointerCancel:l(e.onPointerCancel,$(p)),onPointerUp:r?e.onPointerUp:l(e.onPointerUp,$(p))})]})});sr.displayName=or;var cr=`ContextMenuPortal`,lr=e=>{let{__scopeContextMenu:t,...n}=e,r=Q(t);return(0,X.jsx)(C,{...r,...n})};lr.displayName=cr;var ur=`ContextMenuContent`,dr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=ir(ur,n),a=Q(n),o=O.useRef(!1);return(0,X.jsx)(ee,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});dr.displayName=ur;var fr=`ContextMenuGroup`,pr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(_,{...i,...r,ref:t})});pr.displayName=fr;var mr=`ContextMenuLabel`,hr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(v,{...i,...r,ref:t})});hr.displayName=mr;var gr=`ContextMenuItem`,_r=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(re,{...i,...r,ref:t})});_r.displayName=gr;var vr=`ContextMenuCheckboxItem`,yr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(ae,{...i,...r,ref:t})});yr.displayName=vr;var br=`ContextMenuRadioGroup`,xr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(ce,{...i,...r,ref:t})});xr.displayName=br;var Sr=`ContextMenuRadioItem`,Cr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(y,{...i,...r,ref:t})});Cr.displayName=Sr;var wr=`ContextMenuItemIndicator`,Tr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(oe,{...i,...r,ref:t})});Tr.displayName=wr;var Er=`ContextMenuSeparator`,Dr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(ie,{...i,...r,ref:t})});Dr.displayName=Er;var Or=`ContextMenuArrow`,kr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(ne,{...i,...r,ref:t})});kr.displayName=Or;var Ar=`ContextMenuSub`,jr=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=Q(t),[s,c]=d({prop:i,defaultProp:a??!1,onChange:r,caller:Ar});return(0,X.jsx)(te,{...o,open:s,onOpenChange:c,children:n})};jr.displayName=Ar;var Mr=`ContextMenuSubTrigger`,Nr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(x,{...i,...r,ref:t})});Nr.displayName=Mr;var Pr=`ContextMenuSubContent`,Fr=O.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=Q(n);return(0,X.jsx)(S,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Fr.displayName=Pr;function $(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Ir=ar,Lr=sr,Rr=lr,zr=dr,Br=_r,Vr=Dr,Hr=jr,Ur=Nr,Wr=Fr,Gr=Ir,Kr=Lr,qr=Hr;function Jr({className:e,...t}){return(0,X.jsx)(Rr,{children:(0,X.jsx)(zr,{className:o(`z-50 min-w-36 overflow-hidden`,p,`overlay-context-menu-motion`,e),...t})})}function Yr({className:e,...t}){return(0,X.jsx)(Br,{className:o(f,h,`[&_svg]:size-3.5`,e),...t})}function Xr({className:e,children:t,...n}){return(0,X.jsxs)(Ur,{className:o(f,h,`data-[state=open]:bg-action data-[state=open]:text-action-ink [&_svg]:size-3.5`,e),...n,children:[t,(0,X.jsx)(m,{className:`ml-auto`})]})}function Zr({className:e,...t}){return(0,X.jsx)(Rr,{children:(0,X.jsx)(Wr,{className:o(`z-50 min-w-36 overflow-hidden`,p,`overlay-context-menu-motion`,e),...t})})}function Qr({className:e,...t}){return(0,X.jsx)(Vr,{className:o(`-mx-1 my-1 h-px bg-border`,e),...t})}function $r(){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:e=>{e.preventDefault(),e.currentTarget.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,clientX:e.clientX,clientY:e.clientY,button:2}))}}}function ei(e){let t=Date.parse(e.created_at);return Number.isNaN(t)?0:t}function ti(e,t){let n=new Map(t.map((e,t)=>[e,t])),r=[],i=[];for(let t of e)(n.has(t.id)?r:i).push(t);return r.sort((e,t)=>n.get(e.id)-n.get(t.id)),i.sort((e,t)=>ei(t)-ei(e)),[...i,...r]}function ni(e,t,n){if(t===n)return[...e];let r=e.filter(e=>e!==t),i=r.indexOf(n);return i===-1?[...e]:(r.splice(i,0,t),r)}function ri(e,t,n){if(t===n)return null;let r=e.find(e=>e.sessions.some(e=>e.id===t));if(!r||!r.sessions.some(e=>e.id===n))return null;let i=e.flatMap(e=>e.sessions.map(e=>e.id)),a=ni(i,t,n);return a.some((e,t)=>e!==i[t])?a:null}function ii(e,t){let n=new Set(e);return[...e,...t.filter(e=>!n.has(e))]}export{xt as C,R as S,jn as _,Gr as a,Jt as b,Qr as c,Xr as d,Kr as f,Zn as g,$n as h,ni as i,qr as l,er as m,ri as n,Jr as o,$r as p,ti as r,Yr as s,ii as t,Zr as u,Nn as v,Tt as w,Xt as x,qt as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-C9A1vLE-.js";var t=e(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{U as n}from"./auth-C3ruG3fE.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{n as i,t as a}from"./createLucideIcon-C9A1vLE-.js";import{C as o,E as s,T as c,g as l}from"./dialog-DtvE8ATK.js";import{a as u}from"./dist-DZg8Dwbr.js";import{r as d,x as f}from"./dist-a682-VMb.js";import{t as p}from"./dist-BeQvHdsz.js";var m=a(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),h=a(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),g=a(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),_=a(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),v=a(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),y=r();function b({summary:e,summaryClassName:t,className:n,children:r,...a}){return(0,y.jsxs)(`details`,{className:i(`[&[open]>summary>svg]:rotate-90`,n),...a,children:[(0,y.jsxs)(`summary`,{className:i(`flex cursor-pointer select-none list-none items-center gap-1 text-fg-secondary transition-colors hover:text-fg [&::-webkit-details-marker]:hidden`,t),children:[(0,y.jsx)(d,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]}),r]})}var x=e(t(),1),S=new Set;function C(e){let t=/^#settings\/([\w-]+)$/.exec(e);return t?t[1]:null}var w=C(window.location.hash);function T(){let e=w?`#settings/${w}`:``;window.location.hash!==e&&history.replaceState(null,``,window.location.pathname+window.location.search+e)}function E(e){if(e!==w){w=e;for(let e of S)e()}queueMicrotask(T)}window.addEventListener(`hashchange`,()=>E(C(window.location.hash))),window.addEventListener(`popstate`,()=>E(C(window.location.hash)));function D(){return(0,x.useSyncExternalStore)(e=>(S.add(e),()=>{S.delete(e)}),()=>w)}function O(e=`appearance`){E(e)}function k(){E(null)}function A(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}var j=` — `;function M(e){return e.replace(/\/+$/,``).split(`/`).pop()??``}function N(e){return{name:A(e),title:e.title??``,agentName:e.agent_title??``,sequence:e.osc_title??``,branch:e.branch,cwd:M(e.worktree_path),id:e.id.slice(0,8),status:e.status,agent:e.agent_type??``}}function P(e,t){let r=t&&t.length>0?t:n,i=N(e),a=[];for(let e of r.split(/(\$\{[a-zA-Z]+\})/)){if(e===``)continue;let t=/^\$\{([a-zA-Z]+)\}$/.exec(e)?.[1];t===void 0?a.push({text:e,sep:!1}):t===`separator`?a.push({text:j,sep:!0}):a.push({text:i[t]??e,sep:!1})}let o=[];a.forEach((e,t)=>{if(!e.sep){o.push(e.text);return}let n=o.join(``).trim().length>0,r=a.slice(t+1).some(e=>!e.sep&&e.text.trim().length>0);n&&r&&o.push(e.text)});let s=o.join(``).trim();return s.length>0?s:e.id.slice(0,8)}var F=`Switch`,[I,L]=c(F),[R,z]=I(F);function B(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=l({prop:n,defaultProp:i??!1,onChange:c,caller:F}),[h,g]=x.useState(null),[_,v]=x.useState(null),b={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:x.useRef(!1),required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,y.jsx)(R,{scope:t,...b,children:J(f)?f(b):r})}var V=`SwitchTrigger`,H=x.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:i,form:a,value:c,disabled:l,checked:d,required:f,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:_}=z(V,e),v=u(r,p),b=x.useRef(d);return x.useEffect(()=>{let e=a?i?.ownerDocument.getElementById(a):i?.form;if(e instanceof HTMLFormElement){let t=()=>m(b.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[i,a,m]),(0,y.jsx)(o.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":Y(d),"data-disabled":l?``:void 0,disabled:l,value:c,...n,ref:v,onClick:s(t,e=>{m(e=>!e),_&&g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});H.displayName=V;var U=x.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,y.jsx)(B,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(H,{...d,ref:t,__scopeSwitch:n}),e&&(0,y.jsx)(q,{__scopeSwitch:n})]})})});U.displayName=F;var W=`SwitchThumb`,G=x.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=z(W,n);return(0,y.jsx)(o.span,{"data-state":Y(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});G.displayName=W;var K=`SwitchBubbleInput`,q=x.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:s,required:c,disabled:l,name:d,value:m,form:h,bubbleInput:g,setBubbleInput:_}=z(K,e),v=u(n,_),b=p(a),S=f(r);x.useEffect(()=>{let e=g;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(b!==a&&n){let t=new Event(`click`,{bubbles:r});n.call(e,a),e.dispatchEvent(t)}},[g,b,a,i]);let C=x.useRef(a);return(0,y.jsx)(o.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??C.current,required:c,disabled:l,name:d,value:m,form:h,...t,tabIndex:-1,ref:v,style:{...t.style,...S,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});q.displayName=K;function J(e){return typeof e==`function`}function Y(e){return e?`checked`:`unchecked`}function X({className:e,...t}){return(0,y.jsx)(U,{className:i(`peer group/switch inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,y.jsx)(`span`,{className:`pointer-events-none inline-flex h-5 w-9 shrink-0 items-center rounded-full bg-border transition-colors group-hover/switch:bg-border/70 group-data-[state=checked]/switch:bg-action`,children:(0,y.jsx)(G,{className:`block size-4 rounded-full bg-ground shadow-sm transition-[translate] duration-200 ease-out data-[state=checked]:translate-x-[1.125rem] data-[state=unchecked]:translate-x-0.5`})})})}export{D as a,_ as c,m as d,O as i,g as l,P as n,b as o,k as r,v as s,X as t,h as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{E as n,lt as r,w as i}from"./protocol-support-BwRR1kRO.js";import{F as a}from"./auth-C3ruG3fE.js";import{t as o}from"./jsx-runtime-By8HlURe.js";import{n as s,t as c}from"./createLucideIcon-C9A1vLE-.js";import{C as l,E as u,T as d,_ as f,g as p,v as m,x as h,y as ee}from"./dialog-DtvE8ATK.js";import{a as g,r as _}from"./dist-DZg8Dwbr.js";import{_ as v,b as y,g as te,p as b,s as x,v as S,y as ne}from"./dist-a682-VMb.js";import{i as re}from"./dist-BeQvHdsz.js";import{c as ie,n as ae}from"./switch-AY03lzhq.js";import{a as C,n as oe,o as w}from"./preview-kind-CPkO-rSz.js";import{v as se}from"./ws-CS9chtfK.js";import{t as ce}from"./debounce-B9DrqirV.js";var T=e(t(),1),E=o(),[D,le]=d(`Tooltip`,[y]),O=y(),ue=`TooltipProvider`,de=700,k=`tooltip.open`,[fe,pe]=D(ue),me=e=>{let{__scopeTooltip:t,delayDuration:n=de,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=T.useRef(!0),s=T.useRef(!1),c=T.useRef(0);return T.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,E.jsx)(fe,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:T.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:T.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:T.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};me.displayName=ue;var A=`Tooltip`,[he,j]=D(A),ge=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=pe(A,e.__scopeTooltip),l=O(t),[u,d]=T.useState(null),f=ee(),m=T.useRef(0),h=o??c.disableHoverableContent,g=s??c.delayDuration,_=T.useRef(!1),[v,y]=p({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(k))):c.onClose(),a?.(e)},caller:A}),te=T.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),b=T.useCallback(()=>{window.clearTimeout(m.current),m.current=0,_.current=!1,y(!0)},[y]),x=T.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),S=T.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{_.current=!0,y(!0),m.current=0},g)},[g,y]);return T.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,E.jsx)(ne,{...l,children:(0,E.jsx)(he,{scope:t,contentId:f,open:v,stateAttribute:te,trigger:u,onTriggerChange:d,onTriggerEnter:T.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:T.useCallback(()=>{h?x():(window.clearTimeout(m.current),m.current=0)},[x,h]),onOpen:b,onClose:x,disableHoverableContent:h,children:n})})};ge.displayName=A;var M=`TooltipTrigger`,_e=T.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=j(M,n),a=pe(M,n),o=O(n),s=g(t,T.useRef(null),i.onTriggerChange),c=T.useRef(!1),d=T.useRef(!1),f=T.useCallback(()=>c.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,E.jsx)(te,{asChild:!0,...o,children:(0,E.jsx)(l.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:u(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:u(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:u(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:u(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:u(e.onBlur,i.onClose),onClick:u(e.onClick,i.onClose)})})});_e.displayName=M;var N=`TooltipPortal`,[ve,ye]=D(N,{forceMount:void 0}),be=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=j(N,t);return(0,E.jsx)(ve,{scope:t,forceMount:n,children:(0,E.jsx)(f,{present:n||a.open,children:(0,E.jsx)(m,{asChild:!0,container:i,children:r})})})};be.displayName=N;var P=`TooltipContent`,xe=T.forwardRef((e,t)=>{let n=ye(P,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=j(P,e.__scopeTooltip);return(0,E.jsx)(f,{present:r||o.open,children:o.disableHoverableContent?(0,E.jsx)(Ee,{side:i,...a,ref:t}):(0,E.jsx)(Se,{side:i,...a,ref:t})})}),Se=T.forwardRef((e,t)=>{let n=j(P,e.__scopeTooltip),r=pe(P,e.__scopeTooltip),i=T.useRef(null),a=g(t,i),[o,s]=T.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=T.useCallback(()=>{s(null),d(!1)},[d]),p=T.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ae(r,ke(r,n.getBoundingClientRect())),a=je(t.getBoundingClientRect()),o=Ne([...i,...a]);s(o),d(!0)},[d]);return T.useEffect(()=>()=>f(),[f]),T.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),T.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Me(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,E.jsx)(Ee,{...e,ref:a})}),[Ce,we]=D(A,{isInside:!1}),Te=_(`TooltipContent`),Ee=T.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=j(P,n),l=O(n),{onClose:u}=c;return T.useEffect(()=>(document.addEventListener(k,u),()=>document.removeEventListener(k,u)),[u]),T.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,E.jsx)(h,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,E.jsxs)(S,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,E.jsx)(Te,{children:r}),(0,E.jsx)(Ce,{scope:n,isInside:!0,children:(0,E.jsx)(re,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});xe.displayName=P;var De=`TooltipArrow`,Oe=T.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=O(n);return we(De,n).isInside?null:(0,E.jsx)(v,{...i,...r,ref:t})});Oe.displayName=De;function ke(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ae(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function je(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Me(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ne(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Pe(t)}function Pe(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Fe=me,Ie=ge,Le=_e,Re=be,ze=xe,Be=Fe,Ve=Ie,He=Le;function Ue({className:e,sideOffset:t=4,...n}){return(0,E.jsx)(Re,{children:(0,E.jsx)(ze,{sideOffset:t,className:s(`z-50 overflow-hidden px-2 py-1 text-xs text-fg`,x,b,`overlay-tooltip-motion`,e),...n})})}var We=c(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);function Ge({initial:e,maxLength:t,className:n,fitContent:r=!1,onCommit:i,onCancel:a}){let[o,c]=(0,T.useState)(e),l=(0,E.jsx)(`input`,{autoFocus:!0,value:o,maxLength:t,onFocus:e=>e.currentTarget.select(),onChange:e=>c(e.target.value),onBlur:()=>i(o),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?i(o):e.key===`Escape`&&a()},className:s(`bg-transparent outline-none`,r?`col-start-1 row-start-1 w-0 min-w-full p-0`:n)});return r?(0,E.jsxs)(`span`,{className:s(`inline-grid min-w-px`,n),children:[(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 whitespace-pre`,children:o||``}),l]}):l}function Ke(e){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:t=>{t.preventDefault(),e()}}}var F=null;function qe(e){return F=e,()=>{F===e&&(F=null)}}function Je(){F?.()}var I=null;function Ye(e){return I=e,()=>{I===e&&(I=null)}}async function Xe(e){if(!I)throw Error(`Open a project before opening a path.`);await I(e)}function Ze(){let e=r(se()??void 0).data?.tabTitleTemplate;return(0,T.useCallback)(t=>ae(t,e),[e])}var Qe=(0,T.createContext)({open:()=>void 0,handler:null,setHandler:()=>void 0});function $e({children:e}){let[t,n]=(0,T.useState)(null),r=(0,T.useCallback)(e=>n(()=>e),[]),i=(0,T.useCallback)(e=>t?.(e),[t]),a=(0,T.useMemo)(()=>({open:i,handler:t,setHandler:r}),[i,t,r]);return(0,E.jsx)(Qe.Provider,{value:a,children:e})}function et(){return(0,T.useContext)(Qe)}function tt({className:e,strokeScale:t=1}){return(0,E.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.8*t,strokeLinecap:`round`,"aria-hidden":!0,children:[(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`22`,y2:`12`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17`,y2:`20.66`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`7`,y2:`20.66`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`2`,y2:`12`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`7`,y2:`3.34`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17`,y2:`3.34`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17.63`,y2:`15.25`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`18.5`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`6.37`,y2:`15.25`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`6.37`,y2:`8.75`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`12`,y2:`5.5`}),(0,E.jsx)(`line`,{x1:`12`,y1:`12`,x2:`17.63`,y2:`8.75`})]})}function nt({className:e,strokeScale:t=1}){return(0,E.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.6*t,"aria-hidden":!0,children:[(0,E.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`}),(0,E.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`,transform:`rotate(60 12 12)`}),(0,E.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`,transform:`rotate(120 12 12)`})]})}function rt({className:e,strokeScale:t=1}){return(0,E.jsxs)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`none`,stroke:`currentColor`,strokeWidth:1.8*t,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,E.jsx)(`path`,{d:`M8 4H4v16h4`}),(0,E.jsx)(`path`,{d:`M16 4h4v16h-4`}),(0,E.jsx)(`rect`,{x:`10.5`,y:`10.5`,width:`3`,height:`3`,fill:`currentColor`,stroke:`none`})]})}function it({className:e}){return(0,E.jsx)(`svg`,{viewBox:`0 0 24 24`,className:e,fill:`currentColor`,"aria-hidden":!0,children:(0,E.jsx)(`path`,{d:`M12 1.5c0 5.8 4.7 10.5 10.5 10.5C16.7 12 12 16.7 12 22.5 12 16.7 7.3 12 1.5 12 7.3 12 12 7.3 12 1.5Z`})})}function at({type:e,className:t,strokeScale:n=1}){switch(e){case`claude-code`:return(0,E.jsx)(tt,{className:t,strokeScale:n});case`codex`:return(0,E.jsx)(nt,{className:t,strokeScale:n});case`opencode`:return(0,E.jsx)(rt,{className:t,strokeScale:n});case`gemini-cli`:return(0,E.jsx)(it,{className:t});default:return(0,E.jsx)(ie,{className:t,strokeWidth:2*n})}}var L=new Set,R=!1,ot=null;function st(){for(let e of L)e()}function ct(e){return L.add(e),()=>L.delete(e)}function lt(e){R!==e&&(R=e,st())}function ut(){lt(!R)}function dt(){return(0,T.useSyncExternalStore)(ct,()=>R)}function ft(e){ot=e,st()}function pt(){return(0,T.useSyncExternalStore)(ct,()=>ot)}function z(){return crypto.randomUUID()}function B(e){return e.type===`terminal`?`term:${e.session}`:`editor:${C(e.tab)}`}function V(e,t){return B(e)===B(t)}function mt(e){return e.type===`terminal`}function ht(e){return e.type===`editor`&&(e.tab.view===`linked`||e.tab.view===`locked`)}function H(e=[],t){let n=e.map(B),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:z(),tabs:e,activeKey:r,previewKey:null}}function U(e,t,n){return{kind:`split`,id:z(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function W(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=W(n,t);if(e)return e}return null}function G(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>B(e)===t)?e:null;for(let n of e.children){let e=G(n,t);if(e)return e}return null}function K(e){return e.kind===`leaf`?[e]:e.children.flatMap(K)}function q(e){return K(e).flatMap(e=>e.tabs)}function gt(e){return e.kind===`leaf`?[e.id]:[e.id,...e.children.flatMap(gt)]}function _t(e){let t=gt(e);return new Set(t).size!==t.length}function vt(e){return e.kind===`leaf`?{...e,id:z()}:{...e,id:z(),children:e.children.map(vt)}}function yt(e){if(!_t(e))return e;let t=new Set,n=e=>{let r=t.has(e.id)?z():e.id;return t.add(r),e.kind===`leaf`?{...e,id:r}:{...e,id:r,children:e.children.map(n)}};return n(e)}function bt(e){let t=e.tabs.map(B),n=e.activeKey&&t.includes(e.activeKey)?e.activeKey:t[0]??null,r=e.previewKey&&t.includes(e.previewKey)?e.previewKey:null;return n===e.activeKey&&r===(e.previewKey??null)?e:{...e,activeKey:n,previewKey:r}}function J(e){if(e.kind===`leaf`)return bt(e);let t=e.children.map(J),n=[],r=[];t.forEach((t,i)=>{let a=e.sizes[i]??1;if(t.kind===`split`&&t.direction===e.direction){let e=t.sizes.reduce((e,t)=>e+t,0)||t.children.length;t.children.forEach((i,o)=>{n.push(i),r.push(a*(t.sizes[o]??1)/e)})}else n.push(t),r.push(a)});let i=[],a=[];return n.forEach((e,t)=>{e.kind===`leaf`&&e.tabs.length===0||(i.push(e),a.push(r[t]??1))}),i.length===0?H([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function Y(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>Y(e,t,n))}}function xt(e,t,n){return Y(e,t,e=>{if(!e.tabs.some(e=>B(e)===n))return e;let t=e.tabs.filter(e=>B(e)!==n),r=e.activeKey===n?St(e,n):e.activeKey;return{...e,tabs:t,activeKey:r}})}function St(e,t){let n=e.tabs.findIndex(e=>B(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>B(e)!==t);return r.length===0?null:B(r[Math.min(n,r.length-1)])}function Ct(e,t,n){let r=e.tabs.filter(e=>!V(e,t)),i=n===void 0?r.length:Math.max(0,Math.min(n,r.length)),a=[...r.slice(0,i),t,...r.slice(i)];return{...e,tabs:a,activeKey:B(t)}}function wt(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return J(Y(e,t,e=>{let t=H([r]);return U(i,a?[t,e]:[e,t],[50,50])}))}function Tt(e,t){let{fromLeafId:n,toLeafId:r,edge:i}=t;if(n===r)return e;let a=W(e,n),o=W(e,r);if(!a||!o)return e;if(i===`center`){let t=e=>e.kind===`leaf`?e.id===n?o:e.id===r?a:e:{...e,children:e.children.map(t)};return t(e)}let s=J(Y(e,n,e=>({...e,tabs:[],activeKey:null,previewKey:null}))),c=i===`left`||i===`right`?`row`:`col`,l=i===`left`||i===`top`;return J(Y(s,r,e=>U(c,l?[a,e]:[e,a],[50,50])))}function Et(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=B(n),o=t.copy===!0&&!mt(n),s=t.index;if(i===`center`&&s!==void 0){let t=W(e,r)?.tabs.findIndex(e=>B(e)===a)??-1;t!==-1&&t<s&&--s}let c=o?e:xt(e,t.fromLeafId,a);if(i===`center`){let e=Y(c,r,e=>Ct(e,n,s));return!W(e,r)&&!G(e,a)?X(J(Dt(e,n)),a):X(J(e),a)}return W(c,r)?X(wt(c,r,i,n),a):J(H([n]))}function Dt(e,t){let n=K(e)[0];return n?Y(e,n.id,e=>Ct(e,t)):H([t])}function Ot(e,t,n){return J(Y(e,t,e=>e.tabs.some(e=>B(e)===n)?{...e,tabs:e.tabs.filter(e=>B(e)!==n),activeKey:e.activeKey===n?St(e,n):e.activeKey}:e))}function kt(e,t,n){let r=B(n);return J(Y(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>V(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function At(e,t,n){let r=B(n);return J(Y(e,t,e=>e.tabs.some(e=>B(e)===r)?{...e,tabs:e.tabs.map(e=>B(e)===r?n:e),previewKey:e.previewKey===r?null:e.previewKey}:{...e,tabs:[...e.tabs,n]}))}function jt(e,t,n){let r=B(n);return Y(e,t,e=>({...e,tabs:e.tabs.map(e=>B(e)===r?n:e)}))}function Mt(e,t,n){let r=C(t),i=e=>e.kind===`split`?{...e,children:e.children.map(i)}:{...e,tabs:e.tabs.map(e=>e.type===`editor`&&C(e.tab)===r?{...e,tab:{...e.tab,compile_mode:n}}:e)};return i(e)}function Nt(e,t){return e.type!==`editor`||t.type!==`editor`||e.tab.view!==`preview`||t.tab.view!==void 0||oe(t.tab.path)===null?t:{...t,tab:{...t.tab,view:`preview`}}}function Pt(e,t,n){let r=B(n);return J(Y(e,t,e=>{if(e.tabs.some(e=>V(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>B(t)===e.previewKey):-1,i=t>=0?e.tabs[t]:void 0,a=e.tabs.length>1&&i!==void 0&&!mt(i)&&!ht(i),o=i?Nt(i,n):n,s=a?e.tabs.map((e,n)=>n===t?o:e):[...e.tabs,o];return{...e,tabs:s,activeKey:r,previewKey:r}}))}function X(e,t){let n=e=>e.kind===`leaf`?e.previewKey===t?{...e,previewKey:null}:e:{...e,children:e.children.map(n)};return n(e)}function Ft(e,t,n,r){return Y(e,t,e=>{let t=e.tabs.findIndex(e=>e.type===`editor`&&B(e)===n),i=t>=0?e.tabs[t]:void 0;if(i===void 0||i.type!==`editor`)return e;let a={...i,tab:{...i.tab,view:r}},o=B(a);if(o===n)return{...e,tabs:e.tabs.map((e,n)=>n===t?a:e)};let s=e.tabs.some((e,n)=>n!==t&&B(e)===o),c=s?e.tabs.filter((e,n)=>n!==t):e.tabs.map((e,n)=>n===t?a:e);return{...e,tabs:c,activeKey:e.activeKey===n?o:e.activeKey,previewKey:e.previewKey===n?s?null:o:e.previewKey??null}})}function It(e,t){let n=w(e);return n!==`commit`&&n!==`untitled`&&e.session===t.session&&e.path===t.path&&e.root===t.root}function Lt(e,t,n){if(n===t.path)return e;let r=!1,i=e=>{if(e.kind===`split`){let t=e.children.map(i);return t.some((t,n)=>t!==e.children[n])?{...e,children:t}:e}let a=new Map,o=!1,s=e.tabs.map(e=>{if(e.type!==`editor`||!It(e.tab,t))return e;let r={...e,tab:{...e.tab,path:n}};return a.set(B(e),B(r)),o=!0,r});if(!o)return e;r=!0;let c=e.activeKey,l=e.previewKey??null;return{...e,tabs:s,activeKey:c===null?null:a.get(c)??c,previewKey:l===null?null:a.get(l)??l}},a=i(e);return r?a:e}function Rt(e){if(e.type!==`editor`)return null;let t=e.tab,n=w(t);return n!==`file`&&n!==`external`||t.view===`linked`||t.view===`locked`||oe(t.path)===null?null:t}function zt(e,t){let n=Rt(t);if(!n)return e;let r=!1,i=e=>{if(e.kind===`split`)return{...e,children:e.children.map(i)};let t=!1,a=e.tabs.map(e=>{if(e.type!==`editor`||!ht(e))return e;let r=e.tab;return r.session===n.session&&r.path===n.path&&(r.root??``)===(n.root??``)&&w(r)===w(n)?e:(t=!0,{type:`editor`,tab:{session:n.session,path:n.path,...n.kind===void 0?{}:{kind:n.kind},...n.root===void 0?{}:{root:n.root},view:r.view}})});return t?(r=!0,{...e,tabs:a}):e},a=i(e);return r?a:e}function Bt(e,t){return e.session===t.session&&e.path===t.path&&(e.root??``)===(t.root??``)&&w(e)===w(t)}function Vt(e,t,n){let r=K(e).flatMap(e=>e.tabs.flatMap(n=>n.type!==`editor`||n.tab.view===`linked`||n.tab.view===`locked`||!Bt(n.tab,t)?[]:[{leafId:e.id,ref:n}]));return r.find(({leafId:e})=>e===n)??r.find(({ref:e})=>(e.tab.view??`source`)===`source`)??r[0]??null}function Ht(e,t,n){return Y(e,t,e=>e.tabs.some(e=>B(e)===n)?{...e,activeKey:n}:e)}function Ut(e,t,n){function r(e){return e.kind===`leaf`?e:e.id===t&&n.length===e.children.length?{...e,children:e.children.map(r),sizes:[...n]}:{...e,children:e.children.map(r)}}return r(e)}function Wt(e){let t=e.type===`terminal`?e.session:e.tab.session;return t===`00000000-0000-0000-0000-000000000000`?null:t}function Gt(e){return t=>{let n=Wt(t);return n===null||e.has(n)}}function Z(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return J(n(e))}function Kt(e){let t=new Set,n=[];for(let r of e){let e=J(Z(r,e=>!t.has(B(e)))),i=q(e);if(i.length!==0){for(let e of i)t.add(B(e));n.push(e)}}return n.length===0?H([]):yt(n.length===1?n[0]:J(U(`row`,n)))}function qt(e){let t=e.editor_tabs.map(e=>({type:`editor`,tab:e})),n=e.session_tabs.map(e=>({type:`terminal`,session:e})),r=e.active_editor_tab?B({type:`editor`,tab:e.active_editor_tab}):null,i=e.active_session?`term:${e.active_session}`:null;if(t.length===0&&n.length===0)return H([]);if(t.length===0)return H(n,i);if(n.length===0)return H(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return J(U(`col`,[H(t,r),H(n,i)],[o,s]))}function Jt(e){return JSON.stringify(Yt(e))}function Yt(e){return e===null?null:e.kind===`leaf`?e.tabs.length===0?null:{t:e.tabs.map(B)}:{d:e.direction,s:e.sizes.map(e=>Math.round(e*10)/10),c:e.children.map(Yt)}}var Q=new Set,$=!1,Xt=null;function Zt(){for(let e of Q)e()}function Qt(e){return Q.add(e),()=>Q.delete(e)}function $t(e){$!==e&&($=e,Zt())}function en(){$t(!$)}function tn(){return(0,T.useSyncExternalStore)(Qt,()=>$)}function nn(e){Xt=e,Zt()}function rn(){return(0,T.useSyncExternalStore)(Qt,()=>Xt)}var an={layout_tree:null,active_session:null,layout_ref:null};function on(e){return e.type===`terminal`?e.session:e.tab.session}function sn(e,t){let n=new Set;for(let[r,i]of Object.entries(e))if(!(r===t||!i.layout_tree))for(let e of q(i.layout_tree))e.type===`terminal`&&n.add(e.session);return[...n]}function cn(e,t){let n=e.project_layouts[t];return{...e,layout_tree:n?.layout_tree??null,active_session:n?.active_session??null,layout_ref:n?.layout_ref??null,session_tabs:[],editor_tabs:[],active_editor_tab:null}}function ln(e,t,n){return n?{loaded:e.loaded,snapshot:cn(e.snapshot,t),current:()=>cn(e.current(),t),update(n){let r={},i={...n};if(`layout_tree`in n&&(r.layout_tree=n.layout_tree??null,delete i.layout_tree),`active_session`in n&&(r.active_session=n.active_session??null,delete i.active_session),`layout_ref`in n&&(r.layout_ref=n.layout_ref??null,delete i.layout_ref),Object.keys(r).length>0){let n=e.current().project_layouts;i.project_layouts={...n,[t]:{...n[t]??an,...r}}}Object.keys(i).length>0&&e.update(i)}}:e}function un(e,t,n,r){let i=e.layout_tree??qt(e),a={};for(let o of t)a[o]={layout_tree:vt(Z(i,e=>{let i=on(e);return i===`00000000-0000-0000-0000-000000000000`?o===(r??t[0]):n.get(i)===o})),active_session:e.active_session!==null&&n.get(e.active_session)===o?e.active_session:null,layout_ref:null};return{layout_mode:`project`,project_layouts:a}}function dn(e,t,n={}){return{...e,...t,...n}}function fn(e,t,n){let r=t.layout_tree?Z(t.layout_tree,e=>{let t=on(e);return t===`00000000-0000-0000-0000-000000000000`||n.alive.has(t)}):null,i=t.active_session!==null&&n.alive.has(t.active_session)?t.active_session:null;if(t.scope===`profile`)return{projectBased:!1,patch:{layout_mode:`profile`,layout_tree:r,active_session:i,layout_ref:t.id}};let a=t.project_id??n.currentProject??n.projectIds[0]??``,o={layout_tree:r,active_session:i,layout_ref:t.id};if((e.layout_mode??`profile`)===`project`)return{projectBased:!0,patch:{project_layouts:{...e.project_layouts,[a]:o}}};let s=un(e,n.projectIds,n.sessionProject,a);return{projectBased:!0,patch:{...s,project_layouts:dn(s.project_layouts??{},e.project_layouts,{[a]:o})}}}function pn(e,t){let n=e.project_layouts,r=[...t.filter(e=>e in n),...Object.keys(n).filter(e=>!t.includes(e))].map(e=>n[e]);return{layout_mode:`profile`,project_layouts:{},layout_tree:Kt(r.map(e=>e.layout_tree).filter(e=>e!==null)),active_session:r.map(e=>e.active_session).find(e=>e!==null)??null,layout_ref:null}}var mn=2e3,hn=a.parse({});function gn(e){return`puddle.ws.${e}`}function _n(e){if(e===null)return{kind:`absent`};try{return{kind:`present`,snapshot:a.parse(JSON.parse(e))}}catch{return{kind:`corrupt`}}}function vn(){let e=se(),[t,r]=(0,T.useState)(!1),[a,o]=(0,T.useState)(hn),s=(0,T.useRef)(a);s.current=a;let c=(0,T.useRef)(null),l=(0,T.useMemo)(()=>ce((e,t)=>{n(e,t).catch(e=>console.warn(`ui-state save failed: ${e.message}`))},mn),[]);return(0,T.useEffect)(()=>{if(e===null){c.current=null;return}let t=gn(e);c.current=t;let n=!1;r(!1),o(hn);let a;try{a=_n(sessionStorage.getItem(t)),a.kind===`corrupt`&&sessionStorage.removeItem(t)}catch(e){console.warn(`ui-state read failed: ${e.message}`),a={kind:`absent`}}return a.kind===`present`?(o(a.snapshot),r(!0)):i(e).then(e=>{n||(e&&o(e.ui_state),r(!0))}).catch(e=>{console.warn(`ui-state load failed: ${e.message}`),n||r(!0)}),()=>{n=!0,l.flush()}},[e,l]),{loaded:t,snapshot:a,current:()=>s.current,update(t){if(e===null)return;let n={...s.current,...t};s.current=n,o(n);let r=c.current??gn(e);l(e,n);try{sessionStorage.setItem(r,JSON.stringify(n))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}}}}export{Je as $,H as A,B,Tt as C,Ht as D,q as E,Ut as F,pt as G,ft as H,zt as I,$e as J,dt as K,Mt as L,X as M,Z as N,G as O,Lt as P,Ye as Q,Ft as R,yt as S,W as T,lt as U,jt as V,ut as W,Ze as X,et as Y,Xe as Z,kt as _,dn as a,Ue as at,qt as b,un as c,$t as d,qe as et,en as f,At as g,Jt as h,fn as i,Ve as it,Pt as j,Rt as k,pn as l,tn as m,vn as n,Ke as nt,sn as o,Be as ot,rn as p,at as q,gn as r,We as rt,ln as s,He as st,_n as t,Ge as tt,nn as u,K as v,Et as w,Ot as x,Gt as y,Vt as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n}from"./auth-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n}from"./auth-C3ruG3fE.js";var r=e(t(),1),i=(0,r.createContext)(``);function a(e,t){let a=(0,r.useContext)(i);return n(JSON.stringify([a,e,t]))}var o=class{limit;entries=new Map;constructor(e=500){this.limit=e}get(e){let t=this.entries.get(e);return t!==void 0&&(this.entries.delete(e),this.entries.set(e,t)),t}set(e,t){for(this.entries.delete(e),this.entries.set(e,t);this.entries.size>this.limit;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}};export{i as n,a as r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-C9A1vLE-.js";var t=e(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]);export{t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-C9A1vLE-.js";var t=e(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),n=e(`regex`,[[`path`,{d:`M17 3v10`,key:`15fgeh`}],[`path`,{d:`m12.67 5.5 8.66 5`,key:`1gpheq`}],[`path`,{d:`m12.67 10.5 8.66-5`,key:`1dkfa6`}],[`path`,{d:`M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z`,key:`swwfx4`}]]),r=e(`whole-word`,[[`circle`,{cx:`7`,cy:`12`,r:`3`,key:`12clwm`}],[`path`,{d:`M10 9v6`,key:`17i7lo`}],[`circle`,{cx:`17`,cy:`12`,r:`3`,key:`gl7c2s`}],[`path`,{d:`M14 7v8`,key:`dl84cr`}],[`path`,{d:`M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1`,key:`lt2kga`}]]);export{n,t as r,r as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{i as n,n as r,o as i,r as a}from"./auth-C3ruG3fE.js";import{t as o}from"./desktop-Bl69_YmL.js";import{n as s}from"./dist-BOS6OKSE.js";var c=e(t(),1),l=n(`puddle.profile-id`);function u(){let e=(0,c.useSyncExternalStore)(l.subscribe,l.get);return e!==null&&/^[0-9a-f]{10}$/.test(e)?e:null}function d(e){window.location.pathname!==`/`&&window.history.replaceState(null,``,`/`),l.set(e)}var f=[`Layout & tabs`,`Editor`,`Left sidebar`,`Right sidebar`],p=[{id:`host.peek`,label:`Show host identity (hold)`,group:`Layout & tabs`,defaultBinding:typeof navigator<`u`&&/Mac/.test(navigator.platform)?`alt+meta+Slash`:`ctrl+alt+Slash`,hold:!0},{id:`palette.toggle`,label:`Command palette`,group:`Layout & tabs`,defaultBinding:`meta+KeyK`},{id:`tab.close`,label:`Close current tab`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyW`,desktopBinding:`meta+KeyW`},{id:`tab.reopen`,label:`Reopen last closed tab`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyT`,desktopBinding:`shift+meta+KeyT`},{id:`tab.newUntitled`,label:`New untitled file`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyN`,desktopBinding:`meta+KeyN`},{id:`tab.next`,label:`Next tab in pane`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+BracketRight`,desktopBinding:`ctrl+Tab`},{id:`tab.prev`,label:`Previous tab in pane`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+BracketLeft`,desktopBinding:`ctrl+shift+Tab`},{id:`window.close`,label:`Close window`,group:`Layout & tabs`,defaultBinding:`meta+KeyW`,desktopBinding:`shift+meta+KeyW`},{id:`sidebar.left`,label:`Toggle left sidebar`,group:`Layout & tabs`,defaultBinding:`alt+meta+Comma`,desktopBinding:`meta+KeyB`},{id:`sidebar.right`,label:`Toggle right sidebar`,group:`Layout & tabs`,defaultBinding:`alt+meta+Period`,desktopBinding:`shift+meta+KeyB`},{id:`editor.save`,label:`Save`,group:`Editor`,defaultBinding:`meta+KeyS`,editor:!0},{id:`editor.wordWrap`,label:`Toggle word wrap`,group:`Editor`,defaultBinding:`alt+KeyZ`,editor:!0},{id:`nav.files`,label:`Open Files`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyE`},{id:`nav.search`,label:`Open Search`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyF`},{id:`nav.changes`,label:`Open Changes`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyV`},{id:`nav.worktrees`,label:`Open Worktrees`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyB`},{id:`session.newAgent`,label:`New agent`,group:`Right sidebar`,defaultBinding:`ctrl+alt+Backquote`,desktopBinding:`meta+KeyT`},{id:`session.newTerminal`,label:`New terminal`,group:`Right sidebar`,defaultBinding:`ctrl+Backquote`},{id:`scratchpad.toggle`,label:`Toggle Scratchpad`,group:`Right sidebar`,defaultBinding:`alt+meta+KeyS`},{id:`layouts.toggle`,label:`Toggle Layouts`,group:`Right sidebar`,defaultBinding:`alt+meta+KeyL`}],m=new Map(p.map(e=>[e.id,e])),h=typeof window<`u`&&o()!==void 0;function g(e,t=h){return t&&e.desktopBinding?e.desktopBinding:e.defaultBinding}function _(e){let t=e.code;if(!t||/^(Control|Alt|Shift|Meta)(Left|Right)$/.test(t))return null;let n=[];return e.ctrlKey&&n.push(`ctrl`),e.altKey&&n.push(`alt`),e.shiftKey&&n.push(`shift`),e.metaKey&&n.push(`meta`),n.length===0?null:(n.push(t),n.join(`+`))}var v={ctrl:`⌃`,alt:`⌥`,shift:`⇧`,meta:`⌘`},y={Comma:`,`,Period:`.`,Backquote:"`",Slash:`/`,Backslash:`\\`,Minus:`-`,Equal:`=`,Space:`␣`,Enter:`↵`,Escape:`Esc`,Tab:`⇥`,BracketLeft:`[`,BracketRight:`]`};function b(e){return e.startsWith(`Key`)?e.slice(3):e.startsWith(`Digit`)?e.slice(5):y[e]??e}function x(e){if(!e)return`—`;let t=e.split(`+`),n=t.pop()??``;return t.map(e=>v[e]??e).join(``)+b(n)}var S=new Map;function C(e,t){return S.set(e,t),()=>{S.get(e)===t&&S.delete(e)}}var w=e=>S.get(e),T=e=>m.get(e);function E(e,t){return e.hold===!0||e.id===`editor.save`||t&&e.editor!==!0}var D={},O=new Set,k=A();function A(){let e={};for(let t of p)e[t.id]=D[t.id]||g(t);return e}function j(e){D=e??{},k=A(),O.forEach(e=>e())}var M=e=>k[e]??``;function N(e){for(let[t,n]of Object.entries(k))if(n===e)return t}function P(e){return x(F()[e]??``)}function F(){return(0,c.useSyncExternalStore)(e=>(O.add(e),()=>O.delete(e)),()=>k)}var I=500,L=1e4;function R(e,t){return`${e} ${t}`}var z=new class{ws=null;open=!1;backoff=I;reconnectTimer=null;theme=null;terminals=new Map;notificationListeners=new Set;statusListeners=new Set;renameListeners=new Set;accountListeners=new Set;switchListeners=new Set;sessionsChangedListeners=new Set;hostUpdatesListeners=new Set;connectionListeners=new Set;shellWaiters=new Map;attach(e,t,n,r,i){let a={session:e,term:t,cols:n,rows:r,handlers:i,ready:!1,live:!1,pendingResize:!1};return this.terminals.set(R(e,t),a),this.ensureConnected(),this.open&&this.send({t:`attach`,session:e,term:t,cols:n,rows:r}),()=>this.detach(e,t)}detach(e,t){this.terminals.delete(R(e,t))&&this.open&&this.send({t:`detach`,session:e,term:t})}write(e,t,n){this.open&&this.terminals.get(R(e,t))?.ready&&this.send({t:`stdin`,session:e,term:t,data:n})}resize(e,t,n,r){let i=this.terminals.get(R(e,t));i&&(i.cols=n,i.rows=r,this.open&&i.ready?this.send({t:`resize`,session:e,term:t,cols:n,rows:r}):i.pendingResize=!0)}spawnShell(e){return this.ensureConnected(),this.open?new Promise((t,n)=>{let r=this.shellWaiters.get(e)??[];r.push({resolve:t,reject:n}),this.shellWaiters.set(e,r),this.open&&this.send({t:`spawn-shell`,session:e})}):Promise.reject(Error(`Connection is unavailable`))}killShell(e,t){this.open&&this.send({t:`kill-shell`,session:e,term:t})}onStatus(e){return this.statusListeners.add(e),this.ensureConnected(),()=>this.statusListeners.delete(e)}onAgentNotification(e){return this.notificationListeners.add(e),this.ensureConnected(),()=>this.notificationListeners.delete(e)}onRenamed(e){return this.renameListeners.add(e),this.ensureConnected(),()=>this.renameListeners.delete(e)}onAccount(e){return this.accountListeners.add(e),this.ensureConnected(),()=>this.accountListeners.delete(e)}onSessionSwitched(e){return this.switchListeners.add(e),this.ensureConnected(),()=>this.switchListeners.delete(e)}onSessionsChanged(e){return this.sessionsChangedListeners.add(e),this.ensureConnected(),()=>this.sessionsChangedListeners.delete(e)}onConnectionChange(e){return this.connectionListeners.add(e),()=>this.connectionListeners.delete(e)}onHostUpdatesChanged(e){return this.hostUpdatesListeners.add(e),this.ensureConnected(),()=>this.hostUpdatesListeners.delete(e)}isConnected(){return this.open}reportTheme(e,t){this.theme&&this.theme.fg===e&&this.theme.bg===t||(this.theme={fg:e,bg:t},this.open&&this.send({t:`theme`,fg:e,bg:t}))}reset(){this.ws?.close()}switchHost(){let e=this.ws;this.ws=null,this.open=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.terminals.clear();for(let e of this.shellWaiters.values())for(let t of e)t.reject(Error(`Host changed`));this.shellWaiters.clear(),e?.close();for(let e of this.connectionListeners)e(!1)}ensureConnected(){this.ws||this.reconnectTimer||this.connect()}connect(){let e=a.get(),t=i();if(!e&&!t)return;let n=window.location.protocol===`https:`?`wss`:`ws`,o=t?t.socket():new WebSocket(`${n}://${window.location.host}/ws`);this.ws=o,o.addEventListener(`open`,()=>{if(this.ws!==o){o.close();return}t||o.send(JSON.stringify({t:`auth`,token:e}))}),o.addEventListener(`message`,e=>{if(this.ws!==o)return;let t;try{t=JSON.parse(String(e.data))}catch{return}if(t.t===`authenticated`){if(this.open)return;this.open=!0,this.backoff=I,this.send({t:`subscribe-status`}),this.theme&&this.send({t:`theme`,...this.theme});for(let e of this.terminals.values()){e.ready=!1,e.pendingResize=!1;let{session:t,term:n,cols:r,rows:i}=e;this.send({t:`attach`,session:t,term:n,cols:r,rows:i})}for(let e of this.connectionListeners)e(!0)}else this.open&&this.handle(t)}),o.addEventListener(`close`,e=>{if(this.ws!==o)return;let t=this.open;this.open=!1,this.ws=null;for(let e of this.shellWaiters.values())for(let t of e)t.reject(Error(`Connection lost; operation outcome is unknown`));if(this.shellWaiters.clear(),t)for(let e of this.connectionListeners)e(!1);if(e.code===4401&&e.reason===`browser_rejected`){r();return}this.scheduleReconnect()})}scheduleReconnect(){this.reconnectTimer||this.terminals.size===0&&this.statusListeners.size===0&&this.notificationListeners.size===0&&this.renameListeners.size===0&&this.accountListeners.size===0&&this.switchListeners.size===0&&this.sessionsChangedListeners.size===0||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},this.backoff),this.backoff=Math.min(this.backoff*2,L))}send(e){this.open&&this.ws?.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}handle(e){switch(e.t){case`agent-notification`:for(let t of this.notificationListeners)t(e);break;case`replay`:{let t=this.terminals.get(R(e.session,e.term));if(!t)break;if(t.ready=!0,t.pendingResize){t.pendingResize=!1;let{session:e,term:n,cols:r,rows:i}=t;this.send({t:`resize`,session:e,term:n,cols:r,rows:i})}t.handlers.onData(e.data,e.t);break}case`output`:this.terminals.get(R(e.session,e.term))?.handlers.onData(e.data,e.t);break;case`exit`:{let t=this.terminals.get(R(e.session,e.term));t&&(t.ready=!1,t.handlers.onExit?.(e.code)),e.term===`agent`&&t&&(t.live=!1);break}case`status`:{let t=[`starting`,`running`,`waiting_input`].includes(e.status);for(let n of this.terminals.values())if(!(n.session!==e.session||n.term!==`agent`)){if(t&&!n.live){n.ready=!1,n.pendingResize=!1;let{session:e,term:t,cols:r,rows:i}=n;this.send({t:`attach`,session:e,term:t,cols:r,rows:i})}n.live=t}for(let t of this.statusListeners)t({session:e.session,status:e.status,last_activity_at:e.last_activity_at});break}case`renamed`:for(let t of this.renameListeners)t({session:e.session,title:e.title,agent_title:e.agent_title,osc_title:e.osc_title});break;case`account`:for(let t of this.accountListeners)t({account_id:e.account_id,profile_id:e.profile_id,logged_in:e.logged_in});break;case`session-switched`:for(let t of this.switchListeners)t(e);break;case`sessions-changed`:for(let t of this.sessionsChangedListeners)t(e);break;case`host-updates-changed`:for(let e of this.hostUpdatesListeners)e();break;case`shell-spawned`:{let t=this.shellWaiters.get(e.session)?.shift();t&&t.resolve(e.term);break}case`notice`:(e.level===`warning`?s.warning:s.error)(e.title,{...e.detail===void 0?{}:{description:e.detail},duration:12e3});break;case`error`:s.error(`Connection error`,{description:e.message});break}}};export{d as _,_ as a,w as c,C as d,j as f,l as g,P as h,N as i,M as l,F as m,p as n,x as o,g as p,f as r,T as s,z as t,E as u,u as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./createLucideIcon-C9A1vLE-.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|
package/dist/public/index.html
CHANGED
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
// Storage disabled or unreadable: the module's own init still runs.
|
|
48
48
|
}
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-BuNmxuXx.js"></script>
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-CZI7_Jkm.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/react-dom-cJyBB_A4.js">
|
|
54
|
-
<link rel="modulepreload" crossorigin href="/assets/auth-
|
|
55
|
-
<link rel="modulepreload" crossorigin href="/assets/client-settings-
|
|
54
|
+
<link rel="modulepreload" crossorigin href="/assets/auth-C3ruG3fE.js">
|
|
55
|
+
<link rel="modulepreload" crossorigin href="/assets/client-settings-BdKglwtW.js">
|
|
56
56
|
<link rel="modulepreload" crossorigin href="/assets/theme-swfNLod9.js">
|
|
57
57
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-By8HlURe.js">
|
|
58
58
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
59
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
59
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CHGSBAX2.css">
|
|
60
60
|
</head>
|
|
61
61
|
<body>
|
|
62
62
|
<div id="root"></div>
|