@puddle-code/cli 0.3.9 → 0.3.10
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 +7 -11
- package/dist/host-control.mjs +228 -171
- package/dist/index.js +258 -200
- package/dist/public/assets/App-CNB4a07v.js +2 -0
- package/dist/public/assets/Dashboard-v3OproVW.js +1 -0
- package/dist/public/assets/{EditorTabClose-BolUnwz9.js → EditorTabClose-DwhahpvS.js} +1 -1
- package/dist/public/assets/{FindWidget-BUmuGtbd.js → FindWidget-CVH9U-_P.js} +1 -1
- package/dist/public/assets/{LazyTerminal-BRPy9Nm5.js → LazyTerminal-CgQryH0p.js} +2 -2
- package/dist/public/assets/{ModelRefcount-DdSmsCyg.js → ModelRefcount-njA_f4bS.js} +1 -1
- package/dist/public/assets/NewProjectDialog-BT8rR4yn.js +1 -0
- package/dist/public/assets/NotebookWidget-Cwd77EGL.js +7 -0
- package/dist/public/assets/PaneEditorBody-RaUBrZPu.js +303 -0
- package/dist/public/assets/PdfViewer-Bppu4-0-.js +2 -0
- package/dist/public/assets/SettingsDialog-CaHklYzG.js +8 -0
- package/dist/public/assets/{Terminal-WzMZyNl-.js → Terminal-_10Xyj1h.js} +5 -5
- package/dist/public/assets/Workspace-GgVr1uYN.js +20 -0
- package/dist/public/assets/_virtual_notebook-widget-runtime-Dro422xS.js +6966 -0
- package/dist/public/assets/api-i6xNY3bF.js +1 -0
- package/dist/public/assets/auth-GfOuXpIe.js +64 -0
- package/dist/public/assets/{buffer-store-BcKRO2bQ.js → buffer-store-eMnMxbpI.js} +1 -1
- package/dist/public/assets/{button-Chvl9hcE.js → button-BgeBH2Uc.js} +1 -1
- package/dist/public/assets/{command-CaE1P1RF.js → command-D7m0dmA-.js} +1 -1
- package/dist/public/assets/context-DW21k43a.js +1 -0
- package/dist/public/assets/{context-menu-BTe3xVbd.js → context-menu-CMWkmDu6.js} +1 -1
- package/dist/public/assets/dialog-BMWRC2HO.js +41 -0
- package/dist/public/assets/disclosure-CHXbNzgZ.js +1 -0
- package/dist/public/assets/dist-BOS6OKSE.js +1 -0
- package/dist/public/assets/{dist-BYGE8AQe.js → dist-C_x5-hi8.js} +1 -1
- package/dist/public/assets/{dist-CYLjuW55.js → dist-Cde1E3eV.js} +1 -1
- package/dist/public/assets/{dist-gLP0NXk8.js → dist-Ds3438NL.js} +1 -1
- package/dist/public/assets/errors-O9DWXa3f.js +1 -0
- package/dist/public/assets/forward-link-RM7_5Shu.js +1 -0
- package/dist/public/assets/hotkeys-1uTWFYAL.js +1 -0
- package/dist/public/assets/index-CPHfr3MU.css +2 -0
- package/dist/public/assets/{index-Dp8dqiUy.js → index-np8JXeG6.js} +3 -3
- package/dist/public/assets/input-CxgRsoVg.js +1 -0
- package/dist/public/assets/jsx-runtime-By8HlURe.js +1 -0
- package/dist/public/assets/{markdown-mermaid-BX4brFyy.js → markdown-mermaid-CNYDlgGt.js} +1 -1
- package/dist/public/assets/media-refresh-store-Bu4kWCGq.js +1 -0
- package/dist/public/assets/notification-delivery-Dfvdt_1U.js +1 -0
- package/dist/public/assets/{popover-C20E0SGw.js → popover-CCHRaCvX.js} +1 -1
- package/dist/public/assets/protocol-support-BGmIChNK.js +1 -0
- package/dist/public/assets/{jsx-runtime-ffCh33zF.js → react-dom-cJyBB_A4.js} +1 -1
- package/dist/public/assets/{scroll-restoration-DTBzWrDT.js → scroll-restoration-OVgiE4G9.js} +1 -1
- package/dist/public/assets/select-Bg0rWqco.js +1 -0
- package/dist/public/assets/selection-actions-D875GPFU.js +1 -0
- package/dist/public/assets/{session-order-iDEtZwje.js → session-order-f7QxTbVD.js} +1 -1
- package/dist/public/assets/{switch-B1uGC2PW.js → switch-DhNyUV8C.js} +1 -1
- package/dist/public/assets/use-ui-state-CHqXhyx4.js +1 -0
- package/dist/public/assets/{ws-DfRorDqa.js → ws-CMPCIzY4.js} +1 -1
- package/dist/public/index.html +5 -4
- package/dist/pudl.js +245 -188
- package/package.json +1 -1
- package/dist/public/assets/App-BaLhdtWg.js +0 -2
- package/dist/public/assets/Dashboard-LVU8bCcQ.js +0 -1
- package/dist/public/assets/NewProjectDialog-BFguzZCI.js +0 -1
- package/dist/public/assets/PaneEditorBody-DBW-O4q7.js +0 -303
- package/dist/public/assets/PdfViewer-Q6yROHsM.js +0 -2
- package/dist/public/assets/SettingsDialog-DoVdLwtQ.js +0 -8
- package/dist/public/assets/Workspace-BxGgvBCU.js +0 -20
- package/dist/public/assets/auth-ngM0Ffss.js +0 -64
- package/dist/public/assets/dialog-yvLGI8FJ.js +0 -41
- package/dist/public/assets/disclosure-0ZiECVHr.js +0 -1
- package/dist/public/assets/dist-CwwiP1WN.js +0 -1
- package/dist/public/assets/errors-yaab6YK_.js +0 -1
- package/dist/public/assets/forward-link-kfVuUsZP.js +0 -1
- package/dist/public/assets/index-CItoWyyj.css +0 -2
- package/dist/public/assets/input-DDhYsCUG.js +0 -1
- package/dist/public/assets/media-refresh-store-D3rBSq4q.js +0 -1
- package/dist/public/assets/notification-delivery-B__ASJZR.js +0 -1
- package/dist/public/assets/protocol-support-BNUfFPAF.js +0 -1
- package/dist/public/assets/select-DQmSVYUL.js +0 -1
- package/dist/public/assets/selection-actions-JLWPcaUH.js +0 -1
- package/dist/public/assets/use-ui-state-jAfsiEpt.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./auth-ngM0Ffss.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{t as r}from"./createLucideIcon-DyMAgLa3.js";var i=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,a=/^[\\/]{2}/;function o(e,t){return t+e.replace(/\\/g,`/`)}var s=`popstate`;function c(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function l(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return m(``,{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:h(t)}return _(t,n,null,e)}function u(e,t){if(e===!1||e==null)throw Error(t)}function d(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function f(){return Math.random().toString(36).substring(2,10)}function p(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 m(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?g(t):t,state:n,key:t&&t.key||r||f(),mask:i}}function h({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 g(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 _(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=`POP`,u=null,d=f();d??(d=0,o.replaceState({...o.state,idx:d},``));function f(){return(o.state||{idx:null}).idx}function h(){l=`POP`;let e=f(),t=e==null?null:e-d;d=e,u&&u({action:l,location:b.location,delta:t})}function g(e,t){l=`PUSH`;let r=c(e)?e:m(b.location,e,t);n&&n(r,e),d=f()+1;let s=p(r,d),h=b.createHref(r.mask||r);try{o.pushState(s,``,h)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(h)}a&&u&&u({action:l,location:b.location,delta:1})}function _(e,t){l=`REPLACE`;let r=c(e)?e:m(b.location,e,t);n&&n(r,e),d=f();let i=p(r,d),s=b.createHref(r.mask||r);o.replaceState(i,``,s),a&&u&&u({action:l,location:b.location,delta:0})}function y(e){return v(i,e)}let b={get action(){return l},get location(){return e(i,o)},listen(e){if(u)throw Error(`A history only accepts one active listener`);return i.addEventListener(s,h),u=e,()=>{i.removeEventListener(s,h),u=null}},createHref(e){return t(i,e)},createURL:y,encodeLocation(e){let t=y(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:g,replace:_,go(e){return o.go(e)}};return b}function v(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),u(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:h(t);return i=i.replace(/ $/,`%20`),!n&&a.test(i)&&(i=r+i),new URL(i,r)}var y=e(t(),1);function b(e,t,n=`/`){return x(e,t,n,!1)}function x(e,t,n,r,i){let a=A((typeof t==`string`?g(t):t).pathname||`/`,n);if(a==null)return null;let o=i??C(e),s=null,c=fe(a);for(let e=0;s==null&&e<o.length;++e)s=le(o[e],c,r);return s}function S(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 C(e){let t=w(e);return E(t),t}function w(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;u(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=M([r,c.relativePath]),d=n.concat(c);e.children&&e.children.length>0&&(u(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),w(e.children,t,d,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:se(l,e.index),routesMeta:d.map((e,t)=>{let[n,r]=de(e.relativePath,e.caseSensitive,t===d.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 T(e.path))a(e,t,!0,n)}),t}function T(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=T(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 E(e){e.sort((e,t)=>e.score===t.score?ce(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ee=/^:[\w-]+$/,te=/^:[\w-]+/,ne=3.5,D=3,O=2,re=1,ie=10,ae=-2,oe=e=>e===`*`;function se(e,t){let n=e.split(`/`),r=n.length;return n.some(oe)&&(r+=ae),t&&(r+=O),n.filter(e=>!oe(e)).reduce((e,t)=>e+(ee.test(t)?D:te.test(t)?ne:t===``?re:ie),r)}function ce(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 le(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?ue(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:M([a,d.pathname]),pathnameBase:be(M([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=M([a,d.pathnameBase]))}return o}function k(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=de(e.path,e.caseSensitive,e.end);return ue(e,t,n,r)}function ue(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 de(e,t=!1,n=!0){d(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 fe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return d(!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 pe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?g(e):e,a;return n?(n=ve(n),a=n.startsWith(`/`)?me(n.substring(1),`/`):me(n,t)):a=t,{pathname:a,search:xe(r),hash:Se(i)}}function me(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 j(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 he(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ge(e){let t=he(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function _e(e,t,n,r=!1){let i;typeof e==`string`?i=g(e):(i={...e},u(!i.pathname||!i.pathname.includes(`?`),j(`?`,`pathname`,`search`,i)),u(!i.pathname||!i.pathname.includes(`#`),j(`#`,`pathname`,`hash`,i)),u(!i.search||!i.search.includes(`#`),j(`#`,`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=pe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||d)&&(c.pathname+=`/`),c}var ve=e=>e.replace(/[\\/]{2,}/g,`/`),M=e=>ve(e.join(`/`)),ye=e=>e.replace(/\/+$/,``),be=e=>ye(e).replace(/^\/*/,`/`),xe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Se=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ce=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 we(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Te(e){return M(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ee=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function De(e,t){let n=e;if(typeof n!=`string`||!i.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(Ee)try{let e=new URL(window.location.href),r=a.test(n)?new URL(o(n,e.protocol)):new URL(n),i=A(r.pathname,t);r.origin===e.origin&&i!=null?n=i+r.search+r.hash:s=!0}catch{d(!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:s,to:n}}var Oe=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Oe);var ke=[`GET`,...Oe];new Set(ke);var Ae=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function je(e){try{return Ae.includes(new URL(e).protocol)}catch{return!1}}var N=y.createContext(null);N.displayName=`DataRouter`;var P=y.createContext(null);P.displayName=`DataRouterState`;var Me=y.createContext(!1);function Ne(){return y.useContext(Me)}var Pe=y.createContext({isTransitioning:!1});Pe.displayName=`ViewTransition`;var Fe=y.createContext(new Map);Fe.displayName=`Fetchers`;var Ie=y.createContext(null);Ie.displayName=`Await`;var F=y.createContext(null);F.displayName=`Navigation`;var I=y.createContext(null);I.displayName=`Location`;var L=y.createContext({outlet:null,matches:[],isDataRoute:!1});L.displayName=`Route`;var R=y.createContext(null);R.displayName=`RouteError`;var Le=`REACT_ROUTER_ERROR`,Re=`REDIRECT`,ze=`ROUTE_ERROR_RESPONSE`;function Be(e){if(e.startsWith(`${Le}:${Re}:{`))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 Ve(e){if(e.startsWith(`${Le}:${ze}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ce(t.status,t.statusText,t.data)}catch{}}function He(e,{relative:t}={}){u(z(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=y.useContext(F),{hash:i,pathname:a,search:o}=V(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:M([n,a])),r.createHref({pathname:s,search:o,hash:i})}function z(){return y.useContext(I)!=null}function B(){return u(z(),`useLocation() may be used only in the context of a <Router> component.`),y.useContext(I).location}var Ue=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function We(){let{isDataRoute:e}=y.useContext(L);return e?lt():Ge()}function Ge(){u(z(),`useNavigate() may be used only in the context of a <Router> component.`);let e=y.useContext(N),{basename:t,navigator:n}=y.useContext(F),{matches:r}=y.useContext(L),{pathname:i}=B(),a=JSON.stringify(ge(r)),o=y.useRef(!1);return y.useLayoutEffect(()=>{o.current=!0}),y.useCallback((r,s={})=>{if(d(o.current,Ue),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=_e(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:M([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Ke=y.createContext(null);function qe(e){let t=y.useContext(L).outlet;return y.useMemo(()=>t&&y.createElement(Ke.Provider,{value:e},t),[t,e])}function Je(){let{matches:e}=y.useContext(L);return e[e.length-1]?.params??{}}function V(e,{relative:t}={}){let{matches:n}=y.useContext(L),{pathname:r}=B(),i=JSON.stringify(ge(n));return y.useMemo(()=>_e(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ye(e,t){return Xe(e,t)}function Xe(e,t,n){u(z(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=y.useContext(F),{matches:i}=y.useContext(L),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=B(),l;if(t){let e=typeof t==`string`?g(t):t;u(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 d=l.pathname||`/`,f=d;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):b(e,{pathname:f}),m=nt(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:M([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:M([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&m?y.createElement(I.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},m):m}function Ze(){let e=ct(),t=we(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return y.createElement(y.Fragment,null,y.createElement(`h2`,null,`Unexpected Application Error!`),y.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?y.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var Qe=y.createElement(Ze,null),$e=class extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=Me;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=Ve(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:y.createElement(L.Provider,{value:this.props.routeContext},y.createElement(R.Provider,{value:e,children:this.props.component}));return this.context?y.createElement(et,{error:e},t):t}},H=new WeakMap;function et({children:e,error:t}){let{basename:n}=y.useContext(F);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Be(t.digest);if(e){let r=H.get(t);if(r)throw r;let i=De(e.location,n),a=i.absoluteURL||i.to;if(je(a))throw Error(`Invalid redirect location`);if(Ee&&!H.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 H.set(t,n),n}return y.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function tt({routeContext:e,match:t,children:n}){let r=y.useContext(N);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(L.Provider,{value:e},n)}function nt(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);u(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:Te(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||Qe,o&&(s<0&&c===0?(dt(`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?y.createElement(n.route.Component,null):n.route.element?n.route.element:e,y.createElement(tt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?y.createElement($e,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function U(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rt(e){let t=y.useContext(N);return u(t,U(e)),t}function W(e){let t=y.useContext(P);return u(t,U(e)),t}function it(e){let t=y.useContext(L);return u(t,U(e)),t}function G(e){let t=it(e),n=t.matches[t.matches.length-1];return u(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function at(){return G(`useRouteId`)}function ot(){let e=W(`useNavigation`);return y.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function st(){let{matches:e,loaderData:t}=W(`useMatches`);return y.useMemo(()=>e.map(e=>S(e,t)),[e,t])}function ct(){let e=y.useContext(R),t=W(`useRouteError`),n=G(`useRouteError`);return e===void 0?t.errors?.[n]:e}function lt(){let{router:e}=rt(`useNavigate`),t=G(`useNavigate`),n=y.useRef(!1);return y.useLayoutEffect(()=>{n.current=!0}),y.useCallback(async(r,i={})=>{d(n.current,Ue),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ut={};function dt(e,t,n){!t&&!ut[e]&&(ut[e]=!0,d(!1,n))}y.memo(ft);function ft({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Xe(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function pt(e){return qe(e.context)}function mt(e){u(!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 ht({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){u(!z(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=y.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=g(n));let{pathname:l=`/`,search:f=``,hash:p=``,state:m=null,key:h=`default`,mask:_}=n,v=y.useMemo(()=>{let e=A(l,s);return e==null?null:{location:{pathname:e,search:f,hash:p,state:m,key:h,mask:_},navigationType:r}},[s,l,f,p,m,h,r,_]);return d(v!=null,`<Router basename="${s}"> is not able to match the URL "${l}${f}${p}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:y.createElement(F.Provider,{value:c},y.createElement(I.Provider,{children:t,value:v}))}function gt({children:e,location:t}){return Ye(K(e),t)}y.Component;function K(e,t=[]){let n=[];return y.Children.forEach(e,(e,r)=>{if(!y.isValidElement(e))return;let i=[...t,r];if(e.type===y.Fragment){n.push.apply(n,K(e.props.children,i));return}u(e.type===mt,`[${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;u(!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=K(a.children,i)),n.push(o)}),n}var q=`application/x-www-form-urlencoded`;function J(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function _t(e){return J(e)&&e.tagName.toLowerCase()===`button`}function vt(e){return J(e)&&e.tagName.toLowerCase()===`form`}function yt(e){return J(e)&&e.tagName.toLowerCase()===`input`}function bt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xt(e,t){return e.button===0&&(!t||t===`_self`)&&!bt(e)}var Y=null;function St(){if(Y===null)try{new FormData(document.createElement(`form`),0),Y=!1}catch{Y=!0}return Y}var Ct=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function X(e){return e!=null&&!Ct.has(e)?(d(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${q}"`),null):e}function wt(e,t){let n,r,i,a,o;if(vt(e)){let o=e.getAttribute(`action`);r=o?A(o,t):null,n=e.getAttribute(`method`)||`get`,i=X(e.getAttribute(`enctype`))||q,a=new FormData(e)}else if(_t(e)||yt(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=X(e.getAttribute(`formenctype`))||X(o.getAttribute(`enctype`))||q,a=new FormData(o,e),!St()){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(J(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=q,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function Tt(e,t){if(e===!1||e==null)throw Error(t)}var Et={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Dt=/[&><\u2028\u2029]/g;function Ot(e){return e.replace(Dt,e=>Et[e])}function kt(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 At(e,t){if(e.id in t)return t[e.id];try{let r=await n(()=>import(e.module),[]);return t[e.id]=r,r}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 jt(e){return e!=null&&typeof e.page==`string`}function Mt(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 Nt(e,t,n){return Rt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await At(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Mt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Pt(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 Ft(e,t,{includeHydrateFallback:n}={}){return It(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 It(e){return[...new Set(e)]}function Lt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Rt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!jt(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Lt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function zt(){let e=y.useContext(N);return Tt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Bt(){let e=y.useContext(P);return Tt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Z=y.createContext(void 0);Z.displayName=`FrameworkContext`;function Vt(){let e=y.useContext(Z);return Tt(e,`You must render this element inside a <HydratedRouter> element`),e}function Ht(e,t){let n=y.useContext(Z),[r,i]=y.useState(!1),[a,o]=y.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=y.useRef(null);y.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]),y.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:Q(s,p),onBlur:Q(c,m),onMouseEnter:Q(l,p),onMouseLeave:Q(u,m),onTouchStart:Q(d,p)}]:[a,f,{}]:[!1,f,{}]}function Q(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ut({page:e,...t}){let n=Ne(),{nonce:r}=Vt(),{router:i}=zt(),a=y.useMemo(()=>b(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?y.createElement(Gt,{page:e,matches:a,...t}):y.createElement(Kt,{page:e,matches:a,...t})):null}function Wt(e){let{manifest:t,routeModules:n}=Vt(),[r,i]=y.useState([]);return y.useEffect(()=>{let r=!1;return Nt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Gt({page:e,matches:t,...n}){let r=B(),i=y.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=kt(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 y.createElement(y.Fragment,null,i.map(e=>y.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Kt({page:e,matches:t,...n}){let r=B(),{manifest:i,routeModules:a}=Vt(),{loaderData:o,matches:s}=Bt(),c=y.useMemo(()=>Pt(e,t,s,i,r,`data`),[e,t,s,i,r]),l=y.useMemo(()=>Pt(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=y.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=kt(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=y.useMemo(()=>Ft(l,i),[l,i]),f=Wt(l);return y.createElement(y.Fragment,null,u.map(e=>y.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>y.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>y.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function qt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var Jt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Jt&&(window.__reactRouterVersion=`8.2.0`)}catch{}function Yt({basename:e,children:t,useTransitions:n,window:r}){let i=y.useRef(null);i.current??=l({window:r,v5Compat:!0});let a=i.current,[o,s]=y.useState({action:a.action,location:a.location}),c=y.useCallback(e=>{n===!1?s(e):y.startTransition(()=>s(e))},[n]);return y.useLayoutEffect(()=>a.listen(c),[a,c]),y.createElement(ht,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function Xt({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=y.useState({action:n.action,location:n.location}),o=y.useCallback(e=>{r===!1?a(e):y.startTransition(()=>a(e))},[r]);return y.useLayoutEffect(()=>n.listen(o),[n,o]),y.createElement(ht,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}Xt.displayName=`unstable_HistoryRouter`;var Zt=y.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:a,replace:o,mask:s,state:c,target:l,to:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:_,useTransitions:v}=y.useContext(F),b=typeof u==`string`&&i.test(u),x=De(u,g);u=x.to;let S=He(u,{relative:r}),C=B(),w=null;if(s){let e=_e(s,[],C.mask?C.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:M([g,e.pathname])),w=_.createHref(e)}let[T,E,ee]=Ht(n,m),te=an(u,{replace:o,mask:s,state:c,target:l,preventScrollReset:d,relative:r,viewTransition:f,defaultShouldRevalidate:p,useTransitions:v});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let D=!(x.isExternal||a),O=y.createElement(`a`,{...m,...ee,href:(D?w:void 0)||x.absoluteURL||S,onClick:D?ne:e,ref:qt(h,E),target:l,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?y.createElement(y.Fragment,null,O,y.createElement(Ut,{page:S})):O});Zt.displayName=`Link`;var Qt=y.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=V(a,{relative:c.relative}),d=B(),f=y.useContext(P),{navigator:p,basename:m}=y.useContext(F),h=f!=null&&mn(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 b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return y.createElement(Zt,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Qt.displayName=`NavLink`;var $t=y.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:s=`get`,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=y.useContext(F),_=cn(),v=ln(c,{relative:u}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof c==`string`&&i.test(c);return y.createElement(`form`,{ref:h,method:b,action:v,onSubmit:r?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,i=r?.getAttribute(`formmethod`)||s,c=()=>_(r||e.currentTarget,{fetcherKey:t,method:i,navigate:n,replace:a,state:o,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&n!==!1?y.startTransition(()=>c()):c()},...m,"data-discover":!x&&e===`render`?`true`:void 0})});$t.displayName=`Form`;function en({getKey:e,storageKey:t,...n}){let r=y.useContext(Z),{basename:i}=y.useContext(F),a=B(),o=st();fn({getKey:e,storageKey:t});let s=y.useMemo(()=>{if(!r||!e)return null;let t=dn(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),y.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Ot(JSON.stringify(t||un))}, ${Ot(JSON.stringify(s))})`}})}en.displayName=`ScrollRestoration`;function tn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nn(e){let t=y.useContext(N);return u(t,tn(e)),t}function rn(e){let t=y.useContext(P);return u(t,tn(e)),t}function an(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=We(),d=B(),f=V(e,{relative:o});return y.useCallback(p=>{if(xt(p,t)){p.preventDefault();let t=n===void 0?h(d)===h(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?y.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var on=0,sn=()=>`__${String(++on)}__`;function cn(){let{router:e}=nn(`useSubmit`),{basename:t}=y.useContext(F),n=at(),r=e.fetch,i=e.navigate;return y.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=wt(e,t);a.navigate===!1?await r(a.fetcherKey||sn(),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 ln(e,{relative:t}={}){let{basename:n}=y.useContext(F),r=y.useContext(L);u(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...V(e||`.`,{relative:t})},o=B();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:M([n,a.pathname])),h(a)}var un=`react-router-scroll-positions`,$={};function dn(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 fn({getKey:e,storageKey:t}={}){let{router:n}=nn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=rn(`useScrollRestoration`),{basename:a}=y.useContext(F),o=B(),s=st(),c=ot();y.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),pn(y.useCallback(()=>{if(c.state===`idle`){let t=dn(o,s,a,e);$[t]=window.scrollY}try{sessionStorage.setItem(t||un,JSON.stringify($))}catch(e){d(!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`&&(y.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||un);e&&($=JSON.parse(e))}catch{}},[t]),y.useLayoutEffect(()=>{let t=n?.enableScrollRestoration($,()=>window.scrollY,e?(t,n)=>dn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),y.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{d(!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 pn(e,t){let{capture:n}=t||{};y.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function mn(e,{relative:t}={}){let n=y.useContext(Pe);u(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=nn(`useViewTransitionState`),i=V(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 hn=r(`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`}]]),gn=r(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),_n=r(`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`}]]);function vn(e){let t=Date.parse(e.created_at);return Number.isNaN(t)?0:t}function yn(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)=>vn(t)-vn(e)),[...i,...r]}function bn(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 xn(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=bn(i,t,n);return a.some((e,t)=>e!==i[t])?a:null}function Sn(e,t){let n=new Set(e);return[...e,...t.filter(e=>!n.has(e))]}export{_n as a,Yt as c,mt as d,gt as f,Je as h,bn as i,Zt as l,We as m,xn as n,gn as o,B as p,yn as r,hn as s,Sn as t,pt as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import"./auth-GfOuXpIe.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{t as r}from"./createLucideIcon-DyMAgLa3.js";var i=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,a=/^[\\/]{2}/;function o(e,t){return t+e.replace(/\\/g,`/`)}var s=`popstate`;function c(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function l(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return m(``,{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:h(t)}return _(t,n,null,e)}function u(e,t){if(e===!1||e==null)throw Error(t)}function d(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function f(){return Math.random().toString(36).substring(2,10)}function p(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 m(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?g(t):t,state:n,key:t&&t.key||r||f(),mask:i}}function h({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 g(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 _(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,l=`POP`,u=null,d=f();d??(d=0,o.replaceState({...o.state,idx:d},``));function f(){return(o.state||{idx:null}).idx}function h(){l=`POP`;let e=f(),t=e==null?null:e-d;d=e,u&&u({action:l,location:b.location,delta:t})}function g(e,t){l=`PUSH`;let r=c(e)?e:m(b.location,e,t);n&&n(r,e),d=f()+1;let s=p(r,d),h=b.createHref(r.mask||r);try{o.pushState(s,``,h)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(h)}a&&u&&u({action:l,location:b.location,delta:1})}function _(e,t){l=`REPLACE`;let r=c(e)?e:m(b.location,e,t);n&&n(r,e),d=f();let i=p(r,d),s=b.createHref(r.mask||r);o.replaceState(i,``,s),a&&u&&u({action:l,location:b.location,delta:0})}function y(e){return v(i,e)}let b={get action(){return l},get location(){return e(i,o)},listen(e){if(u)throw Error(`A history only accepts one active listener`);return i.addEventListener(s,h),u=e,()=>{i.removeEventListener(s,h),u=null}},createHref(e){return t(i,e)},createURL:y,encodeLocation(e){let t=y(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:g,replace:_,go(e){return o.go(e)}};return b}function v(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),u(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:h(t);return i=i.replace(/ $/,`%20`),!n&&a.test(i)&&(i=r+i),new URL(i,r)}var y=e(t(),1);function b(e,t,n=`/`){return x(e,t,n,!1)}function x(e,t,n,r,i){let a=A((typeof t==`string`?g(t):t).pathname||`/`,n);if(a==null)return null;let o=i??C(e),s=null,c=fe(a);for(let e=0;s==null&&e<o.length;++e)s=le(o[e],c,r);return s}function S(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 C(e){let t=w(e);return E(t),t}function w(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;u(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=M([r,c.relativePath]),d=n.concat(c);e.children&&e.children.length>0&&(u(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),w(e.children,t,d,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:se(l,e.index),routesMeta:d.map((e,t)=>{let[n,r]=de(e.relativePath,e.caseSensitive,t===d.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 T(e.path))a(e,t,!0,n)}),t}function T(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=T(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 E(e){e.sort((e,t)=>e.score===t.score?ce(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ee=/^:[\w-]+$/,te=/^:[\w-]+/,ne=3.5,D=3,O=2,re=1,ie=10,ae=-2,oe=e=>e===`*`;function se(e,t){let n=e.split(`/`),r=n.length;return n.some(oe)&&(r+=ae),t&&(r+=O),n.filter(e=>!oe(e)).reduce((e,t)=>e+(ee.test(t)?D:te.test(t)?ne:t===``?re:ie),r)}function ce(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 le(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?ue(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:M([a,d.pathname]),pathnameBase:be(M([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=M([a,d.pathnameBase]))}return o}function k(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=de(e.path,e.caseSensitive,e.end);return ue(e,t,n,r)}function ue(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 de(e,t=!1,n=!0){d(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 fe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return d(!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 pe(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?g(e):e,a;return n?(n=ve(n),a=n.startsWith(`/`)?me(n.substring(1),`/`):me(n,t)):a=t,{pathname:a,search:xe(r),hash:Se(i)}}function me(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 j(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 he(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ge(e){let t=he(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function _e(e,t,n,r=!1){let i;typeof e==`string`?i=g(e):(i={...e},u(!i.pathname||!i.pathname.includes(`?`),j(`?`,`pathname`,`search`,i)),u(!i.pathname||!i.pathname.includes(`#`),j(`#`,`pathname`,`hash`,i)),u(!i.search||!i.search.includes(`#`),j(`#`,`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=pe(i,s),l=o&&o!==`/`&&o.endsWith(`/`),d=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||d)&&(c.pathname+=`/`),c}var ve=e=>e.replace(/[\\/]{2,}/g,`/`),M=e=>ve(e.join(`/`)),ye=e=>e.replace(/\/+$/,``),be=e=>ye(e).replace(/^\/*/,`/`),xe=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Se=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ce=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 we(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Te(e){return M(e.map(e=>e.route.path).filter(Boolean))||`/`}var Ee=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function De(e,t){let n=e;if(typeof n!=`string`||!i.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(Ee)try{let e=new URL(window.location.href),r=a.test(n)?new URL(o(n,e.protocol)):new URL(n),i=A(r.pathname,t);r.origin===e.origin&&i!=null?n=i+r.search+r.hash:s=!0}catch{d(!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:s,to:n}}var Oe=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Oe);var ke=[`GET`,...Oe];new Set(ke);var Ae=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function je(e){try{return Ae.includes(new URL(e).protocol)}catch{return!1}}var N=y.createContext(null);N.displayName=`DataRouter`;var P=y.createContext(null);P.displayName=`DataRouterState`;var Me=y.createContext(!1);function Ne(){return y.useContext(Me)}var Pe=y.createContext({isTransitioning:!1});Pe.displayName=`ViewTransition`;var Fe=y.createContext(new Map);Fe.displayName=`Fetchers`;var Ie=y.createContext(null);Ie.displayName=`Await`;var F=y.createContext(null);F.displayName=`Navigation`;var I=y.createContext(null);I.displayName=`Location`;var L=y.createContext({outlet:null,matches:[],isDataRoute:!1});L.displayName=`Route`;var R=y.createContext(null);R.displayName=`RouteError`;var Le=`REACT_ROUTER_ERROR`,Re=`REDIRECT`,ze=`ROUTE_ERROR_RESPONSE`;function Be(e){if(e.startsWith(`${Le}:${Re}:{`))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 Ve(e){if(e.startsWith(`${Le}:${ze}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ce(t.status,t.statusText,t.data)}catch{}}function He(e,{relative:t}={}){u(z(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=y.useContext(F),{hash:i,pathname:a,search:o}=V(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:M([n,a])),r.createHref({pathname:s,search:o,hash:i})}function z(){return y.useContext(I)!=null}function B(){return u(z(),`useLocation() may be used only in the context of a <Router> component.`),y.useContext(I).location}var Ue=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function We(){let{isDataRoute:e}=y.useContext(L);return e?lt():Ge()}function Ge(){u(z(),`useNavigate() may be used only in the context of a <Router> component.`);let e=y.useContext(N),{basename:t,navigator:n}=y.useContext(F),{matches:r}=y.useContext(L),{pathname:i}=B(),a=JSON.stringify(ge(r)),o=y.useRef(!1);return y.useLayoutEffect(()=>{o.current=!0}),y.useCallback((r,s={})=>{if(d(o.current,Ue),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=_e(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:M([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var Ke=y.createContext(null);function qe(e){let t=y.useContext(L).outlet;return y.useMemo(()=>t&&y.createElement(Ke.Provider,{value:e},t),[t,e])}function Je(){let{matches:e}=y.useContext(L);return e[e.length-1]?.params??{}}function V(e,{relative:t}={}){let{matches:n}=y.useContext(L),{pathname:r}=B(),i=JSON.stringify(ge(n));return y.useMemo(()=>_e(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ye(e,t){return Xe(e,t)}function Xe(e,t,n){u(z(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=y.useContext(F),{matches:i}=y.useContext(L),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=B(),l;if(t){let e=typeof t==`string`?g(t):t;u(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 d=l.pathname||`/`,f=d;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):b(e,{pathname:f}),m=nt(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:M([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:M([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&m?y.createElement(I.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},m):m}function Ze(){let e=ct(),t=we(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return y.createElement(y.Fragment,null,y.createElement(`h2`,null,`Unexpected Application Error!`),y.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?y.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var Qe=y.createElement(Ze,null),$e=class extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=Me;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=Ve(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:y.createElement(L.Provider,{value:this.props.routeContext},y.createElement(R.Provider,{value:e,children:this.props.component}));return this.context?y.createElement(et,{error:e},t):t}},H=new WeakMap;function et({children:e,error:t}){let{basename:n}=y.useContext(F);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Be(t.digest);if(e){let r=H.get(t);if(r)throw r;let i=De(e.location,n),a=i.absoluteURL||i.to;if(je(a))throw Error(`Invalid redirect location`);if(Ee&&!H.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 H.set(t,n),n}return y.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function tt({routeContext:e,match:t,children:n}){let r=y.useContext(N);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(L.Provider,{value:e},n)}function nt(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);u(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:Te(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||Qe,o&&(s<0&&c===0?(dt(`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?y.createElement(n.route.Component,null):n.route.element?n.route.element:e,y.createElement(tt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?y.createElement($e,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function U(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rt(e){let t=y.useContext(N);return u(t,U(e)),t}function W(e){let t=y.useContext(P);return u(t,U(e)),t}function it(e){let t=y.useContext(L);return u(t,U(e)),t}function G(e){let t=it(e),n=t.matches[t.matches.length-1];return u(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function at(){return G(`useRouteId`)}function ot(){let e=W(`useNavigation`);return y.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function st(){let{matches:e,loaderData:t}=W(`useMatches`);return y.useMemo(()=>e.map(e=>S(e,t)),[e,t])}function ct(){let e=y.useContext(R),t=W(`useRouteError`),n=G(`useRouteError`);return e===void 0?t.errors?.[n]:e}function lt(){let{router:e}=rt(`useNavigate`),t=G(`useNavigate`),n=y.useRef(!1);return y.useLayoutEffect(()=>{n.current=!0}),y.useCallback(async(r,i={})=>{d(n.current,Ue),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var ut={};function dt(e,t,n){!t&&!ut[e]&&(ut[e]=!0,d(!1,n))}y.memo(ft);function ft({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return Xe(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function pt(e){return qe(e.context)}function mt(e){u(!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 ht({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){u(!z(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=y.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=g(n));let{pathname:l=`/`,search:f=``,hash:p=``,state:m=null,key:h=`default`,mask:_}=n,v=y.useMemo(()=>{let e=A(l,s);return e==null?null:{location:{pathname:e,search:f,hash:p,state:m,key:h,mask:_},navigationType:r}},[s,l,f,p,m,h,r,_]);return d(v!=null,`<Router basename="${s}"> is not able to match the URL "${l}${f}${p}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:y.createElement(F.Provider,{value:c},y.createElement(I.Provider,{children:t,value:v}))}function gt({children:e,location:t}){return Ye(K(e),t)}y.Component;function K(e,t=[]){let n=[];return y.Children.forEach(e,(e,r)=>{if(!y.isValidElement(e))return;let i=[...t,r];if(e.type===y.Fragment){n.push.apply(n,K(e.props.children,i));return}u(e.type===mt,`[${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;u(!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=K(a.children,i)),n.push(o)}),n}var q=`application/x-www-form-urlencoded`;function J(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function _t(e){return J(e)&&e.tagName.toLowerCase()===`button`}function vt(e){return J(e)&&e.tagName.toLowerCase()===`form`}function yt(e){return J(e)&&e.tagName.toLowerCase()===`input`}function bt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xt(e,t){return e.button===0&&(!t||t===`_self`)&&!bt(e)}var Y=null;function St(){if(Y===null)try{new FormData(document.createElement(`form`),0),Y=!1}catch{Y=!0}return Y}var Ct=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function X(e){return e!=null&&!Ct.has(e)?(d(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${q}"`),null):e}function wt(e,t){let n,r,i,a,o;if(vt(e)){let o=e.getAttribute(`action`);r=o?A(o,t):null,n=e.getAttribute(`method`)||`get`,i=X(e.getAttribute(`enctype`))||q,a=new FormData(e)}else if(_t(e)||yt(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=X(e.getAttribute(`formenctype`))||X(o.getAttribute(`enctype`))||q,a=new FormData(o,e),!St()){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(J(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=q,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function Tt(e,t){if(e===!1||e==null)throw Error(t)}var Et={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Dt=/[&><\u2028\u2029]/g;function Ot(e){return e.replace(Dt,e=>Et[e])}function kt(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 At(e,t){if(e.id in t)return t[e.id];try{let r=await n(()=>import(e.module),[]);return t[e.id]=r,r}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 jt(e){return e!=null&&typeof e.page==`string`}function Mt(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 Nt(e,t,n){return Rt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await At(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Mt).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Pt(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 Ft(e,t,{includeHydrateFallback:n}={}){return It(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 It(e){return[...new Set(e)]}function Lt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Rt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!jt(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Lt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function zt(){let e=y.useContext(N);return Tt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Bt(){let e=y.useContext(P);return Tt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Z=y.createContext(void 0);Z.displayName=`FrameworkContext`;function Vt(){let e=y.useContext(Z);return Tt(e,`You must render this element inside a <HydratedRouter> element`),e}function Ht(e,t){let n=y.useContext(Z),[r,i]=y.useState(!1),[a,o]=y.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=y.useRef(null);y.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]),y.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:Q(s,p),onBlur:Q(c,m),onMouseEnter:Q(l,p),onMouseLeave:Q(u,m),onTouchStart:Q(d,p)}]:[a,f,{}]:[!1,f,{}]}function Q(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ut({page:e,...t}){let n=Ne(),{nonce:r}=Vt(),{router:i}=zt(),a=y.useMemo(()=>b(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?y.createElement(Gt,{page:e,matches:a,...t}):y.createElement(Kt,{page:e,matches:a,...t})):null}function Wt(e){let{manifest:t,routeModules:n}=Vt(),[r,i]=y.useState([]);return y.useEffect(()=>{let r=!1;return Nt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Gt({page:e,matches:t,...n}){let r=B(),i=y.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=kt(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 y.createElement(y.Fragment,null,i.map(e=>y.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function Kt({page:e,matches:t,...n}){let r=B(),{manifest:i,routeModules:a}=Vt(),{loaderData:o,matches:s}=Bt(),c=y.useMemo(()=>Pt(e,t,s,i,r,`data`),[e,t,s,i,r]),l=y.useMemo(()=>Pt(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=y.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=kt(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=y.useMemo(()=>Ft(l,i),[l,i]),f=Wt(l);return y.createElement(y.Fragment,null,u.map(e=>y.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>y.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>y.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function qt(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var Jt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Jt&&(window.__reactRouterVersion=`8.2.0`)}catch{}function Yt({basename:e,children:t,useTransitions:n,window:r}){let i=y.useRef(null);i.current??=l({window:r,v5Compat:!0});let a=i.current,[o,s]=y.useState({action:a.action,location:a.location}),c=y.useCallback(e=>{n===!1?s(e):y.startTransition(()=>s(e))},[n]);return y.useLayoutEffect(()=>a.listen(c),[a,c]),y.createElement(ht,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}function Xt({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=y.useState({action:n.action,location:n.location}),o=y.useCallback(e=>{r===!1?a(e):y.startTransition(()=>a(e))},[r]);return y.useLayoutEffect(()=>n.listen(o),[n,o]),y.createElement(ht,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}Xt.displayName=`unstable_HistoryRouter`;var Zt=y.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:a,replace:o,mask:s,state:c,target:l,to:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h){let{basename:g,navigator:_,useTransitions:v}=y.useContext(F),b=typeof u==`string`&&i.test(u),x=De(u,g);u=x.to;let S=He(u,{relative:r}),C=B(),w=null;if(s){let e=_e(s,[],C.mask?C.mask.pathname:`/`,!0);g!==`/`&&(e.pathname=e.pathname===`/`?g:M([g,e.pathname])),w=_.createHref(e)}let[T,E,ee]=Ht(n,m),te=an(u,{replace:o,mask:s,state:c,target:l,preventScrollReset:d,relative:r,viewTransition:f,defaultShouldRevalidate:p,useTransitions:v});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let D=!(x.isExternal||a),O=y.createElement(`a`,{...m,...ee,href:(D?w:void 0)||x.absoluteURL||S,onClick:D?ne:e,ref:qt(h,E),target:l,"data-discover":!b&&t===`render`?`true`:void 0});return T&&!b?y.createElement(y.Fragment,null,O,y.createElement(Ut,{page:S})):O});Zt.displayName=`Link`;var Qt=y.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=V(a,{relative:c.relative}),d=B(),f=y.useContext(P),{navigator:p,basename:m}=y.useContext(F),h=f!=null&&mn(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 b=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(b)===`/`,S=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return y.createElement(Zt,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});Qt.displayName=`NavLink`;var $t=y.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:s=`get`,action:c,onSubmit:l,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p,...m},h)=>{let{useTransitions:g}=y.useContext(F),_=cn(),v=ln(c,{relative:u}),b=s.toLowerCase()===`get`?`get`:`post`,x=typeof c==`string`&&i.test(c);return y.createElement(`form`,{ref:h,method:b,action:v,onSubmit:r?l:e=>{if(l&&l(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,i=r?.getAttribute(`formmethod`)||s,c=()=>_(r||e.currentTarget,{fetcherKey:t,method:i,navigate:n,replace:a,state:o,relative:u,preventScrollReset:d,viewTransition:f,defaultShouldRevalidate:p});g&&n!==!1?y.startTransition(()=>c()):c()},...m,"data-discover":!x&&e===`render`?`true`:void 0})});$t.displayName=`Form`;function en({getKey:e,storageKey:t,...n}){let r=y.useContext(Z),{basename:i}=y.useContext(F),a=B(),o=st();fn({getKey:e,storageKey:t});let s=y.useMemo(()=>{if(!r||!e)return null;let t=dn(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),y.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Ot(JSON.stringify(t||un))}, ${Ot(JSON.stringify(s))})`}})}en.displayName=`ScrollRestoration`;function tn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nn(e){let t=y.useContext(N);return u(t,tn(e)),t}function rn(e){let t=y.useContext(P);return u(t,tn(e)),t}function an(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=We(),d=B(),f=V(e,{relative:o});return y.useCallback(p=>{if(xt(p,t)){p.preventDefault();let t=n===void 0?h(d)===h(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?y.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var on=0,sn=()=>`__${String(++on)}__`;function cn(){let{router:e}=nn(`useSubmit`),{basename:t}=y.useContext(F),n=at(),r=e.fetch,i=e.navigate;return y.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=wt(e,t);a.navigate===!1?await r(a.fetcherKey||sn(),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 ln(e,{relative:t}={}){let{basename:n}=y.useContext(F),r=y.useContext(L);u(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...V(e||`.`,{relative:t})},o=B();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:M([n,a.pathname])),h(a)}var un=`react-router-scroll-positions`,$={};function dn(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 fn({getKey:e,storageKey:t}={}){let{router:n}=nn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=rn(`useScrollRestoration`),{basename:a}=y.useContext(F),o=B(),s=st(),c=ot();y.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),pn(y.useCallback(()=>{if(c.state===`idle`){let t=dn(o,s,a,e);$[t]=window.scrollY}try{sessionStorage.setItem(t||un,JSON.stringify($))}catch(e){d(!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`&&(y.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||un);e&&($=JSON.parse(e))}catch{}},[t]),y.useLayoutEffect(()=>{let t=n?.enableScrollRestoration($,()=>window.scrollY,e?(t,n)=>dn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),y.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{d(!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 pn(e,t){let{capture:n}=t||{};y.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function mn(e,{relative:t}={}){let n=y.useContext(Pe);u(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=nn(`useViewTransitionState`),i=V(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 hn=r(`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`}]]),gn=r(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),_n=r(`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`}]]);function vn(e){let t=Date.parse(e.created_at);return Number.isNaN(t)?0:t}function yn(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)=>vn(t)-vn(e)),[...i,...r]}function bn(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 xn(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=bn(i,t,n);return a.some((e,t)=>e!==i[t])?a:null}function Sn(e,t){let n=new Set(e);return[...e,...t.filter(e=>!n.has(e))]}export{_n as a,Yt as c,mt as d,gt as f,Je as h,bn as i,Zt as l,We as m,xn as n,gn as o,B as p,yn as r,hn as s,Sn as t,pt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{R as n}from"./auth-GfOuXpIe.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{S as i,T as a,h as o,w as s}from"./dialog-BMWRC2HO.js";import{c,n as l}from"./x-DCpy1q13.js";import{f as u}from"./input-CxgRsoVg.js";import{t as d}from"./dist-Cde1E3eV.js";import{t as f}from"./createLucideIcon-DyMAgLa3.js";var p=f(`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`}]]),m=f(`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`}]]),h=f(`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`}]]),g=f(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),_=f(`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`}]]),v=e(t(),1),y=new Set;function b(e){let t=/^#settings\/([\w-]+)$/.exec(e);return t?t[1]:null}var x=b(window.location.hash);function S(){let e=x?`#settings/${x}`:``;window.location.hash!==e&&history.replaceState(null,``,window.location.pathname+window.location.search+e)}function C(e){if(e!==x){x=e;for(let e of y)e()}queueMicrotask(S)}window.addEventListener(`hashchange`,()=>C(b(window.location.hash))),window.addEventListener(`popstate`,()=>C(b(window.location.hash)));function w(){return(0,v.useSyncExternalStore)(e=>(y.add(e),()=>{y.delete(e)}),()=>x)}function T(e=`appearance`){C(e)}function E(){C(null)}function D(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}var O=` — `;function k(e){return e.replace(/\/+$/,``).split(`/`).pop()??``}function A(e){return{name:D(e),title:e.title??``,agentName:e.agent_title??``,sequence:e.osc_title??``,branch:e.branch,cwd:k(e.worktree_path),id:e.id.slice(0,8),status:e.status,agent:e.agent_type??``}}function j(e,t){let r=t&&t.length>0?t:n,i=A(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:O,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 M=r(),N=`Switch`,[P,F]=s(N),[I,L]=P(N);function R(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:s,name:c,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=o({prop:n,defaultProp:i??!1,onChange:l,caller:N}),[h,g]=v.useState(null),[_,y]=v.useState(null),b={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:c,form:s,value:d,hasConsumerStoppedPropagationRef:v.useRef(!1),required:u,defaultChecked:i,isFormControl:!h||!!s||!!h.closest(`form`),bubbleInput:_,setBubbleInput:y};return(0,M.jsx)(I,{scope:t,...b,children:K(f)?f(b):r})}var z=`SwitchTrigger`,B=v.forwardRef(({__scopeSwitch:e,onClick:t,...n},r)=>{let{control:o,form:s,value:l,disabled:u,checked:d,required:f,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:_}=L(z,e),y=c(r,p),b=v.useRef(d);return v.useEffect(()=>{let e=s?o?.ownerDocument.getElementById(s):o?.form;if(e instanceof HTMLFormElement){let t=()=>m(b.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[o,s,m]),(0,M.jsx)(i.button,{type:`button`,role:`switch`,"aria-checked":d,"aria-required":f,"data-state":q(d),"data-disabled":u?``:void 0,disabled:u,value:l,...n,ref:y,onClick:a(t,e=>{m(e=>!e),_&&g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});B.displayName=z;var V=v.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,M.jsx)(R,{__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,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{...d,ref:t,__scopeSwitch:n}),e&&(0,M.jsx)(G,{__scopeSwitch:n})]})})});V.displayName=N;var H=`SwitchThumb`,U=v.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,a=L(H,n);return(0,M.jsx)(i.span,{"data-state":q(a.checked),"data-disabled":a.disabled?``:void 0,...r,ref:t})});U.displayName=H;var W=`SwitchBubbleInput`,G=v.forwardRef(({__scopeSwitch:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:s,required:l,disabled:f,name:p,value:m,form:h,bubbleInput:g,setBubbleInput:_}=L(W,e),y=c(n,_),b=d(o),x=u(r);v.useEffect(()=>{let e=g;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!a.current;if(b!==o&&n){let t=new Event(`click`,{bubbles:r});n.call(e,o),e.dispatchEvent(t)}},[g,b,o,a]);let S=v.useRef(o);return(0,M.jsx)(i.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??S.current,required:l,disabled:f,name:p,value:m,form:h,...t,tabIndex:-1,ref:y,style:{...t.style,...x,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});G.displayName=W;function K(e){return typeof e==`function`}function q(e){return e?`checked`:`unchecked`}function J({className:e,...t}){return(0,M.jsx)(V,{className:l(`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,M.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,M.jsx)(U,{className:`block size-4 rounded-full bg-ground shadow-sm transition-transform data-[state=checked]:translate-x-[1.125rem] data-[state=unchecked]:translate-x-0.5`})})})}export{w as a,h as c,T as i,m as l,j as n,_ as o,E as r,g as s,J as t,p as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{j as n}from"./auth-GfOuXpIe.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{g as i}from"./hotkeys-1uTWFYAL.js";import{it as a,x as o,y as s}from"./protocol-support-BGmIChNK.js";import{S as c,T as l,_ as u,b as d,g as f,h as p,v as ee,w as m}from"./dialog-BMWRC2HO.js";import{c as h,n as g,o as _}from"./x-DCpy1q13.js";import{c as v,d as y,l as te,s as b,u as ne}from"./input-CxgRsoVg.js";import{i as x}from"./dist-Cde1E3eV.js";import{n as S,s as re}from"./switch-DhNyUV8C.js";import{a as C,n as ie,o as w}from"./preview-kind-DiWpvEc0.js";import{t as ae}from"./debounce-B9DrqirV.js";var T=e(t(),1),E=r(),[D,oe]=m(`Tooltip`,[y]),O=y(),se=`TooltipProvider`,ce=700,k=`tooltip.open`,[le,A]=D(se),ue=e=>{let{__scopeTooltip:t,delayDuration:n=ce,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)(le,{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})};ue.displayName=se;var j=`Tooltip`,[de,M]=D(j),fe=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=A(j,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:j}),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)(de,{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})})};fe.displayName=j;var N=`TooltipTrigger`,pe=T.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=M(N,n),a=A(N,n),o=O(n),s=h(t,T.useRef(null),i.onTriggerChange),u=T.useRef(!1),d=T.useRef(!1),f=T.useCallback(()=>u.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,E.jsx)(b,{asChild:!0,...o,children:(0,E.jsx)(c.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:l(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:l(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:l(e.onPointerDown,()=>{i.open&&i.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:l(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:l(e.onBlur,i.onClose),onClick:l(e.onClick,i.onClose)})})});pe.displayName=N;var P=`TooltipPortal`,[me,he]=D(P,{forceMount:void 0}),ge=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=M(P,t);return(0,E.jsx)(me,{scope:t,forceMount:n,children:(0,E.jsx)(f,{present:n||a.open,children:(0,E.jsx)(u,{asChild:!0,container:i,children:r})})})};ge.displayName=P;var F=`TooltipContent`,_e=T.forwardRef((e,t)=>{let n=he(F,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=M(F,e.__scopeTooltip);return(0,E.jsx)(f,{present:r||o.open,children:o.disableHoverableContent?(0,E.jsx)(Se,{side:i,...a,ref:t}):(0,E.jsx)(ve,{side:i,...a,ref:t})})}),ve=T.forwardRef((e,t)=>{let n=M(F,e.__scopeTooltip),r=A(F,e.__scopeTooltip),i=T.useRef(null),a=h(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=Ee(r,Te(r,n.getBoundingClientRect())),a=De(t.getBoundingClientRect()),o=ke([...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=!Oe(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,E.jsx)(Se,{...e,ref:a})}),[ye,be]=D(j,{isInside:!1}),xe=_(`TooltipContent`),Se=T.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=M(F,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)(d,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,E.jsxs)(te,{"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)(xe,{children:r}),(0,E.jsx)(ye,{scope:n,isInside:!0,children:(0,E.jsx)(x,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});_e.displayName=F;var Ce=`TooltipArrow`,we=T.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=O(n);return be(Ce,n).isInside?null:(0,E.jsx)(v,{...i,...r,ref:t})});we.displayName=Ce;function Te(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 Ee(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 De(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 Oe(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 ke(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)),Ae(t)}function Ae(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 je=ue,Me=fe,Ne=pe,Pe=ge,Fe=_e,Ie=je,Le=Me,Re=Ne;function ze({className:e,sideOffset:t=4,...n}){return(0,E.jsx)(Pe,{children:(0,E.jsx)(Fe,{sideOffset:t,className:g(`z-50 overflow-hidden rounded-md bg-elevated px-2 py-1 text-xs text-fg shadow-lg`,e),...n})})}function Be({initial:e,maxLength:t,className:n,onCommit:r,onCancel:i}){let[a,o]=(0,T.useState)(e);return(0,E.jsx)(`input`,{autoFocus:!0,value:a,maxLength:t,onFocus:e=>e.currentTarget.select(),onChange:e=>o(e.target.value),onBlur:()=>r(a),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`?r(a):e.key===`Escape`&&i()},className:g(`bg-transparent outline-none`,n)})}function Ve(e){return{onClick:e=>{e.detail===2&&e.preventDefault()},onDoubleClick:t=>{t.preventDefault(),e()}}}var I=null;function He(e){return I=e,()=>{I===e&&(I=null)}}function Ue(){I?.()}var L=null;function We(e){return L=e,()=>{L===e&&(L=null)}}async function Ge(e){if(!L)throw Error(`Open a project before opening a path.`);await L(e)}function Ke(){let e=a(i()??void 0).data?.tabTitleTemplate;return(0,T.useCallback)(t=>S(t,e),[e])}var qe=(0,T.createContext)({open:()=>void 0,handler:null,setHandler:()=>void 0});function Je({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 Ye(){return(0,T.useContext)(qe)}function Xe({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 Ze({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 Qe({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 $e({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 et({type:e,className:t,strokeScale:n=1}){switch(e){case`claude-code`:return(0,E.jsx)(Xe,{className:t,strokeScale:n});case`codex`:return(0,E.jsx)(Ze,{className:t,strokeScale:n});case`opencode`:return(0,E.jsx)(Qe,{className:t,strokeScale:n});case`gemini-cli`:return(0,E.jsx)($e,{className:t});default:return(0,E.jsx)(re,{className:t,strokeWidth:2*n})}}var R=new Set,z=!1,tt=null;function nt(){for(let e of R)e()}function rt(e){return R.add(e),()=>R.delete(e)}function it(e){z!==e&&(z=e,nt())}function at(){it(!z)}function ot(){return(0,T.useSyncExternalStore)(rt,()=>z)}function st(e){tt=e,nt()}function ct(){return(0,T.useSyncExternalStore)(rt,()=>tt)}function B(){return crypto.randomUUID()}function V(e){return e.type===`terminal`?`term:${e.session}`:`editor:${C(e.tab)}`}function H(e,t){return V(e)===V(t)}function lt(e){return e.type===`terminal`}function ut(e){return e.type===`editor`&&(e.tab.view===`linked`||e.tab.view===`locked`)}function U(e=[],t){let n=e.map(V),r=t&&n.includes(t)?t:n.length>0?n[0]:null;return{kind:`leaf`,id:B(),tabs:e,activeKey:r,previewKey:null}}function W(e,t,n){return{kind:`split`,id:B(),direction:e,children:t,sizes:n??t.map(()=>100/Math.max(1,t.length))}}function G(e,t){if(e.kind===`leaf`)return e.id===t?e:null;for(let n of e.children){let e=G(n,t);if(e)return e}return null}function K(e,t){if(e.kind===`leaf`)return e.tabs.some(e=>V(e)===t)?e:null;for(let n of e.children){let e=K(n,t);if(e)return e}return null}function q(e){return e.kind===`leaf`?[e]:e.children.flatMap(q)}function J(e){return q(e).flatMap(e=>e.tabs)}function dt(e){return e.kind===`leaf`?[e.id]:[e.id,...e.children.flatMap(dt)]}function ft(e){let t=dt(e);return new Set(t).size!==t.length}function pt(e){return e.kind===`leaf`?{...e,id:B()}:{...e,id:B(),children:e.children.map(pt)}}function mt(e){if(!ft(e))return e;let t=new Set,n=e=>{let r=t.has(e.id)?B():e.id;return t.add(r),e.kind===`leaf`?{...e,id:r}:{...e,id:r,children:e.children.map(n)}};return n(e)}function ht(e){let t=e.tabs.map(V),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 Y(e){if(e.kind===`leaf`)return ht(e);let t=e.children.map(Y),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?U([]):i.length===1?i[0]:{...e,children:i,sizes:a}}function X(e,t,n){return e.kind===`leaf`?e.id===t?n(e):e:{...e,children:e.children.map(e=>X(e,t,n))}}function gt(e,t,n){return X(e,t,e=>{if(!e.tabs.some(e=>V(e)===n))return e;let t=e.tabs.filter(e=>V(e)!==n),r=e.activeKey===n?_t(e,n):e.activeKey;return{...e,tabs:t,activeKey:r}})}function _t(e,t){let n=e.tabs.findIndex(e=>V(e)===t);if(n===-1)return e.activeKey;let r=e.tabs.filter(e=>V(e)!==t);return r.length===0?null:V(r[Math.min(n,r.length-1)])}function vt(e,t,n){let r=e.tabs.filter(e=>!H(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:V(t)}}function yt(e,t,n,r){let i=n===`left`||n===`right`?`row`:`col`,a=n===`left`||n===`top`;return Y(X(e,t,e=>{let t=U([r]);return W(i,a?[t,e]:[e,t],[50,50])}))}function bt(e,t){let{ref:n,toLeafId:r,edge:i}=t,a=V(n),o=t.copy===!0&&!lt(n),s=t.index;if(i===`center`&&s!==void 0){let t=G(e,r)?.tabs.findIndex(e=>V(e)===a)??-1;t!==-1&&t<s&&--s}let c=o?e:gt(e,t.fromLeafId,a);if(i===`center`){let e=X(c,r,e=>vt(e,n,s));return!G(e,r)&&!K(e,a)?Z(Y(xt(e,n)),a):Z(Y(e),a)}return G(c,r)?Z(yt(c,r,i,n),a):Y(U([n]))}function xt(e,t){let n=q(e)[0];return n?X(e,n.id,e=>vt(e,t)):U([t])}function St(e,t,n){return Y(X(e,t,e=>e.tabs.some(e=>V(e)===n)?{...e,tabs:e.tabs.filter(e=>V(e)!==n),activeKey:e.activeKey===n?_t(e,n):e.activeKey}:e))}function Ct(e,t,n){let r=V(n);return Y(X(e,t,e=>{let t=e.previewKey===r?null:e.previewKey;return e.tabs.some(e=>H(e,n))?{...e,activeKey:r,previewKey:t}:{...e,tabs:[...e.tabs,n],activeKey:r,previewKey:t}}))}function wt(e,t,n){let r=V(n);return Y(X(e,t,e=>e.tabs.some(e=>V(e)===r)?{...e,tabs:e.tabs.map(e=>V(e)===r?n:e),previewKey:e.previewKey===r?null:e.previewKey}:{...e,tabs:[...e.tabs,n]}))}function Tt(e,t,n){let r=V(n);return X(e,t,e=>({...e,tabs:e.tabs.map(e=>V(e)===r?n:e)}))}function Et(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 Dt(e,t){return e.type!==`editor`||t.type!==`editor`||e.tab.view!==`preview`||t.tab.view!==void 0||ie(t.tab.path)===null?t:{...t,tab:{...t.tab,view:`preview`}}}function Ot(e,t,n){let r=V(n);return Y(X(e,t,e=>{if(e.tabs.some(e=>H(e,n)))return{...e,activeKey:r};let t=e.previewKey?e.tabs.findIndex(t=>V(t)===e.previewKey):-1,i=t>=0?e.tabs[t]:void 0,a=i!==void 0&&!lt(i)&&!ut(i),o=a?Dt(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 Z(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 kt(e,t,n,r){return X(e,t,e=>{let t=e.tabs.findIndex(e=>e.type===`editor`&&V(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=V(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&&V(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 At(e,t){let n=w(e);return n!==`commit`&&n!==`untitled`&&e.session===t.session&&e.path===t.path&&e.root===t.root}function jt(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`||!At(e.tab,t))return e;let r={...e,tab:{...e.tab,path:n}};return a.set(V(e),V(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 Mt(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`||ie(t.path)===null?null:t}function Nt(e,t){let n=Mt(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`||!ut(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 Pt(e,t){return e.session===t.session&&e.path===t.path&&(e.root??``)===(t.root??``)&&w(e)===w(t)}function Ft(e,t,n){let r=q(e).flatMap(e=>e.tabs.flatMap(n=>n.type!==`editor`||n.tab.view===`linked`||n.tab.view===`locked`||!Pt(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 It(e,t,n){return X(e,t,e=>e.tabs.some(e=>V(e)===n)?{...e,activeKey:n}:e)}function Lt(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 Rt(e){let t=e.type===`terminal`?e.session:e.tab.session;return t===`00000000-0000-0000-0000-000000000000`?null:t}function zt(e){return t=>{let n=Rt(t);return n===null||e.has(n)}}function Q(e,t){let n=e=>e.kind===`leaf`?{...e,tabs:e.tabs.filter(t)}:{...e,children:e.children.map(n)};return Y(n(e))}function Bt(e){let t=new Set,n=[];for(let r of e){let e=Y(Q(r,e=>!t.has(V(e)))),i=J(e);if(i.length!==0){for(let e of i)t.add(V(e));n.push(e)}}return n.length===0?U([]):mt(n.length===1?n[0]:Y(W(`row`,n)))}function Vt(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?V({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 U([]);if(t.length===0)return U(n,i);if(n.length===0)return U(t,r);let a=e.layout,o=typeof a.editor==`number`?a.editor:40,s=typeof a.session==`number`?a.session:60;return Y(W(`col`,[U(t,r),U(n,i)],[o,s]))}function Ht(e){return JSON.stringify(Ut(e))}function Ut(e){return e===null?null:e.kind===`leaf`?e.tabs.length===0?null:{t:e.tabs.map(V)}:{d:e.direction,s:e.sizes.map(e=>Math.round(e*10)/10),c:e.children.map(Ut)}}var Wt=new Set,$=!1,Gt=null;function Kt(){for(let e of Wt)e()}function qt(e){return Wt.add(e),()=>Wt.delete(e)}function Jt(e){$!==e&&($=e,Kt())}function Yt(){Jt(!$)}function Xt(){return(0,T.useSyncExternalStore)(qt,()=>$)}function Zt(e){Gt=e,Kt()}function Qt(){return(0,T.useSyncExternalStore)(qt,()=>Gt)}var $t={layout_tree:null,active_session:null,layout_ref:null};function en(e){return e.type===`terminal`?e.session:e.tab.session}function tn(e,t){let n=new Set;for(let[r,i]of Object.entries(e))if(!(r===t||!i.layout_tree))for(let e of J(i.layout_tree))e.type===`terminal`&&n.add(e.session);return[...n]}function nn(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 rn(e,t,n){return n?{loaded:e.loaded,snapshot:nn(e.snapshot,t),current:()=>nn(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]??$t,...r}}}Object.keys(i).length>0&&e.update(i)}}:e}function an(e,t,n,r){let i=e.layout_tree??Vt(e),a={};for(let o of t)a[o]={layout_tree:pt(Q(i,e=>{let i=en(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 on(e,t,n={}){return{...e,...t,...n}}function sn(e,t,n){let r=t.layout_tree?Q(t.layout_tree,e=>{let t=en(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=an(e,n.projectIds,n.sessionProject,a);return{projectBased:!0,patch:{...s,project_layouts:on(s.project_layouts??{},e.project_layouts,{[a]:o})}}}function cn(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:Bt(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 ln=2e3,un=n.parse({});function dn(e){return`puddle.ws.${e}`}function fn(e){if(e===null)return{kind:`absent`};try{return{kind:`present`,snapshot:n.parse(JSON.parse(e))}}catch{return{kind:`corrupt`}}}function pn(){let e=i(),[t,n]=(0,T.useState)(!1),[r,a]=(0,T.useState)(un),c=(0,T.useRef)(r);c.current=r;let l=(0,T.useRef)(null),u=(0,T.useMemo)(()=>ae((e,t)=>{o(e,t).catch(e=>console.warn(`ui-state save failed: ${e.message}`))},ln),[]);return(0,T.useEffect)(()=>{if(e===null){l.current=null;return}let t=dn(e);l.current=t;let r=!1;n(!1),a(un);let i;try{i=fn(sessionStorage.getItem(t)),i.kind===`corrupt`&&sessionStorage.removeItem(t)}catch(e){console.warn(`ui-state read failed: ${e.message}`),i={kind:`absent`}}return i.kind===`present`?(a(i.snapshot),n(!0)):s(e).then(e=>{r||(e&&a(e.ui_state),n(!0))}).catch(e=>{console.warn(`ui-state load failed: ${e.message}`),r||n(!0)}),()=>{r=!0,u.flush()}},[e,u]),{loaded:t,snapshot:r,current:()=>c.current,update(t){if(e===null)return;let n={...c.current,...t};c.current=n,a(n);let r=l.current??dn(e);u(e,n);try{sessionStorage.setItem(r,JSON.stringify(n))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}}}}export{He as $,Ot as A,Tt as B,bt as C,K as D,It as E,Nt as F,ot as G,it as H,Et as I,Ye as J,et as K,kt as L,Q as M,jt as N,Mt as O,Lt as P,Ue as Q,Ft as R,mt as S,J as T,at as U,st as V,ct as W,Ge as X,Ke as Y,We as Z,Ct as _,on as a,Re as at,Vt as b,an as c,Jt as d,Be as et,Yt as f,wt as g,Ht as h,sn as i,Ie as it,Z as j,U as k,cn as l,Xt as m,pn as n,Le as nt,tn as o,Qt as p,Je as q,dn as r,ze as rt,rn as s,fn as t,Ve as tt,Zt as u,q as v,G as w,St as x,zt as y,V as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t,r as n}from"./auth-
|
|
1
|
+
import{n as e,o as t,r as n}from"./auth-GfOuXpIe.js";import{n as r}from"./dist-BOS6OKSE.js";var i=500,a=1e4;function o(e,t){return`${e} ${t}`}var s=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;connectionListeners=new Set;shellWaiters=new Map;attach(e,t,n,r,i){let a={session:e,term:t,cols:n,rows:r,handlers:i};return this.terminals.set(o(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(o(e,t))&&this.open&&this.send({t:`detach`,session:e,term:t})}write(e,t,n){this.open&&this.send({t:`stdin`,session:e,term:t,data:n})}resize(e,t,n,r){let i=this.terminals.get(o(e,t));i&&(i.cols=n,i.rows=r),this.open&&this.send({t:`resize`,session:e,term:t,cols:n,rows:r})}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)}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 r=n.get(),a=t();if(!r&&!a)return;let o=window.location.protocol===`https:`?`wss`:`ws`,s=a?a.socket():new WebSocket(`${o}://${window.location.host}/ws`);this.ws=s,s.addEventListener(`open`,()=>{if(this.ws!==s){s.close();return}a||s.send(JSON.stringify({t:`auth`,token:r}))}),s.addEventListener(`message`,e=>{if(this.ws!==s)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{session:e,term:t,cols:n,rows:r}of this.terminals.values())this.send({t:`attach`,session:e,term:t,cols:n,rows:r});for(let e of this.connectionListeners)e(!0)}else this.open&&this.handle(t)}),s.addEventListener(`close`,t=>{if(this.ws!==s)return;let n=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(),n)for(let e of this.connectionListeners)e(!1);if(t.code===4401&&t.reason===`browser_rejected`){e();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,a))}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`:case`output`:this.terminals.get(o(e.session,e.term))?.handlers.onData(e.data,e.t);break;case`exit`:this.terminals.get(o(e.session,e.term))?.handlers.onExit?.(e.code);break;case`status`: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`shell-spawned`:{let t=this.shellWaiters.get(e.session)?.shift();t&&t.resolve(e.term);break}case`notice`:(e.level===`warning`?r.warning:r.error)(e.title,{...e.detail===void 0?{}:{description:e.detail},duration:12e3});break;case`error`:r.error(`Connection error`,{description:e.message});break}}};export{s as t};
|
package/dist/public/index.html
CHANGED
|
@@ -47,14 +47,15 @@
|
|
|
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-np8JXeG6.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
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
54
|
-
<link rel="modulepreload" crossorigin href="/assets/auth-
|
|
53
|
+
<link rel="modulepreload" crossorigin href="/assets/react-dom-cJyBB_A4.js">
|
|
54
|
+
<link rel="modulepreload" crossorigin href="/assets/auth-GfOuXpIe.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="/assets/client-settings-CwqpIric.js">
|
|
56
|
+
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-By8HlURe.js">
|
|
56
57
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
57
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
58
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CPHfr3MU.css">
|
|
58
59
|
</head>
|
|
59
60
|
<body>
|
|
60
61
|
<div id="root"></div>
|