@spencer-kit/coder-studio 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,111 +0,0 @@
1
- import{r as e,t}from"./rolldown-runtime-S-ySWqyJ.js";import{Bt as n,Ft as r,It as i,Lt as a,Mt as o,Nt as s,Pt as c,Rt as l,zt as u}from"./monaco-editor-CZixARFH.js";import{n as d,t as f}from"./xterm-0bvFymvt.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function p(e){return`init`in e}function m(e){return!!e.write}function h(e){return!!e.onMount}function g(e){return`v`in e||`e`in e}function _(e){if(`e`in e)throw e.e;return e.v}function v(e){return typeof e?.then==`function`}function y(e,t,n){if(!n.p.has(e)){n.p.add(e);let r=()=>n.p.delete(e);t.then(r,r)}}function b(e,t,n){let r=n.get(e)?.t,i=t.p;if(!r?.size)return i;if(!i.size)return r;let a=new Set(r);for(let e of i)a.add(e);return a}var x=(e,t,...n)=>t.read(...n),S=(e,t,...n)=>t.write(...n),C=(e,t)=>t.INTERNAL_onInit?.call(t,e),w=(e,t,n)=>t.onMount?.call(t,n),T=(e,t)=>{var n;let r=F(e),i=r[0],a=r[6],o=r[9],s=i.get(t);return s||(s={d:new Map,p:new Set,n:0},i.set(t,s),(n=a.i)==null||n.call(a,t),o?.(e,t)),s},E=e=>{let t=F(e),n=t[1],r=t[3],i=t[4],a=t[5],o=t[6],s=t[13];if(!o.f&&!r.size&&!i.size&&!a.size)return;let c=[],l=e=>{try{e()}catch(e){c.push(e)}};do{o.f&&l(o.f);let t=new Set;for(let e of r){let r=n.get(e)?.l;if(r)for(let e of r)t.add(e)}r.clear();for(let e of a)t.add(e);a.clear();for(let e of i)t.add(e);i.clear();for(let e of t)l(e);r.size&&s(e)}while(r.size||a.size||i.size);if(c.length)throw AggregateError(c)},D=e=>{let t=F(e),n=t[1],r=t[2],i=t[3],a=t[11],o=t[14],s=t[17];if(!i.size)return;let c=[],l=[],u=new WeakSet,d=new WeakSet,f=[],p=[];for(let t of i)f.push(t),p.push(a(e,t));for(;f.length;){let t=f.length-1,i=f[t],o=p[t];if(d.has(i)){f.pop(),p.pop();continue}if(u.has(i)){r.get(i)===o.n&&(c.push(i),l.push(o)),d.add(i),f.pop(),p.pop();continue}u.add(i);for(let t of b(i,o,n))u.has(t)||(f.push(t),p.push(a(e,t)))}for(let t=c.length-1;t>=0;--t){let n=c[t],a=l[t],u=!1;for(let e of a.d.keys())if(e!==n&&i.has(e)){u=!0;break}u&&(r.set(n,a.n),o(e,n),s(e,n)),r.delete(n)}},O=(e,t)=>{var n,r;let i=F(e),a=i[1],o=i[2],s=i[3],c=i[6],l=i[7],u=i[11],d=i[12],f=i[13],h=i[14],b=i[16],x=i[17],S=i[20],C=i[26],w=i[28],T=u(e,t),E=w[0];if(g(T)){if(a.has(t)&&o.get(t)!==T.n||T.m===E)return T.m=E,T;let n=!1;for(let[t,r]of T.d)if(h(e,t).n!==r){n=!0;break}if(!n)return T.m=E,T}let D=!0,O=new Set(T.d.keys()),k=()=>{for(let e of O)T.d.delete(e)},A=()=>{if(a.has(t)){let n=!s.size;x(e,t),n&&(f(e),d(e))}},j=n=>{var r;if(n===t){let t=u(e,n);if(!g(t))if(p(n))S(e,n,n.init);else throw Error(`no atom init`);return _(t)}let i=h(e,n);try{return _(i)}finally{O.delete(n),T.d.set(n,i.n),v(T.v)&&y(t,T.v,i),a.has(t)&&((r=a.get(n))==null||r.t.add(t)),D||A()}},ee,M,N={get signal(){return ee||=new AbortController,ee.signal},get setSelf(){return!M&&m(t)&&(M=(...n)=>{if(!D)try{return b(e,t,...n)}finally{f(e),d(e)}}),M}},te=T.n,ne=o.get(t)===te;try{let r=l(e,t,j,N);if(S(e,t,r),v(r)){C(e,r,()=>ee?.abort());let t=()=>{k(),A()};r.then(t,t)}else k();return(n=c.r)==null||n.call(c,t),T.m=E,T}catch(e){return delete T.v,T.e=e,++T.n,T.m=E,T}finally{D=!1,T.n!==te&&ne&&(o.set(t,T.n),s.add(t),(r=c.c)==null||r.call(c,t))}},k=(e,t)=>{let n=F(e),r=n[1],i=n[2],a=n[11],o=[t];for(;o.length;){let t=o.pop(),n=a(e,t);for(let s of b(t,n,r)){let t=a(e,s);i.get(s)!==t.n&&(i.set(s,t.n),o.push(s))}}},A=(e,t,...n)=>{let r=F(e),i=r[3],a=r[6],o=r[8],s=r[11],c=r[12],l=r[13],u=r[14],d=r[15],f=r[16],m=r[17],h=r[20],g=r[28],v=!0,y=t=>_(u(e,t)),b=(n,...r)=>{var o;let u=s(e,n);try{if(n===t){if(!p(n))throw Error(`atom not writable`);let t=u.n,s=r[0];h(e,n,s),m(e,n),t!==u.n&&(++g[0],i.add(n),d(e,n),(o=a.c)==null||o.call(a,n));return}else return f(e,n,...r)}finally{v||(l(e),c(e))}};try{return o(e,t,y,b,...n)}finally{v=!1}},j=(e,t)=>{var n;let r=F(e),i=r[1],a=r[3],o=r[6],s=r[11],c=r[15],l=r[18],u=r[19],d=s(e,t),f=i.get(t);if(f&&d.d.size>0){for(let[r,i]of d.d)if(!f.d.has(r)){let u=s(e,r);l(e,r).t.add(t),f.d.add(r),i!==u.n&&(a.add(r),c(e,r),(n=o.c)==null||n.call(o,r))}for(let n of f.d)d.d.has(n)||(f.d.delete(n),u(e,n)?.t.delete(t))}},ee=(e,t)=>{var n;let r=F(e),i=r[1],a=r[4],o=r[6],s=r[10],c=r[11],l=r[12],u=r[13],d=r[14],f=r[16],p=r[18],g=c(e,t),_=i.get(t);if(!_){d(e,t);for(let n of g.d.keys())p(e,n).t.add(t);_={l:new Set,d:new Set(g.d.keys()),t:new Set},i.set(t,_),m(t)&&h(t)&&a.add(()=>{let n=!0,r=(...r)=>{try{return f(e,t,...r)}finally{n||(u(e),l(e))}};try{let i=s(e,t,r);i&&(_.u=()=>{n=!0;try{i()}finally{n=!1}})}finally{n=!1}}),(n=o.m)==null||n.call(o,t)}return _},M=(e,t)=>{var n;let r=F(e),i=r[1],a=r[5],o=r[6],s=r[11],c=r[19],l=s(e,t),u=i.get(t);if(!u||u.l.size)return u;let d=!1;for(let e of u.t)if(i.get(e)?.d.has(t)){d=!0;break}if(!d){u.u&&a.add(u.u),u=void 0,i.delete(t);for(let n of l.d.keys())c(e,n)?.t.delete(t);(n=o.u)==null||n.call(o,t);return}return u},N=(e,t,n)=>{let r=F(e),i=r[11],a=r[27],o=i(e,t),s=`v`in o,c=o.v;if(v(n))for(let r of o.d.keys())y(t,n,i(e,r));o.v=n,delete o.e,(!s||!Object.is(c,o.v))&&(++o.n,v(c)&&a(e,c))},te=(e,t)=>{let n=F(e)[14];return _(n(e,t))},ne=(e,t,...n)=>{let r=F(e),i=r[3],a=r[12],o=r[13],s=r[16],c=i.size;try{return s(e,t,...n)}finally{i.size!==c&&(o(e),a(e))}},re=(e,t,n)=>{let r=F(e),i=r[12],a=r[18],o=r[19],s=a(e,t).l;return s.add(n),i(e),()=>{s.delete(n),o(e,t),i(e)}},ie=(e,t,n)=>{let r=F(e)[25],i=r.get(t);if(!i){i=new Set,r.set(t,i);let e=()=>r.delete(t);t.then(e,e)}i.add(n)},ae=(e,t)=>{F(e)[25].get(t)?.forEach(e=>e())},P=new WeakMap,F=e=>P.get(e);function oe(e){let t=F(e),n=t[24];return n?n(t):t}function se(...e){let t={get(e){let n=F(t)[21];return n(t,e)},set(e,...n){let r=F(t)[22];return r(t,e,...n)},sub(e,n){let r=F(t)[23];return r(t,e,n)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},x,S,C,w,T,E,D,O,k,A,j,ee,M,N,te,ne,re,void 0,new WeakMap,ie,ae,[0]].map((t,n)=>e[n]||t);return P.set(t,Object.freeze(n)),t}var ce=0;function I(e,t){let n=`atom${++ce}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=le,r.write=ue),t&&(r.write=t),r}function le(e){return e(this)}function ue(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}var de;function fe(){return de?de():se()}var pe;function me(){return pe||=fe(),pe}var he=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function ee(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=M(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(ee(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function te(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ne=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},re={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=re,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:te}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,ne)}catch(e){ne(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.5`})),ge=t(((e,t)=>{t.exports=he()})),L=e(ge(),1),_e=(0,L.createContext)(void 0);function ve(e){let t=(0,L.useContext)(_e);return e?.store||t||me()}function ye({children:e,store:t}){let n=(0,L.useRef)(null);return t?(0,L.createElement)(_e.Provider,{value:t},e):(n.current===null&&(n.current=fe()),(0,L.createElement)(_e.Provider,{value:n.current},e))}var be=e=>typeof e?.then==`function`,xe=e=>{e.status||(e.status=`pending`,e.then(t=>{e.status=`fulfilled`,e.value=t},t=>{e.status=`rejected`,e.reason=t}))},Se=L.use||(e=>{if(e.status===`pending`)throw e;if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:(xe(e),e)}),Ce=new WeakMap,we=(e,t,n)=>{let r=oe(e)[26],i=Ce.get(t);return i||(i=new Promise((a,o)=>{let s=t,c=e=>t=>{s===e&&a(t)},l=e=>t=>{s===e&&o(t)},u=()=>{try{let t=n();be(t)?(Ce.set(t,i),s=t,t.then(c(t),l(t)),r(e,t,u)):a(t)}catch(e){o(e)}};t.then(c(t),l(t)),r(e,t,u)}),Ce.set(t,i)),i};function R(e,t){let{delay:n,unstable_promiseStatus:r=!L.use}=t||{},i=ve(t),[[a,o,s],c]=(0,L.useReducer)(t=>{let n=i.get(e);return Object.is(t[0],n)&&t[1]===i&&t[2]===e?t:[n,i,e]},void 0,()=>[i.get(e),i,e]),l=a;if((o!==i||s!==e)&&(c(),l=i.get(e)),(0,L.useEffect)(()=>{let t=i.sub(e,()=>{if(r)try{let t=i.get(e);be(t)&&xe(we(i,t,()=>i.get(e)))}catch{}if(typeof n==`number`){console.warn(`[DEPRECATED] delay option is deprecated and will be removed in v3.
2
-
3
- Migration guide:
4
-
5
- Create a custom hook like the following.
6
-
7
- function useAtomValueWithDelay<Value>(
8
- atom: Atom<Value>,
9
- options: { delay: number },
10
- ): Value {
11
- const { delay } = options
12
- const store = useStore(options)
13
- const [value, setValue] = useState(() => store.get(atom))
14
- useEffect(() => {
15
- const unsub = store.sub(atom, () => {
16
- setTimeout(() => setValue(store.get(atom)), delay)
17
- })
18
- return unsub
19
- }, [store, atom, delay])
20
- return value
21
- }
22
- `),setTimeout(c,n);return}c()});return c(),t},[i,e,n,r]),(0,L.useDebugValue)(l),be(l)){let t=we(i,l,()=>i.get(e));return r&&xe(t),Se(t)}return l}function z(e,t){let n=ve(t);return(0,L.useCallback)((...t)=>n.set(e,...t),[n,e])}function Te(e,t){return[R(e,t),z(e,t)]}var Ee=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),De=t(((e,t)=>{t.exports=Ee()})),Oe=t((e=>{var t=ge();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.5`})),ke=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Oe()})),Ae=t((e=>{var t=De(),n=ge(),r=ke();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var ee=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},ne=[],re=-1;function ie(e){return{current:e}}function ae(e){0>re||(e.current=ne[re],ne[re]=null,re--)}function P(e,t){re++,ne[re]=e.current,e.current=t}var F=ie(null),oe=ie(null),se=ie(null),ce=ie(null);function I(e,t){switch(P(se,t),P(oe,e),P(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ae(F),P(F,e)}function le(){ae(F),ae(oe),ae(se)}function ue(e){e.memoizedState!==null&&P(ce,e);var t=F.current,n=Hd(t,e.type);t!==n&&(P(oe,e),P(F,n))}function de(e){oe.current===e&&(ae(F),ae(oe)),ce.current===e&&(ae(ce),Qf._currentValue=te)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
23
- at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
24
- `+fe+e+pe}var he=!1;function L(e,t){if(!e||he)return``;he=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
25
- `),l=s.split(`
26
- `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
27
- `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{he=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?me(n):``}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return me(e.type);case 16:return me(`Lazy`);case 13:return e.child!==t&&t!==null?me(`Suspense Fallback`):me(`Suspense`);case 19:return me(`SuspenseList`);case 0:case 15:return L(e.type,!1);case 11:return L(e.type.render,!1);case 1:return L(e.type,!0);case 31:return me(`Activity`);default:return``}}function ve(e){try{var t=``,n=null;do t+=_e(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
28
- Error generating stack: `+e.message+`
29
- `+e.stack}}var ye=Object.prototype.hasOwnProperty,be=t.unstable_scheduleCallback,xe=t.unstable_cancelCallback,Se=t.unstable_shouldYield,Ce=t.unstable_requestPaint,we=t.unstable_now,R=t.unstable_getCurrentPriorityLevel,z=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,je=t.log,Me=t.unstable_setDisableYieldValue,Ne=null,Pe=null;function Fe(e){if(typeof je==`function`&&Me(e),Pe&&typeof Pe.setStrictMode==`function`)try{Pe.setStrictMode(Ne,e)}catch{}}var Ie=Math.clz32?Math.clz32:ze,Le=Math.log,Re=Math.LN2;function ze(e){return e>>>=0,e===0?32:31-(Le(e)/Re|0)|0}var Be=256,Ve=262144,He=4194304;function Ue(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function We(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ue(n))):i=Ue(o):i=Ue(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ue(n))):i=Ue(o)):i=Ue(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ge(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ke(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function qe(){var e=He;return He<<=1,!(He&62914560)&&(He=4194304),e}function Je(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ye(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xe(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ie(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ze(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ze(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ie(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ie(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function $e(e,t){var n=t&-t;return n=n&42?1:et(n),(n&(e.suspendedLanes|t))===0?n:0}function et(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function tt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function nt(){var e=N.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function rt(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var it=Math.random().toString(36).slice(2),at=`__reactFiber$`+it,ot=`__reactProps$`+it,st=`__reactContainer$`+it,ct=`__reactEvents$`+it,lt=`__reactListeners$`+it,ut=`__reactHandles$`+it,dt=`__reactResources$`+it,ft=`__reactMarker$`+it;function pt(e){delete e[at],delete e[ot],delete e[ct],delete e[lt],delete e[ut]}function mt(e){var t=e[at];if(t)return t;for(var n=e.parentNode;n;){if(t=n[st]||n[at]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[at])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function ht(e){if(e=e[at]||e[st]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function gt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function _t(e){var t=e[dt];return t||=e[dt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function vt(e){e[ft]=!0}var yt=new Set,bt={};function xt(e,t){St(e,t),St(e+`Capture`,t)}function St(e,t){for(bt[e]=t,e=0;e<t.length;e++)yt.add(t[e])}var Ct=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),wt={},Tt={};function Et(e){return ye.call(Tt,e)?!0:ye.call(wt,e)?!1:Ct.test(e)?Tt[e]=!0:(wt[e]=!0,!1)}function Dt(e,t,n){if(Et(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ot(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function kt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function At(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function jt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Mt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Nt(e){if(!e._valueTracker){var t=jt(e)?`checked`:`value`;e._valueTracker=Mt(e,t,``+e[t])}}function Pt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=jt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Ft(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var It=/[\n"\\]/g;function Lt(e){return e.replace(It,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Rt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+At(t)):e.value!==``+At(t)&&(e.value=``+At(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Bt(e,o,At(n)):Bt(e,o,At(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+At(s):e.removeAttribute(`name`)}function zt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Nt(e);return}n=n==null?``:``+At(n),t=t==null?n:``+At(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Nt(e)}function Bt(e,t,n){t===`number`&&Ft(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Vt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+At(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Ht(e,t,n){if(t!=null&&(t=``+At(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+At(n)}function Ut(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ee(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=At(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Nt(e)}function Wt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Gt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Kt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Gt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function qt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Kt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Kt(e,o,t[o])}function Jt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Yt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Xt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Zt(e){return Xt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Qt(){}var $t=null;function en(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tn=null,nn=null;function rn(e){var t=ht(e);if(t&&(e=t.stateNode)){var n=e[ot]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Rt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Lt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ot]||null;if(!a)throw Error(i(90));Rt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Pt(r)}break a;case`textarea`:Ht(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Vt(e,!!n.multiple,t,!1)}}}var an=!1;function on(e,t,n){if(an)return e(t,n);an=!0;try{return e(t)}finally{if(an=!1,(tn!==null||nn!==null)&&(xu(),tn&&(t=tn,e=nn,nn=tn=null,rn(t),e)))for(t=0;t<e.length;t++)rn(e[t])}}function sn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ot]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var cn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),ln=!1;if(cn)try{var un={};Object.defineProperty(un,`passive`,{get:function(){ln=!0}}),window.addEventListener(`test`,un,un),window.removeEventListener(`test`,un,un)}catch{ln=!1}var dn=null,fn=null,pn=null;function mn(){if(pn)return pn;var e,t=fn,n=t.length,r,i=`value`in dn?dn.value:dn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return pn=i.slice(e,1<r?1-r:void 0)}function hn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function gn(){return!0}function _n(){return!1}function vn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?gn:_n,this.isPropagationStopped=_n,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=gn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=gn)},persist:function(){},isPersistent:gn}),t}var yn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bn=vn(yn),xn=f({},yn,{view:0,detail:0}),Sn=vn(xn),Cn,wn,Tn,En=f({},xn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ln,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Tn&&(Tn&&e.type===`mousemove`?(Cn=e.screenX-Tn.screenX,wn=e.screenY-Tn.screenY):wn=Cn=0,Tn=e),Cn)},movementY:function(e){return`movementY`in e?e.movementY:wn}}),Dn=vn(En),On=vn(f({},En,{dataTransfer:0})),kn=vn(f({},xn,{relatedTarget:0})),An=vn(f({},yn,{animationName:0,elapsedTime:0,pseudoElement:0})),jn=vn(f({},yn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Mn=vn(f({},yn,{data:0})),Nn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Pn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Fn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function In(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Fn[e])?!!t[e]:!1}function Ln(){return In}var Rn=vn(f({},xn,{key:function(e){if(e.key){var t=Nn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=hn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Pn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ln,charCode:function(e){return e.type===`keypress`?hn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?hn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),zn=vn(f({},En,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Bn=vn(f({},xn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ln})),Vn=vn(f({},yn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Hn=vn(f({},En,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Un=vn(f({},yn,{newState:0,oldState:0})),Wn=[9,13,27,32],Gn=cn&&`CompositionEvent`in window,Kn=null;cn&&`documentMode`in document&&(Kn=document.documentMode);var qn=cn&&`TextEvent`in window&&!Kn,Jn=cn&&(!Gn||Kn&&8<Kn&&11>=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=mn(),pn=fn=dn=null,$n=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Jn&&t.locale!==`ko`?null:t.data;default:return null}}var nr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!nr[e.type]:t===`textarea`}function ir(e,t,n,r){tn?nn?nn.push(r):nn=[r]:tn=r,t=Ed(t,`onChange`),0<t.length&&(n=new bn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ar=null,or=null;function sr(e){yd(e,0)}function cr(e){if(Pt(gt(e)))return e}function lr(e,t){if(e===`change`)return t}var ur=!1;if(cn){var dr;if(cn){var fr=`oninput`in document;if(!fr){var pr=document.createElement(`div`);pr.setAttribute(`oninput`,`return;`),fr=typeof pr.oninput==`function`}dr=fr}else dr=!1;ur=dr&&(!document.documentMode||9<document.documentMode)}function mr(){ar&&(ar.detachEvent(`onpropertychange`,hr),or=ar=null)}function hr(e){if(e.propertyName===`value`&&cr(or)){var t=[];ir(t,or,e,en(e)),on(sr,t)}}function gr(e,t,n){e===`focusin`?(mr(),ar=t,or=n,ar.attachEvent(`onpropertychange`,hr)):e===`focusout`&&mr()}function _r(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return cr(or)}function vr(e,t){if(e===`click`)return cr(t)}function yr(e,t){if(e===`input`||e===`change`)return cr(t)}function br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var xr=typeof Object.is==`function`?Object.is:br;function Sr(e,t){if(xr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ye.call(t,i)||!xr(e[i],t[i]))return!1}return!0}function Cr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function wr(e,t){var n=Cr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Cr(n)}}function Tr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Tr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Er(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ft(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function Dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Or=cn&&`documentMode`in document&&11>=document.documentMode,kr=null,Ar=null,jr=null,Mr=!1;function Nr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mr||kr==null||kr!==Ft(r)||(r=kr,`selectionStart`in r&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),jr&&Sr(jr,r)||(jr=r,r=Ed(Ar,`onSelect`),0<r.length&&(t=new bn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=kr)))}function Pr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Fr={animationend:Pr(`Animation`,`AnimationEnd`),animationiteration:Pr(`Animation`,`AnimationIteration`),animationstart:Pr(`Animation`,`AnimationStart`),transitionrun:Pr(`Transition`,`TransitionRun`),transitionstart:Pr(`Transition`,`TransitionStart`),transitioncancel:Pr(`Transition`,`TransitionCancel`),transitionend:Pr(`Transition`,`TransitionEnd`)},Ir={},Lr={};cn&&(Lr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),`TransitionEvent`in window||delete Fr.transitionend.transition);function Rr(e){if(Ir[e])return Ir[e];if(!Fr[e])return e;var t=Fr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lr)return Ir[e]=t[n];return e}var zr=Rr(`animationend`),Br=Rr(`animationiteration`),Vr=Rr(`animationstart`),Hr=Rr(`transitionrun`),Ur=Rr(`transitionstart`),Wr=Rr(`transitioncancel`),Gr=Rr(`transitionend`),Kr=new Map,qr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);qr.push(`scrollEnd`);function Jr(e,t){Kr.set(e,t),xt(t,[e])}var Yr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Xr=[],B=0,Zr=0;function Qr(){for(var e=B,t=Zr=B=0;t<e;){var n=Xr[t];Xr[t++]=null;var r=Xr[t];Xr[t++]=null;var i=Xr[t];Xr[t++]=null;var a=Xr[t];if(Xr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ni(n,i,a)}}function $r(e,t,n,r){Xr[B++]=e,Xr[B++]=t,Xr[B++]=n,Xr[B++]=r,Zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ei(e,t,n,r){return $r(e,t,n,r),ri(e)}function ti(e,t){return $r(e,null,null,t),ri(e)}function ni(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ie(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ri(e){if(50<fu)throw fu=0,pu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ii={};function ai(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function oi(e,t,n,r){return new ai(e,t,n,r)}function si(e){return e=e.prototype,!(!e||!e.isReactComponent)}function V(e,t){var n=e.alternate;return n===null?(n=oi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ci(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function li(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)si(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,F.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case E:return e=oi(31,n,t,a),e.elementType=E,e.lanes=o,e;case g:return ui(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=oi(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=oi(13,n,t,a),e.elementType=S,e.lanes=o,e;case C:return e=oi(19,n,t,a),e.elementType=C,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case w:s=14;break a;case T:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=oi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ui(e,t,n,r){return e=oi(7,e,r,t),e.lanes=n,e}function di(e,t,n){return e=oi(6,e,null,t),e.lanes=n,e}function fi(e){var t=oi(18,null,null,0);return t.stateNode=e,t}function pi(e,t,n){return t=oi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var mi=new WeakMap;function hi(e,t){if(typeof e==`object`&&e){var n=mi.get(e);return n===void 0?(t={value:e,source:t,stack:ve(t)},mi.set(e,t),t):n}return{value:e,source:t,stack:ve(t)}}var gi=[],_i=0,vi=null,yi=0,H=[],bi=0,xi=null,Si=1,Ci=``;function wi(e,t){gi[_i++]=yi,gi[_i++]=vi,vi=e,yi=t}function Ti(e,t,n){H[bi++]=Si,H[bi++]=Ci,H[bi++]=xi,xi=e;var r=Si;e=Ci;var i=32-Ie(r)-1;r&=~(1<<i),n+=1;var a=32-Ie(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Si=1<<32-Ie(t)+i|n<<i|r,Ci=a+e}else Si=1<<a|n<<i|r,Ci=e}function Ei(e){e.return!==null&&(wi(e,1),Ti(e,1,0))}function Di(e){for(;e===vi;)vi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null;for(;e===xi;)xi=H[--bi],H[bi]=null,Ci=H[--bi],H[bi]=null,Si=H[--bi],H[bi]=null}function Oi(e,t){H[bi++]=Si,H[bi++]=Ci,H[bi++]=xi,Si=t.id,Ci=t.overflow,xi=e}var ki=null,Ai=null,U=!1,ji=null,Mi=!1,Ni=Error(i(519));function Pi(e){throw Bi(hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ni}function Fi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[at]=e,t[ot]=r,n){case`dialog`:Q(`cancel`,t),Q(`close`,t);break;case`iframe`:case`object`:case`embed`:Q(`load`,t);break;case`video`:case`audio`:for(n=0;n<vd.length;n++)Q(vd[n],t);break;case`source`:Q(`error`,t);break;case`img`:case`image`:case`link`:Q(`error`,t),Q(`load`,t);break;case`details`:Q(`toggle`,t);break;case`input`:Q(`invalid`,t),zt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Q(`invalid`,t);break;case`textarea`:Q(`invalid`,t),Ut(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&(Q(`beforetoggle`,t),Q(`toggle`,t)),r.onScroll!=null&&Q(`scroll`,t),r.onScrollEnd!=null&&Q(`scrollend`,t),r.onClick!=null&&(t.onclick=Qt),t=!0):t=!1,t||Pi(e,!0)}function Ii(e){for(ki=e.return;ki;)switch(ki.tag){case 5:case 31:case 13:Mi=!1;return;case 27:case 3:Mi=!0;return;default:ki=ki.return}}function Li(e){if(e!==ki)return!1;if(!U)return Ii(e),U=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Ud(e.type,e.memoizedProps)),n=!n),n&&Ai&&Pi(e),Ii(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ai=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ai=uf(e)}else t===27?(t=Ai,Zd(e.type)?(e=lf,lf=null,Ai=e):Ai=t):Ai=ki?cf(e.stateNode.nextSibling):null;return!0}function Ri(){Ai=ki=null,U=!1}function zi(){var e=ji;return e!==null&&(Ql===null?Ql=e:Ql.push.apply(Ql,e),ji=null),e}function Bi(e){ji===null?ji=[e]:ji.push(e)}var Vi=ie(null),Hi=null,Ui=null;function Wi(e,t,n){P(Vi,t._currentValue),t._currentValue=n}function Gi(e){e._currentValue=Vi.current,ae(Vi)}function Ki(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function qi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ki(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ki(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Ji(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;xr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ce.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&qi(t,e,n,r),t.flags|=262144}function Yi(e){for(e=e.firstContext;e!==null;){if(!xr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Xi(e){Hi=e,Ui=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Zi(e){return $i(Hi,e)}function Qi(e,t){return Hi===null&&Xi(e),$i(e,t)}function $i(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ui===null){if(e===null)throw Error(i(308));Ui=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ui=Ui.next=t;return n}var ea=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ta=t.unstable_scheduleCallback,na=t.unstable_NormalPriority,ra={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ia(){return{controller:new ea,data:new Map,refCount:0}}function aa(e){e.refCount--,e.refCount===0&&ta(na,function(){e.controller.abort()})}var oa=null,sa=0,ca=0,la=null;function ua(e,t){if(oa===null){var n=oa=[];sa=0,ca=pd(),la={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return sa++,t.then(da,da),t}function da(){if(--sa===0&&oa!==null){la!==null&&(la.status=`fulfilled`);var e=oa;oa=null,ca=0,la=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function fa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var pa=M.S;M.S=function(e,t){tu=we(),typeof t==`object`&&t&&typeof t.then==`function`&&ua(e,t),pa!==null&&pa(e,t)};var ma=ie(null);function ha(){var e=ma.current;return e===null?zl.pooledCache:e}function ga(e,t){t===null?P(ma,ma.current):P(ma,t.pool)}function _a(){var e=ha();return e===null?null:{parent:ra._currentValue,pool:e}}var va=Error(i(460)),ya=Error(i(474)),ba=Error(i(542)),xa={then:function(){}};function Sa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ca(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Qt,Qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e;default:if(typeof t.status==`string`)t.then(Qt,Qt);else{if(e=zl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Da(e),e}throw Ta=t,va}}function wa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ta=e,va):e}}var Ta=null;function Ea(){if(Ta===null)throw Error(i(459));var e=Ta;return Ta=null,e}function Da(e){if(e===va||e===ba)throw Error(i(483))}var Oa=null,ka=0;function Aa(e){var t=ka;return ka+=1,Oa===null&&(Oa=[]),Ca(Oa,e,t)}function ja(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ma(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Na(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=V(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=di(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===T&&wa(i)===t.type)?(t=a(t,n.props),ja(t,n),t.return=e,t):(t=li(n.type,n.key,n.props,null,e.mode,r),ja(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=pi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ui(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=di(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=li(t.type,t.key,t.props,null,e.mode,n),ja(n,t),n.return=e,n;case h:return t=pi(t,e.mode,n),t.return=e,t;case T:return t=wa(t),f(e,t,n)}if(ee(t)||k(t))return t=ui(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Aa(t),n);if(t.$$typeof===b)return f(e,Qi(e,t),n);Ma(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case T:return n=wa(n),p(e,t,n,r)}if(ee(n)||k(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Aa(n),r);if(n.$$typeof===b)return p(e,t,Qi(e,n),r);Ma(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case T:return r=wa(r),_(e,t,n,r,i)}if(ee(r)||k(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,Aa(r),i);if(r.$$typeof===b)return _(e,t,n,Qi(t,r),i);Ma(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),U&&wi(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return U&&wi(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),U&&wi(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),U&&wi(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return U&&wi(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),U&&wi(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&wa(l)===r.type){n(e,r.sibling),c=a(r,o.props),ja(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=li(o.type,o.key,o.props,null,e.mode,c),ja(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=pi(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=wa(o),x(e,r,o,c)}if(ee(o))return v(e,r,o,c);if(k(o)){if(l=k(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,Aa(o),c);if(o.$$typeof===b)return x(e,r,Qi(e,o),c);Ma(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ka=0;var i=x(e,t,n,r);return Oa=null,i}catch(t){if(t===va||t===ba)throw t;var a=oi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Pa=Na(!0),Fa=Na(!1),Ia=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ra(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function za(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ri(e),ni(e,null,n),t}return $r(e,r,t,n),ri(e)}function Va(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}function Ha(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ua=!1;function Wa(){if(Ua){var e=la;if(e!==null)throw e}}function Ga(e,t,n,r){Ua=!1;var i=e.updateQueue;Ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(J&p)===p:(r&p)===p){p!==0&&p===ca&&(Ua=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ia=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Kl|=o,e.lanes=o,e.memoizedState=d}}function Ka(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function qa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ka(n[e],t)}var Ja=ie(null),Ya=ie(0);function Xa(e,t){e=Wl,P(Ya,e),P(Ja,t),Wl=e|t.baseLanes}function Za(){P(Ya,Wl),P(Ja,Ja.current)}function Qa(){Wl=Ya.current,ae(Ja),ae(Ya)}var $a=ie(null),eo=null;function to(e){var t=e.alternate;P(oo,oo.current&1),P($a,e),eo===null&&(t===null||Ja.current!==null||t.memoizedState!==null)&&(eo=e)}function no(e){P(oo,oo.current),P($a,e),eo===null&&(eo=e)}function ro(e){e.tag===22?(P(oo,oo.current),P($a,e),eo===null&&(eo=e)):io(e)}function io(){P(oo,oo.current),P($a,$a.current)}function ao(e){ae($a),eo===e&&(eo=null),ae(oo)}var oo=ie(0);function so(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var co=0,W=null,lo=null,uo=null,fo=!1,po=!1,mo=!1,ho=0,go=0,_o=null,vo=0;function yo(){throw Error(i(321))}function bo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!xr(e[n],t[n]))return!1;return!0}function xo(e,t,n,r,i,a){return co=a,W=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?Rs:zs,mo=!1,a=n(r,i),mo=!1,po&&(a=Co(t,n,r,i)),So(e),a}function So(e){M.H=Ls;var t=lo!==null&&lo.next!==null;if(co=0,uo=lo=W=null,fo=!1,go=0,_o=null,t)throw Error(i(300));e===null||nc||(e=e.dependencies,e!==null&&Yi(e)&&(nc=!0))}function Co(e,t,n,r){W=e;var a=0;do{if(po&&(_o=null),go=0,po=!1,25<=a)throw Error(i(301));if(a+=1,uo=lo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}M.H=Bs,o=t(n,r)}while(po);return o}function wo(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?jo(t):t,e=e.useState()[0],(lo===null?null:lo.memoizedState)!==e&&(W.flags|=1024),t}function To(){var e=ho!==0;return ho=0,e}function Eo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Do(e){if(fo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}fo=!1}co=0,uo=lo=W=null,po=!1,go=ho=0,_o=null}function Oo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return uo===null?W.memoizedState=uo=e:uo=uo.next=e,uo}function ko(){if(lo===null){var e=W.alternate;e=e===null?null:e.memoizedState}else e=lo.next;var t=uo===null?W.memoizedState:uo.next;if(t!==null)uo=t,lo=e;else{if(e===null)throw W.alternate===null?Error(i(467)):Error(i(310));lo=e,e={memoizedState:lo.memoizedState,baseState:lo.baseState,baseQueue:lo.baseQueue,queue:lo.queue,next:null},uo===null?W.memoizedState=uo=e:uo=uo.next=e}return uo}function Ao(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function jo(e){var t=go;return go+=1,_o===null&&(_o=[]),e=Ca(_o,e,t),t=W,(uo===null?t.memoizedState:uo.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?Rs:zs),e}function Mo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return jo(e);if(e.$$typeof===b)return Zi(e)}throw Error(i(438,String(e)))}function No(e){var t=null,n=W.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=W.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Ao(),W.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=D;return t.index++,n}function Po(e,t){return typeof t==`function`?t(e):t}function Fo(e){return Io(ko(),lo,e)}function Io(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(co&f)===f:(J&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ca&&(d=!0);else if((co&p)===p){u=u.next,p===ca&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,W.lanes|=p,Kl|=p;f=u.action,mo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,W.lanes|=f,Kl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!xr(o,e.memoizedState)&&(nc=!0,d&&(n=la,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Lo(e){var t=ko(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);xr(o,t.memoizedState)||(nc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ro(e,t,n){var r=W,a=ko(),o=U;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!xr((lo||a).memoizedState,n);if(s&&(a.memoizedState=n,nc=!0),a=a.queue,ls(Vo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||uo!==null&&uo.memoizedState.tag&1){if(r.flags|=2048,is(9,{destroy:void 0},Bo.bind(null,r,a,n,t),null),zl===null)throw Error(i(349));o||co&127||zo(r,t,n)}return n}function zo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=W.updateQueue,t===null?(t=Ao(),W.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Bo(e,t,n,r){t.value=n,t.getSnapshot=r,Ho(t)&&Uo(e)}function Vo(e,t,n){return n(function(){Ho(t)&&Uo(e)})}function Ho(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xr(e,n)}catch{return!0}}function Uo(e){var t=ti(e,2);t!==null&&gu(t,e,2)}function Wo(e){var t=Oo();if(typeof e==`function`){var n=e;if(e=n(),mo){Fe(!0);try{n()}finally{Fe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:e},t}function Go(e,t,n,r){return e.baseState=n,Io(e,lo,typeof r==`function`?r:Po)}function Ko(e,t,n,r,a){if(Ps(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};M.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,qo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function qo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),Jo(e,t,s)}catch(n){Xo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),Jo(e,t,a)}catch(n){Xo(e,t,n)}}function Jo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Yo(e,t,n)},function(n){return Xo(e,t,n)}):Yo(e,t,n)}function Yo(e,t,n){t.status=`fulfilled`,t.value=n,Zo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,qo(e,n)))}function Xo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Zo(t),t=t.next;while(t!==r)}e.action=null}function Zo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Qo(e,t){return t}function $o(e,t){if(U){var n=zl.formState;if(n!==null){a:{var r=W;if(U){if(Ai){b:{for(var i=Ai,a=Mi;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ai=cf(i.nextSibling),r=i.data===`F!`;break a}}Pi(r)}r=!1}r&&(t=n[0])}}return n=Oo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:t},n.queue=r,n=js.bind(null,W,r),r.dispatch=n,r=Wo(!1),a=Ns.bind(null,W,!1,r.queue),r=Oo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ko.bind(null,W,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function es(e){return ts(ko(),lo,e)}function ts(e,t,n){if(t=Io(e,t,Qo)[0],e=Fo(Po)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=jo(t)}catch(e){throw e===va?ba:e}else r=t;t=ko();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(W.flags|=2048,is(9,{destroy:void 0},ns.bind(null,i,n),null)),[r,a,e]}function ns(e,t){e.action=t}function rs(e){var t=ko(),n=lo;if(n!==null)return ts(t,n,e);ko(),t=t.memoizedState,n=ko();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function is(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=W.updateQueue,t===null&&(t=Ao(),W.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function as(){return ko().memoizedState}function os(e,t,n,r){var i=Oo();W.flags|=e,i.memoizedState=is(1|t,{destroy:void 0},n,r===void 0?null:r)}function ss(e,t,n,r){var i=ko();r=r===void 0?null:r;var a=i.memoizedState.inst;lo!==null&&r!==null&&bo(r,lo.memoizedState.deps)?i.memoizedState=is(t,a,n,r):(W.flags|=e,i.memoizedState=is(1|t,a,n,r))}function cs(e,t){os(8390656,8,e,t)}function ls(e,t){ss(2048,8,e,t)}function us(e){W.flags|=4;var t=W.updateQueue;if(t===null)t=Ao(),W.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ds(e){var t=ko().memoizedState;return us({ref:t,nextImpl:e}),function(){if(K&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function fs(e,t){return ss(4,2,e,t)}function ps(e,t){return ss(4,4,e,t)}function ms(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function hs(e,t,n){n=n==null?null:n.concat([e]),ss(4,4,ms.bind(null,t,e),n)}function gs(){}function _s(e,t){var n=ko();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&bo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function vs(e,t){var n=ko();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&bo(t,r[1]))return r[0];if(r=e(),mo){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r}function ys(e,t,n){return n===void 0||co&1073741824&&!(J&261930)?e.memoizedState=t:(e.memoizedState=n,e=hu(),W.lanes|=e,Kl|=e,n)}function bs(e,t,n,r){return xr(n,t)?n:Ja.current===null?!(co&42)||co&1073741824&&!(J&261930)?(nc=!0,e.memoizedState=n):(e=hu(),W.lanes|=e,Kl|=e,t):(e=ys(e,n,r),xr(e,t)||(nc=!0),e)}function xs(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};M.T=s,Ns(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ms(e,t,fa(c,r),mu(e)):Ms(e,t,r,mu(e))}catch(n){Ms(e,t,{then:function(){},status:`rejected`,reason:n},mu())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function Ss(){}function Cs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ws(e).queue;xs(e,a,t,te,n===null?Ss:function(){return Ts(e),n(r)})}function ws(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:te},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Po,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ts(e){var t=ws(e);t.next===null&&(t=e.alternate.memoizedState),Ms(e,t.next.queue,{},mu())}function Es(){return Zi(Qf)}function Ds(){return ko().memoizedState}function Os(){return ko().memoizedState}function ks(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=mu();e=za(n);var r=Ba(t,e,n);r!==null&&(gu(r,t,n),Va(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function As(e,t,n){var r=mu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ps(e)?Fs(t,n):(n=ei(e,t,n,r),n!==null&&(gu(n,e,r),Is(n,t,r)))}function js(e,t,n){Ms(e,t,n,mu())}function Ms(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ps(e))Fs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,xr(s,o))return $r(e,t,i,0),zl===null&&Qr(),!1}catch{}if(n=ei(e,t,i,r),n!==null)return gu(n,e,r),Is(n,t,r),!0}return!1}function Ns(e,t,n,r){if(r={lane:2,revertLane:pd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ps(e)){if(t)throw Error(i(479))}else t=ei(e,n,r,2),t!==null&&gu(t,e,2)}function Ps(e){var t=e.alternate;return e===W||t!==null&&t===W}function Fs(e,t){po=fo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Is(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Qe(e,n)}}var Ls={readContext:Zi,use:Mo,useCallback:yo,useContext:yo,useEffect:yo,useImperativeHandle:yo,useLayoutEffect:yo,useInsertionEffect:yo,useMemo:yo,useReducer:yo,useRef:yo,useState:yo,useDebugValue:yo,useDeferredValue:yo,useTransition:yo,useSyncExternalStore:yo,useId:yo,useHostTransitionStatus:yo,useFormState:yo,useActionState:yo,useOptimistic:yo,useMemoCache:yo,useCacheRefresh:yo};Ls.useEffectEvent=yo;var Rs={readContext:Zi,use:Mo,useCallback:function(e,t){return Oo().memoizedState=[e,t===void 0?null:t],e},useContext:Zi,useEffect:cs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),os(4194308,4,ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return os(4194308,4,e,t)},useInsertionEffect:function(e,t){os(4,2,e,t)},useMemo:function(e,t){var n=Oo();t=t===void 0?null:t;var r=e();if(mo){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Oo();if(n!==void 0){var i=n(t);if(mo){Fe(!0);try{n(t)}finally{Fe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=As.bind(null,W,e),[r.memoizedState,e]},useRef:function(e){var t=Oo();return e={current:e},t.memoizedState=e},useState:function(e){e=Wo(e);var t=e.queue,n=js.bind(null,W,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:gs,useDeferredValue:function(e,t){return ys(Oo(),e,t)},useTransition:function(){var e=Wo(!1);return e=xs.bind(null,W,e.queue,!0,!1),Oo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=W,a=Oo();if(U){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),zl===null)throw Error(i(349));J&127||zo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,cs(Vo.bind(null,r,o,e),[e]),r.flags|=2048,is(9,{destroy:void 0},Bo.bind(null,r,o,n,t),null),n},useId:function(){var e=Oo(),t=zl.identifierPrefix;if(U){var n=Ci,r=Si;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ho++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=vo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Es,useFormState:$o,useActionState:$o,useOptimistic:function(e){var t=Oo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ns.bind(null,W,!0,n),n.dispatch=t,[e,t]},useMemoCache:No,useCacheRefresh:function(){return Oo().memoizedState=ks.bind(null,W)},useEffectEvent:function(e){var t=Oo(),n={impl:e};return t.memoizedState=n,function(){if(K&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},zs={readContext:Zi,use:Mo,useCallback:_s,useContext:Zi,useEffect:ls,useImperativeHandle:hs,useInsertionEffect:fs,useLayoutEffect:ps,useMemo:vs,useReducer:Fo,useRef:as,useState:function(){return Fo(Po)},useDebugValue:gs,useDeferredValue:function(e,t){return bs(ko(),lo.memoizedState,e,t)},useTransition:function(){var e=Fo(Po)[0],t=ko().memoizedState;return[typeof e==`boolean`?e:jo(e),t]},useSyncExternalStore:Ro,useId:Ds,useHostTransitionStatus:Es,useFormState:es,useActionState:es,useOptimistic:function(e,t){return Go(ko(),lo,e,t)},useMemoCache:No,useCacheRefresh:Os};zs.useEffectEvent=ds;var Bs={readContext:Zi,use:Mo,useCallback:_s,useContext:Zi,useEffect:ls,useImperativeHandle:hs,useInsertionEffect:fs,useLayoutEffect:ps,useMemo:vs,useReducer:Lo,useRef:as,useState:function(){return Lo(Po)},useDebugValue:gs,useDeferredValue:function(e,t){var n=ko();return lo===null?ys(n,e,t):bs(n,lo.memoizedState,e,t)},useTransition:function(){var e=Lo(Po)[0],t=ko().memoizedState;return[typeof e==`boolean`?e:jo(e),t]},useSyncExternalStore:Ro,useId:Ds,useHostTransitionStatus:Es,useFormState:rs,useActionState:rs,useOptimistic:function(e,t){var n=ko();return lo===null?(n.baseState=e,[e,n.queue.dispatch]):Go(n,lo,e,t)},useMemoCache:No,useCacheRefresh:Os};Bs.useEffectEvent=ds;function Vs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Hs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=mu(),i=za(r);i.payload=t,n!=null&&(i.callback=n),t=Ba(e,i,r),t!==null&&(gu(t,e,r),Va(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=mu(),i=za(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ba(e,i,r),t!==null&&(gu(t,e,r),Va(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=mu(),r=za(n);r.tag=2,t!=null&&(r.callback=t),t=Ba(e,r,n),t!==null&&(gu(t,e,n),Va(t,e,n))}};function Us(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Sr(n,r)||!Sr(i,a):!0}function Ws(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Hs.enqueueReplaceState(t,t.state,null)}function Gs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ks(e){Yr(e)}function qs(e){console.error(e)}function Js(e){Yr(e)}function Ys(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Xs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Zs(e,t,n){return n=za(n),n.tag=3,n.payload={element:null},n.callback=function(){Ys(e,t)},n}function Qs(e){return e=za(e),e.tag=3,e}function $s(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Xs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Xs(t,n,r),typeof i!=`function`&&(iu===null?iu=new Set([this]):iu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function ec(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ji(t,n,a,!0),n=$a.current,n!==null){switch(n.tag){case 31:case 13:return eo===null?Ou():n.alternate===null&&Gl===0&&(Gl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===xa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),Ou(),!1}if(U)return t=$a.current,t===null?(r!==Ni&&(t=Error(i(423),{cause:r}),Bi(hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=hi(r,n),a=Zs(e.stateNode,r,a),Ha(e,a),Gl!==4&&(Gl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ni&&(e=Error(i(422),{cause:r}),Bi(hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=hi(o,n),Zl===null?Zl=[o]:Zl.push(o),Gl!==4&&(Gl=2),t===null)return!0;r=hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Zs(n.stateNode,r,e),Ha(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(iu===null||!iu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Qs(a),$s(a,e,n,r),Ha(n,a),!1}n=n.return}while(n!==null);return!1}var tc=Error(i(461)),nc=!1;function rc(e,t,n,r){t.child=e===null?Fa(t,null,n,r):Pa(t,e.child,n,r)}function ic(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Xi(t),r=xo(e,t,n,o,a,i),s=To(),e!==null&&!nc?(Eo(e,t,i),Oc(e,t,i)):(U&&s&&Ei(t),t.flags|=1,rc(e,t,r,i),t.child)}function ac(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!si(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,oc(e,t,a,r,i)):(e=li(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!kc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Sr:n,n(o,r)&&e.ref===t.ref)return Oc(e,t,i)}return t.flags|=1,e=V(a,r),e.ref=t.ref,e.return=t,t.child=e}function oc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Sr(a,r)&&e.ref===t.ref)if(nc=!1,t.pendingProps=r=a,kc(e,i))e.flags&131072&&(nc=!0);else return t.lanes=e.lanes,Oc(e,t,i)}return mc(e,t,n,r,i)}function sc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return lc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ga(t,a===null?null:a.cachePool),a===null?Za():Xa(t,a),ro(t);else return r=t.lanes=536870912,lc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ga(t,null),Za(),io(t)):(ga(t,a.cachePool),Xa(t,a),io(t),t.memoizedState=null);return rc(e,t,i,n),t.child}function cc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function lc(e,t,n,r,i){var a=ha();return a=a===null?null:{parent:ra._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ga(t,null),Za(),ro(t),e!==null&&Ji(e,t,r,!0),t.childLanes=i,null}function uc(e,t){return t=Cc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function dc(e,t,n){return Pa(t,e.child,null,n),e=uc(t,t.pendingProps),e.flags|=2,ao(t),t.memoizedState=null,e}function fc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(U){if(r.mode===`hidden`)return e=uc(t,r),t.lanes=536870912,cc(null,e);if(no(t),(e=Ai)?(e=rf(e,Mi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:xi===null?null:{id:Si,overflow:Ci},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Pi(t);return t.lanes=536870912,null}return uc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(no(t),a)if(t.flags&256)t.flags&=-257,t=dc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(nc||Ji(e,t,n,!1),a=(n&e.childLanes)!==0,nc||a){if(r=zl,r!==null&&(s=$e(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ti(e,s),gu(r,e,s),tc;Ou(),t=dc(e,t,n)}else e=o.treeContext,Ai=cf(s.nextSibling),ki=t,U=!0,ji=null,Mi=!1,e!==null&&Oi(t,e),t=uc(t,r),t.flags|=4096;return t}return e=V(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function pc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function mc(e,t,n,r,i){return Xi(t),n=xo(e,t,n,r,void 0,i),r=To(),e!==null&&!nc?(Eo(e,t,i),Oc(e,t,i)):(U&&r&&Ei(t),t.flags|=1,rc(e,t,n,i),t.child)}function hc(e,t,n,r,i,a){return Xi(t),t.updateQueue=null,n=Co(t,r,n,i),So(e),r=To(),e!==null&&!nc?(Eo(e,t,a),Oc(e,t,a)):(U&&r&&Ei(t),t.flags|=1,rc(e,t,n,a),t.child)}function gc(e,t,n,r,i){if(Xi(t),t.stateNode===null){var a=ii,o=n.contextType;typeof o==`object`&&o&&(a=Zi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Hs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},La(t),o=n.contextType,a.context=typeof o==`object`&&o?Zi(o):ii,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Vs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Hs.enqueueReplaceState(a,a.state,null),Ga(t,r,a,i),Wa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Gs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ii,typeof u==`object`&&u&&(o=Zi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ws(t,a,r,o),Ia=!1;var f=t.memoizedState;a.state=f,Ga(t,r,a,i),Wa(),l=t.memoizedState,s||f!==l||Ia?(typeof d==`function`&&(Vs(t,n,d,r),l=t.memoizedState),(c=Ia||Us(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ra(e,t),o=t.memoizedProps,u=Gs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ii,typeof l==`object`&&l&&(c=Zi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ws(t,a,r,c),Ia=!1,f=t.memoizedState,a.state=f,Ga(t,r,a,i),Wa();var p=t.memoizedState;o!==d||f!==p||Ia||e!==null&&e.dependencies!==null&&Yi(e.dependencies)?(typeof s==`function`&&(Vs(t,n,s,r),p=t.memoizedState),(u=Ia||Us(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Yi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,pc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Pa(t,e.child,null,i),t.child=Pa(t,null,n,i)):rc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Oc(e,t,i),e}function _c(e,t,n,r){return Ri(),t.flags|=256,rc(e,t,n,r),t.child}var vc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yc(e){return{baseLanes:e,cachePool:_a()}}function bc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Yl),e}function xc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(oo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(U){if(a?to(t):io(t),(e=Ai)?(e=rf(e,Mi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:xi===null?null:{id:Si,overflow:Ci},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,ki=t,Ai=null)):e=null,e===null)throw Pi(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(io(t),a=t.mode,c=Cc({mode:`hidden`,children:c},a),r=ui(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=yc(n),r.childLanes=bc(e,s,n),t.memoizedState=vc,cc(null,r)):(to(t),Sc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(to(t),t.flags&=-257,t=wc(e,t,n)):t.memoizedState===null?(io(t),c=r.fallback,a=t.mode,r=Cc({mode:`visible`,children:r.children},a),c=ui(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Pa(t,e.child,null,n),r=t.child,r.memoizedState=yc(n),r.childLanes=bc(e,s,n),t.memoizedState=vc,t=cc(null,r)):(io(t),t.child=e.child,t.flags|=128,t=null);else if(to(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Bi({value:r,source:null,stack:null}),t=wc(e,t,n)}else if(nc||Ji(e,t,n,!1),s=(n&e.childLanes)!==0,nc||s){if(s=zl,s!==null&&(r=$e(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ti(e,r),gu(s,e,r),tc;af(c)||Ou(),t=wc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ai=cf(c.nextSibling),ki=t,U=!0,ji=null,Mi=!1,e!==null&&Oi(t,e),t=Sc(t,r.children),t.flags|=4096);return t}return a?(io(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=V(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ui(c,a,n,null),c.flags|=2):c=V(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,cc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=yc(n):(a=c.cachePool,a===null?a=_a():(l=ra._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=bc(e,s,n),t.memoizedState=vc,cc(e.child,r)):(to(t),n=e.child,e=n.sibling,n=V(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function Sc(e,t){return t=Cc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Cc(e,t){return e=oi(22,e,null,t),e.lanes=0,e}function wc(e,t,n){return Pa(t,e.child,null,n),e=Sc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ki(e.return,t,n)}function Ec(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Dc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=oo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,P(oo,o),rc(e,t,r,n),r=U?yi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Tc(e,n,t);else if(e.tag===19)Tc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&so(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ec(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&so(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ec(t,!0,n,null,a,r);break;case`together`:Ec(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Oc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ji(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=V(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=V(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function kc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Yi(e))):!0}function Ac(e,t,n){switch(t.tag){case 3:I(t,t.stateNode.containerInfo),Wi(t,ra,e.memoizedState.cache),Ri();break;case 27:case 5:ue(t);break;case 4:I(t,t.stateNode.containerInfo);break;case 10:Wi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,no(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(to(t),e=Oc(e,t,n),e===null?null:e.sibling):xc(e,t,n):(to(t),t.flags|=128,null);to(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Ji(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Dc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),P(oo,oo.current),r)break;return null;case 22:return t.lanes=0,sc(e,t,n,t.pendingProps);case 24:Wi(t,ra,e.memoizedState.cache)}return Oc(e,t,n)}function jc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)nc=!0;else{if(!kc(e,n)&&!(t.flags&128))return nc=!1,Ac(e,t,n);nc=!!(e.flags&131072)}else nc=!1,U&&t.flags&1048576&&Ti(t,yi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=wa(t.elementType),t.type=e,typeof e==`function`)si(e)?(r=Gs(e,r),t.tag=1,t=gc(null,t,e,r,n)):(t.tag=0,t=mc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=ic(null,t,e,r,n);break a}else if(a===w){t.tag=14,t=ac(null,t,e,r,n);break a}}throw t=j(e)||e,Error(i(306,t,``))}}return t;case 0:return mc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Gs(r,t.pendingProps),gc(e,t,r,a,n);case 3:a:{if(I(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ra(e,t),Ga(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Wi(t,ra,r),r!==o.cache&&qi(t,[ra],n,!0),Wa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=_c(e,t,r,n);break a}else if(r!==a){a=hi(Error(i(424)),t),Bi(a),t=_c(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ai=cf(e.firstChild),ki=t,U=!0,ji=null,Mi=!0,n=Fa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ri(),r===a){t=Oc(e,t,n);break a}rc(e,t,r,n)}t=t.child}return t;case 26:return pc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:U||(n=t.type,e=t.pendingProps,r=Bd(se.current).createElement(n),r[at]=t,r[ot]=e,Pd(r,n,e),vt(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&U&&(r=t.stateNode=ff(t.type,t.pendingProps,se.current),ki=t,Mi=!0,a=Ai,Zd(t.type)?(lf=a,Ai=cf(r.firstChild)):Ai=a),rc(e,t,t.pendingProps.children,n),pc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&U&&((a=r=Ai)&&(r=tf(r,t.type,t.pendingProps,Mi),r===null?a=!1:(t.stateNode=r,ki=t,Ai=cf(r.firstChild),Mi=!1,a=!0)),a||Pi(t)),ue(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=xo(e,t,wo,null,null,n),Qf._currentValue=a),pc(e,t),rc(e,t,r,n),t.child;case 6:return e===null&&U&&((e=n=Ai)&&(n=nf(n,t.pendingProps,Mi),n===null?e=!1:(t.stateNode=n,ki=t,Ai=null,e=!0)),e||Pi(t)),null;case 13:return xc(e,t,n);case 4:return I(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pa(t,null,r,n):rc(e,t,r,n),t.child;case 11:return ic(e,t,t.type,t.pendingProps,n);case 7:return rc(e,t,t.pendingProps,n),t.child;case 8:return rc(e,t,t.pendingProps.children,n),t.child;case 12:return rc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Wi(t,t.type,r.value),rc(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Xi(t),a=Zi(a),r=r(a),t.flags|=1,rc(e,t,r,n),t.child;case 14:return ac(e,t,t.type,t.pendingProps,n);case 15:return oc(e,t,t.type,t.pendingProps,n);case 19:return Dc(e,t,n);case 31:return fc(e,t,n);case 22:return sc(e,t,n,t.pendingProps);case 24:return Xi(t),r=Zi(ra),e===null?(a=ha(),a===null&&(a=zl,o=ia(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},La(t),Wi(t,ra,a)):((e.lanes&n)!==0&&(Ra(e,t),Ga(t,null,null,n),Wa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Wi(t,ra,r),r!==a.cache&&qi(t,[ra],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Wi(t,ra,r))),rc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Mc(e){e.flags|=4}function Nc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Tu())e.flags|=8192;else throw Ta=xa,ya}else e.flags&=-16777217}function Pc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(Tu())e.flags|=8192;else throw Ta=xa,ya}function Fc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:qe(),e.lanes|=t,Xl|=t)}function Ic(e,t){if(!U)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Lc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Rc(e,t,n){var r=t.pendingProps;switch(Di(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lc(t),null;case 1:return Lc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Gi(ra),le(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Li(t)?Mc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,zi())),Lc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Mc(t),o===null?(Lc(t),Nc(t,a,null,r,n)):(Lc(t),Pc(t,o))):o?o===e.memoizedState?(Lc(t),t.flags&=-16777217):(Mc(t),Lc(t),Pc(t,o)):(e=e.memoizedProps,e!==r&&Mc(t),Lc(t),Nc(t,a,e,r,n)),null;case 27:if(de(t),n=se.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Lc(t),null}e=F.current,Li(t)?Fi(t,e):(e=ff(a,r,n),t.stateNode=e,Mc(t))}return Lc(t),null;case 5:if(de(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Lc(t),null}if(o=F.current,Li(t))Fi(t,o);else{var s=Bd(se.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[at]=t,o[ot]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Mc(t)}}return Lc(t),Nc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=se.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ki,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[at]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Pi(t,!0)}else e=Bd(e).createTextNode(r),e[at]=t,t.stateNode=e}return Lc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[at]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ao(t),t):(ao(t),null);if(t.flags&128)throw Error(i(558))}return Lc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Li(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[at]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),a=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(ao(t),t):(ao(t),null)}return ao(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Fc(t,t.updateQueue),Lc(t),null);case 4:return le(),e===null&&Sd(t.stateNode.containerInfo),Lc(t),null;case 10:return Gi(t.type),Lc(t),null;case 19:if(ae(oo),r=t.memoizedState,r===null)return Lc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ic(r,!1);else{if(Gl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=so(e),o!==null){for(t.flags|=128,Ic(r,!1),e=o.updateQueue,t.updateQueue=e,Fc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ci(n,e),n=n.sibling;return P(oo,oo.current&1|2),U&&wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&we()>nu&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304)}else{if(!a)if(e=so(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Fc(t,e),Ic(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!U)return Lc(t),null}else 2*we()-r.renderingStartTime>nu&&n!==536870912&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Lc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=we(),e.sibling=null,n=oo.current,P(oo,a?n&1|2:n&1),U&&wi(t,r.treeForkCount),e);case 22:case 23:return ao(t),Qa(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Lc(t),t.subtreeFlags&6&&(t.flags|=8192)):Lc(t),n=t.updateQueue,n!==null&&Fc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ae(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(ra),Lc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function zc(e,t){switch(Di(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(ra),le(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return de(t),null;case 31:if(t.memoizedState!==null){if(ao(t),t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ao(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ae(oo),null;case 4:return le(),null;case 10:return Gi(t.type),null;case 22:case 23:return ao(t),Qa(),e!==null&&ae(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(ra),null;case 25:return null;default:return null}}function Bc(e,t){switch(Di(t),t.tag){case 3:Gi(ra),le();break;case 26:case 27:case 5:de(t);break;case 4:le();break;case 31:t.memoizedState!==null&&ao(t);break;case 13:ao(t);break;case 19:ae(oo);break;case 10:Gi(t.type);break;case 22:case 23:ao(t),Qa(),e!==null&&ae(ma);break;case 24:Gi(ra)}}function Vc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ku(t,t.return,e)}}function Hc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function Uc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{qa(t,n)}catch(t){Ku(e,e.return,t)}}}function Wc(e,t,n){n.props=Gs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Gc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ku(e,t,n)}}function Kc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ku(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ku(e,t,n)}else n.current=null}function qc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ku(e,e.return,t)}}function Jc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[ot]=t}catch(t){Ku(e,e.return,t)}}function Yc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Zc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[at]=e,t[ot]=n}catch(t){Ku(e,e.return,t)}}var el=!1,tl=!1,nl=!1,rl=typeof WeakSet==`function`?WeakSet:Set,il=null;function al(e,t){if(e=e.containerInfo,Rd=sp,e=Er(e),Dr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,il=t;il!==null;)if(t=il,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,il=e;else for(;il!==null;){switch(t=il,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Gs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,il=e;break}il=t.return}}function ol(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:bl(e,n),r&4&&Vc(5,n);break;case 1:if(bl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Gs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}r&64&&Uc(n),r&512&&Gc(n,n.return);break;case 3:if(bl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{qa(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&$c(n);case 26:case 5:bl(e,n),t===null&&r&4&&qc(n),r&512&&Gc(n,n.return);break;case 12:bl(e,n);break;case 31:bl(e,n),r&4&&fl(e,n);break;case 13:bl(e,n),r&4&&pl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||el,!r){t=t!==null&&t.memoizedState!==null||tl,i=el;var a=tl;el=r,(tl=t)&&!a?Sl(e,n,(n.subtreeFlags&8772)!=0):bl(e,n),el=i,tl=a}break;case 30:break;default:bl(e,n)}}function sl(e){var t=e.alternate;t!==null&&(e.alternate=null,sl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&pt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var cl=null,ll=!1;function ul(e,t,n){for(n=n.child;n!==null;)dl(e,t,n),n=n.sibling}function dl(e,t,n){if(Pe&&typeof Pe.onCommitFiberUnmount==`function`)try{Pe.onCommitFiberUnmount(Ne,n)}catch{}switch(n.tag){case 26:tl||Kc(n,t),ul(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:tl||Kc(n,t);var r=cl,i=ll;Zd(n.type)&&(cl=n.stateNode,ll=!1),ul(e,t,n),pf(n.stateNode),cl=r,ll=i;break;case 5:tl||Kc(n,t);case 6:if(r=cl,i=ll,cl=null,ul(e,t,n),cl=r,ll=i,cl!==null)if(ll)try{(cl.nodeType===9?cl.body:cl.nodeName===`HTML`?cl.ownerDocument.body:cl).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{cl.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}break;case 18:cl!==null&&(ll?(e=cl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(cl,n.stateNode));break;case 4:r=cl,i=ll,cl=n.stateNode.containerInfo,ll=!0,ul(e,t,n),cl=r,ll=i;break;case 0:case 11:case 14:case 15:Hc(2,n,t),tl||Hc(4,n,t),ul(e,t,n);break;case 1:tl||(Kc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Wc(n,t,r)),ul(e,t,n);break;case 21:ul(e,t,n);break;case 22:tl=(r=tl)||n.memoizedState!==null,ul(e,t,n),tl=r;break;default:ul(e,t,n)}}function fl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Ku(t,t.return,e)}}}function pl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Ku(t,t.return,e)}}function ml(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new rl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new rl),t;default:throw Error(i(435,e.tag))}}function hl(e,t){var n=ml(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function gl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){cl=c.stateNode,ll=!1;break a}break;case 5:cl=c.stateNode,ll=!1;break a;case 3:case 4:cl=c.stateNode.containerInfo,ll=!0;break a}c=c.return}if(cl===null)throw Error(i(160));dl(o,s,a),cl=null,ll=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)_l(t,e),t=t.sibling}var G=null;function _l(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:gl(t,e),vl(e),r&4&&(Hc(3,e,e.return),Vc(3,e),Hc(5,e,e.return));break;case 1:gl(t,e),vl(e),r&512&&(tl||n===null||Kc(n,n.return)),r&64&&el&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=G;if(gl(t,e),vl(e),r&512&&(tl||n===null||Kc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ft]||o[at]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[at]=e,vt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[at]=e,vt(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode);else e.stateNode=If(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Jc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:gl(t,e),vl(e),r&512&&(tl||n===null||Kc(n,n.return)),n!==null&&r&4&&Jc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(gl(t,e),vl(e),r&512&&(tl||n===null||Kc(n,n.return)),e.flags&32){a=e.stateNode;try{Wt(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Jc(e,a,n===null?a:n.memoizedProps)),r&1024&&(nl=!0);break;case 6:if(gl(t,e),vl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Bf=null,a=G,G=gf(t.containerInfo),gl(t,e),G=a,vl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Ku(e,e.return,t)}nl&&(nl=!1,yl(e));break;case 4:r=G,G=gf(e.stateNode.containerInfo),gl(t,e),vl(e),G=r;break;case 12:gl(t,e),vl(e);break;case 31:gl(t,e),vl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 13:gl(t,e),vl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(eu=we()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=el,d=tl;if(el=u||a,tl=d||l,gl(t,e),tl=d,el=u,vl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||el||tl||xl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Ku(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,hl(e,n))));break;case 19:gl(t,e),vl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 30:break;case 21:break;default:gl(t,e),vl(e)}}function vl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Yc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Qc(e,Xc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Wt(o,``),n.flags&=-33),Qc(e,Xc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Zc(e,Xc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function yl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;yl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function bl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ol(e,t.alternate,t),t=t.sibling}function xl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Hc(4,t,t.return),xl(t);break;case 1:Kc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Wc(t,t.return,n),xl(t);break;case 27:pf(t.stateNode);case 26:case 5:Kc(t,t.return),xl(t);break;case 22:t.memoizedState===null&&xl(t);break;case 30:xl(t);break;default:xl(t)}e=e.sibling}}function Sl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Sl(i,a,n),Vc(4,a);break;case 1:if(Sl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ka(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&Uc(a),Gc(a,a.return);break;case 27:$c(a);case 26:case 5:Sl(i,a,n),n&&r===null&&o&4&&qc(a),Gc(a,a.return);break;case 12:Sl(i,a,n);break;case 31:Sl(i,a,n),n&&o&4&&fl(i,a);break;case 13:Sl(i,a,n),n&&o&4&&pl(i,a);break;case 22:a.memoizedState===null&&Sl(i,a,n),Gc(a,a.return);break;case 30:break;default:Sl(i,a,n)}t=t.sibling}}function Cl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&aa(n))}function wl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e))}function Tl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)El(e,t,n,r),t=t.sibling}function El(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Tl(e,t,n,r),i&2048&&Vc(9,t);break;case 1:Tl(e,t,n,r);break;case 3:Tl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&aa(e)));break;case 12:if(i&2048){Tl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ku(t,t.return,e)}}else Tl(e,t,n,r);break;case 31:Tl(e,t,n,r);break;case 13:Tl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Tl(e,t,n,r):(a._visibility|=2,Dl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Tl(e,t,n,r):Ol(e,t),i&2048&&Cl(o,t);break;case 24:Tl(e,t,n,r),i&2048&&wl(t.alternate,t);break;default:Tl(e,t,n,r)}}function Dl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Dl(a,o,s,c,i),Vc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Dl(a,o,s,c,i)):u._visibility&2?Dl(a,o,s,c,i):Ol(a,o),i&&l&2048&&Cl(o.alternate,o);break;case 24:Dl(a,o,s,c,i),i&&l&2048&&wl(o.alternate,o);break;default:Dl(a,o,s,c,i)}t=t.sibling}}function Ol(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ol(n,r),i&2048&&Cl(r.alternate,r);break;case 24:Ol(n,r),i&2048&&wl(r.alternate,r);break;default:Ol(n,r)}t=t.sibling}}var kl=8192;function Al(e,t,n){if(e.subtreeFlags&kl)for(e=e.child;e!==null;)jl(e,t,n),e=e.sibling}function jl(e,t,n){switch(e.tag){case 26:Al(e,t,n),e.flags&kl&&e.memoizedState!==null&&Gf(n,G,e.memoizedState,e.memoizedProps);break;case 5:Al(e,t,n);break;case 3:case 4:var r=G;G=gf(e.stateNode.containerInfo),Al(e,t,n),G=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=kl,kl=16777216,Al(e,t,n),kl=r):Al(e,t,n));break;default:Al(e,t,n)}}function Ml(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];il=r,Il(r,e)}Ml(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Pl(e),e=e.sibling}function Pl(e){switch(e.tag){case 0:case 11:case 15:Nl(e),e.flags&2048&&Hc(9,e,e.return);break;case 3:Nl(e);break;case 12:Nl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Fl(e)):Nl(e);break;default:Nl(e)}}function Fl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];il=r,Il(r,e)}Ml(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Hc(8,t,t.return),Fl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Fl(t));break;default:Fl(t)}e=e.sibling}}function Il(e,t){for(;il!==null;){var n=il;switch(n.tag){case 0:case 11:case 15:Hc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:aa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,il=r;else a:for(n=e;il!==null;){r=il;var i=r.sibling,a=r.return;if(sl(r),r===n){il=null;break a}if(i!==null){i.return=a,il=i;break a}il=a}}}var Ll={getCacheForType:function(e){var t=Zi(ra),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Zi(ra).controller.signal}},Rl=typeof WeakMap==`function`?WeakMap:Map,K=0,zl=null,q=null,J=0,Y=0,Bl=null,Vl=!1,Hl=!1,Ul=!1,Wl=0,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=null,Ql=null,$l=!1,eu=0,tu=0,nu=1/0,ru=null,iu=null,au=0,ou=null,su=null,cu=0,lu=0,uu=null,du=null,fu=0,pu=null;function mu(){return K&2&&J!==0?J&-J:M.T===null?nt():pd()}function hu(){if(Yl===0)if(!(J&536870912)||U){var e=Ve;Ve<<=1,!(Ve&3932160)&&(Ve=262144),Yl=e}else Yl=536870912;return e=$a.current,e!==null&&(e.flags|=32),Yl}function gu(e,t,n){(e===zl&&(Y===2||Y===9)||e.cancelPendingCommit!==null)&&(Cu(e,0),bu(e,J,Yl,!1)),Ye(e,n),(!(K&2)||e!==zl)&&(e===zl&&(!(K&2)&&(ql|=n),Gl===4&&bu(e,J,Yl,!1)),ad(e))}function _u(e,t,n){if(K&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ge(e,t),a=r?ju(e,t):ku(e,t,!0),o=r;do{if(a===0){Hl&&!r&&bu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!yu(n)){a=ku(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Zl;var l=c.current.memoizedState.isDehydrated;if(l&&(Cu(c,s).flags|=256),s=ku(c,s,!1),s!==2){if(Ul&&!l){c.errorRecoveryDisabledLanes|=o,ql|=o,a=4;break a}o=Ql,Ql=a,o!==null&&(Ql===null?Ql=o:Ql.push.apply(Ql,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Cu(e,0),bu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:bu(r,t,Yl,!Vl);break a;case 2:Ql=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=eu+300-we(),10<a)){if(bu(r,t,Yl,!Vl),We(r,0,!0)!==0)break a;cu=t,r.timeoutHandle=Kd(vu.bind(null,r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,`Throttled`,-0,0),a);break a}vu(r,n,Ql,ru,$l,t,Yl,ql,Xl,Vl,o,null,-0,0)}}break}while(1);ad(e)}function vu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Qt},jl(t,a,d);var m=(a&62914560)===a?eu-we():(a&4194048)===a?tu-we():0;if(m=qf(d,m),m!==null){cu=a,e.cancelPendingCommit=m(Ru.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),bu(e,a,o,!l);return}}Ru(e,t,a,n,r,i,o,s,c)}function yu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!xr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function bu(e,t,n,r){t&=~Jl,t&=~ql,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ie(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ze(e,n,t)}function xu(){return K&6?!0:(od(0,!1),!1)}function Su(){if(q!==null){if(Y===0)var e=q.return;else e=q,Ui=Hi=null,Do(e),Oa=null,ka=0,e=q;for(;e!==null;)Bc(e.alternate,e),e=e.return;q=null}}function Cu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),cu=0,Su(),zl=e,q=n=V(e.current,null),J=t,Y=0,Bl=null,Vl=!1,Hl=Ge(e,t),Ul=!1,Xl=Yl=Jl=ql=Kl=Gl=0,Ql=Zl=null,$l=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ie(r),a=1<<i;t|=e[i],r&=~a}return Wl=t,Qr(),n}function wu(e,t){W=null,M.H=Ls,t===va||t===ba?(t=Ea(),Y=3):t===ya?(t=Ea(),Y=4):Y=t===tc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Bl=t,q===null&&(Gl=1,Ys(e,hi(t,e.current)))}function Tu(){var e=$a.current;return e===null?!0:(J&4194048)===J?eo===null:(J&62914560)===J||J&536870912?e===eo:!1}function Eu(){var e=M.H;return M.H=Ls,e===null?Ls:e}function Du(){var e=M.A;return M.A=Ll,e}function Ou(){Gl=4,Vl||(J&4194048)!==J&&$a.current!==null||(Hl=!0),!(Kl&134217727)&&!(ql&134217727)||zl===null||bu(zl,J,Yl,!1)}function ku(e,t,n){var r=K;K|=2;var i=Eu(),a=Du();(zl!==e||J!==t)&&(ru=null,Cu(e,t)),t=!1;var o=Gl;a:do try{if(Y!==0&&q!==null){var s=q,c=Bl;switch(Y){case 8:Su(),o=6;break a;case 3:case 2:case 9:case 6:$a.current===null&&(t=!0);var l=Y;if(Y=0,Bl=null,Fu(e,s,c,l),n&&Hl){o=0;break a}break;default:l=Y,Y=0,Bl=null,Fu(e,s,c,l)}}Au(),o=Gl;break}catch(t){wu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ui=Hi=null,K=r,M.H=i,M.A=a,q===null&&(zl=null,J=0,Qr()),o}function Au(){for(;q!==null;)Nu(q)}function ju(e,t){var n=K;K|=2;var r=Eu(),a=Du();zl!==e||J!==t?(ru=null,nu=we()+500,Cu(e,t)):Hl=Ge(e,t);a:do try{if(Y!==0&&q!==null){t=q;var o=Bl;b:switch(Y){case 1:Y=0,Bl=null,Fu(e,t,o,1);break;case 2:case 9:if(Sa(o)){Y=0,Bl=null,Pu(t);break}t=function(){Y!==2&&Y!==9||zl!==e||(Y=7),ad(e)},o.then(t,t);break a;case 3:Y=7;break a;case 4:Y=5;break a;case 7:Sa(o)?(Y=0,Bl=null,Pu(t)):(Y=0,Bl=null,Fu(e,t,o,7));break;case 5:var s=null;switch(q.tag){case 26:s=q.memoizedState;case 5:case 27:var c=q;if(s?Wf(s):c.stateNode.complete){Y=0,Bl=null;var l=c.sibling;if(l!==null)q=l;else{var u=c.return;u===null?q=null:(q=u,Iu(u))}break b}}Y=0,Bl=null,Fu(e,t,o,5);break;case 6:Y=0,Bl=null,Fu(e,t,o,6);break;case 8:Su(),Gl=6;break a;default:throw Error(i(462))}}Mu();break}catch(t){wu(e,t)}while(1);return Ui=Hi=null,M.H=r,M.A=a,K=n,q===null?(zl=null,J=0,Qr(),Gl):0}function Mu(){for(;q!==null&&!Se();)Nu(q)}function Nu(e){var t=jc(e.alternate,e,Wl);e.memoizedProps=e.pendingProps,t===null?Iu(e):q=t}function Pu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=hc(n,t,t.pendingProps,t.type,void 0,J);break;case 11:t=hc(n,t,t.pendingProps,t.type.render,t.ref,J);break;case 5:Do(t);default:Bc(n,t),t=q=ci(t,Wl),t=jc(n,t,Wl)}e.memoizedProps=e.pendingProps,t===null?Iu(e):q=t}function Fu(e,t,n,r){Ui=Hi=null,Do(t),Oa=null,ka=0;var i=t.return;try{if(ec(e,i,t,n,J)){Gl=1,Ys(e,hi(n,e.current)),q=null;return}}catch(t){if(i!==null)throw q=i,t;Gl=1,Ys(e,hi(n,e.current)),q=null;return}t.flags&32768?(U||r===1?e=!0:Hl||J&536870912?e=!1:(Vl=e=!0,(r===2||r===9||r===3||r===6)&&(r=$a.current,r!==null&&r.tag===13&&(r.flags|=16384))),Lu(t,e)):Iu(t)}function Iu(e){var t=e;do{if(t.flags&32768){Lu(t,Vl);return}e=t.return;var n=Rc(t.alternate,t,Wl);if(n!==null){q=n;return}if(t=t.sibling,t!==null){q=t;return}q=t=e}while(t!==null);Gl===0&&(Gl=5)}function Lu(e,t){do{var n=zc(e.alternate,e);if(n!==null){n.flags&=32767,q=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){q=e;return}q=e=n}while(e!==null);Gl=6,q=null}function Ru(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Uu();while(au!==0);if(K&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Zr,Xe(e,n,o,s,c,l),e===zl&&(q=zl=null,J=0),su=t,ou=e,cu=n,lu=o,uu=a,du=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(Ee,function(){return Wu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=M.T,M.T=null,a=N.p,N.p=2,s=K,K|=4;try{al(e,t,n)}finally{K=s,N.p=a,M.T=r}}au=1,zu(),Bu(),Vu()}}function zu(){if(au===1){au=0;var e=ou,t=su,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=K;K|=4;try{_l(t,e);var a=zd,o=Er(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Tr(s.ownerDocument.documentElement,s)){if(c!==null&&Dr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=wr(s,h),v=wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{K=i,N.p=r,M.T=n}}e.current=t,au=2}}function Bu(){if(au===2){au=0;var e=ou,t=su,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=K;K|=4;try{ol(e,t.alternate,t)}finally{K=i,N.p=r,M.T=n}}au=3}}function Vu(){if(au===4||au===3){au=0,Ce();var e=ou,t=su,n=cu,r=du;t.subtreeFlags&10256||t.flags&10256?au=5:(au=0,su=ou=null,Hu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(iu=null),tt(n),t=t.stateNode,Pe&&typeof Pe.onCommitFiberRoot==`function`)try{Pe.onCommitFiberRoot(Ne,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=M.T,i=N.p,N.p=2,M.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{M.T=t,N.p=i}}cu&3&&Uu(),ad(e),i=e.pendingLanes,n&261930&&i&42?e===pu?fu++:(fu=0,pu=e):fu=0,od(0,!1)}}function Hu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,aa(t)))}function Uu(){return zu(),Bu(),Vu(),Wu()}function Wu(){if(au!==5)return!1;var e=ou,t=lu;lu=0;var n=tt(cu),r=M.T,a=N.p;try{N.p=32>n?32:n,M.T=null,n=uu,uu=null;var o=ou,s=cu;if(au=0,su=ou=null,cu=0,K&6)throw Error(i(331));var c=K;if(K|=4,Pl(o.current),El(o,o.current,s,n),K=c,od(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot==`function`)try{Pe.onPostCommitFiberRoot(Ne,o)}catch{}return!0}finally{N.p=a,M.T=r,Hu(e,t)}}function Gu(e,t,n){t=hi(n,t),t=Zs(e.stateNode,t,2),e=Ba(e,t,2),e!==null&&(Ye(e,2),ad(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(iu===null||!iu.has(r))){e=hi(n,e),n=Qs(2),r=Ba(t,n,2),r!==null&&($s(n,r,t,e),Ye(r,2),ad(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Ul=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,zl===e&&(J&n)===n&&(Gl===4||Gl===3&&(J&62914560)===J&&300>we()-eu?!(K&2)&&Cu(e,0):Jl|=n,Xl===J&&(Xl=0)),ad(e)}function Yu(e,t){t===0&&(t=qe()),e=ti(e,t),e!==null&&(Ye(e,t),ad(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return be(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,id=0;function ad(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,fd())}function od(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ie(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,dd(r,a))}else a=J,a=We(r,r===zl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ge(r,a)||(n=!0,dd(r,a));r=r.next}while(n);rd=!1}}function sd(){cd()}function cd(){nd=td=!1;var e=0;id!==0&&Gd()&&(e=id);for(var t=we(),n=null,r=$u;r!==null;){var i=r.next,a=ld(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}au!==0&&au!==5||od(e,!1),id!==0&&(id=0)}function ld(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ie(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ke(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=zl,n=J,n=We(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Y===2||Y===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ge(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&xe(r),tt(n)){case 2:case 8:n=Te;break;case 32:n=Ee;break;case 268435456:n=Ae;break;default:n=Ee}return r=ud.bind(null,e),n=be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&xe(r),e.callbackPriority=2,e.callbackNode=null,2}function ud(e,t){if(au!==0&&au!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Uu()&&e.callbackNode!==n)return null;var r=J;return r=We(e,e===zl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(_u(e,r,t),ld(e,we()),e.callbackNode!=null&&e.callbackNode===n?ud.bind(null,e):null)}function dd(e,t){if(Uu())return null;_u(e,t,!0)}function fd(){Yd(function(){K&6?be(z,sd):cd()})}function pd(){if(id===0){var e=ca;e===0&&(e=Be,Be<<=1,!(Be&261888)&&(Be=256)),id=e}return id}function md(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Zt(``+e)}function hd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function gd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=md((i[ot]||null).action),o=r.submitter;o&&(t=(t=o[ot]||null)?md(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new bn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(id!==0){var e=o?hd(i,o):new FormData(i);Cs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?hd(i,o):new FormData(i),Cs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var _d=0;_d<qr.length;_d++){var X=qr[_d];Jr(X.toLowerCase(),`on`+(X[0].toUpperCase()+X.slice(1)))}Jr(zr,`onAnimationEnd`),Jr(Br,`onAnimationIteration`),Jr(Vr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Hr,`onTransitionRun`),Jr(Ur,`onTransitionStart`),Jr(Wr,`onTransitionCancel`),Jr(Gr,`onTransitionEnd`),St(`onMouseEnter`,[`mouseout`,`mouseover`]),St(`onMouseLeave`,[`mouseout`,`mouseover`]),St(`onPointerEnter`,[`pointerout`,`pointerover`]),St(`onPointerLeave`,[`pointerout`,`pointerover`]),xt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),xt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),xt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),xt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),xt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var vd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Z=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(vd));function yd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}}}}function Q(e,t){var n=t[ct];n===void 0&&(n=t[ct]=new Set);var r=e+`__bubble`;n.has(r)||(Cd(t,e,2,!1),n.add(r))}function bd(e,t,n){var r=0;t&&(r|=4),Cd(n,e,r,t)}var xd=`_reactListening`+Math.random().toString(36).slice(2);function Sd(e){if(!e[xd]){e[xd]=!0,yt.forEach(function(t){t!==`selectionchange`&&(Z.has(t)||bd(t,!1,e),bd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xd]||(t[xd]=!0,bd(`selectionchange`,!1,t))}}function Cd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!ln||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function wd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=mt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}on(function(){var r=a,i=en(n),s=[];a:{var c=Kr.get(e);if(c!==void 0){var l=bn,u=e;switch(e){case`keypress`:if(hn(n)===0)break a;case`keydown`:case`keyup`:l=Rn;break;case`focusin`:u=`focus`,l=kn;break;case`focusout`:u=`blur`,l=kn;break;case`beforeblur`:case`afterblur`:l=kn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Dn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=On;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Bn;break;case zr:case Br:case Vr:l=An;break;case Gr:l=Vn;break;case`scroll`:case`scrollend`:l=Sn;break;case`wheel`:l=Hn;break;case`copy`:case`cut`:case`paste`:l=jn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=zn;break;case`toggle`:case`beforetoggle`:l=Un}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=sn(m,p),g!=null&&d.push(Td(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==$t&&(u=n.relatedTarget||n.fromElement)&&(mt(u)||u[st]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?mt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Dn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=zn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:gt(l),h=u==null?c:gt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,mt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Dd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&$(s,c,l,d,!1),u!==null&&f!==null&&$(s,f,u,d,!0)}}a:{if(c=r?gt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=lr;else if(rr(c))if(ur)v=yr;else{v=_r;var y=gr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Jt(r.elementType)&&(v=lr):v=vr;if(v&&=v(e,r)){ir(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Bt(c,`number`,c.value)}switch(y=r?gt(r):window,e){case`focusin`:(rr(y)||y.contentEditable===`true`)&&(kr=y,Ar=r,jr=null);break;case`focusout`:jr=Ar=kr=null;break;case`mousedown`:Mr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Mr=!1,Nr(s,n,i);break;case`selectionchange`:if(Or)break;case`keydown`:case`keyup`:Nr(s,n,i)}var b;if(Gn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else $n?Zn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Jn&&n.locale!==`ko`&&($n||x!==`onCompositionStart`?x===`onCompositionEnd`&&$n&&(b=mn()):(dn=i,fn=`value`in dn?dn.value:dn.textContent,$n=!0)),y=Ed(r,x),0<y.length&&(x=new Mn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Qn(n),b!==null&&(x.data=b)))),(b=qn?er(e,n):tr(e,n))&&(x=Ed(r,`onBeforeInput`),0<x.length&&(y=new Mn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),gd(s,e,r,n,i)}yd(s,t)})}function Td(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ed(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=sn(e,n),i!=null&&r.unshift(Td(e,i,a)),i=sn(e,t),i!=null&&r.push(Td(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Dd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function $(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=sn(n,a),l!=null&&o.unshift(Td(n,l,c))):i||(l=sn(n,a),l!=null&&o.push(Td(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
30
- `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Wt(e,``+r);break;case`className`:Ot(e,`class`,r);break;case`tabIndex`:Ot(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ot(e,n,r);break;case`style`:qt(e,r,o);break;case`data`:if(t!==`object`){Ot(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Zt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Zt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),Dt(e,`popover`,r);break;case`xlinkActuate`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:kt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:kt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Dt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Yt.get(n)||n,Dt(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:qt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Wt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Wt(e,``+r);break;case`onScroll`:r!=null&&Q(`scroll`,e);break;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!bt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[ot]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Dt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Md(e,t,r,d,n,null)}}zt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Q(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Vt(e,!!r,n,!0):Vt(e,!!r,t,!1);return;case`textarea`:for(s in Q(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Md(e,t,s,c,n,null)}Ut(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<vd.length;r++)Q(vd[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Jt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Rt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Vt(e,!!n,n?[]:``,!1):Vt(e,!!n,t,!0)):Vt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Md(e,t,s,a,r,o)}Ht(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Jt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ft]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),pt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ft])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);pt(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=N.d;N.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=xu();return e||t}function yf(e){var t=ht(e);t!==null&&t.tag===5&&t.type===`form`?Ts(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=Lt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Lt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Lt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Lt(n.imageSizes)+`"]`)):i+=`[href="`+Lt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),vt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Lt(r)+`"][href="`+Lt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),vt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=_t(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);vt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=_t(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),vt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=_t(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),vt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=se.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=_t(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=_t(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=_t(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+Lt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),vt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+Lt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Lt(n.href)+`"]`);if(r)return t.instance=r,vt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),vt(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,vt(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),vt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,vt(a),a):(r=n,(a=mf.get(o))&&(r=f({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),vt(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ft]||a[at]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,vt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:b,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Je(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Je(0),this.hiddenUpdates=Je(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=oi(3,null,null,t),e.current=a,a.stateNode=e,t=ia(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},La(a),e}function tp(e){return e?(e=ii,e):ii}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=za(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ba(e,r,t),n!==null&&(gu(n,e,t),Va(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=ti(e,67108864);t!==null&&gu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=mu();t=et(t);var n=ti(e,t);n!==null&&gu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,up(e,t,n,r)}finally{N.p=a,M.T=i}}function lp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,up(e,t,n,r)}finally{N.p=a,M.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)wd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=ht(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ue(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ie(o);s.entanglements[1]|=c,o&=~c}ad(a),!(K&6)&&(nu=we()+500,od(0,!1))}}break;case 31:case 13:s=ti(a,2),s!==null&&gu(s,a,2),xu(),ip(a,2)}if(a=dp(r),a===null&&wd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else wd(e,t,r,null,n)}}function dp(e){return e=en(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=mt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(R()){case z:return 2;case Te:return 8;case Ee:case Oe:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ht(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=mt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,rt(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,rt(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);$t=r,n.target.dispatchEvent(r),$t=null}else return t=ht(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=ht(n);a!==null&&(e.splice(t,3),t-=3,Cs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[ot]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ot]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,mu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),xu(),t[st]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=nt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.5`)throw Error(i(527,Lp,`19.2.5`));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.5`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.5`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Ne=zp.inject(Rp),Pe=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ks,s=qs,c=Js;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[st]=t.current,Sd(e),new Fp(t)}})),je=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Ae()})),Me=`popstate`;function Ne(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Pe(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return ze(``,{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:Be(t)}return He(t,n,null,e)}function Fe(e,t){if(e===!1||e==null)throw Error(t)}function Ie(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Le(){return Math.random().toString(36).substring(2,10)}function Re(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ze(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Ve(t):t,state:n,key:t&&t.key||r||Le(),unstable_mask:i}}function Be({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 Ve(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 He(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Ne(e)?e:ze(h.location,e,t);n&&n(r,e),l=u()+1;let d=Re(r,l),f=h.createHref(r.unstable_mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Ne(e)?e:ze(h.location,e,t);n&&n(r,e),l=u();let i=Re(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ue(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Me,d),c=e,()=>{i.removeEventListener(Me,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ue(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),Fe(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Be(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function We(e,t,n=`/`){return Ge(e,t,n,!1)}function Ge(e,t,n,r){let i=lt((typeof t==`string`?Ve(t):t).pathname||`/`,n);if(i==null)return null;let a=qe(e);Ye(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=ct(i);o=at(a[e],t,r)}return o}function Ke(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function qe(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;Fe(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=vt([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Fe(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),qe(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:rt(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Je(e.path))a(e,t,!0,n)}),t}function Je(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=Je(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 Ye(e){e.sort((e,t)=>e.score===t.score?it(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Xe=/^:[\w-]+$/,Ze=3,Qe=2,$e=1,et=10,tt=-2,nt=e=>e===`*`;function rt(e,t){let n=e.split(`/`),r=n.length;return n.some(nt)&&(r+=tt),t&&(r+=Qe),n.filter(e=>!nt(e)).reduce((e,t)=>e+(Xe.test(t)?Ze:t===``?$e:et),r)}function it(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 at(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=ot({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=ot({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:vt([a,u.pathname]),pathnameBase:bt(vt([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=vt([a,u.pathnameBase]))}return o}function ot(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=st(e.path,e.caseSensitive,e.end),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 st(e,t=!1,n=!0){Ie(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)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ct(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return Ie(!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 lt(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)||`/`}var ut=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function dt(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Ve(e):e,a;return n?(n=_t(n),a=n.startsWith(`/`)?ft(n.substring(1),`/`):ft(n,t)):a=t,{pathname:a,search:xt(r),hash:St(i)}}function ft(e,t){let n=yt(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function pt(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 mt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ht(e){let t=mt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function gt(e,t,n,r=!1){let i;typeof e==`string`?i=Ve(e):(i={...e},Fe(!i.pathname||!i.pathname.includes(`?`),pt(`?`,`pathname`,`search`,i)),Fe(!i.pathname||!i.pathname.includes(`#`),pt(`#`,`pathname`,`hash`,i)),Fe(!i.search||!i.search.includes(`#`),pt(`#`,`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=dt(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var _t=e=>e.replace(/\/\/+/g,`/`),vt=e=>_t(e.join(`/`)),yt=e=>e.replace(/\/+$/,``),bt=e=>yt(e).replace(/^\/*/,`/`),xt=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,St=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ct=class{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 wt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Tt(e){return vt(e.map(e=>e.route.path).filter(Boolean))||`/`}var Et=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Dt(e,t){let n=e;if(typeof n!=`string`||!ut.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Et)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=lt(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{Ie(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ot=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Ot);var kt=[`GET`,...Ot];new Set(kt);var At=L.createContext(null);At.displayName=`DataRouter`;var jt=L.createContext(null);jt.displayName=`DataRouterState`;var Mt=L.createContext(!1);function Nt(){return L.useContext(Mt)}var Pt=L.createContext({isTransitioning:!1});Pt.displayName=`ViewTransition`;var Ft=L.createContext(new Map);Ft.displayName=`Fetchers`;var It=L.createContext(null);It.displayName=`Await`;var Lt=L.createContext(null);Lt.displayName=`Navigation`;var Rt=L.createContext(null);Rt.displayName=`Location`;var zt=L.createContext({outlet:null,matches:[],isDataRoute:!1});zt.displayName=`Route`;var Bt=L.createContext(null);Bt.displayName=`RouteError`;var Vt=`REACT_ROUTER_ERROR`,Ht=`REDIRECT`,Ut=`ROUTE_ERROR_RESPONSE`;function Wt(e){if(e.startsWith(`${Vt}:${Ht}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Gt(e){if(e.startsWith(`${Vt}:${Ut}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ct(t.status,t.statusText,t.data)}catch{}}function Kt(e,{relative:t}={}){Fe(qt(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=L.useContext(Lt),{hash:i,pathname:a,search:o}=$t(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:vt([n,a])),r.createHref({pathname:s,search:o,hash:i})}function qt(){return L.useContext(Rt)!=null}function Jt(){return Fe(qt(),`useLocation() may be used only in the context of a <Router> component.`),L.useContext(Rt).location}var Yt=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Xt(e){L.useContext(Lt).static||L.useLayoutEffect(e)}function Zt(){let{isDataRoute:e}=L.useContext(zt);return e?yn():Qt()}function Qt(){Fe(qt(),`useNavigate() may be used only in the context of a <Router> component.`);let e=L.useContext(At),{basename:t,navigator:n}=L.useContext(Lt),{matches:r}=L.useContext(zt),{pathname:i}=Jt(),a=JSON.stringify(ht(r)),o=L.useRef(!1);return Xt(()=>{o.current=!0}),L.useCallback((r,s={})=>{if(Ie(o.current,Yt),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=gt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:vt([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}L.createContext(null);function $t(e,{relative:t}={}){let{matches:n}=L.useContext(zt),{pathname:r}=Jt(),i=JSON.stringify(ht(n));return L.useMemo(()=>gt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function en(e,t){return tn(e,t)}function tn(e,t,n){Fe(qt(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=L.useContext(Lt),{matches:i}=L.useContext(zt),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;xn(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
31
-
32
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Jt(),d;if(t){let e=typeof t==`string`?Ve(t):t;Fe(c===`/`||e.pathname?.startsWith(c),`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 "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=We(e,{pathname:p});Ie(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),Ie(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=ln(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:vt([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:vt([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?L.createElement(Rt.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function nn(){let e=vn(),t=wt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=L.createElement(L.Fragment,null,L.createElement(`p`,null,`💿 Hey developer 👋`),L.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,L.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,L.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),L.createElement(L.Fragment,null,L.createElement(`h2`,null,`Unexpected Application Error!`),L.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?L.createElement(`pre`,{style:i},n):null,o)}var rn=L.createElement(nn,null),an=class extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}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=Gt(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:L.createElement(zt.Provider,{value:this.props.routeContext},L.createElement(Bt.Provider,{value:e,children:this.props.component}));return this.context?L.createElement(sn,{error:e},t):t}};an.contextType=Mt;var on=new WeakMap;function sn({children:e,error:t}){let{basename:n}=L.useContext(Lt);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Wt(t.digest);if(e){let r=on.get(t);if(r)throw r;let i=Dt(e.location,n);if(Et&&!on.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw on.set(t,n),n}return L.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function cn({routeContext:e,match:t,children:n}){let r=L.useContext(At);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),L.createElement(zt.Provider,{value:e},n)}function ln(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);Fe(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??{},unstable_pattern:Tt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||rn,o&&(s<0&&c===0?(xn(`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?L.createElement(n.route.Component,null):n.route.element?n.route.element:e,L.createElement(cn,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?L.createElement(an,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function un(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dn(e){let t=L.useContext(At);return Fe(t,un(e)),t}function fn(e){let t=L.useContext(jt);return Fe(t,un(e)),t}function pn(e){let t=L.useContext(zt);return Fe(t,un(e)),t}function mn(e){let t=pn(e),n=t.matches[t.matches.length-1];return Fe(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hn(){return mn(`useRouteId`)}function gn(){return fn(`useNavigation`).navigation}function _n(){let{matches:e,loaderData:t}=fn(`useMatches`);return L.useMemo(()=>e.map(e=>Ke(e,t)),[e,t])}function vn(){let e=L.useContext(Bt),t=fn(`useRouteError`),n=mn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function yn(){let{router:e}=dn(`useNavigate`),t=mn(`useNavigate`),n=L.useRef(!1);return Xt(()=>{n.current=!0}),L.useCallback(async(r,i={})=>{Ie(n.current,Yt),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var bn={};function xn(e,t,n){!t&&!bn[e]&&(bn[e]=!0,Ie(!1,n))}L.memo(Sn);function Sn({routes:e,future:t,state:n,isStatic:r,onError:i}){return tn(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function Cn(e){Fe(!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 wn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){Fe(!qt(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=L.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=Ve(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=L.useMemo(()=>{let e=lt(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return Ie(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:L.createElement(Lt.Provider,{value:c},L.createElement(Rt.Provider,{children:t,value:h}))}function Tn({children:e,location:t}){return en(En(e),t)}L.Component;function En(e,t=[]){let n=[];return L.Children.forEach(e,(e,r)=>{if(!L.isValidElement(e))return;let i=[...t,r];if(e.type===L.Fragment){n.push.apply(n,En(e.props.children,i));return}Fe(e.type===Cn,`[${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>`),Fe(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=En(e.props.children,i)),n.push(a)}),n}var Dn=`get`,On=`application/x-www-form-urlencoded`;function kn(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function An(e){return kn(e)&&e.tagName.toLowerCase()===`button`}function jn(e){return kn(e)&&e.tagName.toLowerCase()===`form`}function Mn(e){return kn(e)&&e.tagName.toLowerCase()===`input`}function Nn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Pn(e,t){return e.button===0&&(!t||t===`_self`)&&!Nn(e)}var Fn=null;function In(){if(Fn===null)try{new FormData(document.createElement(`form`),0),Fn=!1}catch{Fn=!0}return Fn}var Ln=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Rn(e){return e!=null&&!Ln.has(e)?(Ie(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${On}"`),null):e}function zn(e,t){let n,r,i,a,o;if(jn(e)){let o=e.getAttribute(`action`);r=o?lt(o,t):null,n=e.getAttribute(`method`)||Dn,i=Rn(e.getAttribute(`enctype`))||On,a=new FormData(e)}else if(An(e)||Mn(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?lt(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Dn,i=Rn(e.getAttribute(`formenctype`))||Rn(o.getAttribute(`enctype`))||On,a=new FormData(o,e),!In()){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(kn(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Dn,r=null,i=On,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Bn={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Vn=/[&><\u2028\u2029]/g;function Hn(e){return e.replace(Vn,e=>Bn[e])}function Un(e,t){if(e===!1||e==null)throw Error(t)}function Wn(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&lt(i.pathname,t)===`/`?i.pathname=`${yt(t)}/_root.${r}`:i.pathname=`${yt(i.pathname)}.${r}`,i}async function Gn(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 Kn(e){return e!=null&&typeof e.page==`string`}function qn(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 Jn(e,t,n){return $n((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Gn(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(qn).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Yn(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,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 Xn(e,t,{includeHydrateFallback:n}={}){return Zn(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 Zn(e){return[...new Set(e)]}function Qn(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function $n(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Kn(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Qn(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function er(){let e=L.useContext(At);return Un(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function tr(){let e=L.useContext(jt);return Un(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var nr=L.createContext(void 0);nr.displayName=`FrameworkContext`;function rr(){let e=L.useContext(nr);return Un(e,`You must render this element inside a <HydratedRouter> element`),e}function ir(e,t){let n=L.useContext(nr),[r,i]=L.useState(!1),[a,o]=L.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=L.useRef(null);L.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]),L.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:ar(s,p),onBlur:ar(c,m),onMouseEnter:ar(l,p),onMouseLeave:ar(u,m),onTouchStart:ar(d,p)}]:[a,f,{}]:[!1,f,{}]}function ar(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function or({page:e,...t}){let n=Nt(),{router:r}=er(),i=L.useMemo(()=>We(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?L.createElement(cr,{page:e,matches:i,...t}):L.createElement(lr,{page:e,matches:i,...t}):null}function sr(e){let{manifest:t,routeModules:n}=rr(),[r,i]=L.useState([]);return L.useEffect(()=>{let r=!1;return Jn(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function cr({page:e,matches:t,...n}){let r=Jt(),{future:i}=rr(),{basename:a}=er(),o=L.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Wn(e,a,i.unstable_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.unstable_trailingSlashAwareDataRequests,e,r,t]);return L.createElement(L.Fragment,null,o.map(e=>L.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function lr({page:e,matches:t,...n}){let r=Jt(),{future:i,manifest:a,routeModules:o}=rr(),{basename:s}=er(),{loaderData:c,matches:l}=tr(),u=L.useMemo(()=>Yn(e,t,l,a,r,`data`),[e,t,l,a,r]),d=L.useMemo(()=>Yn(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=L.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Wn(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=L.useMemo(()=>Xn(d,a),[d,a]),m=sr(d);return L.createElement(L.Fragment,null,f.map(e=>L.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>L.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>L.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ur(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}L.Component;var dr=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{dr&&(window.__reactRouterVersion=`7.14.2`)}catch{}function fr({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=L.useRef();i.current??=Pe({window:r,v5Compat:!0});let a=i.current,[o,s]=L.useState({action:a.action,location:a.location}),c=L.useCallback(e=>{n===!1?s(e):L.startTransition(()=>s(e))},[n]);return L.useLayoutEffect(()=>a.listen(c),[a,c]),L.createElement(wn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function pr({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=L.useState({action:n.action,location:n.location}),o=L.useCallback(e=>{r===!1?a(e):L.startTransition(()=>a(e))},[r]);return L.useLayoutEffect(()=>n.listen(o),[n,o]),L.createElement(wn,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}pr.displayName=`unstable_HistoryRouter`;var mr=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,hr=L.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,unstable_mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,unstable_useTransitions:_}=L.useContext(Lt),v=typeof l==`string`&&mr.test(l),y=Dt(l,h);l=y.to;let b=Kt(l,{relative:r}),x=Jt(),S=null;if(o){let e=gt(o,[],x.unstable_mask?x.unstable_mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:vt([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=ir(n,p),E=Sr(l,{replace:a,unstable_mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=L.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:ur(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?L.createElement(L.Fragment,null,k,L.createElement(or,{page:b})):k});hr.displayName=`Link`;var gr=L.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=$t(a,{relative:c.relative}),d=Jt(),f=L.useContext(jt),{navigator:p,basename:m}=L.useContext(Lt),h=f!=null&&Mr(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=lt(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return L.createElement(hr,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});gr.displayName=`NavLink`;var _r=L.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Dn,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=L.useContext(Lt),g=Tr(),_=Er(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&mr.test(s);return L.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?L.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});_r.displayName=`Form`;function vr({getKey:e,storageKey:t,...n}){let r=L.useContext(nr),{basename:i}=L.useContext(Lt),a=Jt(),o=_n();Ar({getKey:e,storageKey:t});let s=L.useMemo(()=>{if(!r||!e)return null;let t=kr(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 L.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Hn(JSON.stringify(t||Dr))}, ${Hn(JSON.stringify(s))})`}})}vr.displayName=`ScrollRestoration`;function yr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function br(e){let t=L.useContext(At);return Fe(t,yr(e)),t}function xr(e){let t=L.useContext(jt);return Fe(t,yr(e)),t}function Sr(e,{target:t,replace:n,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c,unstable_useTransitions:l}={}){let u=Zt(),d=Jt(),f=$t(e,{relative:o});return L.useCallback(p=>{if(Pn(p,t)){p.preventDefault();let t=n===void 0?Be(d)===Be(f):n,m=()=>u(e,{replace:t,unstable_mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,unstable_defaultShouldRevalidate:c});l?L.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var Cr=0,wr=()=>`__${String(++Cr)}__`;function Tr(){let{router:e}=br(`useSubmit`),{basename:t}=L.useContext(Lt),n=hn(),r=e.fetch,i=e.navigate;return L.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=zn(e,t);a.navigate===!1?await r(a.fetcherKey||wr(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_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 Er(e,{relative:t}={}){let{basename:n}=L.useContext(Lt),r=L.useContext(zt);Fe(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...$t(e||`.`,{relative:t})},o=Jt();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:vt([n,a.pathname])),Be(a)}var Dr=`react-router-scroll-positions`,Or={};function kr(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:lt(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Ar({getKey:e,storageKey:t}={}){let{router:n}=br(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=xr(`useScrollRestoration`),{basename:a}=L.useContext(Lt),o=Jt(),s=_n(),c=gn();L.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),jr(L.useCallback(()=>{if(c.state===`idle`){let t=kr(o,s,a,e);Or[t]=window.scrollY}try{sessionStorage.setItem(t||Dr,JSON.stringify(Or))}catch(e){Ie(!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`&&(L.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Dr);e&&(Or=JSON.parse(e))}catch{}},[t]),L.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Or,()=>window.scrollY,e?(t,n)=>kr(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),L.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{Ie(!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 jr(e,t){let{capture:n}=t||{};L.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Mr(e,{relative:t}={}){let n=L.useContext(Pt);Fe(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=br(`useViewTransitionState`),i=$t(e,{relative:t});if(!n.isTransitioning)return!1;let a=lt(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=lt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ot(i.pathname,o)!=null||ot(i.pathname,a)!=null}var Nr=e(je(),1),Pr=`(max-width: 899px)`;function Fr(){return typeof window>`u`||typeof window.matchMedia!=`function`?`desktop`:window.matchMedia(Pr).matches?`mobile`:`desktop`}function Ir(){let[e,t]=(0,L.useState)(Fr);return(0,L.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Pr),n=()=>{t(Fr())};return e.addEventListener(`change`,n),n(),()=>{e.removeEventListener(`change`,n)}},[]),e}var Lr=Symbol(``),Rr=e=>typeof e?.then==`function`;function zr(e=()=>{try{return window.localStorage}catch{return}},t){let n,r,i={getItem:(i,a)=>{let o=e=>{if(e||=``,n!==e){try{r=JSON.parse(e,t?.reviver)}catch{return a}n=e}return r},s=e()?.getItem(i)??null;return Rr(s)?s.then(o):o(s)},setItem:(n,r)=>e()?.setItem(n,JSON.stringify(r,t?.replacer)),removeItem:t=>e()?.removeItem(t)},a=e=>(t,n,r)=>e(t,e=>{let t;try{t=JSON.parse(e||``)}catch{t=r}n(t)}),o;try{o=e()?.subscribe}catch{}return!o&&typeof window<`u`&&typeof window.addEventListener==`function`&&window.Storage&&(o=(t,n)=>{if(!(e()instanceof window.Storage))return()=>{};let r=r=>{r.storageArea===e()&&r.key===t&&n(r.newValue)};return window.addEventListener(`storage`,r),()=>{window.removeEventListener(`storage`,r)}}),o&&(i.subscribe=a(o)),i}var Br=zr();function Vr(e,t,n=Br,r){let i=I(r?.getOnInit?n.getItem(e,t):t);return i.onMount=r=>(r(n.getItem(e,t)),n.subscribe?.call(n,e,r,t)),I(e=>e(i),(r,a,o)=>{let s=typeof o==`function`?o(r(i)):o;return s===Lr?(a(i,t),n.removeItem(e)):Rr(s)?s.then(t=>(a(i,t),n.setItem(e,t))):(a(i,s),n.setItem(e,s))})}var Hr=Vr(`ui.theme`,`dark`),Ur=Vr(`ui.locale`,`zh`),Wr=I(!1),Gr=I(!1),Kr=I(null),qr=I(null),Jr=86400;function Yr(e){return typeof e!=`number`||!Number.isFinite(e)||!Number.isSafeInteger(e)||e<1||e>86400?600:e}var Xr;function B(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Zr=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Qr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Xr=globalThis).__zod_globalConfig??(Xr.__zod_globalConfig={});var $r=globalThis.__zod_globalConfig;function ei(e){return e&&Object.assign($r,e),$r}function ti(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ni(e,t){return typeof t==`bigint`?t.toString():t}function ri(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ii(e){return e==null}function ai(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function oi(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var si=Symbol(`evaluating`);function V(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==si)return r===void 0&&(r=si,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ci(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function li(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function ui(e){return JSON.stringify(e)}function di(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var fi=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function pi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mi=ri(()=>{if($r.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function hi(e){if(pi(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(pi(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function gi(e){return hi(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var _i=new Set([`string`,`number`,`symbol`]);function vi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function yi(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function H(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function bi(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var xi={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Si(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return yi(e,li(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ci(this,`shape`,e),e},checks:[]}))}function Ci(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return yi(e,li(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ci(this,`shape`,r),r},checks:[]}))}function wi(e,t){if(!hi(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return yi(e,li(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ci(this,`shape`,n),n}}))}function Ti(e,t){if(!hi(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return yi(e,li(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ci(this,`shape`,n),n}}))}function Ei(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return yi(e,li(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ci(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Di(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return yi(t,li(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ci(this,`shape`,i),i},checks:[]}))}function Oi(e,t,n){return yi(t,li(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ci(this,`shape`,i),i}}))}function ki(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ai(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function U(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ji(e){return typeof e==`string`?e:e?.message}function Mi(e,t,n){let r=e.message?e.message:ji(e.inst?._zod.def?.error?.(e))??ji(t?.error?.(e))??ji(n.customError?.(e))??ji(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ni(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Pi(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Fi=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,ni,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Ii=B(`$ZodError`,Fi),Li=B(`$ZodError`,Fi,{Parent:Error});function Ri(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function zi(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Bi=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Zr;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Mi(e,a,ei())));throw fi(t,i?.callee),t}return o.value},Vi=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Mi(e,a,ei())));throw fi(t,i?.callee),t}return o.value},Hi=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Zr;return a.issues.length?{success:!1,error:new(e??Ii)(a.issues.map(e=>Mi(e,i,ei())))}:{success:!0,data:a.value}},Ui=Hi(Li),Wi=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Mi(e,i,ei())))}:{success:!0,data:a.value}},Gi=Wi(Li),Ki=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Bi(e)(t,n,i)},qi=e=>(t,n,r)=>Bi(e)(t,n,r),Ji=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Vi(e)(t,n,i)},Yi=e=>async(t,n,r)=>Vi(e)(t,n,r),Xi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Hi(e)(t,n,i)},Zi=e=>(t,n,r)=>Hi(e)(t,n,r),Qi=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wi(e)(t,n,i)},$i=e=>async(t,n,r)=>Wi(e)(t,n,r),ea=/^[cC][0-9a-z]{6,}$/,ta=/^[0-9a-z]+$/,na=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ra=/^[0-9a-vA-V]{20}$/,ia=/^[A-Za-z0-9]{27}$/,aa=/^[a-zA-Z0-9_-]{21}$/,oa=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,sa=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ca=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,la=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ua=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function da(){return new RegExp(ua,`u`)}var fa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ma=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ha=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ga=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_a=/^[A-Za-z0-9_-]*$/,va=/^https?$/,ya=/^\+[1-9]\d{6,14}$/,ba=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,xa=RegExp(`^${ba}$`);function Sa(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ca(e){return RegExp(`^${Sa(e)}$`)}function wa(e){let t=Sa({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ba}T(?:${r})$`)}var Ta=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ea=/^-?\d+$/,Da=/^-?\d+(?:\.\d+)?$/,Oa=/^(?:true|false)$/i,ka=/^[^A-Z]*$/,Aa=/^[^a-z]*$/,ja=B(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ma={number:`number`,bigint:`bigint`,object:`date`},Na=B(`$ZodCheckLessThan`,(e,t)=>{ja.init(e,t);let n=Ma[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Pa=B(`$ZodCheckGreaterThan`,(e,t)=>{ja.init(e,t);let n=Ma[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Fa=B(`$ZodCheckMultipleOf`,(e,t)=>{ja.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):oi(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ia=B(`$ZodCheckNumberFormat`,(e,t)=>{ja.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=xi[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ea)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),La=B(`$ZodCheckMaxLength`,(e,t)=>{var n;ja.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ii(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ni(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ra=B(`$ZodCheckMinLength`,(e,t)=>{var n;ja.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ii(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ni(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),za=B(`$ZodCheckLengthEquals`,(e,t)=>{var n;ja.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ii(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ni(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ba=B(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ja.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Va=B(`$ZodCheckRegex`,(e,t)=>{Ba.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ha=B(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ka,Ba.init(e,t)}),Ua=B(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Aa,Ba.init(e,t)}),Wa=B(`$ZodCheckIncludes`,(e,t)=>{ja.init(e,t);let n=vi(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ga=B(`$ZodCheckStartsWith`,(e,t)=>{ja.init(e,t);let n=RegExp(`^${vi(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ka=B(`$ZodCheckEndsWith`,(e,t)=>{ja.init(e,t);let n=RegExp(`.*${vi(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),qa=B(`$ZodCheckOverwrite`,(e,t)=>{ja.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ja=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
33
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
34
- `))}},Ya={major:4,minor:4,patch:3},Xa=B(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ya;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ki(e),i;for(let a of t){if(a._zod.def.when){if(Ai(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Zr;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=ki(e,t))});else{if(e.issues.length===t)continue;r||=ki(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(ki(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Zr;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Zr;return o.then(e=>t(e,r,a))}return t(o,r,a)}}V(e,`~standard`,()=>({validate:t=>{try{let n=Ui(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Gi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Za=B(`$ZodString`,(e,t)=>{Xa.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ta(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Qa=B(`$ZodStringFormat`,(e,t)=>{Ba.init(e,t),Za.init(e,t)}),$a=B(`$ZodGUID`,(e,t)=>{t.pattern??=sa,Qa.init(e,t)}),eo=B(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=ca(e)}else t.pattern??=ca();Qa.init(e,t)}),to=B(`$ZodEmail`,(e,t)=>{t.pattern??=la,Qa.init(e,t)}),no=B(`$ZodURL`,(e,t)=>{Qa.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===va.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ro=B(`$ZodEmoji`,(e,t)=>{t.pattern??=da(),Qa.init(e,t)}),io=B(`$ZodNanoID`,(e,t)=>{t.pattern??=aa,Qa.init(e,t)}),ao=B(`$ZodCUID`,(e,t)=>{t.pattern??=ea,Qa.init(e,t)}),oo=B(`$ZodCUID2`,(e,t)=>{t.pattern??=ta,Qa.init(e,t)}),so=B(`$ZodULID`,(e,t)=>{t.pattern??=na,Qa.init(e,t)}),co=B(`$ZodXID`,(e,t)=>{t.pattern??=ra,Qa.init(e,t)}),W=B(`$ZodKSUID`,(e,t)=>{t.pattern??=ia,Qa.init(e,t)}),lo=B(`$ZodISODateTime`,(e,t)=>{t.pattern??=wa(t),Qa.init(e,t)}),uo=B(`$ZodISODate`,(e,t)=>{t.pattern??=xa,Qa.init(e,t)}),fo=B(`$ZodISOTime`,(e,t)=>{t.pattern??=Ca(t),Qa.init(e,t)}),po=B(`$ZodISODuration`,(e,t)=>{t.pattern??=oa,Qa.init(e,t)}),mo=B(`$ZodIPv4`,(e,t)=>{t.pattern??=fa,Qa.init(e,t),e._zod.bag.format=`ipv4`}),ho=B(`$ZodIPv6`,(e,t)=>{t.pattern??=pa,Qa.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),go=B(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ma,Qa.init(e,t)}),_o=B(`$ZodCIDRv6`,(e,t)=>{t.pattern??=ha,Qa.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function vo(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var yo=B(`$ZodBase64`,(e,t)=>{t.pattern??=ga,Qa.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{vo(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function bo(e){if(!_a.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return vo(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var xo=B(`$ZodBase64URL`,(e,t)=>{t.pattern??=_a,Qa.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{bo(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),So=B(`$ZodE164`,(e,t)=>{t.pattern??=ya,Qa.init(e,t)});function Co(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var wo=B(`$ZodJWT`,(e,t)=>{Qa.init(e,t),e._zod.check=n=>{Co(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),To=B(`$ZodNumber`,(e,t)=>{Xa.init(e,t),e._zod.pattern=e._zod.bag.pattern??Da,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Eo=B(`$ZodNumberFormat`,(e,t)=>{Ia.init(e,t),To.init(e,t)}),Do=B(`$ZodBoolean`,(e,t)=>{Xa.init(e,t),e._zod.pattern=Oa,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Oo=B(`$ZodUnknown`,(e,t)=>{Xa.init(e,t),e._zod.parse=e=>e}),ko=B(`$ZodNever`,(e,t)=>{Xa.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ao(e,t,n){e.issues.length&&t.issues.push(...U(n,e.issues)),t.value[n]=e.value}var jo=B(`$ZodArray`,(e,t)=>{Xa.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Ao(t,n,e))):Ao(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Mo(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...U(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function No(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=bi(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Po(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Mo(e,n,i,t,u,d))):Mo(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Fo=B(`$ZodObject`,(e,t)=>{if(Xa.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=ri(()=>No(t));V(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=pi,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Mo(n,t,e,s,r,i))):Mo(a,t,e,s,r,i)}return i?Po(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Io=B(`$ZodObjectJIT`,(e,t)=>{Fo.init(e,t);let n=e._zod.parse,r=ri(()=>No(t)),i=e=>{let t=new Ja([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=ui(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=ui(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
35
- if (${n}.issues.length) {
36
- if (${o} in input) {
37
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
38
- ...iss,
39
- path: iss.path ? [${o}, ...iss.path] : [${o}]
40
- })));
41
- }
42
- }
43
-
44
- if (${n}.value === undefined) {
45
- if (${o} in input) {
46
- newResult[${o}] = undefined;
47
- }
48
- } else {
49
- newResult[${o}] = ${n}.value;
50
- }
51
-
52
- `):c?t.write(`
53
- if (${n}.issues.length) {
54
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
55
- ...iss,
56
- path: iss.path ? [${o}, ...iss.path] : [${o}]
57
- })));
58
- }
59
-
60
- if (${n}.value === undefined) {
61
- if (${o} in input) {
62
- newResult[${o}] = undefined;
63
- }
64
- } else {
65
- newResult[${o}] = ${n}.value;
66
- }
67
-
68
- `):t.write(`
69
- const ${n}_present = ${o} in input;
70
- if (${n}.issues.length) {
71
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
72
- ...iss,
73
- path: iss.path ? [${o}, ...iss.path] : [${o}]
74
- })));
75
- }
76
- if (!${n}_present && !${n}.issues.length) {
77
- payload.issues.push({
78
- code: "invalid_type",
79
- expected: "nonoptional",
80
- input: undefined,
81
- path: [${o}]
82
- });
83
- }
84
-
85
- if (${n}_present) {
86
- if (${n}.value === undefined) {
87
- newResult[${o}] = undefined;
88
- } else {
89
- newResult[${o}] = ${n}.value;
90
- }
91
- }
92
-
93
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=pi,s=!$r.jitless,c=s&&mi.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Po([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Lo(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ki(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Mi(e,r,ei())))}),t)}var Ro=B(`$ZodUnion`,(e,t)=>{Xa.init(e,t),V(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),V(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),V(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),V(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ai(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Lo(t,r,e,i)):Lo(o,r,e,i)}}),zo=B(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Ro.init(e,t);let n=e._zod.parse;V(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=ri(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!pi(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Bo=B(`$ZodIntersection`,(e,t)=>{Xa.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ho(e,t,n)):Ho(e,i,a)}});function Vo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(hi(e)&&hi(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Vo(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Vo(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ho(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ki(e))return e;let o=Vo(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Uo=B(`$ZodRecord`,(e,t)=>{Xa.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!hi(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Mi(e,r,ei())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...U(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...U(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Da.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Mi(e,r,ei())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...U(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...U(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Wo=B(`$ZodEnum`,(e,t)=>{Xa.init(e,t);let n=ti(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>_i.has(typeof e)).map(e=>typeof e==`string`?vi(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Go=B(`$ZodLiteral`,(e,t)=>{if(Xa.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?vi(e):e?vi(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Ko=B(`$ZodTransform`,(e,t)=>{Xa.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Zr;return n.value=i,n.fallback=!0,n}});function qo(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Jo=B(`$ZodOptional`,(e,t)=>{Xa.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,V(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ai(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>qo(e,r)):qo(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Yo=B(`$ZodExactOptional`,(e,t)=>{Jo.init(e,t),V(e._zod,`values`,()=>t.innerType._zod.values),V(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Xo=B(`$ZodNullable`,(e,t)=>{Xa.init(e,t),V(e._zod,`optin`,()=>t.innerType._zod.optin),V(e._zod,`optout`,()=>t.innerType._zod.optout),V(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ai(e.source)}|null)$`):void 0}),V(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Zo=B(`$ZodDefault`,(e,t)=>{Xa.init(e,t),e._zod.optin=`optional`,V(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Qo(e,t)):Qo(r,t)}});function Qo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var $o=B(`$ZodPrefault`,(e,t)=>{Xa.init(e,t),e._zod.optin=`optional`,V(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),es=B(`$ZodNonOptional`,(e,t)=>{Xa.init(e,t),V(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ts(t,e)):ts(i,e)}});function ts(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var ns=B(`$ZodCatch`,(e,t)=>{Xa.init(e,t),e._zod.optin=`optional`,V(e._zod,`optout`,()=>t.innerType._zod.optout),V(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Mi(e,n,ei()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Mi(e,n,ei()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),rs=B(`$ZodPipe`,(e,t)=>{Xa.init(e,t),V(e._zod,`values`,()=>t.in._zod.values),V(e._zod,`optin`,()=>t.in._zod.optin),V(e._zod,`optout`,()=>t.out._zod.optout),V(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>is(e,t.in,n)):is(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>is(e,t.out,n)):is(r,t.out,n)}});function is(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var as=B(`$ZodReadonly`,(e,t)=>{Xa.init(e,t),V(e._zod,`propValues`,()=>t.innerType._zod.propValues),V(e._zod,`values`,()=>t.innerType._zod.values),V(e._zod,`optin`,()=>t.innerType?._zod?.optin),V(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(os):os(r)}});function os(e){return e.value=Object.freeze(e.value),e}var ss=B(`$ZodCustom`,(e,t)=>{ja.init(e,t),Xa.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>cs(t,n,r,e));cs(i,n,r,e)}});function cs(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Pi(e))}}var ls,us=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ds(){return new us}(ls=globalThis).__zod_globalRegistry??(ls.__zod_globalRegistry=ds());var fs=globalThis.__zod_globalRegistry;function ps(e,t){return new e({type:`string`,...H(t)})}function ms(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...H(t)})}function hs(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...H(t)})}function gs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...H(t)})}function _s(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...H(t)})}function vs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...H(t)})}function ys(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...H(t)})}function bs(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...H(t)})}function xs(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...H(t)})}function Ss(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...H(t)})}function Cs(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...H(t)})}function ws(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...H(t)})}function Ts(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...H(t)})}function Es(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...H(t)})}function Ds(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...H(t)})}function Os(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...H(t)})}function ks(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...H(t)})}function As(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...H(t)})}function js(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...H(t)})}function Ms(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...H(t)})}function Ns(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...H(t)})}function Ps(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...H(t)})}function Fs(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...H(t)})}function Is(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...H(t)})}function Ls(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...H(t)})}function Rs(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...H(t)})}function zs(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...H(t)})}function Bs(e,t){return new e({type:`number`,checks:[],...H(t)})}function Vs(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...H(t)})}function Hs(e,t){return new e({type:`boolean`,...H(t)})}function Us(e){return new e({type:`unknown`})}function Ws(e,t){return new e({type:`never`,...H(t)})}function Gs(e,t){return new Na({check:`less_than`,...H(t),value:e,inclusive:!1})}function Ks(e,t){return new Na({check:`less_than`,...H(t),value:e,inclusive:!0})}function qs(e,t){return new Pa({check:`greater_than`,...H(t),value:e,inclusive:!1})}function Js(e,t){return new Pa({check:`greater_than`,...H(t),value:e,inclusive:!0})}function Ys(e,t){return new Fa({check:`multiple_of`,...H(t),value:e})}function Xs(e,t){return new La({check:`max_length`,...H(t),maximum:e})}function Zs(e,t){return new Ra({check:`min_length`,...H(t),minimum:e})}function Qs(e,t){return new za({check:`length_equals`,...H(t),length:e})}function $s(e,t){return new Va({check:`string_format`,format:`regex`,...H(t),pattern:e})}function ec(e){return new Ha({check:`string_format`,format:`lowercase`,...H(e)})}function tc(e){return new Ua({check:`string_format`,format:`uppercase`,...H(e)})}function nc(e,t){return new Wa({check:`string_format`,format:`includes`,...H(t),includes:e})}function rc(e,t){return new Ga({check:`string_format`,format:`starts_with`,...H(t),prefix:e})}function ic(e,t){return new Ka({check:`string_format`,format:`ends_with`,...H(t),suffix:e})}function ac(e){return new qa({check:`overwrite`,tx:e})}function oc(e){return ac(t=>t.normalize(e))}function sc(){return ac(e=>e.trim())}function cc(){return ac(e=>e.toLowerCase())}function lc(){return ac(e=>e.toUpperCase())}function uc(){return ac(e=>di(e))}function dc(e,t,n){return new e({type:`array`,element:t,...H(n)})}function fc(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...H(n)})}function pc(e,t){let n=mc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Pi(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Pi(r))}},e(t.value,t)),t);return n}function mc(e,t){let n=new ja({check:`custom`,...H(t)});return n._zod.check=e,n}function hc(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??fs,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function gc(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,gc(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&yc(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function _c(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
94
-
95
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function vc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:xc(t,`input`,e.processors),output:xc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function yc(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return yc(r.element,n);if(r.type===`set`)return yc(r.valueType,n);if(r.type===`lazy`)return yc(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return yc(r.innerType,n);if(r.type===`intersection`)return yc(r.left,n)||yc(r.right,n);if(r.type===`record`||r.type===`map`)return yc(r.keyType,n)||yc(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:yc(r.in,n)||yc(r.out,n);if(r.type===`object`){for(let e in r.shape)if(yc(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(yc(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(yc(e,n))return!0;return!!(r.rest&&yc(r.rest,n))}return!1}var bc=(e,t={})=>n=>{let r=hc({...n,processors:t});return gc(e,r),_c(r,e),vc(r,e)},xc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=hc({...i??{},target:a,io:t,processors:n});return gc(e,o),_c(o,e),vc(o,e)},Sc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Cc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Sc[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},wc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Tc=(e,t,n,r)=>{n.type=`boolean`},Ec=(e,t,n,r)=>{n.not={}},Dc=(e,t,n,r)=>{let i=e._zod.def,a=ti(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Oc=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},kc=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ac=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},jc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=gc(a.element,t,{...r,path:[...r.path,`items`]})},Mc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=gc(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=gc(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Nc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>gc(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Pc=(e,t,n,r)=>{let i=e._zod.def,a=gc(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=gc(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Fc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=gc(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=gc(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=gc(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ic=(e,t,n,r)=>{let i=e._zod.def,a=gc(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Lc=(e,t,n,r)=>{let i=e._zod.def;gc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Rc=(e,t,n,r)=>{let i=e._zod.def;gc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},zc=(e,t,n,r)=>{let i=e._zod.def;gc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Bc=(e,t,n,r)=>{let i=e._zod.def;gc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Vc=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;gc(o,t,r);let s=t.seen.get(e);s.ref=o},Hc=(e,t,n,r)=>{let i=e._zod.def;gc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Uc=(e,t,n,r)=>{let i=e._zod.def;gc(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wc=B(`ZodISODateTime`,(e,t)=>{lo.init(e,t),G.init(e,t)});function Gc(e){return Is(Wc,e)}var Kc=B(`ZodISODate`,(e,t)=>{uo.init(e,t),G.init(e,t)});function qc(e){return Ls(Kc,e)}var Jc=B(`ZodISOTime`,(e,t)=>{fo.init(e,t),G.init(e,t)});function Yc(e){return Rs(Jc,e)}var Xc=B(`ZodISODuration`,(e,t)=>{po.init(e,t),G.init(e,t)});function Zc(e){return zs(Xc,e)}var Qc=B(`ZodError`,(e,t)=>{Ii.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>zi(e,t)},flatten:{value:t=>Ri(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ni,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ni,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),$c=Bi(Qc),el=Vi(Qc),tl=Hi(Qc),nl=Wi(Qc),rl=Ki(Qc),il=qi(Qc),al=Ji(Qc),ol=Yi(Qc),sl=Xi(Qc),cl=Zi(Qc),ll=Qi(Qc),ul=$i(Qc),dl=new WeakMap;function fl(e,t,n){let r=Object.getPrototypeOf(e),i=dl.get(r);if(i||(i=new Set,dl.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var pl=B(`ZodType`,(e,t)=>(Xa.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:xc(e,`input`),output:xc(e,`output`)}}),e.toJSONSchema=bc(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>$c(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>tl(e,t,n),e.parseAsync=async(t,n)=>el(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>nl(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>rl(e,t,n),e.decode=(t,n)=>il(e,t,n),e.encodeAsync=async(t,n)=>al(e,t,n),e.decodeAsync=async(t,n)=>ol(e,t,n),e.safeEncode=(t,n)=>sl(e,t,n),e.safeDecode=(t,n)=>cl(e,t,n),e.safeEncodeAsync=async(t,n)=>ll(e,t,n),e.safeDecodeAsync=async(t,n)=>ul(e,t,n),fl(e,`ZodType`,{check(...e){let t=this.def;return this.clone(li(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return yi(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Tu(e,t))},superRefine(e,t){return this.check(Eu(e,t))},overwrite(e){return this.check(ac(e))},optional(){return su(this)},exactOptional(){return lu(this)},nullable(){return du(this)},nullish(){return su(du(this))},nonoptional(e){return _u(this,e)},array(){return Ul(this)},or(e){return ql([this,e])},and(e){return Zl(this,e)},transform(e){return xu(this,au(e))},default(e){return pu(this,e)},prefault(e){return hu(this,e)},catch(e){return yu(this,e)},pipe(e){return xu(this,e)},readonly(){return Cu(this)},describe(e){let t=this.clone();return fs.add(t,{description:e}),t},meta(...e){if(e.length===0)return fs.get(this);let t=this.clone();return fs.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return fs.get(e)?.description},configurable:!0}),e)),ml=B(`_ZodString`,(e,t)=>{Za.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cc(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,fl(e,`_ZodString`,{regex(...e){return this.check($s(...e))},includes(...e){return this.check(nc(...e))},startsWith(...e){return this.check(rc(...e))},endsWith(...e){return this.check(ic(...e))},min(...e){return this.check(Zs(...e))},max(...e){return this.check(Xs(...e))},length(...e){return this.check(Qs(...e))},nonempty(...e){return this.check(Zs(1,...e))},lowercase(e){return this.check(ec(e))},uppercase(e){return this.check(tc(e))},trim(){return this.check(sc())},normalize(...e){return this.check(oc(...e))},toLowerCase(){return this.check(cc())},toUpperCase(){return this.check(lc())},slugify(){return this.check(uc())}})}),hl=B(`ZodString`,(e,t)=>{Za.init(e,t),ml.init(e,t),e.email=t=>e.check(ms(_l,t)),e.url=t=>e.check(bs(bl,t)),e.jwt=t=>e.check(Fs(Fl,t)),e.emoji=t=>e.check(xs(xl,t)),e.guid=t=>e.check(hs(vl,t)),e.uuid=t=>e.check(gs(yl,t)),e.uuidv4=t=>e.check(_s(yl,t)),e.uuidv6=t=>e.check(vs(yl,t)),e.uuidv7=t=>e.check(ys(yl,t)),e.nanoid=t=>e.check(Ss(Sl,t)),e.guid=t=>e.check(hs(vl,t)),e.cuid=t=>e.check(Cs(Cl,t)),e.cuid2=t=>e.check(ws(wl,t)),e.ulid=t=>e.check(Ts(Tl,t)),e.base64=t=>e.check(Ms(Ml,t)),e.base64url=t=>e.check(Ns(Nl,t)),e.xid=t=>e.check(Es(El,t)),e.ksuid=t=>e.check(Ds(Dl,t)),e.ipv4=t=>e.check(Os(Ol,t)),e.ipv6=t=>e.check(ks(kl,t)),e.cidrv4=t=>e.check(As(Al,t)),e.cidrv6=t=>e.check(js(jl,t)),e.e164=t=>e.check(Ps(Pl,t)),e.datetime=t=>e.check(Gc(t)),e.date=t=>e.check(qc(t)),e.time=t=>e.check(Yc(t)),e.duration=t=>e.check(Zc(t))});function gl(e){return ps(hl,e)}var G=B(`ZodStringFormat`,(e,t)=>{Qa.init(e,t),ml.init(e,t)}),_l=B(`ZodEmail`,(e,t)=>{to.init(e,t),G.init(e,t)}),vl=B(`ZodGUID`,(e,t)=>{$a.init(e,t),G.init(e,t)}),yl=B(`ZodUUID`,(e,t)=>{eo.init(e,t),G.init(e,t)}),bl=B(`ZodURL`,(e,t)=>{no.init(e,t),G.init(e,t)}),xl=B(`ZodEmoji`,(e,t)=>{ro.init(e,t),G.init(e,t)}),Sl=B(`ZodNanoID`,(e,t)=>{io.init(e,t),G.init(e,t)}),Cl=B(`ZodCUID`,(e,t)=>{ao.init(e,t),G.init(e,t)}),wl=B(`ZodCUID2`,(e,t)=>{oo.init(e,t),G.init(e,t)}),Tl=B(`ZodULID`,(e,t)=>{so.init(e,t),G.init(e,t)}),El=B(`ZodXID`,(e,t)=>{co.init(e,t),G.init(e,t)}),Dl=B(`ZodKSUID`,(e,t)=>{W.init(e,t),G.init(e,t)}),Ol=B(`ZodIPv4`,(e,t)=>{mo.init(e,t),G.init(e,t)}),kl=B(`ZodIPv6`,(e,t)=>{ho.init(e,t),G.init(e,t)}),Al=B(`ZodCIDRv4`,(e,t)=>{go.init(e,t),G.init(e,t)}),jl=B(`ZodCIDRv6`,(e,t)=>{_o.init(e,t),G.init(e,t)}),Ml=B(`ZodBase64`,(e,t)=>{yo.init(e,t),G.init(e,t)}),Nl=B(`ZodBase64URL`,(e,t)=>{xo.init(e,t),G.init(e,t)}),Pl=B(`ZodE164`,(e,t)=>{So.init(e,t),G.init(e,t)}),Fl=B(`ZodJWT`,(e,t)=>{wo.init(e,t),G.init(e,t)}),Il=B(`ZodNumber`,(e,t)=>{To.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wc(e,t,n,r),fl(e,`ZodNumber`,{gt(e,t){return this.check(qs(e,t))},gte(e,t){return this.check(Js(e,t))},min(e,t){return this.check(Js(e,t))},lt(e,t){return this.check(Gs(e,t))},lte(e,t){return this.check(Ks(e,t))},max(e,t){return this.check(Ks(e,t))},int(e){return this.check(K(e))},safe(e){return this.check(K(e))},positive(e){return this.check(qs(0,e))},nonnegative(e){return this.check(Js(0,e))},negative(e){return this.check(Gs(0,e))},nonpositive(e){return this.check(Ks(0,e))},multipleOf(e,t){return this.check(Ys(e,t))},step(e,t){return this.check(Ys(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ll(e){return Bs(Il,e)}var Rl=B(`ZodNumberFormat`,(e,t)=>{Eo.init(e,t),Il.init(e,t)});function K(e){return Vs(Rl,e)}var zl=B(`ZodBoolean`,(e,t)=>{Do.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tc(e,t,n,r)});function q(e){return Hs(zl,e)}var J=B(`ZodUnknown`,(e,t)=>{Oo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Y(){return Us(J)}var Bl=B(`ZodNever`,(e,t)=>{ko.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ec(e,t,n,r)});function Vl(e){return Ws(Bl,e)}var Hl=B(`ZodArray`,(e,t)=>{jo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jc(e,t,n,r),e.element=t.element,fl(e,`ZodArray`,{min(e,t){return this.check(Zs(e,t))},nonempty(e){return this.check(Zs(1,e))},max(e,t){return this.check(Xs(e,t))},length(e,t){return this.check(Qs(e,t))},unwrap(){return this.element}})});function Ul(e,t){return dc(Hl,e,t)}var Wl=B(`ZodObject`,(e,t)=>{Io.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mc(e,t,n,r),V(e,`shape`,()=>t.shape),fl(e,`ZodObject`,{keyof(){return tu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Y()})},loose(){return this.clone({...this._zod.def,catchall:Y()})},strict(){return this.clone({...this._zod.def,catchall:Vl()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return wi(this,e)},safeExtend(e){return Ti(this,e)},merge(e){return Ei(this,e)},pick(e){return Si(this,e)},omit(e){return Ci(this,e)},partial(...e){return Di(ou,this,e[0])},required(...e){return Oi(gu,this,e[0])}})});function Gl(e,t){return new Wl({type:`object`,shape:e??{},...H(t)})}var Kl=B(`ZodUnion`,(e,t)=>{Ro.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nc(e,t,n,r),e.options=t.options});function ql(e,t){return new Kl({type:`union`,options:e,...H(t)})}var Jl=B(`ZodDiscriminatedUnion`,(e,t)=>{Kl.init(e,t),zo.init(e,t)});function Yl(e,t,n){return new Jl({type:`union`,options:t,discriminator:e,...H(n)})}var Xl=B(`ZodIntersection`,(e,t)=>{Bo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pc(e,t,n,r)});function Zl(e,t){return new Xl({type:`intersection`,left:e,right:t})}var Ql=B(`ZodRecord`,(e,t)=>{Uo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function $l(e,t,n){return!t||!t._zod?new Ql({type:`record`,keyType:gl(),valueType:e,...H(t)}):new Ql({type:`record`,keyType:e,valueType:t,...H(n)})}var eu=B(`ZodEnum`,(e,t)=>{Wo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dc(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new eu({...t,checks:[],...H(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new eu({...t,checks:[],...H(r),entries:i})}});function tu(e,t){return new eu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...H(t)})}var nu=B(`ZodLiteral`,(e,t)=>{Go.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oc(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ru(e,t){return new nu({type:`literal`,values:Array.isArray(e)?e:[e],...H(t)})}var iu=B(`ZodTransform`,(e,t)=>{Ko.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ac(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Qr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Pi(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Pi(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function au(e){return new iu({type:`transform`,transform:e})}var ou=B(`ZodOptional`,(e,t)=>{Jo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function su(e){return new ou({type:`optional`,innerType:e})}var cu=B(`ZodExactOptional`,(e,t)=>{Yo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lu(e){return new cu({type:`optional`,innerType:e})}var uu=B(`ZodNullable`,(e,t)=>{Xo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ic(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function du(e){return new uu({type:`nullable`,innerType:e})}var fu=B(`ZodDefault`,(e,t)=>{Zo.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pu(e,t){return new fu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():gi(t)}})}var mu=B(`ZodPrefault`,(e,t)=>{$o.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hu(e,t){return new mu({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():gi(t)}})}var gu=B(`ZodNonOptional`,(e,t)=>{es.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _u(e,t){return new gu({type:`nonoptional`,innerType:e,...H(t)})}var vu=B(`ZodCatch`,(e,t)=>{ns.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yu(e,t){return new vu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var bu=B(`ZodPipe`,(e,t)=>{rs.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.in=t.in,e.out=t.out});function xu(e,t){return new bu({type:`pipe`,in:e,out:t})}var Su=B(`ZodReadonly`,(e,t)=>{as.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cu(e){return new Su({type:`readonly`,innerType:e})}var wu=B(`ZodCustom`,(e,t)=>{ss.init(e,t),pl.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kc(e,t,n,r)});function Tu(e,t={}){return fc(wu,e,t)}function Eu(e,t){return pc(e,t)}var Du={Output:1,Replay:2,Input:3,Snapshot:4},Ou=e=>{let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.byteLength<16)throw Error(`Terminal binary frame is too short`);let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r={version:n.getUint8(0),type:n.getUint8(1),flags:n.getUint16(2),meta:n.getUint32(4),streamId:n.getUint32(8),payloadSize:n.getUint32(12)},i=t.subarray(16);if(i.byteLength!==r.payloadSize)throw Error(`Terminal binary frame payload length mismatch`);return{header:r,payload:i}},ku=e=>{let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t.byteLength<16)throw Error(`Terminal output frame is too short`);let n=new DataView(t.buffer,t.byteOffset,t.byteLength),r=n.getUint8(0);if(r!==2)throw Error(`Expected output frame version 2, got ${r}`);let i=n.getUint16(2,!1),a=n.getUint32(4,!1),o=n.getUint32(8,!1),s=n.getUint32(12,!1);if(t.byteLength<16+i)throw Error(`Terminal output frame topic is truncated`);let c=new TextDecoder().decode(t.subarray(16,16+i)),l=t.subarray(16+i);if(l.byteLength!==s)throw Error(`Terminal output frame payload length mismatch`);return{topic:c,seq:a,streamId:o,payload:l}},Au=Gl({kind:ru(`command`),id:gl().uuid(),op:gl(),args:Y()}),ju=Gl({kind:ru(`result`),id:gl().uuid(),ok:q(),data:Y().optional(),error:Gl({code:gl(),message:gl(),details:Y().optional()}).optional()}),Mu=Gl({kind:ru(`event`),topic:gl(),seq:Ll().int().nonnegative(),timestamp:Ll().int().positive(),data:Y()});Yl(`kind`,[Au,Gl({kind:ru(`subscribe`),topics:Ul(gl())}),Gl({kind:ru(`unsubscribe`),topics:Ul(gl())}),Gl({kind:ru(`resync`),lastSeen:$l(gl(),Ll())})]),Yl(`kind`,[ju,Mu]);var Nu={connectionStatus:`connection.status`,connectionReady:`connection.ready`,workspaceMeta:e=>`workspace.${e}.meta`,workspaceFsDirty:e=>`workspace.${e}.fs.dirty`,workspaceGitState:e=>`workspace.${e}.git.state`,workspaceAll:e=>`workspace.${e}.*`,sessionState:(e,t)=>`workspace.${e}.session.${t}.state`,sessionLifecycle:(e,t)=>`workspace.${e}.session.${t}.lifecycle`,sessionProgress:(e,t)=>`workspace.${e}.session.${t}.progress`,sessionsAll:e=>`workspace.${e}.session.*`,terminalCreated:(e,t)=>`workspace.${e}.terminal.${t}.created`,terminalOutput:(e,t)=>`workspace.${e}.terminal.${t}.output`,terminalExit:(e,t)=>`workspace.${e}.terminal.${t}.exit`,terminalsAll:e=>`workspace.${e}.terminal.*`,notificationToast:`notification.toast`,supervisorState:(e,t)=>`workspace.${e}.session.${t}.supervisor.state`,supervisorCycle:(e,t)=>`workspace.${e}.session.${t}.supervisor.cycle`};function Pu(e,t){if(e===t||e===`*`)return!0;let n=e.split(`.`),r=t.split(`.`);for(let e=0;e<n.length;e++){let t=n[e];if(t===`*`){if(e===n.length-1)return!0;continue}if(e>=r.length||t!==r[e])return!1}return n.length<=r.length}var Fu=class extends Error{constructor(e){super(e.message),this.name=`CommandResultError`,this.code=e.code,this.details=e.details}},Iu={maxAttempts:30,baseDelayMs:1e3,maxDelayMs:3e4},Lu=3e4,Ru=()=>{if(typeof globalThis.crypto?.randomUUID==`function`)return globalThis.crypto.randomUUID();let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return[t.slice(0,8),t.slice(8,12),t.slice(12,16),t.slice(16,20),t.slice(20)].join(`-`)},zu=class{constructor(e,t={}){this.ws=null,this.connectDeferred=null,this.pendingCommands=new Map,this.eventListeners=new Map,this.statusListeners=new Set,this.lastSeenSeq=new Map,this.pendingBinaryStreamIds=new Map,this.orphanBinaryPayloads=new Map,this.nextTerminalInputStreamId=1,this.reconnectAttempts=0,this.reconnectTimer=null,this.isManualClose=!1,this.status=`disconnected`,this.url=e,this.reconnectConfig={...Iu,...t}}async connect(){if(this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`)return Promise.resolve();if(this.connectDeferred)return this.connectDeferred.promise;this.isManualClose=!1,this.setStatus(`connecting`);let e,t,n=new Promise((n,r)=>{e=n,t=r});this.connectDeferred={promise:n,resolve:e,reject:t};try{let e=new WebSocket(this.url);this.ws=e,e.binaryType=`arraybuffer`,e.onopen=()=>{if(this.ws!==e)return;this.setStatus(`connected`),this.reconnectAttempts=0;let t=Array.from(this.eventListeners.keys());if(t.length>0){let n={kind:`subscribe`,topics:t};e.send(JSON.stringify(n))}this.lastSeenSeq.size>0&&this.resync(),this.resolveConnectDeferred()},e.onmessage=t=>{if(this.ws===e)try{if(typeof t.data==`string`){let e=JSON.parse(t.data);this.handleMessage(e);return}if(t.data instanceof ArrayBuffer){this.handleBinaryMessage(new Uint8Array(t.data));return}console.error(`Unsupported WebSocket message type:`,typeof t.data)}catch(e){console.error(`Failed to parse WebSocket message:`,e)}},e.onclose=t=>{this.ws===e&&(this.handleClose(t.code,t.reason),this.rejectConnectDeferred(Error(`WebSocket closed: ${t.reason||t.code}`)))},e.onerror=t=>{this.ws===e&&console.error(`WebSocket error:`,t)}}catch(e){this.rejectConnectDeferred(e instanceof Error?e:Error(String(e)))}return n}disconnect(e){this.isManualClose=!0,this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.rejectConnectDeferred(Error(`WebSocket disconnected`)),this.rejectPendingCommands(Error(`WebSocket disconnected`)),this.clearBinaryCommandState(),this.ws&&=(this.ws.close(1e3,e||`client_disconnect`),null),this.setStatus(`disconnected`)}recoverConnection(e=`manual_retry`){let t=this.getStatus();t===`connected`||t===`connecting`||t===`rejected`||(this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null),this.reconnectAttempts=0,console.log(`[WsClient] Recovering connection after ${e}`),this.connect().catch(e=>{console.error(`Recovery connect failed:`,e)}))}async sendCommand(e,t,n={}){return new Promise((r,i)=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){i(Error(`WebSocket not connected`));return}let a=Ru(),o=n.timeoutMs??Lu,s=setTimeout(()=>{this.cleanupTimedOutBinaryCommand(a),this.pendingCommands.delete(a),i(Error(`Command timeout: ${e}`))},o);this.pendingCommands.set(a,{resolve:r,reject:i,timeoutId:s});let c={kind:`command`,id:a,op:e,args:t};this.ws.send(JSON.stringify(c))})}async sendTerminalInput(e,t,n,r){return new Promise((i,a)=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){a(Error(`WebSocket not connected`));return}let o=Ru(),s=this.allocateTerminalInputStreamId(),c=setTimeout(()=>{this.cleanupTimedOutBinaryCommand(o),this.pendingCommands.delete(o),a(Error(`Command timeout: terminal.input`))},Lu);this.pendingCommands.set(o,{resolve:i,reject:a,timeoutId:c});let l={kind:`command`,id:o,op:`terminal.input`,args:{terminalId:e,transport:`binary`,streamId:s,size:t.byteLength,activity:n,submittedText:r}};this.ws.send(JSON.stringify(l)),this.ws.send(t)})}subscribe(e,t){let n=[];for(let r of e)this.eventListeners.has(r)||(this.eventListeners.set(r,new Set),n.push(r)),this.eventListeners.get(r).add(t);if(n.length>0&&this.ws&&this.ws.readyState===WebSocket.OPEN){let e={kind:`subscribe`,topics:n};this.ws.send(JSON.stringify(e))}return()=>{let n=[];for(let r of e){let e=this.eventListeners.get(r);e&&(e.delete(t),e.size===0&&(this.eventListeners.delete(r),n.push(r)))}if(n.length>0&&this.ws&&this.ws.readyState===WebSocket.OPEN){let e={kind:`unsubscribe`,topics:n};this.ws.send(JSON.stringify(e))}}}onStatus(e){return this.statusListeners.add(e),()=>this.statusListeners.delete(e)}getStatus(){return this.status}handleMessage(e){if(e.kind===`result`){let t=this.pendingCommands.get(e.id);if(t){if(e.ok&&this.isTerminalBinaryCommandResult(e.data)){let n=this.getExpectedFrameType(e.data),r=this.orphanBinaryPayloads.get(e.data.streamId);if(r){if(this.orphanBinaryPayloads.delete(e.data.streamId),clearTimeout(r.timeoutId),r.frameType===n){clearTimeout(t.timeoutId),this.pendingCommands.delete(e.id),t.resolve({...e.data,bytes:r.bytes});return}console.warn(`Discarding terminal binary frame with unexpected type`,{streamId:e.data.streamId,expectedFrameType:n,actualFrameType:r.frameType})}t.terminalBinary=e.data,t.binaryStreamId=e.data.streamId,this.pendingBinaryStreamIds.set(e.data.streamId,{commandId:e.id,expectedFrameType:n});return}clearTimeout(t.timeoutId),this.pendingCommands.delete(e.id),e.ok?t.resolve(e.data):t.reject(new Fu({code:e.error?.code??`command_failed`,message:e.error?.message??`Command failed`,details:e.error?.details}))}}else e.kind===`event`&&(this.lastSeenSeq.set(e.topic,e.seq),this.notifyEventListeners(e.topic,e.data,e.seq))}handleBinaryMessage(e){if(e.length===0)return;if(e[0]===2){let t=ku(e);this.notifyEventListeners(t.topic,{transport:`binary`,streamId:t.streamId,size:t.payload.byteLength,bytes:t.payload},t.seq);return}let{header:t,payload:n}=Ou(e),r=this.pendingBinaryStreamIds.get(t.streamId);if(!r){let e=this.orphanBinaryPayloads.get(t.streamId);e&&clearTimeout(e.timeoutId),this.orphanBinaryPayloads.set(t.streamId,{frameType:t.type,bytes:n,timeoutId:setTimeout(()=>{this.orphanBinaryPayloads.delete(t.streamId)},Lu)});return}if(t.type!==r.expectedFrameType){console.warn(`Discarding terminal binary frame with unexpected type`,{streamId:t.streamId,expectedFrameType:r.expectedFrameType,actualFrameType:t.type});return}this.pendingBinaryStreamIds.delete(t.streamId);let i=this.pendingCommands.get(r.commandId);i?.terminalBinary&&(clearTimeout(i.timeoutId),this.pendingCommands.delete(r.commandId),i.resolve({...i.terminalBinary,bytes:n}))}notifyEventListeners(e,t,n){for(let[r,i]of this.eventListeners.entries())if(Pu(r,e))for(let r of i)try{r(e,t,n)}catch(t){console.error(`Error in event listener for ${e}:`,t)}}isTerminalBinaryCommandResult(e){return typeof e==`object`&&!!e&&`status`in e&&`transport`in e&&`streamId`in e&&`size`in e&&e.status===`ok`&&e.transport===`binary`}getExpectedFrameType(e){return`source`in e?Du.Snapshot:Du.Replay}cleanupTimedOutBinaryCommand(e){let t=this.pendingCommands.get(e)?.binaryStreamId;if(t==null)return;this.pendingBinaryStreamIds.delete(t);let n=this.orphanBinaryPayloads.get(t);n&&(clearTimeout(n.timeoutId),this.orphanBinaryPayloads.delete(t))}clearBinaryCommandState(){this.pendingBinaryStreamIds.clear();for(let e of this.orphanBinaryPayloads.values())clearTimeout(e.timeoutId);this.orphanBinaryPayloads.clear()}resolveConnectDeferred(){let e=this.connectDeferred;e&&(this.connectDeferred=null,e.resolve())}rejectConnectDeferred(e){let t=this.connectDeferred;t&&(this.connectDeferred=null,t.reject(e))}rejectPendingCommands(e){for(let[t,n]of this.pendingCommands)clearTimeout(n.timeoutId),n.reject(e),this.pendingCommands.delete(t)}allocateTerminalInputStreamId(){let e=this.nextTerminalInputStreamId;return this.nextTerminalInputStreamId+=1,e}handleClose(e,t){if(this.ws=null,this.rejectPendingCommands(Error(`WebSocket disconnected`)),this.clearBinaryCommandState(),e===4001||e===4002){this.setStatus(`rejected`);return}this.isManualClose||this.scheduleReconnect()}scheduleReconnect(){if(this.reconnectAttempts>=this.reconnectConfig.maxAttempts){console.error(`Max reconnect attempts reached`),this.setStatus(`disconnected`);return}this.setStatus(`reconnecting`);let e=Math.min(this.reconnectConfig.baseDelayMs*2**this.reconnectAttempts,this.reconnectConfig.maxDelayMs);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect().catch(e=>{console.error(`Reconnect failed:`,e)})},e)}resync(){if(!this.ws||this.ws.readyState!==WebSocket.OPEN||this.lastSeenSeq.size===0)return;let e={kind:`resync`,lastSeen:Object.fromEntries(this.lastSeenSeq)};this.ws.send(JSON.stringify(e))}setStatus(e){this.status=e;for(let t of this.statusListeners)try{t(e)}catch(e){console.error(`Error in status listener:`,e)}}};function Bu(){return typeof window>`u`?`ws://127.0.0.1:4173/ws`:`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/ws`}var Vu=I(null),Hu=I(`connecting`),Uu=I(null),Wu=I(!1),Gu=I(null),Ku=I(0),qu=I(null),Ju=I(null),Yu=I(e=>{let t=e(Vu);return async(e,n,r)=>{if(!t)return{ok:!1,error:{code:`no_client`,message:`WebSocket client not initialized`}};try{return{ok:!0,data:await t.sendCommand(e,n,r)}}catch(e){return e instanceof Fu?{ok:!1,error:{code:e.code,message:e.message,details:e.details}}:{ok:!1,error:{code:`command_error`,message:e instanceof Error?e.message:`Unknown error`}}}}});I(`tab_${Date.now()}_${Math.random().toString(36).substring(2,9)}`);var Xu=I(new Map);I(e=>t=>e(Xu).get(t)?.isController??!1),I(e=>t=>e(Xu).get(t)?.reason),I(e=>{let t=e(Xu);for(let e of t.values())if(!e.isController)return!0;return!1});function Zu(e,t){let n=null,r=new Map,i=new Set;function a(i){let s;if(t===void 0)s=r.get(i);else for(let[e,n]of r)if(t(e,i)){s=n;break}if(s!==void 0)if(n?.(s[1],i))a.remove(i);else return s[0];let c=e(i);return r.set(i,[c,Date.now()]),o(`CREATE`,i,c),c}function o(e,t,n){for(let r of i)r({type:e,param:t,atom:n})}return a.unstable_listen=e=>(i.add(e),()=>{i.delete(e)}),a.getParams=()=>r.keys(),a.remove=e=>{if(t===void 0){if(!r.has(e))return;let[t]=r.get(e);r.delete(e),o(`REMOVE`,e,t)}else for(let[n,[i]]of r)if(t(n,e)){r.delete(n),o(`REMOVE`,n,i);break}},a.setShouldRemove=e=>{if(n=e,n)for(let[e,[t,i]]of r)n(i,e)&&(r.delete(e),o(`REMOVE`,e,t))},a}var Qu=I(null),$u=I({}),ed=I([]),td=I(`idle`),nd=I(null),rd=Zu(e=>I(t=>t($u)[e])),id=I(e=>{let t=e(ed),n=e($u),r=new Set(Object.keys(n)),i=t.filter(e=>r.has(e)),a=new Set(i),o=Object.keys(n).filter(e=>!a.has(e));return[...i,...o]}),ad=I(e=>e(id).map(t=>e(rd(t))).filter(e=>!!e)),od=I(e=>{if(e(td)!==`ready`)return null;let t=e(Qu),n=e($u);return t&&n[t]?t:e(id)[0]??null}),sd=I(e=>{let t=e(od);return t?e(rd(t)):null}),cd=I({}),ld=Zu(e=>I(t=>{let n=t(cd);return Object.values(n).filter(t=>t.workspaceId===e)})),ud=Zu(e=>I(t=>t(cd)[e]));I(e=>{let t=e(Qu);return t?e(ld(t)).find(e=>e.state===`running`||e.state===`idle`)??null:null}),Zu(e=>I(t=>{let n=t(ld(e)),r={draft:0,starting:0,running:0,idle:0,ended:0};for(let e of n)r[e.state]++;return r}));var dd={app:{name:`Coder Studio`,description:`Agent-First Development Environment`},common:{loading:`Loading...`,error:`Error`,success:`Success`,warning:`Warning`,info:`Info`,confirm:`Confirm`,cancel:`Cancel`,save:`Save`,delete:`Delete`,edit:`Edit`,view:`View`,close:`Close`,yes:`Yes`,no:`No`,ok:`OK`,all:`All`},action:{open:`Open`,open_workspace:`Open Workspace`,close_workspace:`Close Workspace`,create_session:`Create Session`,stop_session:`Stop Session`,resume_session:`Resume Session`,save_file:`Save File`,save_all:`Save All`,save:`Save`,discard_changes:`Discard Changes`,commit:`Commit`,push:`Push`,pull:`Pull`,refresh:`Refresh`,settings:`Settings`,cancel:`Cancel`,confirm:`Confirm`,close:`Close`,apply:`Apply`,reset:`Reset`,search:`Search`,search_files:`Search Files`,search_commands:`Search Commands`,back:`Back`},label:{workspace:`Workspace`,agent:`Agent`,session:`Session`,terminal:`Terminal`,file:`File`,git:`Git`,settings:`Settings`,provider:`Provider`,status:`Status`,progress:`Progress`},provider:{install:{cta:{start:`Start Session`,install_and_start:`Install & Start`,installing:`Installing...`,manual:`View Install Steps`},status:{installing:`Installing provider CLI...`,failed:`Automatic install failed`},open_docs:`Open official docs`,nodejs:{manual:`Install Node.js from the official download page.`},claude:{manual:`Then run npm install -g @anthropic-ai/claude-code.`},codex:{manual:`Then run npm install -g @openai/codex.`}}},status:{starting:`Starting`,running:`Running`,idle:`Idle`,busy:`Busy`,ended:`Ended`,unavailable:`Unavailable`,connecting:`Connecting`,connected:`Connected`,disconnected:`Disconnected`,reconnecting:`Reconnecting`,rejected:`Rejected`},workspace:{title:`Workspace`,open:`Open`,close:`Close`,path:`Path`,no_workspace:`No workspace open`,open_hint:`Click the button below to open a project directory`,loading_title:`Loading workspaces`,loading_description:`Preparing your workspace list and restoring the last active session.`,load_failed_title:`Failed to load workspaces`,load_failed_description:`Failed to fetch workspace list`,launch:{kicker:`START WORKSPACE`,title:`Open Workspace`,home_directory:`Home Directory`,go_up:`Go Up`,no_directories:`No directories found`,items_count:`{count} items`,enter_folder:`Enter {name}`,enter_folder_action:`Enter folder →`,cancel:`Cancel`,start:`Start Workspace`,starting:`Starting...`,hint:`Select a directory to use as the workspace root.`,browse_failed:`Failed to browse directories`,select_required:`Please select a directory`,open_failed:`Failed to open workspace`},runtime_check:{title:`Runtime Check`,checking:`Checking runtime environment...`,success:`Runtime environment check passed`,failed:`Runtime environment check failed`,missing_git:`Git command not found`,missing_node:`Node.js not found`,missing_provider:`{provider} CLI not found`}},mobile:{dock:{aria_label:`Mobile dock`,open_agent:`Open Agent sheet`,open_files:`Open Files sheet`,open_terminal:`Open Terminal sheet`},agent:{title:`Agent Sessions`,close_current_session:`Close Current Session`,providers:`Session providers`,start_session:`Start {provider} session`,starting:`Starting...`,start_new_session:`Start new session`,active_agents:`Active agents`,switch_to_agent:`Switch to agent {name}`,empty:`No active sessions`},supervisor:{open_sheet:`Open Supervisor sheet`},topbar:{switch_workspace:`Switch workspace`,open_settings:`Open settings`},sheet:{dismiss:`Dismiss current sheet`,region:`{title} sheet`},files:{tabs:`Files sheet tabs`,git_diff:`Git`,editor_fallback:`Editor`},workspace_drawer:{aria_label:`Workspace drawer`,close:`Close workspace drawer`,select_title:`Select workspace`,switch_to_workspace:`Switch to workspace {name}`,close_workspace:`Close workspace {name}`},empty:{start_session:`Start a new agent session for this workspace.`,files_terminal_hint:`Files and Terminal stay available from the bottom bar.`}},session:{title:`Session`,create:`Create Session`,stop:`Stop`,resume:`Resume`,no_session:`No active session`,provider_select:`Select Provider`,state:{starting:`Starting...`,running:`Running`,idle:`Waiting for input`,busy:`Executing`,ended:`Stopped`,unavailable:`Unavailable`},resume_unavailable:`This session cannot be resumed`,progress:{thinking:`Thinking...`,executing:`Executing...`,waiting:`Waiting for response...`}},terminal:{title:`Terminal`,kicker:`TERMINAL`,new_terminal:`New Terminal`,close_terminal:`Close Terminal`,shell:`Shell Terminal`,agent:`Agent Terminal`,reconnect_hint:`Connection lost, reconnecting...`,no_terminal:`No terminals`,empty_hint:`Launch a shell to inspect files, run commands, and verify changes without leaving the workspace.`,load_failed_title:`Could not load terminals`,load_failed_body:`Refresh the workspace connection and try again.`,create_failed_title:`Could not create terminal`,create_failed_body:`The shell process could not be started. Check the server runtime and shell configuration.`,create_unavailable_title:`No workspace selected`,create_unavailable_body:`Open or switch to a workspace before creating a terminal.`,hide:`Hide Terminal`,show:`Show Terminal`,selector:{switch:`Switch terminal`,title:`Terminal Sessions`,current:`Current terminal`,indexed:`Terminal {index}`},mobile_input:{shortcuts:`Terminal shortcut keys`,ctrl:`Ctrl`,ctrl_armed:`Ctrl armed`,ctrl_locked:`Ctrl locked`,shift:`Shift`,shift_armed:`Shift armed`,escape:`Escape`,tab:`Tab`,enter:`Enter`,up:`Up arrow`,down:`Down arrow`,left:`Left arrow`,right:`Right arrow`},replay:{queued_title:`Waiting in queue ({count} ahead)`,up_next:`Up next...`,loading_title:`Restoring terminal output...`,loading_body:`You can keep using this page while history catches up in the background. Larger histories may take longer to restore.`,failed_title:`Terminal history could not be restored`,failed_body:`New output will keep streaming. Refresh manually only if you need the missing history.`,closed_title:`This session has been closed`,closed_body:`Start a new session to continue.`,truncated_title:`Terminal history is partial`,truncated_body:`Older output has already fallen out of the replay buffer, but new output will continue to stream.`}},file:{title:`Files`,modified:`Modified`,unsaved:`Unsaved`,dirty:`Has unsaved changes`,empty_directory:`Empty directory`,new_file:`New File`,new_folder:`New Folder`,rename:`Rename`,delete:`Delete`,delete_confirm:`Are you sure you want to delete "{name}"?`,path:`Path`,path_required:`Enter a path`,invalid_file_path:`File paths cannot end with /`,path_helper_file:`Enter a workspace-relative path, for example src/demo/new-file.ts`,path_helper_folder:`Enter a workspace-relative path, for example src/demo/new-folder`,create_failed:`Failed to create item`,delete_failed:`Failed to delete file`,conflict:`File has been modified externally`,conflict_message:`The file may have been modified outside the editor. Discard local changes and reload?`},code_editor:{saving:`Saving...`,edit_as_text:`Edit as text`,preview_as_image:`Preview as image`,mode_text:`Text`,mode_image:`Image`,open_failed_title:`Failed to open file`,empty_hint:`Select a file on the left to open it in the editor.`,modified_on_disk:`This file changed on disk after you opened it. Save carefully or reload the file.`,deleted_on_disk:`This file was deleted on disk after you opened it.`},git:{title:`Git`,changes:`Changes`,staged:`Staged`,modified:`Modified`,deleted:`Deleted`,unstaged:`Unstaged`,untracked:`Untracked`,no_changes:`No changes`,commit:`Commit`,commit_message:`Commit Message`,commit_placeholder:`Enter commit message...`,latest_commit:`Latest Commit`,no_commits:`No commits yet`,stage:`Stage`,unstage:`Unstage`,stage_all:`Stage All`,unstage_all:`Unstage All`,discard:`Discard`,discard_all:`Discard All`,discard_file_confirm_title:`Discard File Changes`,discard_file_confirm_message:`Are you sure you want to discard changes in "{path}"?`,discard_all_confirm_title:`Discard All Changes`,discard_all_confirm_message:`Are you sure you want to discard changes in {count} files?`,discard_confirm_irreversible:`This action cannot be undone.`,branch:`Branch`,current_branch:`Current Branch`,no_branch:`Not on any branch`,ahead:`{count} commits ahead`,behind:`{count} commits behind`,synced:`Synced with remote`,push_confirm_title:`Push Changes`,push_confirm_message:`Do you want to push {count} local commits to the remote?`,pull_confirm_title:`Pull Changes`,pull_confirm_message:`Do you want to pull {count} remote commits into your local branch?`,sync_confirm_helper:`This action updates your current branch and workspace state.`,push_success_title:`Push completed`,push_success_body:`Local commits were pushed to the remote.`,pull_success_title:`Pull completed`,pull_success_body:`Latest remote commits were pulled into your local branch.`,push_in_progress:`Pushing...`,pull_in_progress:`Pulling...`,push_failed_title:`Push failed`,pull_failed_title:`Pull failed`,operation_push:`push`,operation_pull:`pull`,auth_required_message:`Authentication is required for {remote}.`,auth_failed_invalid:`Credentials for {remote} were rejected. Enter a valid username and password or personal access token to continue.`,auth_failed_forbidden:`Credentials for {remote} were accepted, but this account is not allowed to {operation}.`,auth_failed_unsupported:`Authentication failed for {remote}. Configure SSH keys or a credential helper, then try again.`,auth_helper_http:`Enter your Git username and password or a personal access token to retry this operation.`,auth_helper_unsupported:`This remote does not support in-app authentication. Configure SSH keys or a credential helper, then try again.`,auth_username:`Username`,auth_password:`Password or token`,auth_username_placeholder:`Git username`,auth_password_placeholder:`Password or personal access token`,branch_remote:`Remote`,quick_pick:{search_placeholder:`Search branches or create new branch...`,loading:`Loading branches...`,empty_filtered:`No branches found`,empty_idle:`Type to search branches`,create:`Create branch: {name}`,confirm_create:`Confirm create branch: {name}`},statusbar:{changes:`Uncommitted file changes`,ahead:`Local commits to push`,behind:`Remote commits to pull`}},worktree:{title:`Worktree`,status_tab:`Status`,diff_tab:`Diff`,tree_tab:`Tree`,path:`Path`,branch:`Branch`,changes:`Changes`,loading:`Loading...`,empty_tree:`Empty tree`,clean:`Clean`,dirty:`Dirty`,dirty_status:`Has changes`,staged_count:`Staged: {count}`,modified_count:`Modified: {count}`,untracked_count:`Untracked: {count}`},settings:{title:`Settings`,general:`General`,appearance:`Appearance`,providers:`Providers`,autosave_hint:`Settings saved automatically`,load_failed:`Failed to load settings`,load_failed_unknown:`Server did not return settings data`,notifications:`Notifications`,notifications_channel_hint:`No notification while you are in the originating workspace; an in-app banner if you are in another workspace; a system notification when the window is hidden.`,notifications_enabled:`Enable completion notifications`,notifications_enabled_hint:`Send notification when Agent session completes`,notification_sound:`Notification sound`,notification_sound_hint:`Play a completion chime when a notification fires`,notification_status:`Notification Status`,notification_status_available:`Available`,notification_status_limited:`Limited`,notification_status_limited_hint:`System notifications on this mobile browser are inconsistent; browser permission does not guarantee delivery.`,notification_status_unsupported:`Unsupported`,notification_status_unsupported_hint:`This browser environment does not support this notification path.`,notification_permission:`Notification Permission`,permission_granted:`Granted`,permission_denied:`Denied`,permission_request:`Request Permission`,permission_unavailable:`Unavailable`,permission_limited_hint:`Even with notification permission allowed, this mobile browser may still fail to show system notifications reliably.`,supervisor:{title:`Supervisor`,hint:`Maximum time the supervisor evaluator can run before the server aborts it.`,evaluation_timeout:`Supervisor Evaluation Timeout (seconds)`,validation_error:`Enter a whole number between 1 and {max} seconds.`},terminal_renderer:`Terminal Renderer`,terminal_renderer_hint:`Choose terminal rendering mode`,terminal_standard:`Standard`,terminal_compatibility:`Compatibility Mode`,provider:{title:`Provider Settings`,status:`Status`,capability:`Capability Level`,capability_full:`Full Support`,capability_limited:`Limited Support`,capability_unsupported:`Unsupported`,hooks_registered:`Hooks Registered`,hooks_unregistered:`Hooks Not Registered`,hooks_error:`Hooks Registration Failed`,hooks:`Hooks Integration`,hooks_hint:`Inject Provider-specific hooks into current workspace`,hooks_inject:`Inject Hooks`,configure:`Configure`,reset:`Reset`,config:`Configuration`,base:`Base Settings`,config_file:`Config File`,open_config_file_editor:`Open Config File Editor`,back_to_base:`Back to Base Settings`,startup_args:`Startup Command Args`,startup_args_hint:`Enter one startup argument per line. Each saved line is appended to the provider launch command.`,startup_args_placeholder:`--verbose
96
- --debug`},theme:{title:`Theme`,dark:`Dark`,light:`Light`,system:`System`,hint:`Only dark theme is currently supported`},language:{title:`Language`,zh:`中文`,en:`English`,hint:`Select interface language`},auth:{title:`Authentication`,password:`Password`,password_set:`Set Password`,password_change:`Change Password`,password_remove:`Remove Password`},shortcuts:{title:`Keyboard Shortcuts`,reset_all:`Reset All`,capture_hint:`Press new shortcut combination`,reset_hint:`Reset to default`},config_files:{title:`Config Files`,codex_config:`Codex Config`,claude_config:`Claude Config`,path_label:`Path`,unsaved_changes:`Unsaved changes`,saving:`Saving...`,save_success:`Config saved successfully`,backup_created:`Backup saved to {path}`,save_failed:`Failed to save config`,load_failed:`Failed to load config`,file_not_found:`Config file does not exist. Edit and save to create it.`,status_saved:`Saved`,collapse:`Collapse`,format:`Format`,format_hint:`Format JSON code`,file_not_found_hint:`Edit and save to create the config file.`},permission_denied_hint:`Browser or system notification permission may be blocked. Check site settings and device notification settings.`,permission_unavailable_hint:`This environment cannot request browser notification permission`},auth:{description:`Enter your password to continue to the current workspace.`,hint:`Enter the access password configured for this deployment.`,blocked_until:`Too many attempts. Try again after {time}, or ask an administrator to unblock access.`,blocked_generic:`Too many attempts. Try again later, or ask an administrator to unblock access.`,status_title:`Access verification`,status_loading:`Checking the access state for this deployment.`,status_unavailable:`The authentication service is temporarily unavailable. Please try again shortly.`,status_not_configured:`Authentication is not configured on this deployment.`},connection:{title:`Connection`,status:`Status`,reconnecting:`Reconnecting...`,reconnect_failed:`Reconnection failed`,another_tab:`Another tab is active`,takeover:`Take Control`,server_shutdown:`Server has shut down`,backpressure_warning:`Network congested, some output may be lost`},supervisor:{title:`Supervisor`,empty:`Supervisor is not enabled`,latest_evaluation:`Latest evaluation`,state:{inactive:`Inactive`,idle:`Idle`,evaluating:`Evaluating`,injecting:`Injecting`,paused:`Paused`,error:`Error`},trigger:{manual:`MANUAL`,auto:`AUTO`},cycle:{no_guidance:`No guidance injected this cycle`,evaluating:`Evaluating...`,waiting:`Waiting for evaluation result`},field:{objective:`Objective`,current_objective:`Current objective`,objective_placeholder:`Describe what Supervisor should watch, for example:
97
- - Finish implementing user authentication
98
- - Fix all failing unit tests
99
- - Reduce P95 latency below 100ms`,objective_helper:`The more specific and measurable the target, the better the evaluation. Include completion criteria when possible.`,evaluator:`Evaluator`,evaluator_helper:`The provider that evaluates progress and suggests the next step. It can differ from the execution provider.`},action:{enable:`Enable Supervisor`,enable_objective:`Enable Objective`,edit_objective:`Edit Objective`,disable:`Disable Supervisor`,pause:`Pause`,resume:`Resume`,trigger:`Trigger Evaluation`,pause_failed:`Failed to pause Supervisor`,resume_failed:`Failed to resume Supervisor`,trigger_failed:`Failed to trigger evaluation`},dialog:{enable:{title:`Enable Supervisor`,subtitle:`Describe an objective and Supervisor will evaluate progress and suggest the next step after each turn.`,confirm:`Enable`},edit:{title:`Edit Supervisor`,subtitle:`Adjust the objective or switch evaluators without clearing evaluation history.`,confirm:`Save`},disable:{title:`Disable Supervisor`,subtitle:`Stop automatic evaluation. The current session's supervision cycles will be removed.`,confirm:`Disable`,warning_title:`Disabling stops evaluation cycles`,warning_body:`Supervisor will be removed from the current session and its cycle history will be cleared. You can enable it again later, but previous records cannot be restored.`}}},command:{palette:`Command Palette`,no_results:`No results found`,shortcut:{save:`Save`,save_all:`Save All`,search:`Search`,search_files:`Search Files`,command_palette:`Command Palette`,toggle_focus:`Toggle Focus Mode`,toggle_sidebar:`Toggle Sidebar`,toggle_terminal:`Toggle Terminal Panel`}},notification:{success:`Success`,error:`Error`,warning:`Warning`,info:`Info`,session_turn_completed:`Session turn completed`,file_saved:`File saved`,committed:`Committed`,session_completed_title:`{session} completed`,session_completed_body:`Agent session has finished executing`,session_ended:`Session ended`,session_ended_hint:`The session has stopped running`},error:{unknown:`Unknown error`,network:`Network error`,not_found:`Not found`,permission_denied:`Permission denied`,validation:`Validation failed`,conflict:`Resource conflict`},welcome:{kicker:`GET STARTED`,title:`Welcome to Coder Studio`,description:`A local-first AI coding workbench. Launch AI agent sessions, review generated code, manage Git changes, and run terminals all in one place.`,features:{agent_first:{title:`Agent-first AI coding`,description:`Launch AI sessions that write, test, and deploy code.`},git_tools:{title:`Built-in Git tools`,description:`Stage, commit, and manage branches without leaving the IDE.`},terminals:{title:`Integrated terminals`,description:`Run commands and scripts alongside your AI sessions.`}}},not_found:{kicker:`ROUTE NOT FOUND`,title:`Page not found`,description:`The route you opened does not exist in this workspace shell.`,path_label:`Requested path`,go_home:`Go Home`},confirm:{save_changes:`Save changes?`,discard_changes:`Discard changes?`,delete_file:`Delete this file?`,stop_session:`Stop session?`,close_workspace:`Close workspace?`},placeholder:{search:`Type to search...`,command:`Type a command or shortcut...`,commit_message:`Enter commit message`},tooltip:{focus_mode:`Focus Mode: Hide sidebar and bottom panel`,split_horizontal:`Split panel horizontally`,split_vertical:`Split panel vertically`,close_pane:`Close panel`,new_workspace:`New workspace`,quick_actions:`Quick Actions`,enter_fullscreen:`Enter Fullscreen`,exit_fullscreen:`Exit Fullscreen`,show_terminal:`Show Terminal`,hide_terminal:`Hide Terminal`,show_files:`Show Files`,hide_files:`Hide Files`},time:{just_now:`Just now`,seconds_ago:`{count} seconds ago`,minutes_ago:`{count} minutes ago`,hours_ago:`{count} hours ago`,days_ago:`{count} days ago`},fencing:{observer_mode:`Read-only mode — another tab is the controller`,takeover:`Take over`,takeover_failed:`Takeover failed — controller is still active`},codex_audit:{title:`Codex config conflicts ({count})`,load_failed_title:`Codex config check unavailable`,load_failed_unknown:`Server did not return config audit data`,show_details:`Show details`,collapse:`Collapse`,cleanup_select:`Select entries to clean up`,cleanup_action:`Clean up {count} selected`,cleaning:`Cleaning up...`,cleanup_done:`Cleanup complete`,cleanup_done_with_backup:`Cleanup complete. Backup saved to {path}`,cleanup_noop:`Nothing to clean up`,cleanup_failed:`Cleanup failed`,finding:{toml_notify:`Top-level notify = [...]`,toml_codex_hooks:`[features] codex_hooks = true`}}},fd={app:{name:`Coder Studio`,description:`Agent-First Development Environment`},common:{loading:`加载中...`,error:`错误`,success:`成功`,warning:`警告`,info:`信息`,confirm:`确认`,cancel:`取消`,save:`保存`,delete:`删除`,edit:`编辑`,view:`查看`,close:`关闭`,yes:`是`,no:`否`,ok:`确定`,all:`全部`},action:{open:`打开`,open_workspace:`打开工作区`,close_workspace:`关闭工作区`,create_session:`创建会话`,stop_session:`停止会话`,resume_session:`恢复会话`,save_file:`保存文件`,save_all:`保存全部`,save:`保存`,discard_changes:`放弃更改`,commit:`提交`,push:`推送`,pull:`拉取`,refresh:`刷新`,settings:`设置`,cancel:`取消`,confirm:`确认`,close:`关闭`,apply:`应用`,reset:`重置`,search:`搜索`,search_files:`搜索文件`,search_commands:`搜索命令`,back:`返回`},label:{workspace:`工作区`,agent:`Agent`,session:`会话`,terminal:`终端`,file:`文件`,git:`Git`,settings:`设置`,provider:`Provider`,status:`状态`,progress:`进度`},provider:{install:{cta:{start:`启动会话`,install_and_start:`安装并启动`,installing:`安装中...`,manual:`查看安装步骤`},status:{installing:`正在安装 Provider CLI...`,failed:`自动安装失败`},open_docs:`打开官方文档`,nodejs:{manual:`请先从 Node.js 官方下载页安装 Node.js。`},claude:{manual:`然后执行 npm install -g @anthropic-ai/claude-code。`},codex:{manual:`然后执行 npm install -g @openai/codex。`}}},status:{starting:`启动中`,running:`运行中`,idle:`空闲`,busy:`忙碌`,ended:`已结束`,unavailable:`不可用`,connecting:`连接中`,connected:`已连接`,disconnected:`已断开`,reconnecting:`重连中`,rejected:`被拒绝`},workspace:{title:`工作区`,open:`打开`,close:`关闭`,path:`路径`,no_workspace:`未打开工作区`,open_hint:`点击下方按钮打开一个项目目录`,loading_title:`正在加载工作区`,loading_description:`正在准备工作区列表并恢复上次活跃的会话。`,load_failed_title:`工作区加载失败`,load_failed_description:`获取工作区列表失败`,launch:{kicker:`启动工作区`,title:`打开工作区`,home_directory:`主目录`,go_up:`返回上一级`,no_directories:`未找到目录`,items_count:`{count} 项`,enter_folder:`进入 {name}`,enter_folder_action:`进入文件夹 →`,cancel:`取消`,start:`启动工作区`,starting:`启动中...`,hint:`选择一个目录作为工作区根目录。`,browse_failed:`浏览目录失败`,select_required:`请选择一个目录`,open_failed:`打开工作区失败`},runtime_check:{title:`运行时检查`,checking:`正在检查运行时环境...`,success:`运行时环境检查通过`,failed:`运行时环境检查失败`,missing_git:`未找到 Git 命令`,missing_node:`未找到 Node.js`,missing_provider:`未找到 {provider} CLI`}},mobile:{dock:{aria_label:`移动底栏`,open_agent:`打开 Agent 面板`,open_files:`打开文件面板`,open_terminal:`打开终端面板`},agent:{title:`Agent 会话`,close_current_session:`关闭当前会话`,providers:`会话提供方`,start_session:`启动 {provider} 会话`,starting:`正在启动…`,start_new_session:`启动新会话`,active_agents:`活跃 Agent`,switch_to_agent:`切换到 Agent {name}`,empty:`暂无活跃会话`},supervisor:{open_sheet:`打开 Supervisor 面板`},topbar:{switch_workspace:`切换工作区`,open_settings:`打开设置`},sheet:{dismiss:`关闭当前面板`,region:`{title}面板`},files:{tabs:`文件面板标签`,git_diff:`Git`,editor_fallback:`编辑器`},workspace_drawer:{aria_label:`工作区抽屉`,close:`关闭工作区抽屉`,select_title:`选择工作区`,switch_to_workspace:`切换到工作区 {name}`,close_workspace:`关闭工作区 {name}`},empty:{start_session:`为当前工作区启动一个新的 Agent 会话。`,files_terminal_hint:`文件和终端可继续通过底部栏访问。`}},session:{title:`会话`,create:`创建会话`,stop:`停止`,resume:`恢复`,no_session:`无活跃会话`,provider_select:`选择 Provider`,state:{starting:`启动中...`,running:`运行中`,idle:`等待指令`,busy:`执行中`,ended:`已停止`,unavailable:`不可用`},resume_unavailable:`此会话无法恢复`,progress:{thinking:`正在思考...`,executing:`正在执行...`,waiting:`等待响应...`}},terminal:{title:`终端`,kicker:`TERMINAL`,new_terminal:`新建终端`,close_terminal:`关闭终端`,shell:`Shell 终端`,agent:`Agent 终端`,reconnect_hint:`连接已断开,正在重连...`,no_terminal:`暂无终端`,empty_hint:`启动一个 Shell 来查看文件、运行命令,并在不离开工作区的情况下验证更改。`,load_failed_title:`加载终端失败`,load_failed_body:`请刷新工作区连接后重试。`,create_failed_title:`创建终端失败`,create_failed_body:`Shell 进程启动失败,请检查服务端运行环境和 Shell 配置。`,create_unavailable_title:`当前没有已选中的工作区`,create_unavailable_body:`请先打开或切换到一个工作区,再新建终端。`,hide:`隐藏终端`,show:`显示终端`,selector:{switch:`切换终端`,title:`终端会话`,current:`当前终端`,indexed:`终端 {index}`},mobile_input:{shortcuts:`终端快捷按键`,ctrl:`Ctrl`,ctrl_armed:`Ctrl 已待命`,ctrl_locked:`Ctrl 已锁定`,shift:`Shift`,shift_armed:`Shift 已待命`,escape:`Esc`,tab:`Tab`,enter:`Enter`,up:`上方向键`,down:`下方向键`,left:`左方向键`,right:`右方向键`},replay:{queued_title:`等待队列中(前方还有 {count} 个)`,up_next:`即将开始…`,loading_title:`正在恢复终端内容…`,loading_body:`你已经可以继续使用当前页面;历史内容会在后台补上,内容较多时可能需要更久。`,failed_title:`历史内容恢复失败`,failed_body:`新输出仍会继续显示;如果需要完整历史,再手动刷新页面。`,closed_title:`该会话已被关闭`,closed_body:`请重新开启新会话。`,truncated_title:`历史内容不完整`,truncated_body:`较早的终端输出已被回放缓冲区淘汰,后续输出仍会继续显示。`}},file:{title:`文件`,modified:`已修改`,unsaved:`未保存`,dirty:`有未保存更改`,empty_directory:`空文件夹`,new_file:`新建文件`,new_folder:`新建文件夹`,rename:`重命名`,delete:`删除`,delete_confirm:`确定要删除 "{name}" 吗?`,path:`路径`,path_required:`请输入路径`,invalid_file_path:`文件路径不能以 / 结尾`,path_helper_file:`输入工作区内的相对路径,例如 src/demo/new-file.ts`,path_helper_folder:`输入工作区内的相对路径,例如 src/demo/new-folder`,create_failed:`创建失败`,delete_failed:`删除失败`,conflict:`文件已被外部程序修改`,conflict_message:`文件可能已被编辑器外部修改。要放弃本地更改并重新加载吗?`},code_editor:{saving:`保存中...`,edit_as_text:`以文本编辑`,preview_as_image:`以图像预览`,mode_text:`文本`,mode_image:`图像`,open_failed_title:`打开文件失败`,empty_hint:`从左侧选择一个文件以在编辑器中打开。`,modified_on_disk:`该文件在打开后已被磁盘上的其他操作修改。请谨慎保存或重新加载文件。`,deleted_on_disk:`该文件在打开后已被磁盘上的其他操作删除。`},git:{title:`Git`,changes:`更改`,staged:`已暂存`,modified:`已修改`,deleted:`已删除`,unstaged:`未暂存`,untracked:`未跟踪`,no_changes:`无更改`,commit:`提交`,commit_message:`提交信息`,commit_placeholder:`输入提交信息...`,latest_commit:`最新提交`,no_commits:`暂无提交`,stage:`暂存`,unstage:`取消暂存`,stage_all:`暂存全部`,unstage_all:`取消暂存全部`,discard:`放弃`,discard_all:`放弃全部`,discard_file_confirm_title:`放弃文件更改`,discard_file_confirm_message:`确定要放弃 “{path}” 的更改吗?`,discard_all_confirm_title:`放弃所有更改`,discard_all_confirm_message:`确定要放弃 {count} 个文件的更改吗?`,discard_confirm_irreversible:`此操作不可恢复。`,branch:`分支`,current_branch:`当前分支`,no_branch:`不在任何分支上`,ahead:`领先 {count} 个提交`,behind:`落后 {count} 个提交`,synced:`与远程同步`,push_confirm_title:`推送更改`,push_confirm_message:`是否将 {count} 个本地提交推送到远端?`,pull_confirm_title:`拉取更改`,pull_confirm_message:`是否从远端拉取 {count} 个最新提交到本地?`,sync_confirm_helper:`该操作会更新当前分支和工作区状态。`,push_success_title:`推送完成`,push_success_body:`本地提交已推送到远端。`,pull_success_title:`拉取完成`,pull_success_body:`已拉取远端最新提交到当前分支。`,push_in_progress:`推送中...`,pull_in_progress:`拉取中...`,push_failed_title:`推送失败`,pull_failed_title:`拉取失败`,operation_push:`推送`,operation_pull:`拉取`,auth_required_message:`{remote} 需要认证。`,auth_failed_invalid:`{remote} 的凭证被拒绝,请输入有效的用户名和密码或个人访问令牌后重试。`,auth_failed_forbidden:`{remote} 已接受当前凭证,但该账号没有执行 {operation} 的权限。`,auth_failed_unsupported:`{remote} 认证失败。请先配置 SSH key 或 credential helper,再重试。`,auth_helper_http:`请输入 Git 用户名和密码,或个人访问令牌后重试。`,auth_helper_unsupported:`当前远端不支持应用内认证。请先配置 SSH key 或 credential helper,再重试。`,auth_username:`用户名`,auth_password:`密码或令牌`,auth_username_placeholder:`Git 用户名`,auth_password_placeholder:`密码或个人访问令牌`,branch_remote:`远程`,quick_pick:{search_placeholder:`搜索分支或创建新分支...`,loading:`正在加载分支...`,empty_filtered:`未找到分支`,empty_idle:`输入以搜索分支`,create:`创建分支:{name}`,confirm_create:`确认创建分支:{name}`},statusbar:{changes:`未提交的文件变更`,ahead:`待推送的本地提交`,behind:`远端有新提交待拉取`}},worktree:{title:`工作树`,status_tab:`状态`,diff_tab:`差异`,tree_tab:`树`,path:`路径`,branch:`分支`,changes:`更改`,loading:`加载中...`,empty_tree:`空目录树`,clean:`干净`,dirty:`有更改`,dirty_status:`有更改`,staged_count:`已暂存:{count}`,modified_count:`已修改:{count}`,untracked_count:`未跟踪:{count}`},settings:{title:`设置`,general:`通用`,appearance:`外观`,providers:`Providers`,autosave_hint:`设置已自动保存`,load_failed:`设置加载失败`,load_failed_unknown:`未收到服务端返回的设置数据`,notifications:`通知`,notifications_channel_hint:`当前 workspace 处于活跃状态时不会通知;切换到其他 workspace 显示页面横幅;窗口不可见时使用系统通知。`,notifications_enabled:`启用完成通知`,notifications_enabled_hint:`当 Agent 会话完成时发送通知`,notification_sound:`通知声音`,notification_sound_hint:`通知触发时播放完成提示音`,notification_status:`通知状态`,notification_status_available:`可用`,notification_status_limited:`受限`,notification_status_limited_hint:`当前移动端浏览器中的系统通知支持不稳定,浏览器权限不代表一定能正常送达。`,notification_status_unsupported:`不支持`,notification_status_unsupported_hint:`当前浏览器环境不支持此通知方式。`,notification_permission:`通知权限`,permission_granted:`已授权`,permission_denied:`已拒绝`,permission_request:`请求授权`,permission_unavailable:`不可用`,permission_limited_hint:`当前移动端浏览器内即使允许通知权限,也可能无法稳定展示系统通知。`,supervisor:{title:`Supervisor`,hint:`限制 Supervisor 评估器的最长运行时间,超过后服务端会主动中止本轮评估。`,evaluation_timeout:`Supervisor 超时(秒)`,validation_error:`请输入 1 到 {max} 秒之间的整数。`},terminal_renderer:`终端渲染器`,terminal_renderer_hint:`选择终端渲染模式`,terminal_standard:`标准`,terminal_compatibility:`兼容模式`,provider:{title:`Provider 设置`,status:`状态`,capability:`能力等级`,capability_full:`完整支持`,capability_limited:`有限支持`,capability_unsupported:`不支持`,hooks_registered:`Hooks 已注册`,hooks_unregistered:`Hooks 未注册`,hooks_error:`Hooks 注册失败`,hooks:`Hooks 集成`,hooks_hint:`将 Provider 特定的 hooks 注入到当前工作区`,hooks_inject:`注入 Hooks`,configure:`配置`,reset:`重置`,config:`配置`,base:`基础配置`,config_file:`配置文件`,open_config_file_editor:`打开配置文件编辑`,back_to_base:`返回基础配置`,startup_args:`启动命令参数`,startup_args_hint:`每行填写一个启动参数,保存后会追加到 Provider 启动命令后面。`,startup_args_placeholder:`--verbose
100
- --debug`},theme:{title:`主题`,dark:`深色`,light:`浅色`,system:`跟随系统`,hint:`当前仅支持深色主题`},language:{title:`语言`,zh:`中文`,en:`English`,hint:`选择界面语言`},auth:{title:`认证`,password:`密码`,password_set:`设置密码`,password_change:`修改密码`,password_remove:`移除密码`},shortcuts:{title:`快捷键`,reset_all:`重置全部`,capture_hint:`按下新的快捷键组合`,reset_hint:`重置为默认`},config_files:{title:`配置文件`,codex_config:`Codex 配置`,claude_config:`Claude 配置`,path_label:`路径`,unsaved_changes:`未保存的更改`,saving:`保存中...`,save_success:`配置保存成功`,backup_created:`备份已保存到 {path}`,save_failed:`配置保存失败`,load_failed:`配置加载失败`,file_not_found:`配置文件不存在,编辑并保存以创建。`,status_saved:`已保存`,collapse:`折叠`,format:`格式化`,format_hint:`格式化 JSON 代码`,file_not_found_hint:`编辑并保存以创建配置文件。`},permission_denied_hint:`浏览器或系统通知权限可能已阻止,请检查站点设置和设备通知设置`,permission_unavailable_hint:`当前环境无法请求浏览器通知权限`},auth:{description:`输入密码后继续进入当前工作区。`,hint:`请输入当前部署配置的访问密码。`,blocked_until:`尝试次数过多,请于 {time} 后再试,或联系管理员解禁。`,blocked_generic:`尝试次数过多,请稍后再试,或联系管理员解禁。`,status_title:`访问验证`,status_loading:`正在检查当前部署的访问状态。`,status_unavailable:`暂时无法连接鉴权服务,请稍后重试。`,status_not_configured:`当前部署未配置鉴权。`},connection:{title:`连接`,status:`状态`,reconnecting:`正在重新连接...`,reconnect_failed:`重连失败`,another_tab:`另一个标签页已激活`,takeover:`接管控制权`,server_shutdown:`服务器已关闭`,backpressure_warning:`网络拥堵,部分输出可能丢失`},supervisor:{title:`Supervisor`,empty:`Supervisor 未启用`,latest_evaluation:`最近一次评估`,state:{inactive:`未启用`,idle:`空闲`,evaluating:`评估中`,injecting:`注入中`,paused:`已暂停`,error:`错误`},trigger:{manual:`手动`,auto:`自动`},cycle:{no_guidance:`本轮无需注入 guidance`,evaluating:`评估中…`,waiting:`等待评估结果`},field:{objective:`目标描述`,current_objective:`当前目标`,objective_placeholder:`描述希望 Supervisor 盯住的目标,例如:
101
- - 完成用户认证功能的实现
102
- - 修复所有失败的单元测试
103
- - 把 P95 响应时间压到 100ms 以内`,objective_helper:`越具体、越可衡量,评估效果越好。建议包含完成条件。`,evaluator:`评估方`,evaluator_helper:`用于评估进度并生成下一步指引的 provider,与执行方可不相同。`},action:{enable:`启用 Supervisor`,enable_objective:`启用目标`,edit_objective:`编辑目标`,disable:`禁用 Supervisor`,pause:`暂停`,resume:`恢复`,trigger:`触发评估`,pause_failed:`暂停失败`,resume_failed:`恢复失败`,trigger_failed:`触发评估失败`},dialog:{enable:{title:`启用 Supervisor`,subtitle:`描述一个目标,Supervisor 会在每轮结束后自动评估并提示下一步`,confirm:`启用`},edit:{title:`编辑 Supervisor`,subtitle:`调整目标描述或切换评估方,历史评估不会被清除`,confirm:`保存`},disable:{title:`禁用 Supervisor`,subtitle:`停止自动评估。当前会话的监督周期将被移除`,confirm:`禁用`,warning_title:`禁用后会停止评估周期`,warning_body:`当前会话的 Supervisor 将被移除,历史 cycles 会一并清理。可重新启用,但无法恢复记录。`}}},command:{palette:`命令面板`,no_results:`未找到结果`,shortcut:{save:`保存`,save_all:`保存全部`,search:`搜索`,search_files:`搜索文件`,command_palette:`命令面板`,toggle_focus:`切换专注模式`,toggle_sidebar:`切换侧边栏`,toggle_terminal:`切换终端面板`}},notification:{success:`成功`,error:`错误`,warning:`警告`,info:`信息`,session_turn_completed:`会话回合完成`,file_saved:`文件已保存`,committed:`已提交`,session_completed_title:`{session} 已完成`,session_completed_body:`Agent 会话已完成执行`,session_ended:`会话已结束`,session_ended_hint:`会话已停止运行`},error:{unknown:`未知错误`,network:`网络错误`,not_found:`未找到`,permission_denied:`权限不足`,validation:`数据验证失败`,conflict:`资源冲突`},welcome:{kicker:`开始使用`,title:`欢迎使用 Coder Studio`,description:`一个本地优先的 AI 编码工作台。在同一个界面里启动 AI Agent 会话、审阅生成代码、管理 Git 变更并运行终端。`,features:{agent_first:{title:`以 Agent 为核心的 AI 编码`,description:`启动能够编写、测试和部署代码的 AI 会话。`},git_tools:{title:`内置 Git 工具`,description:`无需离开 IDE,就能暂存、提交并管理分支。`},terminals:{title:`集成终端`,description:`在 AI 会话旁边直接运行命令和脚本。`}}},not_found:{kicker:`路由不存在`,title:`页面不存在`,description:`你访问的路径不在当前工作台的前端路由中。`,path_label:`请求路径`,go_home:`返回首页`},confirm:{save_changes:`是否保存更改?`,discard_changes:`确定要放弃更改吗?`,delete_file:`确定要删除此文件吗?`,stop_session:`确定要停止会话吗?`,close_workspace:`确定要关闭工作区吗?`},placeholder:{search:`输入关键词搜索...`,command:`输入命令名称或快捷键...`,commit_message:`输入提交信息`},tooltip:{focus_mode:`专注模式:隐藏侧边栏和底部面板`,split_horizontal:`水平分割面板`,split_vertical:`垂直分割面板`,close_pane:`关闭面板`,new_workspace:`新建工作区`,quick_actions:`快捷操作`,enter_fullscreen:`进入全屏`,exit_fullscreen:`退出全屏`,show_terminal:`显示终端`,hide_terminal:`隐藏终端`,show_files:`显示文件`,hide_files:`隐藏文件`},time:{just_now:`刚刚`,seconds_ago:`{count} 秒前`,minutes_ago:`{count} 分钟前`,hours_ago:`{count} 小时前`,days_ago:`{count} 天前`},fencing:{observer_mode:`只读模式 — 另一个标签页正在控制`,takeover:`接管控制`,takeover_failed:`接管失败 — 控制器仍然活跃`},codex_audit:{title:`Codex 配置冲突({count} 项)`,load_failed_title:`Codex 配置检查不可用`,load_failed_unknown:`未收到服务端返回的配置检查结果`,show_details:`展开`,collapse:`折叠`,cleanup_select:`选择要清理的项`,cleanup_action:`清理选中的 {count} 项`,cleaning:`正在清理...`,cleanup_done:`清理完成`,cleanup_done_with_backup:`清理完成,原文件已备份到 {path}`,cleanup_noop:`没有需要清理的内容`,cleanup_failed:`清理失败`,finding:{toml_notify:`顶层 notify = [...]`,toml_codex_hooks:`[features] codex_hooks = true`}}},pd={zh:{name:`中文`,data:fd},en:{name:`English`,data:dd}};function md(e,t){let n=t.split(`.`),r=e;for(let e of n){if(typeof r!=`object`||!r)return;r=r[e]}return typeof r==`string`?r:void 0}function hd(e){let t=pd[e]?.data??fd;function n(e,n){let r=md(t,e);if(r===void 0)return console.warn(`Translation missing for key: ${e}`),e;if(n)for(let[e,t]of Object.entries(n))r=r.replace(RegExp(`\\{${e}\\}`,`g`),String(t));return r}return n}var gd=I(e=>hd(e(Ur)));function _d(e,t,n){return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,...n}).format(e)}function X(){return R(gd)}var vd=t((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),Z=t(((e,t)=>{t.exports=vd()}))();function yd(){let e=X(),[,t]=Te(Wr),n=R(Ur),r=R(Ju),i=Ir()===`mobile`,[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(!1),[d,f]=(0,L.useState)(r===null),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(!1);(0,L.useEffect)(()=>{if(r!==null){f(!1),m(!1),g(r===!1),r===!1&&t(!0);return}(async()=>{try{let e=await(await fetch(`/auth/status`)).json();m(!1),g(e.authEnabled===!1),e.authEnabled===!1||e.authenticated===!0?t(!0):t(!1)}catch{m(!0),g(!1)}finally{f(!1)}})()},[r,t]);let _=e(d?`status.connecting`:p?`status.unavailable`:h?`auth.status_not_configured`:`auth.description`),v=e(d?`auth.status_loading`:p?`auth.status_unavailable`:h?`auth.status_not_configured`:`auth.hint`),y=`auth-status-panel${p||s?` auth-status-panel-error`:``}`,b=e(d||l?`status.connecting`:`action.confirm`),x=t=>typeof t!=`number`||Number.isNaN(t)?e(`auth.blocked_generic`):e(`auth.blocked_until`,{time:_d(t,n,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1})});return(0,Z.jsx)(`div`,{className:[`welcome-container`,`auth-screen`,i?`welcome-container--mobile auth-screen--mobile`:``].filter(Boolean).join(` `),children:(0,Z.jsxs)(`div`,{className:[`welcome-card`,`auth-card-shell`,i?`welcome-card--mobile auth-card-shell--mobile`:``].filter(Boolean).join(` `),children:[(0,Z.jsx)(`div`,{className:`welcome-kicker`,children:`CODER STUDIO`}),(0,Z.jsx)(`h1`,{className:`welcome-title`,children:e(`app.name`)}),(0,Z.jsx)(`p`,{className:`welcome-body auth-card-desc`,children:_}),(0,Z.jsxs)(`div`,{className:y,children:[(0,Z.jsx)(`div`,{className:`auth-status-eyebrow`,children:e(`auth.status_title`)}),(0,Z.jsx)(`p`,{className:`auth-status-detail`,children:s??v})]}),(0,Z.jsxs)(`form`,{className:`auth-form`,onSubmit:async n=>{n.preventDefault(),u(!0),c(null);try{let e=await fetch(`/auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({password:a})});if(!e.ok){let t=await e.json().catch(()=>({error:`Login failed`}));if(t?.blocked===!0){c(x(t.blockedUntil));return}c(t.error||`Login failed`);return}let n=await e.json();(n.authEnabled===!1||n.ok)&&t(!0)}catch{c(e(`error.network`))}finally{u(!1)}},children:[(0,Z.jsx)(`input`,{className:`input auth-input`,type:`password`,value:a,onChange:e=>o(e.target.value),placeholder:e(`settings.auth.password`)}),(0,Z.jsx)(`button`,{className:`btn btn-primary btn-lg auth-submit`,type:`submit`,disabled:d||l||!a.trim(),children:b})]})]})})}var Q=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),bd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),xd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Sd=e=>{let t=xd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Cd={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},wd=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Td=(0,L.createContext)({}),Ed=()=>(0,L.useContext)(Td),Dd=(0,L.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=Ed()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,L.createElement)(`svg`,{ref:c,...Cd,width:t??l??Cd.width,height:t??l??Cd.height,stroke:e??f,strokeWidth:m,className:Q(`lucide`,p,i),...!a&&!wd(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,L.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),$=(e,t)=>{let n=(0,L.forwardRef)(({className:n,...r},i)=>(0,L.createElement)(Dd,{ref:i,iconNode:t,className:Q(`lucide-${bd(Sd(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Sd(e),n},Od=$(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),kd=$(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Ad=$(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),jd=$(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Md=$(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Nd=$(`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`}]]),Pd=$(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Fd=$(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Id=$(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Ld=$(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Rd=$(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),zd=$(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),Bd=$(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Vd=$(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Hd=$(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Ud=$(`diff`,[[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 10h14`,key:`elsbfy`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Wd=$(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Gd=$(`file-braces-corner`,[[`path`,{d:`M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6`,key:`14cnrg`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1`,key:`sr0ebq`}],[`path`,{d:`M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1`,key:`w793db`}]]),Kd=$(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),qd=$(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Jd=$(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),Yd=$(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Xd=$(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),Zd=$(`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`}]]),Qd=$(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),$d=$(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ef=$(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),tf=$(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),nf=$(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),rf=$(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),af=$(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),of=$(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),sf=$(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),cf=$(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),lf=$(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),uf=$(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),df=$(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),ff=$(`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`}]]),pf=$(`panel-bottom`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),mf=$(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),hf=$(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),gf=$(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),_f=$(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),vf=$(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),yf=$(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),bf=$(`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`}]]),xf=$(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Sf=$(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Cf=$(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),wf=$(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Tf=$(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ef=$(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Df=$(`square-centerline-dashed-vertical`,[[`path`,{d:`M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3`,key:`14bfxa`}],[`path`,{d:`M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3`,key:`14rx03`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}]]),Of=$(`square-centerline-dashed-horizontal`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3`,key:`1i73f7`}],[`path`,{d:`M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3`,key:`saxlbk`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 14v2`,key:`8jcxud`}],[`path`,{d:`M12 8v2`,key:`1woqiv`}],[`path`,{d:`M12 2v2`,key:`tus03m`}]]),kf=$(`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`}]]),Af=$(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),jf=$(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Mf=$(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),Nf=$(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Pf=$(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ff=$(`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`}]]),If=Zu(e=>I(null)),Lf=Zu(e=>I(!1)),Rf=Zu(e=>I(new Set)),zf=Zu(e=>I({})),Bf=Zu(e=>I(null)),Vf=Zu(e=>I(0));Zu(e=>I(t=>{let n=t(Bf(e));return n?t(zf(e))[n]??null:null})),Zu(e=>I(t=>{let n=t(zf(e));return Object.values(n).filter(e=>e.isDirty).length}));var Hf=Zu(e=>I(null)),Uf=Zu(e=>I(null)),Wf=Zu(e=>I(!1));Zu(e=>I(t=>{let n=t(Hf(e));return n?n.staged.length>0||n.modified.length>0||n.untracked.length>0||n.deleted.length>0:!1})),Zu(e=>I(t=>{let n=t(Hf(e));return n?{staged:n.staged.length,unstaged:n.modified.length+n.deleted.length,untracked:n.untracked.length,total:n.staged.length+n.modified.length+n.untracked.length+n.deleted.length}:{staged:0,unstaged:0,untracked:0,total:0}}));var Gf=Zu(e=>I({current:``,branches:[],loading:!1})),Kf=I({visible:!1,inputValue:``}),qf=Vr(`ui.focusMode`,!1),Jf=Vr(`ui.leftPanelWidth`,280),Yf=Vr(`ui.bottomPanelHeight`,200),Xf=Vr(`ui.sidebarCollapsed`,!1),Zf=Vr(`ui.terminalPanelVisible`,!0);function Qf({title:e,onBack:t,backLabel:n=`Back`,backAriaLabel:r,kicker:i,rightSlot:a,titleAs:o=`h2`}){return(0,Z.jsxs)(`div`,{className:`page-header`,children:[(0,Z.jsxs)(`div`,{className:`page-header__leading`,children:[t?(0,Z.jsxs)(`button`,{type:`button`,className:`page-header__back`,onClick:t,"aria-label":r??n,children:[(0,Z.jsx)(kd,{size:16}),(0,Z.jsx)(`span`,{children:n})]}):null,(0,Z.jsxs)(`div`,{className:`page-header__copy`,children:[i?(0,Z.jsx)(`div`,{className:`page-header__kicker`,children:i}):null,(0,Z.jsx)(o,{className:`page-header__title`,children:e})]})]}),a?(0,Z.jsx)(`div`,{className:`page-header__actions`,children:a}):null]})}function $f({title:e,body:t,onClose:n,kicker:r,onBack:i,footer:a,headerAction:o,bodyClassName:s,contentClassName:c,fullscreen:l=!1,backLabel:u}){let d=X(),f=[`mobile-sheet`,l?`mobile-sheet--fullscreen`:null,c].filter(Boolean).join(` `),p=[`mobile-sheet__body`,s].filter(Boolean).join(` `),m=i??n,h=u??d(`action.back`);return(0,Z.jsxs)(`div`,{className:`mobile-sheet-layer`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`mobile-sheet-layer__backdrop`,"aria-label":d(`mobile.sheet.dismiss`),onClick:n}),(0,Z.jsxs)(`section`,{className:f,"aria-label":d(`mobile.sheet.region`,{title:e}),role:`region`,children:[l?null:(0,Z.jsx)(`div`,{className:`mobile-sheet__handle`,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:`mobile-sheet__header`,children:(0,Z.jsx)(Qf,{title:e,kicker:r,onBack:m,backLabel:h,rightSlot:o})}),(0,Z.jsx)(`div`,{className:p,children:t}),a?(0,Z.jsx)(`div`,{className:`mobile-sheet__footer`,children:a}):null]})]})}function ep(e){let t=X(),n=Jt(),r=Zt(),i=R(Yu),a=z(Qu),o=z($u),s=z(ed),c=z(td),l=z(nd),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)([]),[m,h]=(0,L.useState)(null),[g,_]=(0,L.useState)(null),[v,y]=(0,L.useState)(!1),[b,x]=(0,L.useState)(!0),[S,C]=(0,L.useState)(null),w=t(`workspace.launch.title`),T=t(`workspace.launch.hint`),E=[`/`,`~`,`/home/spencer`];(0,L.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let D=(0,L.useCallback)(async e=>{x(!0),C(null);try{let n=await i(`workspace.browse`,{path:e});if(!n.ok||!n.data){C(n.error?.message||t(`workspace.launch.browse_failed`));return}d(n.data.currentPath),p(n.data.directories),h(n.data.parentPath)}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(!1)}},[i]);(0,L.useEffect)(()=>{D()},[D]);let O=(0,L.useCallback)(e=>{_(null),D(e)},[D]),k=(0,L.useCallback)(e=>{_(e)},[]),A=(0,L.useCallback)(async()=>{if(!g){C(t(`workspace.launch.select_required`));return}y(!0),C(null);try{let u=await i(`workspace.open`,{path:g});u.ok&&u.data?.id?(a(u.data.id),o(e=>({...e,[u.data.id]:u.data})),s(e=>e.includes(u.data.id)?e:[u.data.id,...e]),c(`ready`),l(null),n.pathname!==`/workspace`&&r(`/workspace`),e()):C(u.error?.message||t(`workspace.launch.open_failed`))}catch(e){C(e instanceof Error?e.message:String(e))}finally{y(!1)}},[i,n.pathname,r,e,g,a,s,o,l,c,t]);return{browsing:b,currentPath:u,directories:f,error:S,getShortPath:(0,L.useCallback)(e=>{if(e===`~`)return`~`;if(e===`/`)return`/`;let t=e.match(/^\/home\/[^/]+/);return t?e.replace(t[0],`~`):e},[]),handleNavigate:O,handleOpen:A,handleSelect:k,launchHint:T,launchTitle:w,loading:v,parentPath:m,rootPaths:E,selectedPath:g}}function tp({onClose:e}){let t=Ir()===`mobile`,n=X(),{browsing:r,currentPath:i,directories:a,error:o,getShortPath:s,handleNavigate:c,handleOpen:l,handleSelect:u,launchHint:d,launchTitle:f,loading:p,parentPath:m,rootPaths:h,selectedPath:g}=ep(e),_=(0,Z.jsxs)(`div`,{className:`launch-body`,children:[(0,Z.jsxs)(`div`,{className:`folder-picker`,children:[(0,Z.jsxs)(`div`,{className:`fp-toolbar`,children:[(0,Z.jsxs)(`button`,{className:`fp-btn`,onClick:()=>c(`~`),children:[(0,Z.jsx)(nf,{size:12}),n(`workspace.launch.home_directory`)]}),m&&(0,Z.jsxs)(`button`,{className:`fp-btn`,onClick:()=>c(m),children:[(0,Z.jsx)(Md,{size:12}),n(`workspace.launch.go_up`)]})]}),(0,Z.jsxs)(`div`,{className:`fp-root-chips`,children:[h.map(e=>(0,Z.jsx)(`span`,{className:`fp-chip ${i===e?`active`:``}`,onClick:()=>c(e),children:e},e)),i&&!h.includes(i)&&(0,Z.jsx)(`span`,{className:`fp-chip active`,children:s(i)})]}),(0,Z.jsx)(`div`,{className:`fp-dir-list`,children:r?(0,Z.jsx)(`div`,{className:`directory-loading`,children:(0,Z.jsx)(sf,{size:16,className:`animate-spin`})}):a.length===0?(0,Z.jsx)(`div`,{className:`directory-empty`,children:n(`workspace.launch.no_directories`)}):a.map(e=>(0,Z.jsxs)(`div`,{className:`fp-dir ${g===e.path?`selected`:``}`,onClick:()=>u(e.path),onDoubleClick:()=>c(e.path),children:[(0,Z.jsx)(`span`,{className:`fp-dir-icon`,children:(0,Z.jsx)($d,{size:14})}),(0,Z.jsx)(`span`,{className:`fp-dir-name ${g===e.path?`selected`:``}`,children:e.name}),e.itemCount!==void 0&&(0,Z.jsx)(`span`,{className:`fp-dir-hint`,children:n(`workspace.launch.items_count`,{count:e.itemCount})}),g===e.path&&(0,Z.jsx)(`button`,{className:`fp-dir-action`,type:`button`,"aria-label":n(`workspace.launch.enter_folder`,{name:e.name}),onClick:t=>{t.stopPropagation(),c(e.path)},children:n(`workspace.launch.enter_folder_action`)})]},e.path))})]}),o&&(0,Z.jsx)(`div`,{className:`form-error`,style:{marginTop:`var(--sp-3)`},children:o})]}),v=(0,Z.jsx)(`div`,{className:`mobile-launch-sheet__footer`,children:(0,Z.jsx)(`button`,{className:`launch-start-btn launch-start-btn--mobile`,onClick:()=>void l(),disabled:p||!g,children:n(p?`workspace.launch.starting`:`workspace.launch.start`)})});return t?(0,Z.jsx)($f,{kicker:n(`workspace.launch.kicker`),title:f,body:_,footer:v,fullscreen:!0,bodyClassName:`mobile-sheet__body--flush mobile-sheet__body--fullscreen mobile-launch-sheet`,contentClassName:`mobile-sheet--launch`,onClose:e}):(0,Z.jsx)(`div`,{className:`launch-overlay`,onClick:e,children:(0,Z.jsxs)(`div`,{className:`launch-modal`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`launch-header`,children:[(0,Z.jsxs)(`div`,{className:`launch-header-left`,children:[(0,Z.jsx)(`div`,{className:`launch-kicker`,children:n(`workspace.launch.kicker`)}),(0,Z.jsx)(`div`,{className:`launch-title`,children:f}),(0,Z.jsx)(`div`,{className:`launch-hint`,children:d})]}),(0,Z.jsx)(`div`,{className:`launch-header-right`,children:(0,Z.jsx)(`div`,{className:`launch-close-btn`,onClick:e,role:`button`,tabIndex:0,"aria-label":n(`action.close`),children:(0,Z.jsx)(Pf,{size:16})})})]}),_,(0,Z.jsx)(`div`,{className:`launch-footer`,children:(0,Z.jsx)(`button`,{className:`launch-start-btn launch-start-btn--desktop`,onClick:()=>void l(),disabled:p||!g,children:n(p?`workspace.launch.starting`:`workspace.launch.start`)})})]})})}function np(){let e=X(),t=Jt(),n=Zt(),r=Ir()===`mobile`,[i,a]=Te(Gr),[o,s]=Te(qf),[c,l]=Te(Xf),[u,d]=Te(Zf),[f,p]=Te(Yf),m=R(od),h=z(Qu),g=R(ad),[_,v]=(0,L.useState)(``),[y,b]=(0,L.useState)(0),[x,S]=(0,L.useState)(!1),C=(0,L.useRef)(null),w=rp({shellKind:r?`mobile`:`desktop`,focusMode:o,setFocusMode:s,sidebarCollapsed:c,setSidebarCollapsed:l,terminalPanelVisible:u,setTerminalPanelVisible:d,bottomPanelHeight:f,setBottomPanelHeight:p,activeWorkspaceId:m,setActiveWorkspaceId:h,workspaces:g,locationPathname:t.pathname,navigate:n,t:e,setShowWorkspaceLaunch:e=>{e&&a(!1),S(e)}}).filter(e=>{let t=_.toLowerCase();return e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.shortcut&&e.shortcut.toLowerCase().includes(t)});(0,L.useEffect)(()=>{i&&(C.current?.focus(),v(``),b(0))},[i]);let T=(0,L.useCallback)(e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),b(e=>e<w.length-1?e+1:e);break;case`ArrowUp`:e.preventDefault(),b(e=>e>0?e-1:e);break;case`Enter`:e.preventDefault(),w[y]&&(w[y].action(),a(!1));break;case`Escape`:e.preventDefault(),a(!1);break}},[w,y,a]);(0,L.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key===`k`&&(e.preventDefault(),a(!i))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,a]);let E=e=>{e.action(),a(!1)},D=(0,Z.jsxs)(`div`,{className:`command-palette-search`,children:[(0,Z.jsx)(Cf,{size:16,className:`command-palette-search-icon`}),(0,Z.jsx)(`input`,{ref:C,type:`text`,className:`command-palette-input`,placeholder:e(`placeholder.command`),value:_,onChange:e=>{v(e.target.value),b(0)}})]}),O=(0,Z.jsx)(`div`,{className:`command-palette-list`,children:w.length>0?w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`command-palette-item ${t===y?`command-palette-item-selected`:``}`,onClick:()=>E(e),onMouseEnter:()=>b(t),children:[(0,Z.jsxs)(`div`,{className:`command-palette-item-content`,children:[(0,Z.jsx)(`span`,{className:`command-palette-item-label`,children:e.label}),(0,Z.jsx)(`span`,{className:`command-palette-item-desc`,children:e.description})]}),e.shortcut?(0,Z.jsx)(`span`,{className:`command-palette-item-shortcut`,children:e.shortcut}):null]},e.id)):(0,Z.jsx)(`div`,{className:`command-palette-empty`,children:e(`command.no_results`)})});return x?(0,Z.jsx)(tp,{onClose:()=>S(!1)}):i?r?(0,Z.jsx)($f,{title:`Quick Actions`,kicker:e(`command.palette`).toUpperCase(),onClose:()=>a(!1),bodyClassName:`mobile-sheet__body--flush`,contentClassName:`command-palette-sheet-layer`,body:(0,Z.jsx)(`div`,{className:`command-palette-sheet-shell`,onKeyDown:T,children:(0,Z.jsxs)(`div`,{className:`command-palette-sheet`,children:[(0,Z.jsxs)(`div`,{className:`command-palette-sheet__search`,children:[D,(0,Z.jsxs)(`div`,{className:`command-palette-sheet__meta`,children:[(0,Z.jsx)(`span`,{className:`command-palette-hint`,children:e(`placeholder.command`)}),(0,Z.jsxs)(`span`,{className:`command-palette-meta`,children:[w.length,` actions`]})]})]}),O]})})}):(0,Z.jsx)(`div`,{className:`command-palette-overlay`,onClick:()=>a(!1),children:(0,Z.jsxs)(`div`,{className:`command-palette`,onClick:e=>e.stopPropagation(),onKeyDown:T,children:[(0,Z.jsxs)(`div`,{className:`command-palette-header`,children:[(0,Z.jsx)(`span`,{className:`command-palette-kicker`,children:e(`command.palette`).toUpperCase()}),(0,Z.jsxs)(`span`,{className:`command-palette-meta`,children:[w.length,` actions`]})]}),D,(0,Z.jsx)(`div`,{className:`command-palette-hint`,children:e(`placeholder.command`)}),O]})}):null}function rp(e){let{shellKind:t,focusMode:n,setFocusMode:r,sidebarCollapsed:i,setSidebarCollapsed:a,terminalPanelVisible:o,setTerminalPanelVisible:s,bottomPanelHeight:c,setBottomPanelHeight:l,activeWorkspaceId:u,setActiveWorkspaceId:d,workspaces:f,locationPathname:p,navigate:m,t:h,setShowWorkspaceLaunch:g}=e,_=[{id:`new-workspace`,label:h(`workspace.open`),description:h(`workspace.open_hint`),shortcut:`Ctrl+N`,action:()=>{g(!0)}},{id:`open-home`,label:h(`workspace.title`),description:h(`action.back`),action:()=>m(`/`)},{id:`open-settings`,label:h(`action.settings`),description:h(`settings.title`),shortcut:`Ctrl+,`,action:()=>{m(`/settings`)}}];return t===`desktop`&&_.push({id:`toggle-focus-mode`,label:h(`tooltip.focus_mode`),description:h(n?`action.close`:`action.open`),shortcut:`F`,action:()=>r(!n)},{id:`enable-focus-mode`,label:`${h(`action.open`)} Focus Mode`,description:h(`tooltip.focus_mode`),action:()=>r(!0)},{id:`disable-focus-mode`,label:`${h(`action.close`)} Focus Mode`,description:h(`tooltip.focus_mode`),action:()=>r(!1)},{id:`toggle-sidebar`,label:h(`command.shortcut.toggle_sidebar`),description:h(i?`action.open`:`action.close`),action:()=>a(!i)},{id:`toggle-terminal`,label:h(`terminal.title`),description:h(o?`action.close`:`action.open`),action:()=>{s(!o),!o&&c===0&&l(200)}},{id:`show-terminal`,label:`${h(`action.open`)} ${h(`terminal.title`)}`,description:h(`command.shortcut.toggle_terminal`),action:()=>{s(!0),c===0&&l(200)}},{id:`hide-terminal`,label:`${h(`action.close`)} ${h(`terminal.title`)}`,description:h(`command.shortcut.toggle_terminal`),action:()=>s(!1)}),f.forEach(e=>{let t=e.name||e.path?.split(`/`).pop()||e.path||e.id;_.push({id:`switch-workspace-${e.id}`,label:`${h(`workspace.title`)}: ${t}`,description:e.path||e.id,action:()=>{d(e.id),p!==`/workspace`&&m(`/workspace`)}})}),u&&_.push({id:`go-home`,label:h(`action.back`),description:h(`workspace.no_workspace`),action:()=>{d(null),m(`/`)}}),_}function ip({variant:e=`global`,showLoadError:t=!0}){let n=X(),r=Zt(),i=Ir()===`mobile`,a=n(`codex_audit.load_failed_unknown`),o=R(Yu),s=R(Hu),[c,l]=(0,L.useState)(null),[u,d]=(0,L.useState)(!1),[f,p]=(0,L.useState)(new Set),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)(0);(0,L.useEffect)(()=>{if(s!==`connected`)return;let e=!1;return(async()=>{let t=await o(`settings.get`,{});if(e)return;if(!t.ok||!t.data){l(null),p(new Set),x(t.error?.message??a);return}let n=t.data.externalConfigAudit?.codex??null;x(null),l(n),p(new Set((n?.findings??[]).map(e=>e.id)))})(),()=>{e=!0}},[a,s,o,S]);let w=!!c&&c.findings.length>0,T=i&&e===`global`,E=[`config-drift-banner`,e===`embedded`?`config-drift-banner--embedded`:``,T?`config-drift-banner--mobile-compact`:``,b?`config-drift-banner--error`:``].filter(Boolean).join(` `),D=(0,L.useCallback)(e=>{p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),O=(0,L.useCallback)(async()=>{if(!(f.size===0||!c)){_(!0),y(null);try{let e=await o(`settings.cleanupCodexConfig`,{removeIds:Array.from(f)});if(!e.ok||!e.data){y(n(`codex_audit.cleanup_failed`)+(e.error?.message?`: ${e.error.message}`:``));return}let t=e.data.audit?.codex??null;l(t),p(new Set((t?.findings??[]).map(e=>e.id))),e.data.backupPath?y(n(`codex_audit.cleanup_done_with_backup`,{path:e.data.backupPath})):e.data.noop?y(n(`codex_audit.cleanup_noop`)):y(n(`codex_audit.cleanup_done`))}finally{_(!1)}}},[c,o,f,n]),k=(0,L.useMemo)(()=>g?n(`codex_audit.cleaning`):f.size===0?n(`codex_audit.cleanup_select`):n(`codex_audit.cleanup_action`,{count:String(f.size)}),[g,f.size,n]);return m?null:b&&t&&T?(0,Z.jsx)(`div`,{className:E,role:`alert`,children:(0,Z.jsxs)(`div`,{className:`config-drift-banner__row config-drift-banner__row--compact`,children:[(0,Z.jsx)(Nf,{size:16,className:`config-drift-banner__icon`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`config-drift-banner__title`,children:n(`codex_audit.load_failed_title`)}),(0,Z.jsx)(`div`,{className:`config-drift-banner__spacer`}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__summary-action`,onClick:()=>C(e=>e+1),children:n(`action.refresh`)}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__dismiss`,onClick:()=>h(!0),"aria-label":n(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})]})}):b&&t?(0,Z.jsx)(`div`,{className:E,role:`alert`,children:(0,Z.jsxs)(`div`,{className:`config-drift-banner__row`,children:[(0,Z.jsx)(Nf,{size:16,className:`config-drift-banner__icon`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`config-drift-banner__title`,children:n(`codex_audit.load_failed_title`)}),(0,Z.jsx)(`span`,{className:`config-drift-banner__message`,children:b}),(0,Z.jsx)(`div`,{className:`config-drift-banner__spacer`}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__toggle`,onClick:()=>C(e=>e+1),children:(0,Z.jsx)(`span`,{children:n(`action.refresh`)})}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__dismiss`,onClick:()=>h(!0),"aria-label":n(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})]})}):b||!w?null:T?(0,Z.jsx)(`div`,{className:E,role:`alert`,children:(0,Z.jsxs)(`div`,{className:`config-drift-banner__row config-drift-banner__row--compact`,children:[(0,Z.jsx)(Nf,{size:16,className:`config-drift-banner__icon`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`config-drift-banner__title`,children:n(`codex_audit.title`,{count:String(c.findings.length)})}),(0,Z.jsx)(`div`,{className:`config-drift-banner__spacer`}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__summary-action`,onClick:()=>r(`/settings`),children:n(`settings.title`)}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__dismiss`,onClick:()=>h(!0),"aria-label":n(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})]})}):(0,Z.jsxs)(`div`,{className:E,role:`alert`,children:[(0,Z.jsxs)(`div`,{className:`config-drift-banner__row`,children:[(0,Z.jsx)(Nf,{size:16,className:`config-drift-banner__icon`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`config-drift-banner__title`,children:n(`codex_audit.title`,{count:String(c.findings.length)})}),(0,Z.jsx)(`span`,{className:`config-drift-banner__path`,title:c.configPath,children:c.configPath}),(0,Z.jsx)(`div`,{className:`config-drift-banner__spacer`}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__toggle`,onClick:()=>d(e=>!e),children:u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:n(`codex_audit.collapse`)}),(0,Z.jsx)(Ld,{size:14})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:n(`codex_audit.show_details`)}),(0,Z.jsx)(Fd,{size:14})]})}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__primary`,onClick:O,disabled:g||f.size===0,children:k}),(0,Z.jsx)(`button`,{type:`button`,className:`config-drift-banner__dismiss`,onClick:()=>h(!0),"aria-label":n(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})]}),u&&(0,Z.jsx)(`ul`,{className:`config-drift-banner__list`,children:c.findings.map(e=>(0,Z.jsxs)(`li`,{className:`config-drift-banner__item`,children:[(0,Z.jsxs)(`label`,{className:`config-drift-banner__checkbox`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:f.has(e.id),onChange:()=>D(e.id)}),(0,Z.jsxs)(`span`,{className:`config-drift-banner__item-title`,children:[n(`codex_audit.finding.${e.type}`),(0,Z.jsxs)(`span`,{className:`config-drift-banner__item-line`,children:[`:`,e.startLine,e.endLine===e.startLine?``:`-${e.endLine}`]})]})]}),(0,Z.jsx)(`p`,{className:`config-drift-banner__item-message`,children:e.message}),(0,Z.jsx)(`pre`,{className:`config-drift-banner__snippet`,children:e.snippet})]},e.id))}),v&&(0,Z.jsx)(`div`,{className:`config-drift-banner__notice`,children:v})]})}function ap(){let e=X(),t=Zt(),n=Jt(),r=Ir()===`mobile`;return(0,Z.jsx)(`div`,{className:`welcome-container ${r?`welcome-container--mobile`:``}`,children:(0,Z.jsxs)(`div`,{className:`welcome-card ${r?`welcome-card--mobile`:``}`,children:[(0,Z.jsx)(`div`,{className:`welcome-kicker`,children:e(`not_found.kicker`)}),(0,Z.jsx)(`h1`,{className:`welcome-title`,children:e(`not_found.title`)}),(0,Z.jsx)(`p`,{className:`welcome-body`,children:e(`not_found.description`)}),(0,Z.jsxs)(`div`,{className:`auth-status-panel`,children:[(0,Z.jsx)(`div`,{className:`auth-status-eyebrow`,children:e(`not_found.path_label`)}),(0,Z.jsx)(`p`,{className:`auth-status-detail`,children:n.pathname})]}),(0,Z.jsx)(`button`,{className:`welcome-btn`,onClick:()=>t(`/`),children:(0,Z.jsx)(`span`,{children:e(`not_found.go_home`)})})]})})}var op=Vr(`ui.notificationPreferences`,{enabled:!0,soundEnabled:!0}),sp=I([]),cp=I(null,(e,t,n)=>{let r=`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,i={...n,id:r,createdAt:Date.now()};t(sp,e=>[...e.slice(-4),i])}),lp=I(null,(e,t,n)=>{t(sp,e=>e.filter(e=>e.id!==n))});function up(e){let{workspaceId:t,sessionId:n,setPendingFocus:r,setActiveWorkspaceId:i,navigate:a}=e;if(typeof window>`u`)return;i(t),r(n);let o=`/workspace`;window.location.pathname!==o&&(a?a(o):(window.history.pushState({},``,o),window.dispatchEvent(new PopStateEvent(`popstate`))))}var dp={success:{icon:Bd,className:`toast--success`},error:{icon:Rd,className:`toast--error`},warning:{icon:Nf,className:`toast--warning`},info:{icon:af,className:`toast--info`}};function fp({toast:e}){let t=z(lp),n=z(Qu),r=z(Kr),i=Zt(),a=dp[e.kind],o=a.icon,s=e.duration??5e3;(0,L.useEffect)(()=>{if(s<=0)return;let n=setTimeout(()=>t(e.id),s);return()=>clearTimeout(n)},[e.id,s,t]);let c=(0,L.useCallback)(()=>{e.workspaceId&&e.sessionId?up({workspaceId:e.workspaceId,sessionId:e.sessionId,setPendingFocus:r,setActiveWorkspaceId:n,navigate:i}):e.workspaceId&&(n(e.workspaceId),window.location.pathname!==`/workspace`&&i(`/workspace`)),t(e.id)},[e.workspaceId,e.sessionId,i,t,n,r]);return(0,Z.jsxs)(`div`,{className:`toast ${a.className}`,role:`alert`,onClick:c,style:{cursor:e.workspaceId?`pointer`:`default`},children:[(0,Z.jsx)(o,{size:16,className:`toast__icon`}),(0,Z.jsxs)(`div`,{className:`toast__content`,children:[(0,Z.jsx)(`span`,{className:`toast__title`,children:e.title}),e.body&&(0,Z.jsx)(`span`,{className:`toast__body`,children:e.body})]}),(0,Z.jsx)(`button`,{className:`toast__close`,onClick:n=>{n.stopPropagation(),t(e.id)},"aria-label":`Dismiss`,children:(0,Z.jsx)(Pf,{size:14})})]})}function pp(){let e=R(sp),t=Ir()===`mobile`;return e.length===0?null:(0,Z.jsx)(`div`,{className:[`toast-container`,t?`toast-container--mobile`:``].filter(Boolean).join(` `),"aria-live":`polite`,children:e.map(e=>(0,Z.jsx)(fp,{toast:e},e.id))})}var mp={claude:`Claude`,codex:`Codex`};function hp(e){return mp[e]?mp[e]:e?e.charAt(0).toUpperCase()+e.slice(1):`Agent`}function gp(e){if(!e)return``;let t=e.name?.trim();if(t)return t;let n=e.path?.trim();if(!n)return``;let r=n.replace(/[/\\]+$/,``),i=r.split(/[/\\]/);return i[i.length-1]||r}function _p(e){if(!Number.isFinite(e)||e<0)return``;if(e<1e3)return`<1s`;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?r===0?`${n}m`:`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}var vp=4e3,yp=new Set([`running`]),bp=new Set([`idle`,`ended`]);function xp(e,t,n,r,i){return n===e?r===`mobile`?i===t:!0:!1}function Sp(e,t){return e?`system`:t?`none`:`toast`}function Cp(){return!!(typeof document<`u`&&document.hidden)}async function wp(){try{let e=new Audio(`/task-complete.wav`);e.volume=.75,await e.play();return}catch{}try{let e=window.AudioContext||window.webkitAudioContext;if(!e)return;let t=new e,n=t.currentTime,r=t.createOscillator(),i=t.createGain();r.type=`sine`,r.frequency.value=880,i.gain.setValueAtTime(.25,n),i.gain.exponentialRampToValueAtTime(.001,n+.3),r.connect(i).connect(t.destination),r.start(n),r.stop(n+.3);let a=t.createOscillator(),o=t.createGain();a.type=`sine`,a.frequency.value=660,o.gain.setValueAtTime(.25,n+.15),o.gain.exponentialRampToValueAtTime(.001,n+.5),a.connect(o).connect(t.destination),a.start(n+.15),a.stop(n+.5),setTimeout(()=>t.close(),2e3)}catch{}}function Tp(e){if(`Notification`in window&&Notification.permission===`granted`)try{let t=new Notification(e.title,{body:e.body,tag:e.tag,silent:!0});t.onclick=()=>{window.focus(),up({workspaceId:e.workspaceId,sessionId:e.sessionId,setActiveWorkspaceId:e.setActiveWorkspaceId,setPendingFocus:e.setPendingFocus}),t.close()}}catch{}}function Ep(){let e=R(cd),t=R(Hu),n=R(Yu),r=R(op),i=z(op),a=R(od),o=R(qr),s=z(Qu),c=z(cp),l=z(Kr),u=X(),d=Ir(),f=ve(),p=(0,L.useRef)(new Map);(0,L.useEffect)(()=>{if(t!==`connected`)return;let e=!1;return(async()=>{let t=await n(`settings.get`,{});e||!t.ok||!t.data||i({enabled:typeof t.data[`notifications.enabled`]==`boolean`?t.data[`notifications.enabled`]:!0,soundEnabled:typeof t.data[`notifications.soundEnabled`]==`boolean`?t.data[`notifications.soundEnabled`]:!0})})(),()=>{e=!0}},[t,n,i]),(0,L.useEffect)(()=>{let t=p.current;for(let n of Object.values(e)){let e=t.get(n.id),i=e?.state,p=n.state,m=yp.has(p)&&(!e||!yp.has(e.state)),h={state:p,activeSince:m?Date.now():e?.activeSince??(yp.has(p)?Date.now():null),notifiedForTurn:m?!1:e?.notifiedForTurn??!1};if(t.set(n.id,h),!r.enabled||!i||!yp.has(i)||!bp.has(p)||h.notifiedForTurn)continue;if(p===`idle`&&h.activeSince!==null&&Date.now()-h.activeSince<vp){h.notifiedForTurn=!0;continue}h.notifiedForTurn=!0;let g=Cp(),_=Sp(g,g?!1:xp(n.workspaceId,n.id,a,d,o));if(_===`none`)continue;let v=u(`notification.session_completed_title`,{session:n.title?.trim()||Dp(n.id)}),y=f.get($u)[n.workspaceId],b=[],x=hp(n.providerId).replace(/\s+/g,` `).trim();x&&b.push(x);let S=gp(y??null).replace(/\s+/g,` `).trim();S&&b.push(S);let C=h.activeSince===null?null:Date.now()-h.activeSince,w=C===null?``:_p(C);w&&b.push(w);let T=b.join(` · `),E=u(p===`ended`?`notification.session_ended_hint`:`notification.session_turn_completed`),D=[];T&&D.push(T),D.push(E);let O=D.join(`
104
- `);r.soundEnabled&&wp(),_===`system`?Tp({title:v,body:O,tag:`session-${n.id}-${h.activeSince??`unknown`}`,workspaceId:n.workspaceId,sessionId:n.id,setActiveWorkspaceId:s,setPendingFocus:l}):c({kind:`success`,title:v,body:O,workspaceId:n.workspaceId,sessionId:n.id,duration:6e3})}let n=new Set(Object.keys(e));for(let e of t.keys())n.has(e)||t.delete(e)},[e,r,a,o,d,c,s,l,f,u])}function Dp(e){let t=e.match(/(\d+)/)?.[1];return t?`SESSION-${t.slice(-2).padStart(2,`0`)}`:e.replace(/[_-]/g,` `).toUpperCase()}var Op=globalThis;Op.MonacoEnvironment??={getWorker(e,t){return t===`json`?new s:t===`css`||t===`scss`||t===`less`?new r:t===`html`||t===`handlebars`||t===`razor`?new c:t===`typescript`||t===`javascript`?new o:new i}};var kp=({workspaceId:e,filePath:t,content:n,visible:r=!0,onContentChange:i,onSave:o})=>{let s=R(Hr),c=(0,L.useRef)(null),d=(0,L.useRef)(null),f=(0,L.useRef)(r),p=(0,L.useRef)(i),m=(0,L.useRef)(o);(0,L.useEffect)(()=>{p.current=i},[i]),(0,L.useEffect)(()=>{m.current=o},[o]);let h=Ap(t),g=s===`light`?`vs`:`vs-dark`;return(0,L.useEffect)(()=>{if(!c.current||d.current)return;let e=u.create(c.current,{value:n,language:h,theme:g,fontSize:13,fontFamily:`JetBrains Mono, monospace`,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:12,bottom:12},automaticLayout:!0});d.current=e;let t=e.onDidChangeModelContent(()=>{p.current?.(e.getValue())});return e.addCommand(l.CtrlCmd|a.KeyS,()=>{m.current?.()}),()=>{t.dispose(),e.dispose(),d.current=null}},[]),(0,L.useEffect)(()=>{let e=d.current;if(!e)return;let t=e.getModel();t&&u.setModelLanguage(t,h)},[h]),(0,L.useEffect)(()=>{u.setTheme(g)},[g]),(0,L.useEffect)(()=>{let e=d.current;!e||e.getValue()===n||e.setValue(n)},[n]),(0,L.useEffect)(()=>{let e=d.current,t=f.current;f.current=r,!(!e||!r||t)&&e.layout()},[r]),(0,Z.jsx)(`div`,{ref:c,className:`monaco-host`})};function Ap(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,go:`go`,rs:`rust`,java:`java`,cpp:`cpp`,c:`c`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()||``]||`plaintext`}function jp({configType:e,visible:t=!0,fillHeight:n=!1}){let r=X(),i=R(Yu),a=z(cp),[o,s]=(0,L.useState)(``),[c,l]=(0,L.useState)(``),[u,d]=(0,L.useState)(``),[f,p]=(0,L.useState)(!0),[m,h]=(0,L.useState)(!0),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(()=>{let t=localStorage.getItem(`config-expanded-${e}`);return t===null?!0:t===`true`}),S=(0,L.useMemo)(()=>g?`saving`:v?`error`:o===c?`saved`:`dirty`,[g,v,o,c]),C=S===`dirty`;(0,L.useEffect)(()=>{let t=!1;return(async()=>{h(!0),y(null);try{let n=await i(`settings.readConfigFile`,{configType:e});if(t)return;n.ok&&n.data?(s(n.data.content),l(n.data.content),d(n.data.configPath),p(n.data.exists)):y(n.error?.message??r(`settings.config_files.load_failed`))}catch{t||y(r(`settings.config_files.load_failed`))}finally{t||h(!1)}})(),()=>{t=!0}},[e,i,r]),(0,L.useEffect)(()=>{localStorage.setItem(`config-expanded-${e}`,String(b))},[b,e]);let w=(0,L.useCallback)(async()=>{if(!(!C||g)){_(!0);try{let t=await i(`settings.writeConfigFile`,{configType:e,content:o});if(t.ok&&t.data?.success)a({kind:`success`,title:r(`settings.config_files.save_success`),body:t.data.backupPath?r(`settings.config_files.backup_created`,{path:t.data.backupPath}):void 0}),l(o),y(null);else{let e=t.error?.message??t.data?.error;y(e??`Save failed`),a({kind:`error`,title:r(`settings.config_files.save_failed`),body:e})}}catch(e){y(e instanceof Error?e.message:`Save failed`),a({kind:`error`,title:r(`settings.config_files.save_failed`)})}finally{_(!1)}}},[e,o,C,g,i,a,r]),T=(0,L.useCallback)(()=>{s(c),y(null)},[c]),E=(0,L.useCallback)(()=>{if(e===`claude`)try{let e=JSON.parse(o);s(JSON.stringify(e,null,2)),a({kind:`success`,title:`JSON formatted`})}catch{a({kind:`error`,title:`Invalid JSON`,body:`Cannot format invalid JSON`})}},[e,o,a]),D=(0,L.useCallback)(e=>{s(e),y(null)},[]),O=(0,L.useCallback)(()=>{x(e=>!e)},[]);return m?(0,Z.jsx)(`div`,{className:`config-card`,children:(0,Z.jsx)(`div`,{className:`config-card-loading`,children:r(`common.loading`)})}):v&&!u?(0,Z.jsx)(`div`,{className:`config-card`,children:(0,Z.jsx)(`div`,{className:`config-card-error`,children:(0,Z.jsx)(`span`,{className:`config-card-error-message`,children:v})})}):(0,Z.jsxs)(`div`,{className:`config-card ${n?`config-card--fill-height`:``}`,children:[(0,Z.jsxs)(`div`,{className:`config-card-header`,onClick:O,children:[(0,Z.jsxs)(`div`,{className:`config-card-title`,children:[(0,Z.jsx)(Gd,{size:16}),(0,Z.jsx)(`span`,{className:`config-card-path`,title:u,children:u})]}),(0,Z.jsx)(`div`,{className:`config-card-header-right`,children:b?(0,Z.jsx)(Ld,{size:16}):(0,Z.jsx)(Fd,{size:16})})]}),b&&(0,Z.jsxs)(`div`,{className:`config-card-body ${n?`config-card-body--fill-height`:``}`,children:[!f&&(0,Z.jsxs)(`div`,{className:`config-empty-state`,children:[(0,Z.jsx)(`div`,{className:`config-empty-icon`,children:`📭`}),(0,Z.jsx)(`div`,{className:`config-empty-title`,children:r(`settings.config_files.file_not_found`)}),(0,Z.jsx)(`div`,{className:`config-empty-desc`,children:r(`settings.config_files.file_not_found_hint`)})]}),f&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(kp,{workspaceId:`config-editor-${e}`,filePath:u,content:o,onContentChange:D,visible:t}),(0,Z.jsxs)(`div`,{className:`config-card-actions`,children:[(0,Z.jsx)(`div`,{className:`config-actions-left`,children:(0,Z.jsx)(()=>{let e={saved:{icon:Bd,color:`success`,text:r(`settings.config_files.status_saved`)},dirty:{icon:Hd,color:`warning`,text:r(`settings.config_files.unsaved_changes`)},saving:{icon:bf,color:`info`,text:r(`settings.config_files.saving`)},error:{icon:Vd,color:`error`,text:r(`settings.config_files.save_failed`)}}[S],t=e.icon;return(0,Z.jsxs)(`div`,{className:`config-status config-status--${e.color}`,children:[(0,Z.jsx)(t,{size:14,className:S===`saving`?`animate-spin`:``}),(0,Z.jsx)(`span`,{children:e.text})]})},{})}),(0,Z.jsxs)(`div`,{className:`config-actions-right`,children:[e===`claude`&&(0,Z.jsxs)(`button`,{className:`btn btn-secondary btn-sm`,onClick:E,title:r(`settings.config_files.format_hint`),children:[(0,Z.jsx)(Ef,{size:14}),(0,Z.jsx)(`span`,{children:r(`settings.config_files.format`)})]}),(0,Z.jsx)(`button`,{className:`btn btn-secondary btn-sm`,onClick:T,disabled:!C||g,children:r(`action.reset`)}),(0,Z.jsx)(`button`,{className:`btn btn-primary btn-sm`,onClick:w,disabled:!C||g,children:r(g?`settings.config_files.saving`:`action.save`)})]})]})]})]})]})}function Mp(e){return e.split(`
105
- `).map(e=>e.trim()).filter(e=>e.length>0)}function Np(e,t){return Object.fromEntries(e.map(e=>[e.id,t()]))}function Pp({providers:e,additionalArgsById:t,setAdditionalArgsById:n,isMobile:r,onLayoutModeChange:i}){let a=X(),o=R(Yu),s=R(Hu),[c,l]=(0,L.useState)(e[0]?.id??`claude`),[u,d]=(0,L.useState)(`base`),[f,p]=(0,L.useState)(`base`),[m,h]=(0,L.useState)(()=>Np(e,()=>``)),[g,_]=(0,L.useState)(()=>Np(e,()=>!1)),v=(0,L.useRef)(Np(e,()=>0));(0,L.useEffect)(()=>{e.some(e=>e.id===c)||l(e[0]?.id??`claude`)},[e,c]),(0,L.useEffect)(()=>{h(t=>{let n=Np(e,()=>``),r=!1;for(let i of e)i.id in t?n[i.id]=t[i.id]:r=!0;return Object.keys(t).length!==e.length&&(r=!0),r?n:t}),_(t=>{let n=Np(e,()=>!1),r=!1;for(let i of e)i.id in t?n[i.id]=t[i.id]:r=!0;return Object.keys(t).length!==e.length&&(r=!0),r?n:t});let t=Np(e,()=>0);for(let n of e)n.id in v.current&&(t[n.id]=v.current[n.id]);v.current=t},[e]);let y=e.find(e=>e.id===c),b=y?t[y.id]??``:``,x=(0,L.useMemo)(()=>Mp(b),[b]),S=r?f===`base`:u===`base`,C=r?f===`config`:u===`config`,w=y?m[y.id]??``:``,T=C;(0,L.useEffect)(()=>{i?.(T?`fill-height`:`default`)},[i,T]),(0,L.useEffect)(()=>{if(s!==`connected`||!y)return;let e=(v.current[y.id]??0)+1;v.current[y.id]=e;let t=!1;return(async()=>{let n=await o(`settings.previewCommand`,{providerId:y.id,config:{additionalArgs:x}});t||v.current[y.id]===e&&h(e=>({...e,[y.id]:n.ok&&n.data?n.data.preview:`Error loading preview`}))})(),()=>{t=!0}},[x,b,s,o,y]),(0,L.useEffect)(()=>{!y||!C||_(e=>e[y.id]?e:{...e,[y.id]:!0})},[y,C]);let E=e=>{l(e),r&&p(`base`)},D=async(e,t)=>{await o(`settings.update`,{settings:{providers:{[e]:{additionalArgs:Mp(t)}}}})};return(0,Z.jsxs)(`div`,{className:`settings-section ${T?`settings-section--fill-height settings-provider-section--config-active`:``}`,children:[(0,Z.jsx)(`div`,{className:`settings-provider-tabs`,children:e.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:`settings-provider-tab ${c===e.id?`settings-provider-tab-active`:``}`,onClick:()=>E(e.id),children:e.displayName},e.id))}),r?null:(0,Z.jsxs)(`div`,{className:`settings-provider-subnav`,role:`tablist`,"aria-label":a(`settings.provider.config`),children:[(0,Z.jsx)(`button`,{type:`button`,className:`settings-provider-subnav-button ${u===`base`?`settings-provider-subnav-button-active`:``}`,"aria-pressed":u===`base`,onClick:()=>d(`base`),children:a(`settings.provider.base`)}),(0,Z.jsx)(`button`,{type:`button`,className:`settings-provider-subnav-button ${u===`config`?`settings-provider-subnav-button-active`:``}`,"aria-pressed":u===`config`,onClick:()=>d(`config`),children:a(`settings.provider.config_file`)})]}),y&&S?(0,Z.jsxs)(`div`,{className:`settings-provider-content ${T?`settings-provider-content--fill-height`:``}`,children:[(0,Z.jsxs)(`div`,{className:`settings-group`,children:[(0,Z.jsx)(`h3`,{className:`settings-group-title`,children:a(`settings.provider.config`)}),(0,Z.jsx)(`p`,{className:`settings-group-desc`,children:a(`settings.provider.startup_args_hint`)}),(0,Z.jsxs)(`div`,{className:`settings-config-field`,children:[(0,Z.jsx)(`label`,{className:`settings-config-label`,htmlFor:`provider-startup-args`,children:a(`settings.provider.startup_args`)}),(0,Z.jsx)(`textarea`,{id:`provider-startup-args`,className:`input settings-provider-args-input`,rows:4,placeholder:a(`settings.provider.startup_args_placeholder`),value:b,onChange:e=>{let t=e.target.value;n(e=>({...e,[y.id]:t})),D(y.id,t)}})]})]}),(0,Z.jsxs)(`div`,{className:`settings-group`,children:[(0,Z.jsx)(`h3`,{className:`settings-group-title`,children:`Command Preview`}),(0,Z.jsx)(`p`,{className:`settings-group-desc`,children:`Preview of the effective provider command`}),(0,Z.jsx)(`div`,{className:`settings-config-field`,children:(0,Z.jsx)(`code`,{className:`settings-command-preview`,children:w})})]}),r?(0,Z.jsxs)(`button`,{type:`button`,className:`settings-provider-mobile-entry`,"aria-label":a(`settings.provider.open_config_file_editor`),onClick:()=>p(`config`),children:[(0,Z.jsx)(`span`,{className:`settings-provider-mobile-entry__title`,children:a(`settings.provider.open_config_file_editor`)}),(0,Z.jsx)(`span`,{className:`settings-provider-mobile-entry__meta`,children:y.id===`codex`?a(`settings.config_files.codex_config`):a(`settings.config_files.claude_config`)})]}):null]}):null,(0,Z.jsx)(`div`,{className:`settings-provider-config-stack ${T?`settings-provider-config-stack--fill-height`:``}`,children:e.filter(e=>g[e.id]||y?.id===e.id&&C).map(e=>{let t=y?.id===e.id&&C;return(0,Z.jsx)(`div`,{className:`settings-provider-config-panel ${T?`settings-provider-config-panel--fill-height`:``} ${t?``:`settings-provider-config-panel-hidden`}`,"aria-hidden":!t,children:(0,Z.jsx)(`div`,{className:`settings-provider-content ${T?`settings-provider-content--fill-height`:``}`,children:(0,Z.jsxs)(`div`,{className:`settings-group ${T?`settings-group--fill-height`:``}`,children:[r?(0,Z.jsx)(`div`,{className:`settings-provider-mobile-config-header`,children:(0,Z.jsx)(`button`,{type:`button`,className:`settings-link`,onClick:()=>p(`base`),children:a(`settings.provider.back_to_base`)})}):null,(0,Z.jsx)(`h3`,{className:`settings-group-title`,children:a(`settings.config_files.title`)}),(0,Z.jsx)(`p`,{className:`settings-group-desc`,children:e.id===`codex`?a(`settings.config_files.codex_config`):a(`settings.config_files.claude_config`)}),(0,Z.jsx)(jp,{configType:e.id,visible:t,fillHeight:T})]})})},e.id)})})]})}function Fp({historyIndex:e,historyLength:t,hasActiveWorkspace:n}){return(typeof e==`number`?e>0:t>1)?`history`:n?`/workspace`:`/`}function Ip(e){let{history:t,hasActiveWorkspace:n}=e,r=t.state;return Fp({historyIndex:r?.idx??null,historyLength:t.length,hasActiveWorkspace:n})}function Lp(e){return Ip({history:typeof window<`u`?window.history:{state:null,length:1},hasActiveWorkspace:e})}var Rp=[{id:`general`,labelKey:`settings.general`,Icon:Tf},{id:`providers`,labelKey:`settings.providers`,Icon:tf},{id:`appearance`,labelKey:`settings.appearance`,Icon:ff},{id:`shortcuts`,labelKey:`settings.shortcuts.title`,Icon:of}],zp=Rp.filter(e=>e.id!==`shortcuts`),Bp=[{id:`command-palette.toggle`,name:`命令面板`,description:`打开/关闭命令面板`,defaultBinding:`Mod+K`,category:`global`},{id:`workspace.new`,name:`新建工作区`,description:`打开新的工作区标签`,defaultBinding:`Mod+N`,category:`global`},{id:`workspace.previous`,name:`上一个工作区`,description:`切换到上一个工作区标签`,defaultBinding:`Mod+Shift+[`,category:`global`},{id:`workspace.next`,name:`下一个工作区`,description:`切换到下一个工作区标签`,defaultBinding:`Mod+Shift+]`,category:`global`},{id:`focus-mode.toggle`,name:`专注模式`,description:`切换专注模式(隐藏非必要面板)`,defaultBinding:`F`,category:`global`},{id:`agent.split-vertical`,name:`垂直分屏`,description:`垂直分割 Agent 面板`,defaultBinding:`Mod+D`,category:`workspace`},{id:`agent.split-horizontal`,name:`水平分屏`,description:`水平分割 Agent 面板`,defaultBinding:`Mod+Shift+D`,category:`workspace`},{id:`editor.save`,name:`保存文件`,description:`保存当前编辑的文件`,defaultBinding:`Mod+S`,category:`editor`}],Vp=Vr(`ui.customShortcuts`,{});function Hp(e){return e.replace(`Mod`,navigator.platform.includes(`Mac`)?`⌘`:`Ctrl`).replace(`Shift`,`⇧`).replace(`Alt`,navigator.platform.includes(`Mac`)?`⌥`:`Alt`)}function Up(e,t){return t[e]||Bp.find(t=>t.id===e)?.defaultBinding||``}var Wp={global:`全局`,workspace:`工作区`,editor:`编辑器`,terminal:`终端`};function Gp(){let e=X(),t=R(Yu),[n,r]=Te(Vp),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(`global`),c=(0,L.useRef)(null);(0,L.useEffect)(()=>{i&&c.current&&c.current.focus()},[i]);let l=(0,L.useCallback)((e,n)=>{e.preventDefault(),e.stopPropagation();let i=[];if((navigator.platform.includes(`Mac`)?e.metaKey:e.ctrlKey)&&i.push(`Mod`),e.shiftKey&&i.push(`Shift`),e.altKey&&i.push(`Alt`),e.key.length===1)i.push(e.key.toUpperCase());else if(e.key===`Escape`){a(null);return}else i.push(e.key);let o=i.join(`+`);r(e=>({...e,[n]:o})),t(`settings.update`,{settings:{shortcuts:{[n]:o}}}),a(null)},[r,t]),u=(0,L.useCallback)(e=>{r(t=>{let n={...t};return delete n[e],n}),t(`settings.update`,{settings:{shortcuts:{[e]:null}}})},[r,t]),d=(0,L.useCallback)(()=>{r({}),t(`settings.update`,{settings:{shortcuts:{}}})},[r,t]),f=Bp.filter(e=>e.category===o);return(0,Z.jsxs)(`div`,{className:`settings-section`,children:[(0,Z.jsx)(`div`,{className:`shortcuts-category-tabs`,children:Object.keys(Wp).map(e=>(0,Z.jsx)(`button`,{className:`shortcuts-category-tab ${o===e?`active`:``}`,onClick:()=>s(e),children:Wp[e]},e))}),(0,Z.jsx)(`div`,{className:`shortcuts-list`,children:f.map(e=>{let t=Up(e.id,n),r=n[e.id]!==void 0,o=i===e.id;return(0,Z.jsxs)(`div`,{className:`shortcuts-item ${r?`shortcuts-item-custom`:``}`,children:[(0,Z.jsxs)(`div`,{className:`shortcuts-info`,children:[(0,Z.jsx)(`span`,{className:`shortcuts-name`,children:e.name}),(0,Z.jsx)(`span`,{className:`shortcuts-desc`,children:e.description})]}),(0,Z.jsx)(`div`,{className:`shortcuts-binding`,children:o?(0,Z.jsx)(`input`,{ref:c,type:`text`,className:`input shortcuts-capture`,placeholder:`按下快捷键...`,onKeyDown:t=>l(t,e.id),onBlur:()=>a(null),readOnly:!0}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`kbd`,{className:`shortcuts-key`,onClick:()=>a(e.id),children:Hp(t)}),r&&(0,Z.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:()=>u(e.id),title:`重置为默认`,children:`↺`})]})})]},e.id)})}),(0,Z.jsx)(`div`,{className:`shortcuts-footer`,children:(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:d,children:e(`settings.shortcuts.reset_all`)})})]})}var Kp=Rp[0].id;function qp(){if(typeof window>`u`)return!1;let e=window.navigator;return window.matchMedia?.(`(display-mode: standalone)`).matches===!0||e.standalone===!0}function Jp(){if(typeof window>`u`)return!1;let{userAgent:e=``,maxTouchPoints:t=0,platform:n=``}=window.navigator,r=e.toLowerCase();return/android|iphone|ipad|ipod|mobile/.test(r)||n===`MacIntel`&&t>1}function Yp(){return typeof window>`u`||!(`Notification`in window)?`unsupported`:Jp()?qp()?`available`:`limited`:`available`}function Xp(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`
106
- `):``}function Zp(e,t){return Object.fromEntries(t.map(t=>[t.id,Xp(e[`providers.${t.id}.additionalArgs`])]))}function Qp(){let e=X(),t=e(`settings.load_failed_unknown`),n=Zt(),r=Ir()===`mobile`,i=R(Yu),a=R(Hu),o=R(od),[s,c]=(0,L.useState)(()=>r?{kind:`root`,lastSection:Kp}:{kind:`detail`,section:Kp}),[l]=(0,L.useState)([{id:`claude`,displayName:`Claude`},{id:`codex`,displayName:`Codex`}]),[u,d]=(0,L.useState)(!0),[f,p]=(0,L.useState)(!0),[m,h]=(0,L.useState)(600),[g,_]=(0,L.useState)(`standard`),[v,y]=(0,L.useState)({}),[b,x]=(0,L.useState)(`default`),[S,C]=(0,L.useState)(null),[w,T]=(0,L.useState)(0),[E,D]=Te(Ur),[O,k]=Te(Hr),A=z(op),j=s.kind===`detail`?s.section:s.lastSection,ee=r?zp:Rp,M=ee.find(e=>e.id===j)??ee[0];(0,L.useEffect)(()=>{c(e=>r?e.kind===`root`?e:{kind:`root`,lastSection:e.section}:e.kind===`detail`?e:{kind:`detail`,section:e.lastSection})},[r]),(0,L.useEffect)(()=>{if(a!==`connected`)return;let e=!1;return(async()=>{let n=await i(`settings.get`,{});if(!n.ok||!n.data){e||C(n.error?.message??t);return}let r=n.data;e||(C(null),typeof r[`notifications.enabled`]==`boolean`&&d(r[`notifications.enabled`]),typeof r[`notifications.soundEnabled`]==`boolean`&&p(r[`notifications.soundEnabled`]),h(Yr(r[`supervisor.evaluationTimeoutSec`])),A({enabled:typeof r[`notifications.enabled`]==`boolean`?r[`notifications.enabled`]:!0,soundEnabled:typeof r[`notifications.soundEnabled`]==`boolean`?r[`notifications.soundEnabled`]:!0}),(r[`appearance.terminalRenderer`]===`standard`||r[`appearance.terminalRenderer`]===`compatibility`)&&_(r[`appearance.terminalRenderer`]),(r[`appearance.locale`]===`zh`||r[`appearance.locale`]===`en`)&&D(r[`appearance.locale`]),y(Zp(r,l)))})(),()=>{e=!0}},[a,i,D,A,t,w]),(0,L.useEffect)(()=>{j!==`providers`&&x(`default`)},[j]);let N=()=>{let e=Lp(!!o);if(e===`history`){n(-1);return}n(e)},te=()=>{if(r&&s.kind===`detail`){c({kind:`root`,lastSection:s.section});return}N()},ne=()=>{switch(j){case`general`:return(0,Z.jsx)(tm,{notificationsEnabled:u,setNotificationsEnabled:d,soundEnabled:f,setSoundEnabled:p,supervisorEvaluationTimeoutSec:m,setSupervisorEvaluationTimeoutSec:h});case`appearance`:return(0,Z.jsx)(nm,{locale:E,setLocale:D,terminalRenderer:g,setTerminalRenderer:_,theme:O,setTheme:k});case`providers`:return(0,Z.jsx)(Pp,{providers:l,additionalArgsById:v,setAdditionalArgsById:y,isMobile:r,onLayoutModeChange:x});case`shortcuts`:return r?null:(0,Z.jsx)(Gp,{});default:return null}},re=()=>(0,Z.jsx)(`main`,{className:`settings-content settings-content--mobile-root`,children:(0,Z.jsx)(`div`,{className:`settings-mobile-list`,children:ee.map(({id:t,labelKey:n,Icon:r})=>(0,Z.jsxs)(`button`,{type:`button`,className:`settings-mobile-item`,onClick:()=>c({kind:`detail`,section:t}),children:[(0,Z.jsx)(`span`,{className:`settings-mobile-item__icon`,children:(0,Z.jsx)(r,{size:18})}),(0,Z.jsx)(`span`,{className:`settings-mobile-item__label`,children:e(n)}),(0,Z.jsx)(Id,{size:16,className:`settings-mobile-item__arrow`})]},t))})}),ie=r&&s.kind===`root`,ae=e(r?ie?`settings.title`:M.labelKey:`settings.title`);return(0,Z.jsxs)(`div`,{className:`settings-page ${r?`settings-page--mobile`:``}`,children:[(0,Z.jsx)(`header`,{className:`settings-header`,children:(0,Z.jsx)(Qf,{title:ae,titleAs:`div`,onBack:te,backLabel:e(`action.back`)})}),ie?re():(0,Z.jsxs)(`div`,{className:`settings-body ${r?`settings-body--mobile`:``} ${b===`fill-height`?`settings-body--fill-height`:``}`,children:[r?null:(0,Z.jsx)(`aside`,{className:`settings-sidebar`,children:(0,Z.jsx)(`nav`,{className:`settings-nav`,children:ee.map(({id:t,labelKey:n,Icon:r})=>(0,Z.jsx)($p,{icon:(0,Z.jsx)(r,{size:16}),label:e(n),active:j===t,onClick:()=>c({kind:`detail`,section:t})},t))})}),(0,Z.jsxs)(`main`,{className:`settings-content ${r?`settings-content--mobile`:``} ${b===`fill-height`?`settings-content--fill-height`:``}`,children:[S&&(0,Z.jsxs)(`div`,{className:`settings-page__notice settings-page__notice--error`,role:`alert`,children:[(0,Z.jsxs)(`div`,{className:`settings-page__notice-copy`,children:[(0,Z.jsx)(`span`,{className:`settings-page__notice-title`,children:e(`settings.load_failed`)}),(0,Z.jsx)(`span`,{className:`settings-page__notice-message`,children:S})]}),(0,Z.jsx)(`button`,{type:`button`,className:`settings-link`,onClick:()=>T(e=>e+1),children:e(`action.refresh`)})]}),(0,Z.jsx)(ip,{variant:`embedded`,showLoadError:!S}),ne()]})]}),(0,Z.jsxs)(`footer`,{className:`settings-footer ${r?`settings-footer--mobile`:``}`,children:[(0,Z.jsx)(`span`,{className:`settings-autosave`,children:e(`settings.autosave_hint`)}),(0,Z.jsx)(`span`,{className:`settings-version`,children:`v0.2.6`})]})]})}function $p({icon:e,label:t,active:n,onClick:r}){return(0,Z.jsxs)(`button`,{className:`settings-nav-item ${n?`settings-nav-item-active`:``}`,onClick:r,children:[(0,Z.jsx)(`span`,{className:`settings-nav-icon`,children:e}),(0,Z.jsx)(`span`,{className:`settings-nav-label`,children:t}),n&&(0,Z.jsx)(Id,{size:14,className:`settings-nav-arrow`})]})}function em(e){let t=e.trim();if(!/^\d+$/.test(t))return null;let n=Number(t);return!Number.isSafeInteger(n)||n<1||n>86400?null:n}function tm({notificationsEnabled:e,setNotificationsEnabled:t,soundEnabled:n,setSoundEnabled:r,supervisorEvaluationTimeoutSec:i,setSupervisorEvaluationTimeoutSec:a}){let o=X(),s=R(Yu),c=z(op),[l,u]=(0,L.useState)(`unavailable`),[d,f]=(0,L.useState)(`unsupported`),[p,m]=(0,L.useState)(String(i)),[h,g]=(0,L.useState)(null),_=async e=>await s(`settings.update`,{settings:e}),v=e=>{c(e)};(0,L.useEffect)(()=>{if(f(Yp()),`Notification`in window){u(Notification.permission);return}u(`unavailable`)},[]),(0,L.useEffect)(()=>{m(String(i))},[i]),(0,L.useEffect)(()=>{g(null)},[i]);let y=async()=>{`Notification`in window&&u(await Notification.requestPermission())},b=async()=>{let e=em(p);if(e===null){m(String(i)),g(o(`settings.supervisor.validation_error`,{max:Jr}));return}if(e===i){m(String(e)),g(null);return}let t=await _({supervisor:{evaluationTimeoutSec:e}});if(!t.ok){m(String(i)),g(t.error?.message||o(`settings.config_files.save_failed`));return}a(e),m(String(e)),g(null)};return(0,Z.jsxs)(`div`,{className:`settings-section`,children:[(0,Z.jsxs)(`div`,{className:`settings-group`,children:[(0,Z.jsx)(`h3`,{className:`settings-group-title`,children:o(`settings.notifications`)}),(0,Z.jsx)(`p`,{className:`settings-group-desc`,children:o(`settings.notifications_channel_hint`)}),(0,Z.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Z.jsxs)(`div`,{className:`settings-toggle-info`,children:[(0,Z.jsx)(`span`,{className:`settings-toggle-label`,children:o(`settings.notifications_enabled`)}),(0,Z.jsx)(`span`,{className:`settings-toggle-desc`,children:o(`settings.notifications_enabled_hint`)})]}),(0,Z.jsxs)(`label`,{className:`settings-toggle`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>{let r=e.target.checked;t(r),v({enabled:r,soundEnabled:n}),_({notifications:{enabled:r}})}}),(0,Z.jsx)(`span`,{className:`settings-toggle-slider`})]})]}),(0,Z.jsxs)(`div`,{className:`settings-toggle-row`,children:[(0,Z.jsxs)(`div`,{className:`settings-toggle-info`,children:[(0,Z.jsx)(`span`,{className:`settings-toggle-label`,children:o(`settings.notification_sound`)}),(0,Z.jsx)(`span`,{className:`settings-toggle-desc`,children:o(`settings.notification_sound_hint`)})]}),(0,Z.jsxs)(`label`,{className:`settings-toggle`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:t=>{let n=t.target.checked;r(n),v({enabled:e,soundEnabled:n}),_({notifications:{soundEnabled:n}})},disabled:!e}),(0,Z.jsx)(`span`,{className:`settings-toggle-slider`})]})]}),(0,Z.jsxs)(`div`,{className:`settings-info-row`,children:[(0,Z.jsx)(`span`,{className:`settings-info-label`,children:o(`settings.notification_status`)}),(0,Z.jsxs)(`span`,{className:`settings-info-value settings-capability-${d}`,children:[d===`available`&&o(`settings.notification_status_available`),d===`limited`&&(0,Z.jsxs)(Z.Fragment,{children:[o(`settings.notification_status_limited`),(0,Z.jsx)(`span`,{className:`settings-status-hint`,children:o(`settings.notification_status_limited_hint`)})]}),d===`unsupported`&&(0,Z.jsxs)(Z.Fragment,{children:[o(`settings.notification_status_unsupported`),(0,Z.jsx)(`span`,{className:`settings-status-hint`,children:o(`settings.notification_status_unsupported_hint`)})]})]})]}),(0,Z.jsxs)(`div`,{className:`settings-info-row`,children:[(0,Z.jsx)(`span`,{className:`settings-info-label`,children:o(`settings.notification_permission`)}),(0,Z.jsxs)(`span`,{className:`settings-info-value settings-permission-${l}`,children:[l===`granted`&&o(`settings.permission_granted`),l===`denied`&&(0,Z.jsxs)(Z.Fragment,{children:[o(`settings.permission_denied`),(0,Z.jsx)(`span`,{className:`settings-status-hint`,children:o(`settings.permission_denied_hint`)})]}),l===`default`&&d===`available`&&(0,Z.jsx)(`button`,{className:`settings-link`,onClick:y,children:o(`settings.permission_request`)}),l===`default`&&d===`limited`&&(0,Z.jsxs)(Z.Fragment,{children:[o(`settings.permission_unavailable`),(0,Z.jsx)(`span`,{className:`settings-status-hint`,children:o(`settings.permission_limited_hint`)})]}),l===`unavailable`&&(0,Z.jsxs)(Z.Fragment,{children:[o(`settings.permission_unavailable`),(0,Z.jsx)(`span`,{className:`settings-status-hint`,children:o(`settings.permission_unavailable_hint`)})]})]})]})]}),(0,Z.jsxs)(`div`,{className:`settings-group`,children:[(0,Z.jsx)(`h3`,{className:`settings-group-title`,children:o(`settings.supervisor.title`)}),(0,Z.jsx)(`p`,{className:`settings-group-desc`,children:o(`settings.supervisor.hint`)}),(0,Z.jsxs)(`div`,{className:`settings-config-field settings-config-field--inline`,children:[(0,Z.jsx)(`label`,{className:`settings-config-label`,htmlFor:`supervisor-evaluation-timeout`,children:o(`settings.supervisor.evaluation_timeout`)}),(0,Z.jsx)(`div`,{className:`settings-config-control`,children:(0,Z.jsx)(`input`,{id:`supervisor-evaluation-timeout`,className:`input settings-input-compact`,type:`number`,min:1,max:Jr,step:1,inputMode:`numeric`,"aria-invalid":h?`true`:`false`,value:p,onChange:e=>{m(e.target.value),h&&g(null)},onBlur:()=>{b()},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),b())}})}),h?(0,Z.jsx)(`span`,{className:`form-error`,role:`alert`,children:h}):null]})]})]})}function nm({locale:e,setLocale:t,terminalRenderer:n,setTerminalRenderer:r,theme:i,setTheme:a}){let o=X(),s=R(Yu),c=async e=>{await s(`settings.update`,{settings:e})},l=e=>{a(e),document.documentElement.setAttribute(`data-theme`,e),c({appearance:{theme:e}})};return(0,Z.jsxs)(`div`,{className:`settings-section`,children:[(0,Z.jsxs)(`div`,{className:`settings-group`,children:[(0,Z.jsx)(`h3`,{className:`settings-group-title`,children:o(`settings.theme.title`)}),(0,Z.jsx)(`p`,{className:`settings-group-desc`,children:o(`settings.theme.hint`)}),(0,Z.jsxs)(`div`,{className:`settings-pills`,children:[(0,Z.jsxs)(`button`,{className:`settings-pill ${i===`dark`?`settings-pill-active`:``}`,onClick:()=>l(`dark`),children:[i===`dark`&&(0,Z.jsx)(Pd,{size:12}),(0,Z.jsx)(`span`,{children:o(`settings.theme.dark`)})]}),(0,Z.jsxs)(`button`,{className:`settings-pill ${i===`light`?`settings-pill-active`:``}`,onClick:()=>l(`light`),children:[i===`light`&&(0,Z.jsx)(Pd,{size:12}),(0,Z.jsx)(`span`,{children:o(`settings.theme.light`)})]})]})]}),(0,Z.jsxs)(`div`,{className:`settings-group`,children:[(0,Z.jsx)(`h3`,{className:`settings-group-title`,children:o(`settings.terminal_renderer`)}),(0,Z.jsx)(`p`,{className:`settings-group-desc`,children:o(`settings.terminal_renderer_hint`)}),(0,Z.jsxs)(`div`,{className:`settings-pills`,children:[(0,Z.jsxs)(`button`,{className:`settings-pill ${n===`standard`?`settings-pill-active`:``}`,onClick:()=>{r(`standard`),c({appearance:{terminalRenderer:`standard`}})},children:[n===`standard`&&(0,Z.jsx)(Pd,{size:12}),(0,Z.jsx)(`span`,{children:o(`settings.terminal_standard`)})]}),(0,Z.jsxs)(`button`,{className:`settings-pill ${n===`compatibility`?`settings-pill-active`:``}`,onClick:()=>{r(`compatibility`),c({appearance:{terminalRenderer:`compatibility`}})},children:[n===`compatibility`&&(0,Z.jsx)(Pd,{size:12}),(0,Z.jsx)(`span`,{children:o(`settings.terminal_compatibility`)})]})]})]}),(0,Z.jsxs)(`div`,{className:`settings-group`,children:[(0,Z.jsx)(`h3`,{className:`settings-group-title`,children:o(`settings.language.title`)}),(0,Z.jsx)(`p`,{className:`settings-group-desc`,children:o(`settings.language.hint`)}),(0,Z.jsxs)(`div`,{className:`settings-pills`,children:[(0,Z.jsxs)(`button`,{className:`settings-pill ${e===`zh`?`settings-pill-active`:``}`,onClick:()=>{t(`zh`),c({appearance:{locale:`zh`}})},children:[e===`zh`&&(0,Z.jsx)(Pd,{size:12}),(0,Z.jsx)(`span`,{children:o(`settings.language.zh`)})]}),(0,Z.jsxs)(`button`,{className:`settings-pill ${e===`en`?`settings-pill-active`:``}`,onClick:()=>{t(`en`),c({appearance:{locale:`en`}})},children:[e===`en`&&(0,Z.jsx)(Pd,{size:12}),(0,Z.jsx)(`span`,{children:o(`settings.language.en`)})]})]})]})]})}var rm=()=>{let e=X(),t=Zt(),[n,r]=(0,L.useState)(!1),i=Ir()===`mobile`,a=[{icon:(0,Z.jsx)(Ff,{size:18}),title:e(`welcome.features.agent_first.title`),description:e(`welcome.features.agent_first.description`)},{icon:(0,Z.jsx)(ef,{size:18}),title:e(`welcome.features.git_tools.title`),description:e(`welcome.features.git_tools.description`)},{icon:(0,Z.jsx)(jf,{size:18}),title:e(`welcome.features.terminals.title`),description:e(`welcome.features.terminals.description`)}];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`welcome-container ${i?`welcome-container--mobile`:``}`,children:(0,Z.jsxs)(`div`,{className:`welcome-card ${i?`welcome-card--mobile`:``}`,children:[(0,Z.jsx)(`div`,{className:`welcome-kicker`,children:e(`welcome.kicker`)}),(0,Z.jsx)(`h1`,{className:`welcome-title`,children:e(`welcome.title`)}),(0,Z.jsx)(`p`,{className:`welcome-body`,children:e(`welcome.description`)}),(0,Z.jsxs)(`button`,{className:`welcome-btn`,onClick:()=>{r(!0)},children:[(0,Z.jsx)(vf,{size:18}),(0,Z.jsx)(`span`,{children:e(`action.open_workspace`)})]}),(0,Z.jsxs)(`button`,{className:`welcome-link`,onClick:()=>{t(`/settings`)},children:[(0,Z.jsx)(Tf,{size:14}),(0,Z.jsx)(`span`,{children:e(`action.settings`)})]}),(0,Z.jsx)(`div`,{className:`welcome-divider`}),(0,Z.jsx)(`div`,{className:`welcome-features`,children:a.map((e,t)=>(0,Z.jsxs)(`div`,{className:`welcome-feature`,children:[(0,Z.jsx)(`div`,{className:`welcome-feature-icon`,children:e.icon}),(0,Z.jsxs)(`div`,{className:`welcome-feature-text`,children:[(0,Z.jsx)(`div`,{className:`welcome-feature-title`,children:e.title}),(0,Z.jsx)(`div`,{className:`welcome-feature-desc`,children:e.description})]})]},t))})]})}),n?(0,Z.jsx)(tp,{onClose:()=>r(!1)}):null]})};function im(){let e=(0,L.useRef)(0),t=Zt(),n=Jt(),r=R(Hu),i=R(Yu),a=R(ad),o=R(Wr),s=R(Ju),c=R(td),l=z($u),u=z(ed),d=z(td),f=z(nd);(0,L.useEffect)(()=>{if(s===null)return;let p=n.pathname===`/workspace`,m=s===!0;if(m&&!o){if(p){t(`/login`,{replace:!0});return}return}if(n.pathname===`/login`&&(!m||o)){t(`/`,{replace:!0});return}if(!(n.pathname!==`/`&&n.pathname!==`/workspace`)){if(c===`idle`){if(r!==`connected`)return;let t=e.current+1;e.current=t,d(`loading`),f(null),i(`workspace.list`,{}).then(n=>{if(e.current!==t)return;if(!n.ok){d(`error`),f(n.error?.message??`Failed to fetch workspace list`);return}let r=Array.isArray(n.data)?n.data:[],i={};for(let e of r)i[e.id]=e;l(i),u(r.map(e=>e.id)),d(`ready`),f(null)}).catch(n=>{e.current===t&&(d(`error`),f(n instanceof Error?n.message:`Failed to fetch workspace list`))});return}if(c===`ready`){if(n.pathname===`/`&&a.length>0){t(`/workspace`,{replace:!0});return}n.pathname===`/workspace`&&a.length===0&&t(`/`,{replace:!0})}}},[s,o,r,i,n.pathname,t,u,l,f,d,a.length,c])}function am(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.path==`string`&&typeof t.uiState==`object`&&t.uiState!==null}function om(e){let t=R(Yu),n=z($u),r=ve();return{persistUiState:(0,L.useCallback)(async i=>{if(!e||e.startsWith(`__workspace_`))return!1;let a=r.get($u)[e];if(!a)return!1;let o={...a.uiState,leftPanelWidth:r.get(Jf),bottomPanelHeight:r.get(Yf),focusMode:r.get(qf),...i};n(t=>{let n=t[e];return n?{...t,[e]:{...n,uiState:o}}:t});try{let r=await t(`workspace.uiState.set`,{workspaceId:e,uiState:o});return r.ok?(am(r.data)&&n(t=>({...t,[e]:r.data})),!0):(console.error(`Failed to persist workspace ui state:`,r.error?.message),!1)}catch(e){return console.error(`Failed to persist workspace ui state:`,e),!1}},[t,n,r,e])}}var sm=`ui.paneLayout.`,cm=`ui.paneRatio.`,lm={id:`root`,type:`leaf`},um=Zu(e=>I(lm));function dm(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function fm(e){let t=dm();if(!t)return null;try{let n=t.getItem(`${sm}${e}`);return n?JSON.parse(n):null}catch{return null}}function pm(e){let t=dm();if(t)try{t.removeItem(`${sm}${e}`)}catch{}}function mm(e,t){let n=dm();if(!n)return null;try{let r=n.getItem(`${cm}${e}.${t}`);if(r===null)return null;let i=Number(r);return Number.isFinite(i)?i:null}catch{return null}}function hm(e,t,n){let r=dm();if(r)try{r.setItem(`${cm}${e}.${t}`,String(n))}catch{}}function gm(e){return{id:e,type:`leaf`}}function _m(e,t){return{id:e,type:`leaf`,sessionId:t}}function vm(e,t,n){if(e.type===`leaf`){if(e.id!==t)return e;let r=`split-${e.id}-${n}-${Date.now()}`;return{id:r,type:`split`,direction:n,ratio:.5,children:[{...e},gm(`${r}-draft`)]}}let r=e.children??[],i=!1,a=r.map(e=>{let r=vm(e,t,n);return r!==e&&(i=!0),r});return i?{...e,children:a}:e}function ym(e,t,n){if(e.type===`leaf`){if(e.sessionId!==t)return e;let r=`split-${e.id}-${n}-${Date.now()}`;return{id:r,type:`split`,direction:n,ratio:.5,children:[{...e},gm(`${r}-draft`)]}}let r=e.children??[],i=!1,a=r.map(e=>{let r=ym(e,t,n);return r!==e&&(i=!0),r});return i?{...e,children:a}:e}function bm(e,t,n){if(e.type===`leaf`)return e.id===t?{...e,sessionId:n}:e;let r=e.children??[],i=!1,a=r.map(e=>{let r=bm(e,t,n);return r!==e&&(i=!0),r});return i?{...e,children:a}:e}function xm(e,t){return t.startsWith(`__draft__`)?Cm(e,t.replace(`__draft__`,``)):wm(e,t)}function Sm(e,t){if(e.type===`leaf`)return e.id===t&&!e.sessionId?null:e;let n=e.children??[],r=!1,i=[];for(let e of n){let n=Sm(e,t);n!==e&&(r=!0),n!==null&&i.push(n)}return r?i.length===1?i[0]:i.length===0?null:{...e,children:i}:e}function Cm(e,t){return Sm(e,t)??{id:e.id,type:`leaf`}}function wm(e,t){if(e.type===`leaf`)return e.sessionId===t?{id:e.id,type:`leaf`}:e;let n=e.children??[],r=!1,i=n.map(e=>{let n=wm(e,t);return n!==e&&(r=!0),n});return r?{...e,children:i}:e}function Tm(e){return e.type===`leaf`?e.sessionId?[e.sessionId]:[]:e.children?.flatMap(e=>Tm(e))??[]}function Em(e,t,n,r=`horizontal`){let i=km(e,t);if(i)return i;if(n){let i=Am(e,t,r,n);if(i)return i}return Am(e,t,r)||(e.type===`leaf`&&!e.sessionId?{...e,sessionId:t}:{id:`root`,type:`leaf`,sessionId:t})}function Dm(e){if(e.length===0)return{id:`root`,type:`leaf`};if(e.length===1)return{id:`fallback-leaf-1`,type:`leaf`,sessionId:e[0]};let[t,...n]=e;return{id:`split-fallback-1`,type:`split`,direction:`horizontal`,ratio:.5,children:[{id:`fallback-leaf-1`,type:`leaf`,sessionId:t},jm(n,2)]}}function Om(e,t){if(e.type===`leaf`)return e.sessionId&&!t.has(e.sessionId)?{id:e.id,type:`leaf`}:e;let n=e.children??[],r=!1,i=n.map(e=>{let n=Om(e,t);return n!==e&&(r=!0),n});return r?i.length===1?i[0]:{...e,children:i}:e}function km(e,t){if(e.type===`leaf`)return e.sessionId?null:{...e,sessionId:t};let n=e.children??[];for(let r=0;r<n.length;r+=1){let i=n[r],a=km(i,t);if(a)return{...e,children:n.map((e,t)=>t===r?a:e)}}return null}function Am(e,t,n,r){if(e.type===`leaf`){if(!e.sessionId||r&&e.sessionId!==r)return null;let i=`split-${e.id}-${n}-${Date.now()}`;return{id:i,type:`split`,direction:n,ratio:.5,children:[{...e},_m(`${i}-session`,t)]}}let i=e.children??[];for(let a=0;a<i.length;a+=1){let o=i[a],s=Am(o,t,n,r);if(s)return{...e,children:i.map((e,t)=>t===a?s:e)}}return null}function jm(e,t){if(e.length===1)return{id:`fallback-leaf-${t}`,type:`leaf`,sessionId:e[0]};let[n,...r]=e;return{id:`split-fallback-${t}`,type:`split`,direction:`horizontal`,ratio:.5,children:[{id:`fallback-leaf-${t}`,type:`leaf`,sessionId:n},jm(r,t+1)]}}function Mm(e){let t=z(um(e)),n=ve(),{persistUiState:r}=om(e),i=(0,L.useCallback)(i=>{let a=n.get(um(e)),o=typeof i==`function`?i(a):i;return t(o),r({paneLayout:o}),o},[r,t,n,e]),a=(0,L.useCallback)((e,t)=>{i(n=>ym(n,e,t))},[i]),o=(0,L.useCallback)((e,t)=>{i(n=>vm(n,e,t))},[i]),s=(0,L.useCallback)(e=>{i(t=>xm(t,e))},[i]),c=(0,L.useCallback)(e=>{i(t=>Cm(t,e))},[i]),l=(0,L.useCallback)((e,t)=>{i(n=>bm(n,e,t))},[i]),u=(0,L.useCallback)(e=>{i({id:`root`,type:`leaf`,sessionId:e})},[i]);return{appendSession:(0,L.useCallback)((e,t,n=`horizontal`)=>{i(r=>Em(r,e,t,n))},[i]),assignSession:l,closeDraftPane:c,closeSessionPane:s,replaceWithSession:u,splitDraftPane:o,splitSessionPane:a}}var Nm=new TextEncoder,Pm=100,Fm=5e3;function Im(e){return new Promise(t=>{setTimeout(t,e)})}function Lm(){let e=R(Yu),t=R(Vu),n=ve(),r=(0,L.useCallback)(async t=>{let n=await e(`session.stop`,{sessionId:t});n.ok||console.error(`Failed to stop session:`,n.error?.message)},[e]);return{closeSession:(0,L.useCallback)(async t=>{let r=n.get(ud(t));if(!r)return;if(r.state===`ended`){let n=await e(`session.remove`,{sessionId:t});n.ok||console.error(`Failed to remove ended session:`,n.error?.message);return}let i=await e(`session.stop`,{sessionId:t});if(!i.ok&&i.error?.code!==`invalid_state`){console.error(`Failed to stop session before removal:`,i.error?.message);return}let a=Date.now()+Fm;for(;Date.now()<a;){let r=n.get(ud(t));if(!r)return;if(r.state===`ended`){let n=await e(`session.remove`,{sessionId:t});n.ok||console.error(`Failed to remove ended session:`,n.error?.message);return}await Im(Pm)}console.error(`Timed out waiting for session to end before removal:`,t)},[e,n]),submitSessionPrompt:(0,L.useCallback)(async(e,n)=>{let r=n.trim();if(!t||!r)return!1;try{return await t.sendTerminalInput(e,Nm.encode(`${r}\r`),`submit`,r),!0}catch(e){return console.error(`Failed to submit session prompt:`,e),!1}},[t]),stopSession:r}}function Rm(e,t){let n=R(sd),r=e===void 0?n:e,i=r?.id??`__workspace_empty__`,a=t?.disabled??!1,o=R(Yu),s=R(Hu),c=R(ld(i)),l=R(um(i)),u=z(cd),d=z(um(i)),f=ve(),{persistUiState:p}=om(i);return(0,L.useEffect)(()=>{if(a||!r||s!==`connected`)return;let e=!1;return o(`session.list`,{workspaceId:r.id}).then(t=>{if(e||!t.ok||!t.data){console.error(`Failed to fetch sessions:`,t.error?.message);return}let n=t.data;u(e=>{let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e.workspaceId!==r.id));for(let e of n)t[e.id]=e;return t});let a=f.get(um(i)),o=zm(r?.uiState.paneLayout),s=o?null:fm(r.id),c=o??s??a??lm,l=new Set(n.filter(e=>e.state!==`draft`).map(e=>e.id)),m=n.filter(e=>e.state!==`draft`),h=Om(c,l),g=h;h!==a&&d(h),Tm(h).length>0||m.length>0&&(g=Dm(m.map(e=>e.id)),d(g)),o||(s!==null||Tm(g).length>0)&&p({paneLayout:g}).then(e=>{e&&s!==null&&pm(r.id)})}).catch(t=>{e||console.error(`Failed to fetch sessions:`,t)}),()=>{e=!0}},[s,a,o,p,d,u,f,r?.id,i]),{workspace:r,workspaceId:i,sessions:c,paneLayout:l,setPaneLayout:d}}function zm(e){return e?{...e,children:e.children?.map(e=>zm(e)??lm)}:null}function Bm(e){return{providerId:e,available:!0,missingCommands:[],missingPrerequisites:[],autoInstallSupported:!1,installReadiness:`ready`,manualGuideKeys:[],docUrls:{provider:``,prerequisites:{}}}}function Vm(e){return{claude:{runtime:e?.claude??Bm(`claude`),loading:!1},codex:{runtime:e?.codex??Bm(`codex`),loading:!1}}}function Hm(e,t,n){let[r,i]=(0,L.useState)(Vm()),a=(0,L.useRef)({});(0,L.useEffect)(()=>{let t=!1;return(async()=>{let n=await e(`provider.runtimeStatus`,{});if(!t){if(!n.ok||!n.data){i(e=>({claude:{...e.claude,...Vm().claude},codex:{...e.codex,...Vm().codex}}));return}i(e=>({claude:{...e.claude,...Vm(n.data.providers).claude},codex:{...e.codex,...Vm(n.data.providers).codex}}))}})(),()=>{t=!0;for(let e of Object.values(a.current))typeof e==`number`&&window.clearTimeout(e)}},[e]);let o=async()=>{let t=await e(`provider.runtimeStatus`,{});!t.ok||!t.data||i(e=>({claude:{...e.claude,runtime:t.data.providers.claude,loading:!1},codex:{...e.codex,runtime:t.data.providers.codex,loading:!1}}))},s=(e,t,n)=>{i(r=>({...r,[e]:{...r[e],loading:!1,inlineError:n,installJob:r[e].installJob?{...r[e].installJob,failure:t}:r[e].installJob}}))};return{states:r,launch:async c=>{let l=r[c].runtime;if(!l)return;if(i(e=>({...e,[c]:{...e[c],loading:!0,inlineError:void 0}})),l.available){let r=await e(`session.create`,{workspaceId:t,providerId:c});if(r.ok&&r.data){n(r.data,c),i(e=>({...e,[c]:{...e[c],loading:!1}}));return}r.error?.code===`provider_cli_missing`&&await o(),i(e=>({...e,[c]:{...e[c],loading:!1,inlineError:r.error?.message}}));return}if(!l.autoInstallSupported){i(e=>({...e,[c]:{...e[c],loading:!1,inlineError:`manual`}}));return}let u=await e(`provider.install.start`,{providerId:c});if(!u.ok||!u.data){i(e=>({...e,[c]:{...e[c],loading:!1,inlineError:u.error?.message}}));return}if(i(e=>({...e,[c]:{...e[c],installJob:u.data,loading:!1}})),u.data.status===`failed`){s(c,u.data.failure,u.data.failure?.message);return}if(u.data.status===`succeeded`){await o();let r=await e(`session.create`,{workspaceId:t,providerId:c});r.ok&&r.data&&n(r.data,c);return}let d=async()=>{let r=await e(`provider.install.get`,{jobId:u.data.jobId});if(!r.ok||!r.data){i(e=>({...e,[c]:{...e[c],loading:!1,inlineError:r.error?.message}}));return}if(i(e=>({...e,[c]:{...e[c],installJob:r.data,loading:!1,inlineError:void 0}})),r.data.status===`queued`||r.data.status===`running`){a.current[c]=window.setTimeout(d,1500);return}if(r.data.status===`failed`){s(c,r.data.failure,r.data.failure?.message);return}await o();let l=await e(`session.create`,{workspaceId:t,providerId:c});if(l.ok&&l.data){n(l.data,c);return}i(e=>({...e,[c]:{...e[c],inlineError:l.error?.message,loading:!1}}))};a.current[c]=window.setTimeout(d,1500)}}}var Um=({workspaceId:e,paneId:t,onAssignSession:n,onClosePane:r,onReplaceWithSession:i,onSplitPane:a})=>{let o=X(),s=R(Yu),c=z(cd),{states:l,launch:u}=Hm(s,e,(e,r)=>{c(t=>({...t,[e.id]:e})),t?n?.(t,e.id):i?.(e.id)}),d=e=>{let t=l[e];return t.loading||t.installJob?.status===`queued`||t.installJob?.status===`running`?o(`provider.install.cta.installing`):t.runtime?.available?o(`provider.install.cta.start`):t.runtime?.autoInstallSupported?o(`provider.install.cta.install_and_start`):o(`provider.install.cta.manual`)},f=e=>{let t=l[e],n=t.installJob?.failure;return n?{message:n.message,docUrl:n.docUrls.provider}:t.inlineError&&t.inlineError!==`manual`?{message:t.inlineError,docUrl:t.runtime?.docUrls.provider}:t.inlineError===`manual`||t.runtime?.autoInstallSupported===!1?{message:t.runtime?.manualGuideKeys.map(e=>o(e)).join(` `),docUrl:t.runtime?.docUrls.provider}:{docUrl:t.runtime?.docUrls.provider}},p=Object.values(l).some(e=>e.loading||e.installJob?.status===`queued`||e.installJob?.status===`running`);return(0,Z.jsxs)(`div`,{className:`session-card agent-pane`,children:[(0,Z.jsxs)(`div`,{className:`session-header`,children:[(0,Z.jsxs)(`div`,{className:`session-header-left`,children:[(0,Z.jsx)(`span`,{className:`session-dot session-dot-idle`}),(0,Z.jsx)(`div`,{className:`session-header-copy`,children:(0,Z.jsxs)(`div`,{className:`session-title-row`,children:[(0,Z.jsx)(`span`,{className:`session-title`,children:o(`session.provider_select`)||`New Session`}),(0,Z.jsx)(`span`,{className:`session-state-badge badge badge-gray`,children:`DRAFT`})]})})]}),(0,Z.jsxs)(`div`,{className:`session-header-actions`,children:[(0,Z.jsx)(`button`,{className:`session-action-btn`,onClick:()=>{t&&a?.(t,`horizontal`)},title:`Split horizontal`,"aria-label":`Split horizontal`,children:(0,Z.jsx)(Of,{size:13})}),(0,Z.jsx)(`button`,{className:`session-action-btn`,onClick:()=>{t&&a?.(t,`vertical`)},title:`Split vertical`,"aria-label":`Split vertical`,children:(0,Z.jsx)(Df,{size:13})}),(0,Z.jsx)(`button`,{className:`session-action-btn session-action-btn-close`,onClick:()=>{t&&r?.(t)},title:`Close`,"aria-label":`Close`,children:(0,Z.jsx)(Pf,{size:14})})]})]}),(0,Z.jsx)(`div`,{className:`agent-draft-launcher`,children:(0,Z.jsxs)(`div`,{className:`agent-draft-content`,children:[(0,Z.jsx)(`span`,{className:`agent-draft-kicker`,children:`SESSION LAUNCHER`}),(0,Z.jsx)(`p`,{className:`agent-draft-description`,children:`选择一个 AI 会话,在当前 workspace 里继续查看文件、运行命令和推进代码修改。`}),(0,Z.jsx)(`div`,{className:`agent-draft-providers`,children:[{id:`claude`,title:`Claude`,meta:`analysis`,icon:(0,Z.jsx)(Ef,{size:18}),description:`更适合长上下文梳理、方案分析和代码审查。`,className:`agent-provider-card-claude`},{id:`codex`,title:`Codex`,meta:`workspace`,icon:(0,Z.jsx)(Nd,{size:18}),description:`更适合终端操作、直接改文件和逐步修复问题。`,className:`agent-provider-card-codex`}].map(e=>{let t=l[e.id],n=f(e.id),r=t.loading||t.installJob?.status===`queued`||t.installJob?.status===`running`;return(0,Z.jsxs)(`button`,{className:`btn btn-secondary agent-provider-card ${e.className}`,disabled:p,onClick:()=>{u(e.id)},children:[(0,Z.jsx)(`span`,{className:`agent-provider-card-icon`,children:e.icon}),(0,Z.jsxs)(`span`,{className:`agent-provider-card-body`,children:[(0,Z.jsxs)(`span`,{className:`agent-provider-card-title-row`,children:[(0,Z.jsx)(`span`,{className:`agent-provider-card-title`,children:e.title}),(0,Z.jsx)(`span`,{className:`agent-provider-card-meta`,children:e.meta})]}),(0,Z.jsx)(`span`,{className:`agent-provider-card-desc`,children:e.description}),(0,Z.jsx)(`span`,{className:`agent-provider-card-cta`,children:d(e.id)}),r?(0,Z.jsx)(`span`,{className:`agent-provider-card-status`,children:o(`provider.install.status.installing`)}):null,n.message?(0,Z.jsxs)(`span`,{className:`agent-provider-card-guide`,children:[(0,Z.jsx)(`span`,{children:n.message}),n.docUrl?(0,Z.jsx)(`a`,{href:n.docUrl,target:`_blank`,rel:`noreferrer`,children:o(`provider.install.open_docs`)}):null]}):null]}),(0,Z.jsx)(Ad,{size:16,className:`agent-provider-card-arrow`})]},e.id)})})]})})]})},Wm=({splitId:e,direction:t,ratio:n,children:r,onRatioCommit:i})=>{let[a,o]=(0,L.useState)(n),s=(0,L.useRef)(null),c=(0,L.useRef)(!1),l=(0,L.useRef)(n),u=(0,L.useCallback)(()=>{c.current=!0,l.current=a,document.body.classList.add(`is-resizing-panels`)},[a]),d=(0,L.useCallback)(e=>{if(!c.current||!s.current)return;let n=s.current.getBoundingClientRect(),r=t===`horizontal`?n.width:n.height,i=t===`horizontal`?e.clientX-n.left:e.clientY-n.top,a=Math.max(.1,Math.min(.9,i/r));o(a),l.current=a},[t]),f=(0,L.useCallback)(()=>{c.current&&(c.current=!1,document.body.classList.remove(`is-resizing-panels`),i?.(l.current))},[i]);(0,L.useEffect)(()=>(document.addEventListener(`mousemove`,d),document.addEventListener(`mouseup`,f),()=>{document.removeEventListener(`mousemove`,d),document.removeEventListener(`mouseup`,f)}),[d,f]),(0,L.useEffect)(()=>{o(n),l.current=n},[n,e]);let[p,m]=Array.isArray(r)?r:[r],h=t===`horizontal`?{gridTemplateColumns:`${a*100}% 8px ${(1-a)*100}%`}:{gridTemplateRows:`${a*100}% 8px ${(1-a)*100}%`};return(0,Z.jsxs)(`div`,{ref:s,className:`pane-layout pane-layout-${t}`,style:{display:`grid`,...h},children:[(0,Z.jsx)(`div`,{className:`pane-layout-child`,children:p}),(0,Z.jsx)(`div`,{className:`pane-layout-divider`,onMouseDown:u,role:`separator`,"aria-orientation":t===`horizontal`?`vertical`:`horizontal`}),(0,Z.jsx)(`div`,{className:`pane-layout-child`,children:m})]})},Gm=I(new Map),Km=I(new Map),qm=Zu(e=>I(!1)),Jm=I({open:!1,sessionId:null,mode:`enable`,draftObjective:``,draftEvaluatorProviderId:`claude`});I(e=>t=>e(Gm).get(t));var Ym=`__supervisor-empty__`;function Xm(e){let t=e?.id??Ym,n=R(Yu),r=R(qm(t)),i=z(qm(t)),a=z(Gm),o=z(Km),s=z(Jm);return(0,L.useEffect)(()=>{if(!e||r||e.capability!==`full`||e.state===`draft`||e.state===`ended`)return;let t=!1;return n(`supervisor.get`,{sessionId:e.id}).then(n=>{if(t||!n.ok)return;let r=n.data?.supervisor??null;r?(a(t=>{let n=new Map(t);return n.set(e.id,r),n}),o(e=>{let t=new Map(e);return t.set(r.id,r.cycles??[]),t})):a(t=>{let n=new Map(t);return n.delete(e.id),n}),i(!0)}),()=>{t=!0}},[n,r,e,o,i,a]),{openDialog:(0,L.useCallback)((e,n)=>{s({open:!0,sessionId:t,mode:e,draftObjective:n?.objective??``,draftEvaluatorProviderId:n?.evaluatorProviderId??`claude`})},[t,s])}}var Zm=[{id:`claude`,label:`Claude`},{id:`codex`,label:`Codex`}],Qm={open:!1,sessionId:null,mode:`enable`,draftObjective:``,draftEvaluatorProviderId:`claude`};function $m({workspaceId:e,sessionId:t}){let[n,r]=Te(Jm),i=R(Gm),a=R(Yu),o=X(),s=t??n.sessionId,c=s?i.get(s):void 0,l=n.open&&(!t||n.sessionId===t),u=n.mode,d={title:o(`supervisor.dialog.${u}.title`),subtitle:o(`supervisor.dialog.${u}.subtitle`),confirm:o(`supervisor.dialog.${u}.confirm`)},f=u===`disable`,p=c?.objective??n.draftObjective,m=(0,L.useCallback)(()=>{r(Qm)},[r]);return{dialog:n,supervisor:c,isVisible:l,mode:u,copy:d,isDisable:f,disableObjective:p,close:m,updateDraft:(0,L.useCallback)(e=>{r(t=>({...t,...e}))},[r]),confirm:(0,L.useCallback)(async()=>{if(!n.sessionId)return!1;if(n.mode===`disable`)return c&&(await a(`supervisor.delete`,{id:c.id})).ok?(m(),!0):!1;let t=n.draftObjective.trim();return t?n.mode===`enable`?(await a(`supervisor.create`,{sessionId:n.sessionId,workspaceId:e,objective:t,evaluatorProviderId:n.draftEvaluatorProviderId})).ok?(m(),!0):!1:c&&(await a(`supervisor.update`,{id:c.id,objective:t,evaluatorProviderId:n.draftEvaluatorProviderId})).ok?(m(),!0):!1:!1},[m,n,a,c,e])}}function eh({mode:e}){return e===`enable`?(0,Z.jsx)(Wd,{size:14}):e===`edit`?(0,Z.jsx)(gf,{size:14}):(0,Z.jsx)(yf,{size:14})}function th({mode:e,draftObjective:t,draftEvaluatorProviderId:n,disableObjective:r,onDraftObjectiveChange:i,onDraftEvaluatorProviderChange:a,mobileEvaluatorPicker:o}){let s=X(),c=(0,L.useId)(),l=(0,L.useId)(),u=(0,L.useId)(),d=Zm.find(e=>e.id===n)?.label??n;return e===`disable`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`supervisor-danger-callout`,role:`alert`,children:[(0,Z.jsx)(Nf,{size:16,className:`supervisor-danger-callout-icon`,"aria-hidden":`true`}),(0,Z.jsxs)(`div`,{className:`supervisor-danger-callout-copy`,children:[(0,Z.jsx)(`strong`,{children:s(`supervisor.dialog.disable.warning_title`)}),(0,Z.jsx)(`small`,{children:s(`supervisor.dialog.disable.warning_body`)})]})]}),(0,Z.jsxs)(`div`,{className:`form-group`,children:[(0,Z.jsx)(`label`,{children:s(`supervisor.field.current_objective`)}),(0,Z.jsx)(`pre`,{className:`objective-preview`,children:r})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`form-group`,children:[(0,Z.jsx)(`label`,{htmlFor:`objective`,children:s(`supervisor.field.objective`)}),(0,Z.jsx)(`textarea`,{id:`objective`,className:`input textarea`,rows:5,value:t,onChange:e=>i(e.target.value),placeholder:s(`supervisor.field.objective_placeholder`),autoFocus:!0}),(0,Z.jsx)(`span`,{className:`dialog-helper`,children:s(`supervisor.field.objective_helper`)})]}),(0,Z.jsxs)(`div`,{className:`form-group`,children:[(0,Z.jsx)(`label`,{id:c,htmlFor:o?.isMobile?`evaluator-provider-trigger`:`evaluator-provider`,children:s(`supervisor.field.evaluator`)}),o?.isMobile?(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsxs)(`button`,{id:`evaluator-provider-trigger`,type:`button`,className:`input mobile-select-trigger`,"aria-labelledby":`${c} ${u}`,"aria-describedby":l,"aria-haspopup":`dialog`,onClick:o.onOpen,children:[(0,Z.jsx)(`span`,{id:u,className:`mobile-select-trigger__value`,children:d}),(0,Z.jsx)(Fd,{size:16,className:`mobile-select-trigger__icon`,"aria-hidden":`true`})]})}):(0,Z.jsx)(`select`,{id:`evaluator-provider`,className:`input`,value:n,onChange:e=>a(e.target.value),children:Zm.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,Z.jsx)(`span`,{id:l,className:`dialog-helper`,children:s(`supervisor.field.evaluator_helper`)})]})]})}function nh({workspaceId:e,sessionId:t}){let n=Ir(),r=X(),{dialog:i,isVisible:a,mode:o,copy:s,isDisable:c,disableObjective:l,close:u,updateDraft:d,confirm:f}=$m({workspaceId:e,sessionId:t});return!a||n===`mobile`?null:(0,Z.jsx)(`div`,{className:`modal-overlay`,onClick:u,children:(0,Z.jsxs)(`div`,{className:`modal-card supervisor-dialog`,"data-mode":o,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`modal-header`,children:[(0,Z.jsxs)(`div`,{className:`supervisor-dialog-header`,children:[(0,Z.jsx)(`span`,{className:`supervisor-dialog-header-icon`,"aria-hidden":`true`,children:(0,Z.jsx)(eh,{mode:o})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{children:s.title}),(0,Z.jsx)(`span`,{className:`supervisor-dialog-subtitle`,children:s.subtitle})]})]}),(0,Z.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:u,"aria-label":r(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})]}),(0,Z.jsx)(`div`,{className:`modal-body`,children:(0,Z.jsx)(th,{mode:o,draftObjective:i.draftObjective,draftEvaluatorProviderId:i.draftEvaluatorProviderId,disableObjective:l,onDraftObjectiveChange:e=>d({draftObjective:e}),onDraftEvaluatorProviderChange:e=>d({draftEvaluatorProviderId:e})})}),(0,Z.jsxs)(`div`,{className:`modal-footer`,children:[(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:u,children:r(`action.cancel`)}),(0,Z.jsx)(`button`,{className:`btn ${c?`btn-danger`:`btn-primary`}`,onClick:()=>{f()},disabled:!c&&!i.draftObjective.trim(),children:s.confirm})]})]})})}var rh={inactive:`supervisor-state-inactive`,idle:`supervisor-state-idle`,evaluating:`supervisor-state-evaluating`,injecting:`supervisor-state-injecting`,paused:`supervisor-state-paused`,error:`supervisor-state-error`};function ih({sessionId:e}){let t=R(Gm),n=R(Km),r=R(Yu),i=z(Jm),a=X(),o=t.get(e),[s,c]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(!s)return;let e=window.setTimeout(()=>c(null),6e3);return()=>window.clearTimeout(e)},[s]);let l=(0,L.useCallback)(t=>{i({open:!0,sessionId:e,mode:t,draftObjective:o?.objective??``,draftEvaluatorProviderId:o?.evaluatorProviderId??`claude`})},[e,i,o]),u=(0,L.useCallback)(async(e,t,n)=>{c(null);let i=await r(e,{id:t});i.ok||c(i.error?.message?`${n}: ${i.error.message}`:n)},[r]),d=(0,L.useCallback)(async()=>{o&&await u(`supervisor.pause`,o.id,a(`supervisor.action.pause_failed`))},[u,o,a]),f=(0,L.useCallback)(async()=>{o&&await u(`supervisor.resume`,o.id,a(`supervisor.action.resume_failed`))},[u,o,a]),p=(0,L.useCallback)(async()=>{o&&await u(`supervisor.trigger`,o.id,a(`supervisor.action.trigger_failed`))},[u,o,a]),m=o?[...n.get(o.id)??o.cycles??[]].sort((e,t)=>(t.completedAt??t.createdAt)-(e.completedAt??e.createdAt)):[],h=m[0],g=h?h.result??h.errorReason??(h.status===`completed`?a(`supervisor.cycle.no_guidance`):h.status===`evaluating`?a(`supervisor.cycle.evaluating`):a(`supervisor.cycle.waiting`)):null;return{actionError:s,cycles:m,handlePause:d,handleResume:f,handleTrigger:p,isBusy:o?.state===`evaluating`||o?.state===`injecting`,latestCycle:h,latestCycleText:g,openDialog:l,stateClass:o?rh[o.state]:rh.inactive,stateLabel:a(`supervisor.state.${o?o.state:`inactive`}`),supervisor:o}}function ah({sessionId:e,workspaceId:t}){let n=X(),{actionError:r,handlePause:i,handleResume:a,handleTrigger:o,isBusy:s,latestCycle:c,latestCycleText:l,openDialog:u,stateClass:d,stateLabel:f,supervisor:p}=ih({sessionId:e});return p?(0,Z.jsxs)(`div`,{className:`supervisor-card ${d}`,"data-workspace-id":t,children:[(0,Z.jsxs)(`div`,{className:`supervisor-strip-row`,children:[(0,Z.jsxs)(`span`,{className:`supervisor-strip-eyebrow`,children:[(0,Z.jsx)(`span`,{className:`supervisor-pulse ${d}`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`supervisor-label`,children:n(`supervisor.title`)})]}),(0,Z.jsx)(`span`,{className:`supervisor-state-tag ${d}`,children:f}),(0,Z.jsxs)(`div`,{className:`supervisor-actions`,children:[(0,Z.jsx)(`button`,{className:`supervisor-icon-btn`,onClick:()=>u(`edit`),title:n(`supervisor.action.edit_objective`),"aria-label":n(`supervisor.action.edit_objective`),children:(0,Z.jsx)(gf,{size:12})}),p.state===`paused`?(0,Z.jsx)(`button`,{className:`supervisor-icon-btn`,onClick:()=>{a()},title:n(`supervisor.action.resume`),"aria-label":n(`supervisor.action.resume`),children:(0,Z.jsx)(_f,{size:12})}):(0,Z.jsx)(`button`,{className:`supervisor-icon-btn`,onClick:()=>{i()},title:n(`supervisor.action.pause`),"aria-label":n(`supervisor.action.pause`),disabled:s,children:(0,Z.jsx)(hf,{size:12})}),(0,Z.jsx)(`button`,{className:`supervisor-icon-btn`,onClick:()=>{o()},title:n(`supervisor.action.trigger`),"aria-label":n(`supervisor.action.trigger`),disabled:s,children:(0,Z.jsx)(zd,{size:12})}),(0,Z.jsx)(`button`,{className:`supervisor-icon-btn supervisor-icon-btn-danger`,onClick:()=>u(`disable`),title:n(`supervisor.action.disable`),"aria-label":n(`supervisor.action.disable`),children:(0,Z.jsx)(yf,{size:12})})]})]}),(0,Z.jsxs)(`div`,{className:`supervisor-objective-row`,onDoubleClick:()=>u(`edit`),children:[(0,Z.jsx)(`span`,{className:`supervisor-objective-text`,title:p.objective,children:p.objective}),(0,Z.jsx)(`span`,{className:`supervisor-provider-pill`,children:p.evaluatorProviderId})]}),c?(0,Z.jsx)(`ol`,{className:`supervisor-history-list`,"aria-label":n(`supervisor.latest_evaluation`),children:(0,Z.jsxs)(`li`,{className:`supervisor-history-item`,"data-trigger":c.trigger,children:[(0,Z.jsx)(`span`,{className:`supervisor-history-trigger`,children:c.trigger===`manual`?n(`supervisor.trigger.manual`):n(`supervisor.trigger.auto`)}),(0,Z.jsx)(`span`,{className:`supervisor-history-result`,children:l})]})}):null,r?(0,Z.jsx)(`div`,{className:`supervisor-error`,role:`alert`,children:r}):p.errorReason?(0,Z.jsx)(`div`,{className:`supervisor-error`,role:`alert`,children:p.errorReason}):null]}):(0,Z.jsx)(`div`,{className:`supervisor-card supervisor-card-inactive`,children:(0,Z.jsxs)(`button`,{className:`supervisor-enable-btn`,onClick:()=>u(`enable`),title:n(`supervisor.action.enable`),"aria-label":n(`supervisor.action.enable`),children:[(0,Z.jsx)(Wd,{size:13}),(0,Z.jsx)(`span`,{children:n(`supervisor.title`)})]})})}var oh=Zu(e=>I({chunks:[],lastSeq:0})),sh=Zu(e=>I(null));Zu(e=>I(e=>[]));var ch=2,lh={focused:0,"visible-active":1,"visible-other":2,background:3};function uh(e,t){return lh[e]-lh[t]}function dh(e){let t=Math.max(1,e?.concurrency??ch),n=new Map,r=[],i=new Map,a=()=>{r.forEach((e,t)=>{for(let n of e.positionListeners)n(t)})},o=()=>{for(;n.size<t&&r.length>0;){let e=r.shift();if(!e)break;e.running=!0,n.set(e.terminalId,e),e.handle.isGranted=!0,e.grantedResolved||(e.grantedResolved=!0,e.resolveGranted())}a()},s=e=>{let t=r.findIndex(t=>t.terminalId===e);return t>=0?(r.splice(t,1),a(),!0):!1},c=e=>{let t=s(e.terminalId),r=n.delete(e.terminalId);!t&&!r||(i.delete(e.terminalId),r&&o())},l=(e,t)=>{if(e.tier=t,e.running)return;let n=r.findIndex(t=>t.terminalId===e.terminalId);if(n<0)return;r.splice(n,1);let i=r.findIndex(e=>uh(t,e.tier)<0);i<0&&(i=r.length),r.splice(i,0,e),o()},u=e=>{let t=r.findIndex(t=>uh(e.tier,t.tier)<0);t<0&&(t=r.length),r.splice(t,0,e),o()};return{request(e){let a=i.get(e.terminalId);if(a)return uh(e.tier,a.tier)<0&&l(a,e.tier),a.handle;let o=()=>{},s=new Promise(e=>{o=e}),d={};return d.terminalId=e.terminalId,d.tier=e.tier,d.granted=s,d.resolveGranted=o,d.grantedResolved=!1,d.running=!1,d.positionListeners=new Set,d.handle={granted:s,isGranted:!1,promote:e=>l(d,e),release:()=>c(d),subscribePosition:e=>{d.positionListeners.add(e);let t=r.findIndex(e=>e.terminalId===d.terminalId);return t>=0&&e(t),()=>{d.positionListeners.delete(e)}}},i.set(e.terminalId,d),n.size<t?(d.running=!0,n.set(d.terminalId,d),d.handle.isGranted=!0,d.grantedResolved=!0,d.resolveGranted()):u(d),d.handle},inspect(){return{running:Array.from(n.keys()),queued:r.map((e,t)=>({terminalId:e.terminalId,tier:e.tier,queuePosition:t}))}}}}var fh=dh(),ph=400,mh=[{id:`escape`,text:`Esc`},{id:`tab`,text:`Tab`},{id:`arrow_up`,text:`↑`},{id:`arrow_left`,text:`←`},{id:`arrow_down`,text:`↓`},{id:`arrow_right`,text:`→`},{id:`enter`,text:`Enter`}];function hh(e,t){switch(e){case`escape`:return t.escape;case`tab`:return t.tab;case`enter`:return t.enter;case`arrow_up`:return t.up;case`arrow_down`:return t.down;case`arrow_left`:return t.left;case`arrow_right`:return t.right}}function gh({ctrlMode:e,shiftArmed:t,disabled:n=!1,labels:r,onKeyPress:i,onCtrlTap:a,onCtrlLongPress:o,onShiftTap:s}){let c=(0,L.useRef)(null),l=(0,L.useRef)(!1),u=(0,L.useRef)(null),d=n,f=()=>{c.current!==null&&(clearTimeout(c.current),c.current=null)};(0,L.useEffect)(()=>{d&&(f(),l.current=!1,u.current=null)},[d]),(0,L.useEffect)(()=>()=>{f()},[]);let p=()=>{d||(f(),l.current=!1,u.current=null,c.current=setTimeout(()=>{l.current=!0,u.current=`pointer`,o()},ph))},m=()=>{f(),l.current=!1,u.current=null},h=()=>{d||f()},g=e=>{if(!d){if(l.current){let t=u.current===`pointer`||u.current===`keyboard`&&e.detail===0;if(l.current=!1,u.current=null,t)return}a()}},_=e=>{d||(e.key===`Enter`||e.key===` `)&&e.altKey&&(e.preventDefault(),f(),l.current=!0,u.current=`keyboard`,o())},v=e===`locked`?r.ctrlLocked:e===`armed`?r.ctrlArmed:r.ctrl,y=t?r.shiftArmed:r.shift;return(0,Z.jsx)(`div`,{className:`mobile-terminal-input-bar`,"data-expanded":`true`,"data-disabled":n?`true`:`false`,children:(0,Z.jsxs)(`div`,{className:`mobile-terminal-input-bar__keys`,role:`group`,"aria-label":r.shortcuts,children:[(0,Z.jsx)(`button`,{type:`button`,className:`mobile-terminal-input-bar__key mobile-terminal-input-bar__ctrl`,"data-ctrl-mode":e,"aria-pressed":e!==`off`,"aria-label":v,"aria-keyshortcuts":`Alt+Enter Alt+Space`,disabled:d,onPointerDown:p,onPointerUp:h,onPointerCancel:m,onPointerLeave:m,onClick:g,onKeyDown:_,children:`Ctrl`}),(0,Z.jsx)(`button`,{type:`button`,className:`mobile-terminal-input-bar__key mobile-terminal-input-bar__shift`,"data-shift-armed":t?`true`:`false`,"aria-pressed":t,"aria-label":y,disabled:d,onClick:s,children:`Shift`}),mh.map(e=>(0,Z.jsx)(`button`,{type:`button`,className:`mobile-terminal-input-bar__key`,"aria-label":hh(e.id,r),disabled:d,onClick:()=>i(e.id),children:e.text},e.id))]})})}var _h={escape:`\x1B`,tab:` `,enter:`\r`,arrow_up:`\x1B[A`,arrow_down:`\x1B[B`,arrow_left:`\x1B[D`,arrow_right:`\x1B[C`},vh={tab:`\x1B[Z`,arrow_up:`\x1B[1;2A`,arrow_down:`\x1B[1;2B`,arrow_left:`\x1B[1;2D`,arrow_right:`\x1B[1;2C`},yh=`control`;function bh(e,t){return t?.shift?vh[e]??_h[e]:_h[e]}function xh(e){return e===`off`?`armed`:`off`}function Sh(){return`locked`}function Ch(e,t){if(t===`off`)return{data:e,nextCtrlMode:`off`};if(!/^[A-Za-z]$/.test(e))return{data:e,nextCtrlMode:t};let n=e.toUpperCase();return{data:String.fromCharCode(n.charCodeAt(0)-64),nextCtrlMode:t===`armed`?`off`:`locked`,activity:yh}}var wh=12e4;function Th(e){return e instanceof Error&&e.message.includes(`Command timeout: terminal.replay`)||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`&&String(e.message).includes(`Command timeout: terminal.replay`)?`timeout`:`failed`}function Eh(e){return`'${e.replace(/'/g,`'\\''`)}'`}var Dh=class extends Error{constructor(e,t,n){super(n??e),this.code=e,this.status=t,this.name=`UploadError`}};async function Oh(e){let t=new FormData;t.append(`workspaceId`,e.workspaceId);for(let n of e.files)t.append(`files`,n,n.name);let n;try{n=await fetch(`/api/uploads`,{method:`POST`,body:t,credentials:`include`})}catch(e){throw new Dh(`network_error`,0,e.message)}let r;try{r=await n.json()}catch{r={}}if(!n.ok||!r.ok)throw new Dh(r.error??`http_${n.status}`,n.status);return r.files??[]}function kh(e){let{containerRef:t,workspaceId:n,sendTextToTerminal:r,enabled:i}=e,[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(0),c=(0,L.useRef)(0),l=(0,L.useRef)(0),u=(0,L.useRef)(new Map),d=(0,L.useRef)(Promise.resolve()),f=z(cp),p=(0,L.useCallback)(async()=>{for(;u.current.has(l.current);){let e=l.current,t=u.current.get(e)??null;u.current.delete(e),l.current+=1,t&&await r(t)}},[r]),m=(0,L.useCallback)(async(e,t)=>{u.current.set(e,t),d.current=d.current.then(()=>p()),await d.current},[p]),h=(0,L.useCallback)(async e=>{if(e.length===0)return;let t=c.current;c.current+=1,s.current+=1,o(!0);try{let r=await Oh({workspaceId:n,files:e});if(r.length===0){await m(t,null);return}await m(t,`${r.map(e=>Eh(e.path)).join(` `)} `)}catch(e){await m(t,null),f({kind:`error`,title:`Upload failed`,body:`Could not upload file(s): ${e instanceof Dh?e.code:`unknown`}`,duration:5e3})}finally{s.current=Math.max(0,s.current-1),o(s.current>0)}},[f,m,n]);return(0,L.useEffect)(()=>{let e=t.current;if(!e||!i)return;let n=e=>{let t=e.clipboardData?.files;!t||t.length===0||(e.preventDefault(),e.stopPropagation(),h(Array.from(t)))},r=e=>{let t=e.dataTransfer?.files;!t||t.length===0||(e.preventDefault(),e.stopPropagation(),h(Array.from(t)))},a=e=>{Array.from(e.dataTransfer?.types??[]).includes(`Files`)&&e.preventDefault()};return e.addEventListener(`paste`,n,{capture:!0}),e.addEventListener(`drop`,r,{capture:!0}),e.addEventListener(`dragover`,a,{capture:!0}),()=>{e.removeEventListener(`paste`,n,{capture:!0}),e.removeEventListener(`drop`,r,{capture:!0}),e.removeEventListener(`dragover`,a,{capture:!0})}},[t,i,h]),{busy:a}}var Ah=({state:e,queuePosition:t})=>{let n=X(),r=e===`granting`?n(`terminal.replay.loading_title`):t===0?n(`terminal.replay.up_next`):n(`terminal.replay.queued_title`,{count:t??0});return(0,Z.jsx)(`div`,{className:`xterm-replay-overlay xterm-replay-overlay--placeholder`,role:`status`,"aria-live":`polite`,children:(0,Z.jsxs)(`div`,{className:`xterm-replay-overlay__card`,children:[e===`granting`?(0,Z.jsx)(`div`,{className:`xterm-replay-overlay__spinner`,"aria-hidden":`true`}):null,(0,Z.jsx)(`div`,{className:`xterm-replay-overlay__title`,children:r})]})})},jh=16,Mh=80,Nh=.12,Ph=.02,Fh=.92,Ih=16,Lh=new Set([`\x1B[I`,`\x1B[O`]);function Rh(e){return/^\x1b\[\d+;\d+R$/.test(e)||/^\x1b\[(?:\?|>)(?:\d+;)*\d*c$/.test(e)}function zh(e){return Lh.has(e)?`system`:e.includes(`\r`)||e.includes(`
107
- `)?`submit`:`typing`}function Bh(e){let t=e.length;for(;t>0;){let n=e[t-1];if(!n||!/\s/.test(n))break;--t}for(;t>0;){let n=e[t-1];if(!n||/\s/.test(n))break;--t}return e.slice(0,t)}function Vh(e,t,n){if(n===`system`)return{nextDraft:e};let r=e,i;for(let e=0;e<t.length;e+=1){let n=t[e];if(n===`\x1B`){let n=t.slice(e).match(/^\x1b(?:\[[0-9;?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\)|P[\s\S]*?\x1b\\|[@-_])/);if(n){e+=n[0].length-1;continue}}if(n===``||n===`\b`){r=r.slice(0,-1);continue}if(n===``){r=``;continue}if(n===``){r=Bh(r);continue}if(n===``){r=``,i=void 0;continue}if(n===`\r`||n===`
108
- `){i=r.length>0?r:i,r=``;continue}n>=` `&&(r+=n)}return{nextDraft:r,submittedText:i}}function Hh(e,t){return e?`item`in e&&typeof e.item==`function`?e.item(t):e[t]??null:null}function Uh(e,t){if(t===null||!e)return null;for(let n=0;n<e.length;n+=1){let r=Hh(e,n);if(r?.identifier===t)return r}return null}function Wh(e,t){if(e.rows>0){let n=e.element?.querySelector(`.xterm-screen`),r=n instanceof HTMLElement?n.getBoundingClientRect().height:t.getBoundingClientRect().height;if(r>0)return r/e.rows}return jh}var Gh={dark:{background:`#0b1218`,foreground:`#e5edf3`,cursor:`#78d7b2`,cursorAccent:`#0b1218`,selectionBackground:`#1e3040`,selectionForeground:`#e5edf3`,black:`#0a1014`,red:`#ff9eb0`,green:`#78d7b2`,yellow:`#f1b86a`,blue:`#6cb6ff`,magenta:`#c792ea`,cyan:`#78d7b2`,white:`#9fb0bc`,brightBlack:`#4a5b6a`,brightRed:`#ff9eb0`,brightGreen:`#78d7b2`,brightYellow:`#f1b86a`,brightBlue:`#6cb6ff`,brightMagenta:`#c792ea`,brightCyan:`#78d7b2`,brightWhite:`#e5edf3`},light:{background:`#fafbfc`,foreground:`#1f2328`,cursor:`#0969da`,cursorAccent:`#fafbfc`,selectionBackground:`#dde4ea`,selectionForeground:`#1f2328`,black:`#24292f`,red:`#cf222e`,green:`#1a7f37`,yellow:`#9a6700`,blue:`#0969da`,magenta:`#8250df`,cyan:`#1b7c83`,white:`#57606a`,brightBlack:`#8b949e`,brightRed:`#cf222e`,brightGreen:`#1a7f37`,brightYellow:`#9a6700`,brightBlue:`#0969da`,brightMagenta:`#8250df`,brightCyan:`#1b7c83`,brightWhite:`#1f2328`}};function Kh(e){return Gh[e]}function qh(e){return e.type!==`keydown`||e.shiftKey||e.altKey?!1:(e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`v`}var Jh=new TextEncoder,Yh=new TextDecoder(`utf-8`,{fatal:!1}),Xh=`coderStudio.terminalTrace`;function Zh(){try{return globalThis.localStorage?.getItem(Xh)===`1`}catch{return!1}}function Qh(){if(typeof document>`u`)return Promise.resolve();let e=document.fonts;return e?.ready?e.ready.then(()=>void 0,()=>void 0):Promise.resolve()}function $h(e,t){return e.split(t).length-1}function eg(e){let t=typeof e==`string`?e:Yh.decode(e);return{length:typeof e==`string`?e.length:e.byteLength,syncStart:$h(t,`\x1B[?2026h`),syncEnd:$h(t,`\x1B[?2026l`),clearToEnd:$h(t,`\x1B[J`),clearScreen:$h(t,`\x1B[2J`),eraseLine:$h(t,`\x1B[K`),cursorHome:$h(t,`\x1B[1;1H`),dsr:$h(t,`\x1B[6n`),da:$h(t,`\x1B[c`),reverseIndex:$h(t,`\x1BM`),cursorMoves:t.match(/\x1b\[[0-9;]*[Hf]/g)?.length??0,scrollRegions:t.match(/\x1b\[[0-9;]*r/g)?.slice(0,6)??[]}}function tg(e,t,n={}){Zh()&&console.debug(`[terminal-trace]`,{at:Math.round(performance.now()*100)/100,terminalId:e,event:t,...n})}function ng(e,t){let n=Math.min(t,e.chunks.length);return n===0?e:{...e,chunks:e.chunks.slice(n)}}function rg({terminalId:e,workspaceId:t,readOnly:n=!1,isActiveSession:r=!1,terminalKind:i}){let a=X(),o=Ir(),s=R(Hr),c=R(Vu),l=R(Yu),[u,p]=Te(oh(e)),m=R(sh(e)),h=i??m?.kind??`shell`,g=!n&&m?.alive!==!1,_=(0,L.useRef)(null),v=(0,L.useRef)(null),y=(0,L.useRef)(null),b=(0,L.useRef)(null),x=(0,L.useRef)(null),S=(0,L.useRef)(!1),C=(0,L.useRef)([]),w=(0,L.useRef)(null),T=(0,L.useRef)(!0),E=(0,L.useRef)(null),D=(0,L.useRef)([]),O=(0,L.useRef)(!1),k=(0,L.useRef)(0),A=(0,L.useRef)(`idle`),j=(0,L.useRef)(null),ee=(0,L.useRef)(0),M=(0,L.useRef)(null),N=(0,L.useRef)(0),te=(0,L.useRef)(0),ne=(0,L.useRef)(s),re=(0,L.useRef)(``),ie=(0,L.useRef)(0),ae=(0,L.useRef)(null),P=(0,L.useRef)(!1),F=(0,L.useRef)(null),oe=(0,L.useRef)({activeTouchId:null,lastClientY:0,carryPx:0,pxPerLine:null,velocityPxPerMs:0,lastMomentumFrameAt:0,momentumFrameId:null,samples:[]}),[se,ce]=(0,L.useState)({kind:`loading`}),[I,le]=(0,L.useState)(o===`mobile`?{kind:`granted`}:{kind:`idle`}),[ue,de]=(0,L.useState)(`off`),[fe,pe]=(0,L.useState)(!1),me=(0,L.useRef)(`off`),he=(0,L.useRef)(!1),[ge,_e]=(0,L.useState)(()=>!c||typeof c.getStatus!=`function`?`disconnected`:c.getStatus()),ve=(0,L.useRef)(()=>{}),ye=(0,L.useRef)(()=>{});(0,L.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]),(0,L.useEffect)(()=>{ne.current=s},[s]),(0,L.useLayoutEffect)(()=>{if(o===`mobile`){le({kind:`granted`}),P.current=!0,ae.current=null;return}P.current=!1;let t=m?.alive===!1?`background`:r?`visible-active`:`visible-other`,n=fh.request({terminalId:e,tier:t});ae.current=n,le(n.isGranted?{kind:`granted`}:{kind:`idle`});let i=!1,a=n.subscribePosition(e=>{i||le({kind:`queued`,queuePosition:e})});return n.isGranted||n.granted.then(()=>{i||le({kind:`granted`})}),()=>{i=!0,a(),P.current||=(n.release(),!0),ae.current=null}},[e,o]),(0,L.useEffect)(()=>{if(o===`mobile`)return;let e=m?.alive===!1?`background`:r?`visible-active`:`visible-other`;ae.current?.promote(e)},[r,m?.alive,o]),(0,L.useEffect)(()=>{v.current&&(v.current.options.theme=Kh(s))},[s]),(0,L.useEffect)(()=>{let e=_.current;if(!e||typeof window>`u`||typeof window.matchMedia!=`function`||!window.matchMedia(`(pointer: coarse)`).matches)return;let t=oe.current,n=()=>{t.momentumFrameId!==null&&(cancelAnimationFrame(t.momentumFrameId),t.momentumFrameId=null),t.velocityPxPerMs=0,t.lastMomentumFrameAt=0},r=(e,n)=>{t.samples.push({clientY:e,at:n});let r=n-Mh;for(;t.samples.length>0&&t.samples[0].at<r;)t.samples.shift()},i=()=>{if(t.samples.length<2){t.velocityPxPerMs=0;return}let e=t.samples[0],n=t.samples[t.samples.length-1],r=n.at-e.at;if(r<=0){t.velocityPxPerMs=0;return}t.velocityPxPerMs=(e.clientY-n.clientY)/r},a=(n,r)=>{let i=n.buffer.active.baseY;if(i<=0)return t.carryPx=0,`blocked`;t.carryPx+=r;let a=t.pxPerLine??=Wh(n,e),o=t.carryPx>0?Math.floor(t.carryPx/a):Math.ceil(t.carryPx/a);if(o===0)return`buffered`;let s=n.buffer.active.viewportY,c=i-s,l=o>0?Math.min(o,c):Math.max(o,-s);return l===0?(t.carryPx=0,`blocked`):(n.scrollLines(l),t.carryPx-=l*a,`scrolled`)},o=e=>{if(t.momentumFrameId===null)return;let r=v.current;if(!r){n();return}let i=t.lastMomentumFrameAt>0?t.lastMomentumFrameAt:e-Ih,s=Math.max(1,Math.min(64,e-i));t.lastMomentumFrameAt=e;let c=a(r,t.velocityPxPerMs*s),l=Fh**+(s/Ih);if(t.velocityPxPerMs*=l,c===`blocked`||Math.abs(t.velocityPxPerMs)<=Ph){t.carryPx=0,n(),t.pxPerLine=null;return}t.momentumFrameId=requestAnimationFrame(o)},s=()=>{n(),t.activeTouchId=null,t.lastClientY=0,t.carryPx=0,t.pxPerLine=null,t.samples=[]},c=i=>{if(i.touches.length!==1){s();return}let a=Hh(i.touches,0);if(!a){s();return}n(),t.activeTouchId=a.identifier,t.lastClientY=a.clientY,t.carryPx=0,t.pxPerLine=v.current?Wh(v.current,e):jh,t.samples=[],r(a.clientY,performance.now())},l=e=>{let n=Uh(e.changedTouches,t.activeTouchId),o=v.current;if(!n||!o)return;if(o.buffer.active.baseY<=0){t.lastClientY=n.clientY,t.carryPx=0,t.samples=[],t.velocityPxPerMs=0;return}let s=t.lastClientY-n.clientY;t.lastClientY=n.clientY,r(n.clientY,performance.now()),i();let c=a(o,s);(c===`buffered`||c===`scrolled`)&&e.cancelable&&e.preventDefault()},u=e=>{if(Uh(e.changedTouches,t.activeTouchId)){let n=Uh(e.changedTouches,t.activeTouchId);if(n&&(r(n.clientY,performance.now()),i()),t.activeTouchId=null,t.lastClientY=0,t.samples=[],Math.abs(t.velocityPxPerMs)>=Nh){t.lastMomentumFrameAt=0,t.momentumFrameId=requestAnimationFrame(o);return}t.carryPx=0,t.pxPerLine=null,t.velocityPxPerMs=0}},d=()=>{s()};return e.addEventListener(`touchstart`,c,{passive:!0}),e.addEventListener(`touchmove`,l,{passive:!1}),e.addEventListener(`touchend`,u,{passive:!0}),e.addEventListener(`touchcancel`,d,{passive:!0}),()=>{e.removeEventListener(`touchstart`,c),e.removeEventListener(`touchmove`,l),e.removeEventListener(`touchend`,u),e.removeEventListener(`touchcancel`,d),s()}},[]);let be=(0,L.useCallback)(()=>{x.current!==null&&cancelAnimationFrame(x.current),x.current=requestAnimationFrame(()=>{x.current=null;try{let t=v.current?{cols:v.current.cols,rows:v.current.rows}:null;y.current?.fit(),tg(e,`fit`,{before:t,after:v.current?{cols:v.current.cols,rows:v.current.rows}:null})}catch(e){console.error(`Failed to fit xterm instance:`,e)}finally{let e=C.current;C.current=[];for(let t of e)t()}})},[e]),xe=(0,L.useCallback)(()=>new Promise(e=>{C.current.push(e)}),[]),Se=(0,L.useCallback)(e=>{me.current=e,de(e)},[]),Ce=(0,L.useCallback)(e=>{he.current=e,pe(e)},[]),we=(0,L.useCallback)(()=>{v.current?.focus()},[]),z=(0,L.useCallback)(async(t,n)=>{if(N.current>0&&Rh(t)){tg(e,`input.suppressed-replay-response`,{summary:eg(t)});return}if(!T.current)return;if(!c){console.error(`Cannot send terminal input: WebSocket not connected`);return}let r=ie.current+1;ie.current=r;let i=me.current,a=re.current,o=Ch(t,i),s=o.activity??n??zh(o.data),{nextDraft:l,submittedText:u}=Vh(a,o.data,s);try{o.nextCtrlMode!==i&&Se(o.nextCtrlMode),tg(e,`input`,{activity:s,summary:eg(o.data)}),re.current=l,await c.sendTerminalInput(e,Jh.encode(o.data),s,u)}catch(e){ie.current===r&&(re.current=a,o.nextCtrlMode!==i&&me.current===o.nextCtrlMode&&Se(i)),console.error(`Failed to send terminal input:`,e)}},[e,Se,c]),Ee=(0,L.useCallback)(async({cols:t,rows:n})=>{if(!T.current)return;let r=E.current;if(r&&r.cols===t&&r.rows===n)return;E.current={cols:t,rows:n},tg(e,`resize.dispatch`,{previousSize:r,nextSize:{cols:t,rows:n}});let i=await l(`terminal.resize`,{terminalId:e,cols:t,rows:n});i.ok||console.error(`Failed to sync terminal size:`,i.error),tg(e,`resize.result`,{nextSize:{cols:t,rows:n},ok:i.ok,error:i.ok?void 0:i.error})},[e,l]),{busy:De}=kh({containerRef:_,workspaceId:t,sendTextToTerminal:(0,L.useCallback)(async e=>{await z(e)},[z]),enabled:g});(0,L.useEffect)(()=>{T.current=g,v.current&&(v.current.options.disableStdin=!g||De,v.current.options.cursorBlink=g&&!De)},[g,De]),(0,L.useEffect)(()=>{if(!c){_e(`disconnected`);return}if(typeof c.getStatus==`function`?_e(c.getStatus()):_e(`connected`),typeof c.onStatus==`function`)return c.onStatus(e=>{_e(e)})},[c]),(0,L.useLayoutEffect)(()=>{Se(`off`),Ce(!1),re.current=``,ie.current+=1},[e,Se,Ce]),(0,L.useEffect)(()=>{ve.current=z},[z]),(0,L.useEffect)(()=>{ye.current=Ee},[Ee]),(0,L.useEffect)(()=>{if(o!==`mobile`&&I.kind!==`granted`||!_.current)return;let n=!1,r=null,i=te.current+1;te.current=i,N.current=0,F.current=null,M.current=null,O.current=!1,k.current=0,A.current=`idle`,j.current=null,D.current=[],E.current=null,ce({kind:`loading`});let a=new f({theme:Kh(ne.current),fontFamily:`JetBrains Mono, Fira Code, SF Mono, monospace`,fontSize:11,scrollback:5e3,cursorBlink:g&&!De,cursorStyle:`block`,disableStdin:!g||De,allowProposedApi:!0}),s=new d;a.loadAddon(s),a.onResize(e=>{ye.current(e)}),a.onData(e=>{ve.current(e)}),a.attachCustomKeyEventHandler(e=>!qh(e)),a.open(_.current),tg(e,`mount.open`),v.current=a,y.current=s,be();let u=xe();o!==`mobile`&&u.then(async()=>{await Qh(),!(n||!S.current)&&be()}).catch(()=>{});let m=async()=>{c&&(typeof c.getStatus!=`function`||typeof c.onStatus!=`function`||c.getStatus()!==`connected`&&await new Promise(e=>{let t=!1,n=()=>{t||(t=!0,r?.(),r=null,e())};r=c.onStatus(e=>{e===`connected`&&n()}),c.getStatus()===`connected`&&n()}))},h=u.then(async()=>{if(!c||(await m(),n||!S.current))return;let{cols:e,rows:t}=a;await ye.current({cols:e,rows:t})}),C=(e,t)=>{N.current+=1;let n=!1,r=()=>{n||(n=!0,te.current===i&&(N.current=Math.max(0,N.current-1),t?.()))};try{a.write(e,r)}catch(e){throw r(),e}},w=Nu.terminalOutput(t,e),T=Nu.terminalExit(t,e),re=e=>{let t=D.current;D.current=[];let n=[],r=e;for(let e of t)e.seq<=r||(n.push(e),r=e.seq);return{entries:n,latestCoveredSeq:r}},ie=e=>{A.current=`done`,j.current=null,e&&M.current===e&&(M.current=`reconnect`),F.current?.()},oe=(t,n,r)=>{if(k.current=n,O.current=!0,r.length===0){ee.current=Math.max(ee.current,n),ie(t);return}let a=r.length,o=e=>{!S.current||te.current!==i||(ee.current=Math.max(ee.current,e),a=Math.max(0,a-1),a===0&&ie(t))};for(let t of r)t.resetTerminalBeforeWrite&&typeof v.current?.reset==`function`&&v.current.reset(),t.kind===`historical`?tg(e,`write.historical`,{seq:t.seq,size:t.bytes.byteLength,summary:eg(t.bytes)}):tg(e,`write.pending-replay-chunk`,{seq:t.seq,summary:eg(t.bytes)}),C(t.bytes,()=>{o(t.seq)})},se=(e,t)=>{if(!S.current||!v.current||!e)return;let n=j.current,r=k.current,i=[];e.ok&&e.data?.status===t.successStatus?(t.successBytes&&i.push({kind:`historical`,bytes:t.successBytes,seq:t.coveredSeq??r,resetTerminalBeforeWrite:t.resetTerminalBeforeWrite}),r=t.coveredSeq??r,ce({kind:`ready`}),o!==`mobile`&&(ae.current?.release(),P.current=!0)):e.data?.status===`too_old`?(v.current&&v.current.writeln(`\r
109
- \x1B[33m[Session history truncated - output exceeds buffer size]\x1B[0m`),ce({kind:`degraded`,reason:`truncated`}),o!==`mobile`&&(ae.current?.release(),P.current=!0)):e.data?.status===`unknown`?(ce({kind:`degraded`,reason:`closed`}),o!==`mobile`&&(ae.current?.release(),P.current=!0)):e.ok||(console.error(`Failed to replay terminal output:`,e.error),ce({kind:`degraded`,reason:Th(e.error)}),o!==`mobile`&&(ae.current?.release(),P.current=!0));let{entries:a,latestCoveredSeq:s}=re(r);r=s;for(let e of a)i.push({kind:`pending`,bytes:e.bytes,seq:e.seq});p(e=>({...e,chunks:[],lastSeq:Math.max(e.lastSeq,r)})),oe(n,r,i)},le=e=>{se(e,{successStatus:`ok`,successBytes:e?.data?.bytes,coveredSeq:e?.data?.seq})},ue=e=>{if(console.error(`Failed to recover terminal output:`,e),!S.current||!v.current)return;let t=j.current;ce({kind:`degraded`,reason:Th(e)}),o!==`mobile`&&(ae.current?.release(),P.current=!0),p(e=>({...e,chunks:[],lastSeq:Math.max(e.lastSeq,k.current)}));let{entries:n,latestCoveredSeq:r}=re(k.current);oe(t,r,n.map(e=>({kind:`pending`,bytes:e.bytes,seq:e.seq})))},de=t=>{c&&(A.current=`in-flight`,O.current=!1,ce({kind:`loading`}),c.sendCommand(`terminal.snapshot`,{terminalId:e},{timeoutMs:wh}).then(e=>({ok:!0,data:e})).catch(e=>({ok:!1,error:e})).then(e=>{if(!(!S.current||!v.current)){if(e.ok&&e.data?.status===`ok`&&e.data.bytes&&typeof e.data.seq==`number`){se(e,{successStatus:`ok`,successBytes:e.data.bytes,coveredSeq:e.data.seq,resetTerminalBeforeWrite:t?.resetTerminalBeforeWrite});return}if(t?.onUnavailable){t.onUnavailable(e);return}ue(e.ok?Error(`terminal.snapshot returned status ${e.data?.status??`unknown`}`):e.error)}}))},fe=(t,n)=>{c&&(A.current=`in-flight`,O.current=!1,t===0&&ce({kind:`loading`}),tg(e,`replay.request`,{lastSeq:t}),(c?c.sendCommand(`terminal.replay`,{terminalId:e,lastSeq:t},{timeoutMs:wh}).then(e=>({ok:!0,data:e})):l(`terminal.replay`,{terminalId:e,lastSeq:t})).then(e=>{if(e.ok&&e.data?.status===`too_old`&&n?.onTooOld){n.onTooOld();return}le(e)}).catch(e=>{if(n?.onError){n.onError(e);return}ue(e)}))},pe=()=>{M.current||=j.current??`reconnect`,A.current=`idle`,j.current=null,O.current=!1,F.current?.()},me=()=>typeof c.getStatus==`function`?c.getStatus():`connected`,he=(t,n)=>{let r=me();if(M.current===`reconnect`||r===`disconnected`||r===`reconnecting`){tg(e,`reconnect.snapshot-fallback.defer-until-reconnect`,{lastSeq:ee.current,reason:t,error:n?String(n):void 0,connectionStatus:r}),pe();return}tg(e,`reconnect.snapshot-fallback`,{lastSeq:ee.current,reason:t,error:n?String(n):void 0}),de({resetTerminalBeforeWrite:!0,onUnavailable:t=>{let n=me();if(M.current===`reconnect`||n===`disconnected`||n===`reconnecting`){tg(e,`reconnect.snapshot.defer-until-reconnect`,{reason:t.ok?t.data?.status??`unsupported`:String(t.error),connectionStatus:n}),pe();return}ue(t.ok?Error(`terminal.snapshot returned status ${t.data?.status??`unknown`}`):t.error)}})},ge=t=>{if(c){if(j.current=t,t===`reconnect`){ce({kind:`loading`}),fe(ee.current,{onTooOld:()=>{he(`too_old`)},onError:e=>{he(`error`,e)}});return}de({onUnavailable:t=>{let n=me();if(M.current===`initial`||n===`disconnected`||n===`reconnecting`){tg(e,`snapshot.defer-until-reconnect`,{reason:t.ok?t.data?.status??`unsupported`:String(t.error),connectionStatus:n}),pe();return}tg(e,`snapshot.fallback`,{reason:t.ok?t.data?.status??`unsupported`:String(t.error)}),fe(0)}})}};return F.current=()=>{if(!M.current||typeof c.getStatus==`function`&&c.getStatus()!==`connected`||A.current===`in-flight`)return;let e=M.current;M.current=null,ge(e)},c&&(b.current=c.subscribe([w,T],(t,n,r)=>{if(t===w){let t=n;if(tg(e,`live.output`,{seq:r,replayCompleted:O.current,replayedSeq:k.current,size:t.bytes.byteLength,summary:eg(t.bytes)}),!O.current){D.current.push({bytes:t.bytes,seq:r});return}if(r<=k.current){tg(e,`live.drop-covered`,{seq:r,replayedSeq:k.current});return}let i=r-t.bytes.byteLength;if(i>k.current){tg(e,`live.gap`,{seq:r,chunkStartSeq:i,replayedSeq:k.current}),D.current.push({bytes:t.bytes,seq:r}),p(e=>({chunks:[],lastSeq:k.current})),fe(k.current);return}p(e=>r<=e.lastSeq?e:{chunks:[...e.chunks,t.bytes],lastSeq:r}),k.current=r}else if(t===T){let e=n;v.current&&v.current.writeln(`\r\n[Process exited with code ${e.code}]`)}})),(async()=>{await h,S.current&&ge(`initial`)})().catch(e=>{ue(e)}),()=>{if(n=!0,F.current=null,M.current=null,te.current===i&&(te.current+=1,N.current=0),r&&=(r(),null),b.current&&=(b.current(),null),x.current!==null&&(cancelAnimationFrame(x.current),x.current=null),v.current){try{v.current.dispose()}catch(e){console.error(`Failed to dispose xterm instance:`,e)}v.current=null,y.current=null}}},[l,I.kind,be,p,e,h,o,t,c]),(0,L.useEffect)(()=>{if(!(!c||typeof c.onStatus!=`function`))return c.onStatus(e=>{if(e===`disconnected`||e===`reconnecting`){A.current!==`idle`&&(M.current=j.current??`reconnect`);return}e!==`connected`||!M.current||F.current?.()})},[c]),(0,L.useEffect)(()=>{let t=v.current;if(!t)return;let{chunks:n}=u,r=n.length;if(r>0){let i=Array(n.length),a=u.lastSeq;for(let e=n.length-1;e>=0;--e)i[e]=a,a-=n[e]?.byteLength??0;for(let r=0;r<n.length;r++){let a=n[r];if(!a)continue;let o=i[r]??u.lastSeq;tg(e,`write.live-buffer`,{index:r,lastSeq:u.lastSeq,summary:eg(a)}),t.write(a,()=>{ee.current=Math.max(ee.current,o)})}p(e=>ng(e,r))}},[I.kind,u,p,e]),(0,L.useEffect)(()=>{let t=_.current,n=y.current;if(!t||!n)return;let r=new ResizeObserver(()=>{tg(e,`resize-observer`,{clientWidth:t.clientWidth,clientHeight:t.clientHeight}),w.current!==null&&clearTimeout(w.current),w.current=setTimeout(()=>{w.current=null,be()},150)});return r.observe(t),()=>{r.disconnect(),w.current!==null&&(clearTimeout(w.current),w.current=null)}},[I.kind,be,e]),(0,L.useEffect)(()=>{m?.alive&&v.current&&v.current.focus()},[m?.alive]);let Oe=o===`mobile`&&g,ke=!g||De||ge!==`connected`,Ae={shortcuts:a(`terminal.mobile_input.shortcuts`),ctrl:a(`terminal.mobile_input.ctrl`),ctrlArmed:a(`terminal.mobile_input.ctrl_armed`),ctrlLocked:a(`terminal.mobile_input.ctrl_locked`),shift:a(`terminal.mobile_input.shift`),shiftArmed:a(`terminal.mobile_input.shift_armed`),escape:a(`terminal.mobile_input.escape`),tab:a(`terminal.mobile_input.tab`),enter:a(`terminal.mobile_input.enter`),up:a(`terminal.mobile_input.up`),down:a(`terminal.mobile_input.down`),left:a(`terminal.mobile_input.left`),right:a(`terminal.mobile_input.right`)},je=(0,L.useCallback)(async e=>{we();let t=he.current;t&&Ce(!1),await z(bh(e,{shift:t}))},[we,z,Ce]),Me=(0,L.useCallback)(()=>{we(),Se(xh(me.current))},[we,Se]),Ne=(0,L.useCallback)(()=>{we(),Se(Sh())},[we,Se]),Pe=(0,L.useCallback)(()=>{we(),Ce(!he.current)},[we,Ce]),Fe=se.kind!==`ready`&&(o===`mobile`||I.kind===`granted`),Ie=``,Le=``,Re=`xterm-replay-overlay`;return se.kind===`loading`?(Ie=a(`terminal.replay.loading_title`),Le=a(`terminal.replay.loading_body`)):(Re+=` xterm-replay-overlay--degraded`,Ie=se.reason===`truncated`?a(`terminal.replay.truncated_title`):se.reason===`closed`?a(`terminal.replay.closed_title`):a(`terminal.replay.failed_title`),Le=se.reason===`truncated`?a(`terminal.replay.truncated_body`):se.reason===`closed`?a(`terminal.replay.closed_body`):a(`terminal.replay.failed_body`)),(0,Z.jsxs)(`div`,{className:`xterm-host-shell${Oe?` xterm-host-shell--mobile-input`:``}`,children:[Oe?(0,Z.jsx)(gh,{ctrlMode:ue,shiftArmed:fe,disabled:ke,labels:Ae,onKeyPress:e=>{je(e)},onCtrlTap:Me,onCtrlLongPress:Ne,onShiftTap:Pe}):null,(0,Z.jsx)(`div`,{ref:_,className:`xterm-host`,style:{width:`100%`,minHeight:0,overflow:`hidden`},onFocusCapture:()=>{g&&ae.current?.promote(`focused`)},onMouseDown:()=>{g&&ae.current?.promote(`focused`)}}),De?(0,Z.jsx)(`div`,{role:`status`,"aria-live":`polite`,style:{position:`absolute`,inset:0,display:`flex`,alignItems:`center`,justifyContent:`center`,backgroundColor:`rgba(0,0,0,0.35)`,pointerEvents:`none`,zIndex:5,fontSize:12,color:`var(--text-muted, #ddd)`},children:`Uploading…`}):null,o!==`mobile`&&I.kind===`queued`?(0,Z.jsx)(Ah,{state:`queued`,queuePosition:I.queuePosition}):null,Fe?(0,Z.jsx)(`div`,{className:Re,role:`status`,"aria-live":`polite`,children:(0,Z.jsxs)(`div`,{className:`xterm-replay-overlay__card`,children:[se.kind===`loading`?(0,Z.jsx)(`div`,{className:`xterm-replay-overlay__spinner`,"aria-hidden":`true`}):null,(0,Z.jsx)(`div`,{className:`xterm-replay-overlay__title`,children:Ie}),Le?(0,Z.jsx)(`div`,{className:`xterm-replay-overlay__body`,children:Le}):null]})}):null]})}var ig=({sessionId:e,showHeaderActions:t=!0,showSupervisorInline:n=!0,terminalReadOnlyOverride:r,headerAccessory:i,onClose:a,onSplitHorizontal:o,onSplitVertical:s,onStop:c})=>{let l=R(ud(e)),u=R(rd(l?.workspaceId??`__workspace_empty__`)),d=R(Kr),f=z(Kr),p=(0,L.useRef)(null),[m,h]=(0,L.useState)(!1);Xm(l);let{persistUiState:g}=om(l?.workspaceId??`__workspace_empty__`);if((0,L.useEffect)(()=>{if(d!==e)return;let t=p.current;t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`nearest`}),h(!0),f(null);let n=setTimeout(()=>h(!1),1400);return()=>clearTimeout(n)},[d,e,f]),!l)return null;let _=ag(l.state),v=l.title?.trim()||lg(l.id),y=dg(l.providerId),b=ug(l.state),x=r??!fg(l.state),S=u?.uiState.activeSessionId===l.id;return(0,Z.jsxs)(`div`,{ref:p,className:`session-card agent-pane${m?` session-card--focus-pulse`:``}`,"data-session-id":e,onClick:e=>{let t=e.target;t instanceof HTMLElement&&(t.closest(`button, a, input, textarea, select, [role="button"]`)||g({activeSessionId:l.id}))},children:[(0,Z.jsx)(`div`,{className:`session-progress`,children:(0,Z.jsx)(`div`,{className:`session-progress-bar ${og(l.state)}`,style:{width:`${_}%`}})}),(0,Z.jsxs)(`div`,{className:`session-header`,children:[(0,Z.jsxs)(`div`,{className:`session-header-left`,children:[(0,Z.jsx)(`span`,{className:`session-dot ${sg(l.state)}`}),(0,Z.jsx)(`div`,{className:`session-header-copy`,children:(0,Z.jsxs)(`div`,{className:`session-title-row`,children:[(0,Z.jsx)(`span`,{className:`session-title`,children:v}),(0,Z.jsx)(`span`,{className:`badge badge-blue session-provider-badge`,children:y}),(0,Z.jsx)(`span`,{className:`session-state-badge ${cg(l.state)}`,children:b})]})})]}),t||i?(0,Z.jsxs)(`div`,{className:`session-header-right`,children:[i?(0,Z.jsx)(`div`,{className:`session-header-accessory`,children:i}):null,t?(0,Z.jsxs)(`div`,{className:`session-header-actions`,children:[l.state===`running`?(0,Z.jsx)(`button`,{className:`session-action-btn`,onClick:()=>void c?.(),title:`Stop`,"aria-label":`Stop`,children:(0,Z.jsx)(Af,{size:13})}):null,(0,Z.jsx)(`button`,{className:`session-action-btn`,onClick:()=>o?.(),title:`Split horizontal`,"aria-label":`Split horizontal`,children:(0,Z.jsx)(Of,{size:13})}),(0,Z.jsx)(`button`,{className:`session-action-btn`,onClick:()=>s?.(),title:`Split vertical`,"aria-label":`Split vertical`,children:(0,Z.jsx)(Df,{size:13})}),(0,Z.jsx)(`button`,{className:`session-action-btn session-action-btn-close`,onClick:()=>void a?.(),title:`Close`,"aria-label":`Close`,children:(0,Z.jsx)(Pf,{size:14})})]}):null]}):null]}),n&&l.capability===`full`&&l.state!==`draft`&&l.state!==`ended`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ah,{sessionId:l.id,workspaceId:l.workspaceId}),(0,Z.jsx)(nh,{workspaceId:l.workspaceId,sessionId:l.id})]}):null,(0,Z.jsx)(`div`,{className:`session-terminal`,children:(0,Z.jsx)(rg,{terminalId:l.terminalId,workspaceId:l.workspaceId,readOnly:x,isActiveSession:S,terminalKind:`agent`})})]})};function ag(e){switch(e){case`starting`:return 18;case`running`:return 42;case`ended`:return 100;default:return 8}}function og(e){switch(e){case`starting`:return`session-progress-starting`;case`running`:return`session-progress-running`;case`idle`:return`session-progress-idle`;case`ended`:return`session-progress-complete`;default:return`session-progress-idle`}}function sg(e){switch(e){case`starting`:return`session-dot-starting`;case`running`:return`session-dot-running`;case`ended`:return`session-dot-complete`;default:return`session-dot-idle`}}function cg(e){switch(e){case`starting`:return`badge badge-amber`;case`running`:return`badge badge-green`;case`ended`:return`badge badge-blue`;default:return`badge badge-gray`}}function lg(e){let t=e.match(/(\d+)/)?.[1];return t?`SESSION-${t.slice(-2).padStart(2,`0`)}`:e.replace(/[_-]/g,` `).toUpperCase()}function ug(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function dg(e){return e.replace(/\b\w/g,e=>e.toUpperCase())}function fg(e){return e===`running`||e===`idle`||e===`starting`}var pg=({hydrateSessions:e=!0})=>{let t=X(),n=R(sd),{workspaceId:r,sessions:i,paneLayout:a}=Rm(n,{disabled:!e}),o=Mm(r),s=Lm(),c=Tm(a).length>0,l=i.length===0&&(c||a.type===`leaf`&&!a.sessionId&&a.id===`root`);return n?l?(0,Z.jsx)(Um,{workspaceId:r,onReplaceWithSession:o.replaceWithSession}):(0,Z.jsx)(`div`,{className:`agent-panes`,children:(0,Z.jsx)(mg,{node:a,workspaceId:r,onCloseSession:o.closeSessionPane,onSplitDraftPane:o.splitDraftPane,onSplitSession:o.splitSessionPane,onCloseDraftPane:o.closeDraftPane,onAssignSession:o.assignSession,onReplaceWithSession:o.replaceWithSession,onCloseSessionCommand:s.closeSession,onStopSession:s.stopSession})}):(0,Z.jsx)(`div`,{className:`agent-panes-empty`,children:(0,Z.jsx)(`p`,{children:t(`workspace.no_workspace`)})})},mg=({node:e,workspaceId:t,onAssignSession:n,onCloseDraftPane:r,onCloseSession:i,onCloseSessionCommand:a,onReplaceWithSession:o,onSplitDraftPane:s,onSplitSession:c,onStopSession:l})=>{if(e.type===`leaf`)return e.sessionId?(0,Z.jsx)(ig,{sessionId:e.sessionId,onClose:async()=>{i(e.sessionId),await a(e.sessionId)},onSplitHorizontal:()=>c(e.sessionId,`horizontal`),onSplitVertical:()=>c(e.sessionId,`vertical`),onStop:()=>l(e.sessionId)}):(0,Z.jsx)(Um,{workspaceId:t,paneId:e.id,onAssignSession:n,onClosePane:r,onReplaceWithSession:o,onSplitPane:s});let u=mm(t,e.id)??e.ratio??.5;return(0,Z.jsx)(Wm,{splitId:e.id,direction:e.direction||`horizontal`,ratio:u,onRatioCommit:n=>hm(t,e.id,n),children:e.children?.map(e=>(0,Z.jsx)(mg,{node:e,workspaceId:t,onAssignSession:n,onCloseDraftPane:r,onCloseSession:i,onCloseSessionCommand:a,onReplaceWithSession:o,onSplitDraftPane:s,onSplitSession:c,onStopSession:l},e.id))})};function hg(){let e=R(sd),t=R(Yu),n=z(Uf(e?.id??``)),[r,i]=(0,L.useState)(!1),[a,o]=(0,L.useState)(null),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),d=e?.id,[f,p]=Te(Bf(d??``)),[m,h]=Te(zf(d??``)),g=R(Vf(d??``)),_=d?m[f??``]:void 0,v=(0,L.useCallback)(async(e,n)=>{if(!d)return;c(t=>t?.path===e?null:t);let r=await t(`file.read`,{workspaceId:d,path:e});if(!r.ok||!r.data){let t=r.error?.message??`Failed to open file`;console.error(`Failed to open file:`,t),c({path:e,message:t});return}let i=r.data;if(n?.forceText&&i.kind===`image`&&i.isTextBacked){try{let t=await fetch(i.url,{credentials:`include`});if(!t.ok){let n=`Failed to fetch text-backed image bytes: ${t.status}`;console.error(n),c({path:e,message:n});return}let n={kind:`text`,path:e,content:await t.text(),baseHash:``,isDirty:!1,viewingTextBackedImageAsText:!0};h(t=>({...t,[e]:n})),c(t=>t?.path===e?null:t)}catch(t){let n=t instanceof Error?t.message:`Failed to fetch text-backed image bytes`;console.error(`Failed to fetch text-backed image bytes:`,t),c({path:e,message:n})}return}let a=i.kind===`text`?{kind:`text`,path:e,content:i.content,baseHash:i.baseHash,isDirty:!1,externalState:void 0}:{kind:`image`,path:e,mime:i.mime,url:i.url,size:i.size,isTextBacked:i.isTextBacked,externalState:void 0};h(t=>({...t,[e]:a})),u(t=>t?.path===e?null:t),c(t=>t?.path===e?null:t)},[t,h,d]),y=(0,L.useCallback)(async()=>{if(!d||!_||_.kind!==`text`||r)return;i(!0),o(null);let e=await t(`file.write`,{workspaceId:d,path:_.path,content:_.content,baseHash:_.baseHash||void 0});e.ok&&e.data?(h(t=>{let n=t[_.path];return!n||n.kind!==`text`?t:{...t,[_.path]:{...n,baseHash:e.data.newHash,isDirty:!1,externalState:void 0}}}),u(e=>e?.path===_.path?null:e)):o(e.error?.message??`Failed to save file`),i(!1)},[_,t,r,h,d]),b=(0,L.useCallback)(e=>{!d||!_||_.kind!==`text`||h(t=>{let n=t[_.path];return!n||n.kind!==`text`?t:{...t,[_.path]:{...n,content:e,isDirty:e!==n.content}}})},[_,h,d]);(0,L.useEffect)(()=>{!d||!f||m[f]||v(f)},[f,v,m,d]),(0,L.useEffect)(()=>{if(!d||g<=0)return;let e=Object.entries(m);if(e.length===0)return;let n=!1;return(async()=>{for(let[r,i]of e){let e=await t(`file.read`,{workspaceId:d,path:r});if(n)return;if(!e.ok||!e.data){let t=e.error?.code===`not_found`;h(e=>{let n=e[r];return n?{...e,[r]:{...n,externalState:t?`deleted`:n.externalState}}:e}),t&&f===r&&u({path:r,status:`deleted`});continue}let a=e.data;if(i.kind===`text`&&a.kind===`text`){if(a.baseHash===i.baseHash)continue;if(i.isDirty){h(e=>{let t=e[r];return!t||t.kind!==`text`?e:{...e,[r]:{...t,externalState:`modified`}}}),f===r&&u({path:r,status:`modified`});continue}h(e=>({...e,[r]:{kind:`text`,path:r,content:a.content,baseHash:a.baseHash,isDirty:!1,externalState:void 0,viewingTextBackedImageAsText:i.viewingTextBackedImageAsText}})),f===r&&u(e=>e?.path===r?null:e);continue}if(i.kind===`image`&&a.kind===`image`){if(i.url===a.url&&i.size===a.size)continue;h(e=>({...e,[r]:{kind:`image`,path:r,mime:a.mime,url:a.url,size:a.size,isTextBacked:a.isTextBacked,externalState:void 0}})),f===r&&u(e=>e?.path===r?null:e);continue}h(e=>{let t={...e};return delete t[r],t}),f===r&&u({path:r,status:`modified`})}})(),()=>{n=!0}},[f,t,g,m,h,d]);let x=(0,L.useCallback)(()=>{if(!d)return;let e=_?.path;p(null),e&&h(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n}),o(null)},[_,p,h,d]),S=(0,L.useCallback)(()=>{if(!d||!_)return;let e=_.path,t=_.kind===`image`;h(t=>{let n={...t};return delete n[e],n}),v(e,t?{forceText:!0}:void 0)},[_,v,h,d]),C=(0,L.useCallback)(async()=>{if(!d||!_)return!1;let e=await t(`git.diff`,{workspaceId:d,path:_.path,staged:!1});return!e.ok||!e.data?!1:(n({path:_.path,diff:e.data.diff,staged:!1}),!0)},[_,t,n,d]),w=_?.kind===`text`,T=_?.kind===`image`,E=T&&_.isTextBacked||w&&_.viewingTextBackedImageAsText===!0,D=!!(w&&_.isDirty&&!r),O=f&&s?.path===f?s.message:null;return{activeFilePath:f,activeExternalStatus:f&&l?.path===f?l.status:null,activeLoadError:O,canSave:D,currentFile:_,handleClose:x,handleContentChange:b,handleSave:y,isImageFile:T,isSaving:r,isSvgTextBacked:E,isTextFile:w,openInDiffMode:C,saveError:a,toggleSvgTextMode:S,workspace:e,workspaceId:d}}function gg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(2)} MB`}function _g(e){return(e.split(`/`)[1]??e).split(`+`)[0].replace(/^x-/,``).toUpperCase()}var vg=({url:e,mime:t,sizeBytes:n,alt:r})=>{let[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{a(null),s(!1)},[e]),(0,Z.jsxs)(`div`,{className:`image-preview`,children:[(0,Z.jsx)(`div`,{className:`image-preview-canvas`,children:o?(0,Z.jsxs)(`div`,{className:`git-diff-empty`,children:[(0,Z.jsx)(`p`,{className:`git-diff-empty-title`,children:`Preview unavailable`}),(0,Z.jsx)(`p`,{className:`git-diff-empty-body`,children:`The image could not be loaded. The file may have been moved or is larger than the browser allows.`})]}):(0,Z.jsx)(`img`,{className:`image-preview-img`,src:e,alt:r,draggable:!1,onLoad:e=>{let t=e.currentTarget;a({w:t.naturalWidth,h:t.naturalHeight})},onError:()=>s(!0)})}),(0,Z.jsxs)(`div`,{className:`image-preview-meta`,children:[(0,Z.jsx)(`span`,{className:`image-preview-type`,children:_g(t)}),i&&(0,Z.jsxs)(`span`,{className:`image-preview-dim`,children:[i.w,` × `,i.h]}),(0,Z.jsx)(`span`,{className:`image-preview-size`,children:gg(n)})]})]})},yg=({state:e,variant:t=`full`})=>{let n=X(),{canSave:r,handleClose:i,handleSave:a,isImageFile:o,isSaving:s,isSvgTextBacked:c,toggleSvgTextMode:l}=e,u=n(s?`code_editor.saving`:`action.save_file`),d=n(o?`code_editor.edit_as_text`:`code_editor.preview_as_image`),f=n(o?`code_editor.mode_text`:`code_editor.mode_image`);return t===`mobile`?(0,Z.jsxs)(`div`,{className:`mobile-sheet__header-actions`,children:[c?(0,Z.jsx)(`button`,{type:`button`,className:`mobile-sheet__action mobile-sheet__action--icon`,onClick:l,title:d,"aria-label":d,children:o?(0,Z.jsx)(Yd,{size:16}):(0,Z.jsx)(rf,{size:16})}):null,(0,Z.jsx)(`button`,{type:`button`,className:`mobile-sheet__action`,onClick:a,disabled:!r,"aria-label":u,children:u})]}):(0,Z.jsxs)(`div`,{className:`code-mode-toggle`,children:[c&&(0,Z.jsxs)(`button`,{type:`button`,className:`code-mode-btn`,onClick:l,title:d,"aria-label":d,children:[o?(0,Z.jsx)(Yd,{size:12}):(0,Z.jsx)(rf,{size:12}),(0,Z.jsx)(`span`,{children:f})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`code-mode-btn`,onClick:a,disabled:!r,title:u,"aria-label":u,children:[(0,Z.jsx)(Sf,{size:12}),(0,Z.jsx)(`span`,{children:u})]}),(0,Z.jsx)(`button`,{type:`button`,className:`code-mode-btn`,onClick:i,title:n(`action.close`),"aria-label":n(`action.close`),children:(0,Z.jsx)(Pf,{size:12})})]})},bg=({state:e,chrome:t=`full`})=>{let n=X(),{activeFilePath:r,activeExternalStatus:i,activeLoadError:a,currentFile:o,handleContentChange:s,handleSave:c,isImageFile:l,isTextFile:u,saveError:d,workspace:f}=e;if(!f)return(0,Z.jsx)(`div`,{className:`workspace-git-view`,children:(0,Z.jsx)(`div`,{className:`code-editor workspace-git-editor`,children:(0,Z.jsx)(`div`,{className:`code-editor-body`,children:(0,Z.jsx)(`div`,{className:`git-diff-empty`,children:(0,Z.jsx)(`p`,{className:`git-diff-empty-title`,children:n(`workspace.no_workspace`)})})})})});let p=u&&o.isDirty?(0,Z.jsx)(`span`,{className:`dirty-indicator`,children:`*`}):null;return(0,Z.jsx)(`div`,{className:`workspace-git-view`,children:(0,Z.jsxs)(`div`,{className:`code-editor workspace-git-editor`,children:[t===`full`?(0,Z.jsxs)(`div`,{className:`code-editor-header`,children:[(0,Z.jsx)(`span`,{className:`code-file-path`,children:o?(0,Z.jsxs)(Z.Fragment,{children:[o.path,p]}):r||n(`file.title`)}),(0,Z.jsx)(yg,{state:e})]}):null,d&&(0,Z.jsxs)(`div`,{className:`code-editor-error`,role:`alert`,children:[(0,Z.jsx)(Rd,{size:14}),(0,Z.jsx)(`span`,{children:d})]}),i&&(0,Z.jsxs)(`div`,{className:`code-editor-error`,role:`alert`,children:[(0,Z.jsx)(Rd,{size:14}),(0,Z.jsx)(`span`,{children:n(i===`deleted`?`code_editor.deleted_on_disk`:`code_editor.modified_on_disk`)})]}),(0,Z.jsx)(`div`,{className:`code-editor-body`,children:u?(0,Z.jsx)(kp,{workspaceId:f.id,filePath:o.path,content:o.content,onContentChange:s,onSave:c}):l?(0,Z.jsx)(vg,{url:o.url,mime:o.mime,sizeBytes:o.size,alt:o.path}):a?(0,Z.jsxs)(`div`,{className:`git-diff-empty`,role:`alert`,children:[(0,Z.jsx)(`p`,{className:`git-diff-empty-title`,children:n(`code_editor.open_failed_title`)}),(0,Z.jsx)(`p`,{className:`git-diff-empty-body`,children:a})]}):r?(0,Z.jsx)(`div`,{className:`git-diff-empty`,children:(0,Z.jsxs)(`p`,{className:`git-diff-empty-title`,children:[n(`status.connecting`),`…`]})}):(0,Z.jsxs)(`div`,{className:`git-diff-empty`,children:[(0,Z.jsx)(`p`,{className:`git-diff-empty-title`,children:n(`file.title`)}),(0,Z.jsx)(`p`,{className:`git-diff-empty-body`,children:n(`code_editor.empty_hint`)})]})})]})})},xg=({chrome:e=`full`,editorState:t})=>(0,Z.jsx)(bg,{state:t??hg(),chrome:e});function Sg({title:e,sections:t,selectedId:n,presentation:r=`sheet`,searchable:i=!1,searchPlaceholder:a,searchValue:o,onSearchValueChange:s,create:c,closeOnSelect:l=!0,loading:u=!1,loadingText:d,emptyText:f,kicker:p,onBack:m,onSelect:h,onClose:g}){let _=X(),[v,y]=(0,L.useState)(``),b=(0,L.useId)(),x=o??v,S=x.trim().toLowerCase(),C=d??_(`common.loading`),w=f??_(`command.no_results`),T=a??_(`action.search`),E=e=>{o===void 0&&y(e),s?.(e)},D=(0,L.useMemo)(()=>S?t.map(e=>e.kind===`options`?{...e,items:e.items.filter(e=>[e.label,e.description??``,e.meta??``,...e.keywords??[]].join(` `).toLowerCase().includes(S))}:e):t,[S,t]),O=D.some(e=>e.items.length>0),k=!!(c?.visible&&x.trim()),A=!!(k&&c?.disabled?.(x.trim())),j=(e,t)=>{Promise.resolve(t()).catch(t=>{console.error(`MobileSelectSheet ${e} failed`,t)})},ee=e=>{j(`select`,async()=>{await h(e),l&&g()})},M=e=>{j(`action`,e)},N=e=>{j(`action`,e)},te=()=>{!c||!x.trim()||j(`create`,()=>c.onCreate(x.trim()))},ne=(0,Z.jsxs)(Z.Fragment,{children:[i?(0,Z.jsxs)(`div`,{className:`mobile-select-sheet__search`,children:[(0,Z.jsx)(`label`,{className:`mobile-select-sheet__search-label`,htmlFor:b,children:_(`action.search`)}),(0,Z.jsx)(`input`,{id:b,type:`text`,className:`mobile-select-sheet__search-input`,placeholder:T,value:x,onChange:e=>E(e.target.value)})]}):null,(0,Z.jsx)(`div`,{className:`mobile-select-sheet__content`,children:u?(0,Z.jsx)(`div`,{className:`mobile-select-sheet__loading`,role:`status`,children:C}):(0,Z.jsxs)(Z.Fragment,{children:[D.map(e=>e.items.length===0&&e.kind===`options`?null:(0,Z.jsxs)(`div`,{className:`mobile-select-sheet__section`,children:[e.title?(0,Z.jsx)(`div`,{className:`mobile-select-sheet__section-title`,children:e.title}):null,(0,Z.jsx)(`div`,{className:`mobile-select-sheet__list`,children:e.kind===`options`?e.items.map(t=>{let r=t.id===n,i=`${e.id}-${t.id}-label`,a=[t.description?`${e.id}-${t.id}-description`:null,t.meta?`${e.id}-${t.id}-meta`:null].filter(Boolean).join(` `),o=(0,Z.jsxs)(`button`,{type:`button`,className:`mobile-select-sheet__item ${t.tone===`danger`?`mobile-select-sheet__item--danger`:``}`,"aria-pressed":r,"aria-labelledby":i,"aria-describedby":a||void 0,disabled:t.disabled,onClick:()=>ee(t.id),children:[t.icon?(0,Z.jsx)(`span`,{className:`mobile-select-sheet__item-icon`,"aria-hidden":`true`,children:t.icon}):null,(0,Z.jsxs)(`span`,{className:`mobile-select-sheet__item-copy`,children:[(0,Z.jsx)(`span`,{id:i,className:`mobile-select-sheet__item-label`,children:t.label}),t.description?(0,Z.jsx)(`span`,{id:`${e.id}-${t.id}-description`,className:`mobile-select-sheet__item-description`,children:t.description}):null,t.meta?(0,Z.jsx)(`span`,{id:`${e.id}-${t.id}-meta`,className:`mobile-select-sheet__item-meta`,children:t.meta}):null]}),t.badge?(0,Z.jsx)(`span`,{className:`mobile-select-sheet__item-badge`,children:t.badge}):null]});return t.trailingAction?(0,Z.jsxs)(`div`,{className:`mobile-select-sheet__item-row`,"data-selected":r?`true`:`false`,children:[o,(0,Z.jsx)(`button`,{type:`button`,className:`mobile-select-sheet__item-side-action ${t.trailingAction.tone===`danger`?`mobile-select-sheet__item-side-action--danger`:``}`,"aria-label":t.trailingAction.ariaLabel,disabled:t.disabled||t.trailingAction.disabled,onClick:()=>N(t.trailingAction.onAction),children:(0,Z.jsx)(`span`,{className:`mobile-select-sheet__item-side-action-icon`,"aria-hidden":`true`,children:t.trailingAction.icon})})]},t.id):(0,Z.jsx)(`div`,{"data-selected":r?`true`:`false`,children:o},t.id)}):e.items.map(t=>{let n=`${e.id}-${t.id}-label`,r=t.description?`${e.id}-${t.id}-description`:void 0;return(0,Z.jsxs)(`button`,{type:`button`,className:`mobile-select-sheet__item mobile-select-sheet__item--action ${t.tone===`danger`?`mobile-select-sheet__item--danger`:``}`,"aria-labelledby":n,"aria-describedby":r,disabled:t.disabled,onClick:()=>M(t.onAction),children:[t.icon?(0,Z.jsx)(`span`,{className:`mobile-select-sheet__item-icon`,"aria-hidden":`true`,children:t.icon}):null,(0,Z.jsxs)(`span`,{className:`mobile-select-sheet__item-copy`,children:[(0,Z.jsx)(`span`,{id:n,className:`mobile-select-sheet__item-label`,children:t.label}),t.description?(0,Z.jsx)(`span`,{id:r,className:`mobile-select-sheet__item-description`,children:t.description}):null]})]},t.id)})})]},e.id)),k?(0,Z.jsx)(`div`,{className:`mobile-select-sheet__section`,children:(0,Z.jsx)(`div`,{className:`mobile-select-sheet__list`,children:(()=>{let e=`mobile-select-create-label`;return(0,Z.jsx)(`button`,{type:`button`,className:`mobile-select-sheet__item mobile-select-sheet__item--create`,"aria-labelledby":e,disabled:A,onClick:te,children:(0,Z.jsx)(`span`,{className:`mobile-select-sheet__item-copy`,children:(0,Z.jsx)(`span`,{id:e,className:`mobile-select-sheet__item-label`,children:c?.label(x.trim())})})})})()})}):null,!O&&!k?(0,Z.jsx)(`div`,{className:`mobile-select-sheet__empty`,children:w}):null]})})]});return r===`inline`?(0,Z.jsxs)(`div`,{className:`mobile-inline-sheet`,role:`dialog`,"aria-label":e,children:[(0,Z.jsx)(`div`,{className:`mobile-inline-sheet__handle`,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:`mobile-inline-sheet__header`,children:(0,Z.jsx)(Qf,{title:e,titleAs:`h3`,onBack:m,backLabel:_(`action.back`)})}),(0,Z.jsx)(`div`,{className:`mobile-inline-sheet__body`,children:(0,Z.jsx)(`div`,{className:`mobile-select-sheet mobile-select-sheet--inline`,children:ne})})]}):(0,Z.jsx)($f,{title:e,body:(0,Z.jsx)(`div`,{className:`mobile-select-sheet`,children:ne}),onClose:g,kicker:p,onBack:m,bodyClassName:`mobile-sheet__body--flush`,fullscreen:!0})}var Cg=`__terminal_panel_empty__`;function wg(e,t){let n=new Set(t),r=[...t];for(let t of e)n.has(t)||(n.add(t),r.push(t));return r}function Tg(e){return{id:e.id,workspaceId:e.workspaceId,kind:e.kind,alive:e.alive,exitCode:e.exitCode,title:e.title}}function Eg(){let e=X(),t=R(od),n=R(Yu),r=R(Vu),i=z(cp),a=ve(),[o,s]=(0,L.useState)([]),[c,l]=(0,L.useState)(null),u=(0,L.useRef)(null),d=R(sh(c??Cg)),f=c?d:null;(0,L.useEffect)(()=>{if(!t){s([]),l(null);return}let r=!1;return s([]),l(null),n(`terminal.list`,{workspaceId:t}).then(t=>{if(r)return;if(!t.ok||!t.data){console.error(`Failed to fetch terminals:`,t.error?.message),i({kind:`error`,title:e(`terminal.load_failed_title`),body:t.error?.message??e(`terminal.load_failed_body`)});return}let n=t.data.filter(e=>e.kind===`shell`),o=n.map(e=>e.id);for(let e of n)a.set(sh(e.id),Tg(e));s(e=>wg(e,o)),l(e=>e??o[0]??null)}).catch(t=>{r||(console.error(`Failed to fetch terminals:`,t),i({kind:`error`,title:e(`terminal.load_failed_title`),body:t instanceof Error?t.message:e(`terminal.load_failed_body`)}))}),()=>{r=!0}},[t,n,i,a,e]),(0,L.useEffect)(()=>{if(!r||!t)return;let e=Nu.terminalsAll(t);return u.current=r.subscribe([e],(e,t,n)=>{let r=e.split(`.`);if(r.length<5)return;let i=r[3],o=r[4];if(o===`created`){let e=t;if(e.kind!==`shell`)return;s(t=>t.includes(e.id)?t:[...t,e.id]),l(e.id);return}if(o!==`output`)return;let c=a.get(sh(i));if(!c||c.kind!==`shell`)return;let u=t,d=oh(i),f=a.get(d);n<=f.lastSeq||a.set(d,{chunks:[...f.chunks,u.bytes],lastSeq:n})}),()=>{u.current?.(),u.current=null}},[t,a,r]);let p=(0,L.useCallback)(async()=>{if(!t){i({kind:`warning`,title:e(`terminal.create_unavailable_title`),body:e(`terminal.create_unavailable_body`)});return}try{let r=await n(`terminal.create`,{workspaceId:t,kind:`shell`});if(!r.ok||!r.data){i({kind:`error`,title:e(`terminal.create_failed_title`),body:r.error?.message??e(`terminal.create_failed_body`)});return}let o=r.data;a.set(sh(o.id),Tg(o)),s(e=>e.includes(o.id)?e:[...e,o.id]),l(o.id)}catch(t){i({kind:`error`,title:e(`terminal.create_failed_title`),body:t instanceof Error?t.message:e(`terminal.create_failed_body`)})}},[t,n,i,a,e]);return{activeTerminalId:c,activeTerminalMeta:f,activeWorkspaceId:t,handleCloseTerminal:(0,L.useCallback)(async e=>{(await n(`terminal.close`,{terminalId:e})).ok&&s(t=>{let n=t.filter(t=>t!==e);return l(t=>t===e?n[0]??null:t),n})},[n]),handleCreateTerminal:p,handleSwitchTerminal:(0,L.useCallback)(e=>{l(e)},[]),hasTerminals:o.length>0,terminalIds:o}}function Dg(e,t,n){let r=e?.title?.trim(),i=Og(r);return!r||kg(r,n)?`${i??n} — ${t+1}`:i?`${i} — ${t+1}`:r}function Og(e){if(!e)return null;let t=e.split(/[\\/]/).pop()?.trim();if(!t)return null;let n=t.toLowerCase().replace(/\.exe$/,``);return new Set([`bash`,`cmd`,`csh`,`fish`,`ksh`,`powershell`,`pwsh`,`sh`,`tcsh`,`zsh`]).has(n)?n:null}function kg(e,t){let n=e.toLowerCase();return n===t.trim().toLowerCase()||n===`shell terminal`||n===`shell 终端`}function Ag({id:e,index:t,isActive:n,onSelect:r,onClose:i}){let a=X(),o=Dg(R(sh(e)),t,a(`terminal.shell`));return(0,Z.jsxs)(`div`,{className:`terminal-selector-item ${n?`terminal-selector-item-active`:``}`,children:[(0,Z.jsx)(`button`,{className:`terminal-selector-item-trigger`,onClick:r,children:(0,Z.jsx)(`span`,{className:`terminal-selector-item-title`,children:o})}),(0,Z.jsx)(`button`,{className:`terminal-selector-item-close`,onClick:e=>{e.stopPropagation(),i()},children:(0,Z.jsx)(Pf,{size:12})})]})}function jg({id:e,index:t,isActive:n,onSelect:r,onClose:i}){let a=X(),o=Dg(R(sh(e)),t,a(`terminal.shell`));return(0,Z.jsxs)(`div`,{className:`terminal-tab ${n?`terminal-tab-active`:``}`,children:[(0,Z.jsx)(`button`,{className:`terminal-tab-label`,onClick:r,children:(0,Z.jsx)(`span`,{className:`terminal-tab-title`,children:o})}),(0,Z.jsx)(`button`,{className:`terminal-tab-close`,onClick:i,children:(0,Z.jsx)(Pf,{size:12})})]})}function Mg({chrome:e=`default`}){let t=X(),n=ve(),[r,i]=(0,L.useState)(!1),{activeTerminalId:a,activeTerminalMeta:o,activeWorkspaceId:s,handleCloseTerminal:c,handleCreateTerminal:l,handleSwitchTerminal:u,hasTerminals:d,terminalIds:f}=Eg(),p=a?f.indexOf(a):0,m=Dg(o,p>=0?p:0,t(`terminal.shell`)),h=e===`mobile-fullscreen`,g=d&&(!h||f.length>1),_=f.length>1&&!h;return(0,Z.jsxs)(`div`,{className:`bottom-terminal${h?` bottom-terminal--mobile-fullscreen`:``}`,children:[(0,Z.jsxs)(`div`,{className:`terminal-toolbar`,children:[(0,Z.jsx)(`div`,{className:`terminal-toolbar-left`,children:h?null:(0,Z.jsxs)(`div`,{className:`terminal-title-stack`,children:[(0,Z.jsx)(`span`,{className:`terminal-kicker`,children:t(`terminal.kicker`)}),o?(0,Z.jsx)(`span`,{className:`terminal-title`,children:m}):null]})}),(0,Z.jsxs)(`div`,{className:`terminal-toolbar-right`,children:[d&&(0,Z.jsxs)(Z.Fragment,{children:[g?(0,Z.jsxs)(`div`,{className:`terminal-selector`,children:[(0,Z.jsxs)(`button`,{className:`terminal-selector-btn`,"aria-label":h?t(`terminal.selector.switch`):m,"aria-expanded":h?r:void 0,onClick:()=>{h&&i(e=>!e)},children:[(0,Z.jsx)(`span`,{children:m}),(0,Z.jsx)(Fd,{size:12})]}),h?r?(0,Z.jsx)(Sg,{title:t(`terminal.selector.title`),sections:[{kind:`options`,id:`terminals`,items:f.map((e,r)=>({id:e,label:Dg(n.get(sh(e)),r,t(`terminal.shell`)),meta:e===a?t(`terminal.selector.current`):t(`terminal.selector.indexed`,{index:r+1})}))}],selectedId:a,onSelect:u,onClose:()=>i(!1)}):null:f.length>1?(0,Z.jsx)(`div`,{className:`terminal-selector-dropdown`,children:f.map((e,t)=>(0,Z.jsx)(Ag,{id:e,index:t,isActive:e===a,onSelect:()=>u(e),onClose:()=>c(e)},e))}):null]}):null,(0,Z.jsx)(`div`,{className:`terminal-toolbar-actions`,children:(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,onClick:()=>{a&&(i(!1),c(a))},"aria-label":t(`terminal.close_terminal`),title:t(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})})]}),(0,Z.jsx)(`div`,{className:`terminal-toolbar-actions`,children:(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,onClick:l,"aria-label":t(`terminal.new_terminal`),title:t(`action.open`),children:(0,Z.jsx)(vf,{size:14})})})]})]}),(0,Z.jsx)(`div`,{className:`bottom-terminal-content`,children:d?(0,Z.jsxs)(Z.Fragment,{children:[_?(0,Z.jsx)(`div`,{className:`bottom-terminal-tabs`,children:f.map((e,t)=>(0,Z.jsx)(jg,{id:e,index:t,isActive:e===a,onSelect:()=>u(e),onClose:()=>c(e)},e))}):null,o&&s&&(0,Z.jsx)(`div`,{className:`bottom-terminal-xterm`,children:(0,Z.jsx)(rg,{terminalId:o.id,workspaceId:s,terminalKind:o.kind??`shell`})})]}):(0,Z.jsxs)(`div`,{className:`bottom-terminal-empty`,children:[(0,Z.jsx)(jf,{size:32,className:`bottom-terminal-empty-icon`}),(0,Z.jsx)(`p`,{className:`bottom-terminal-empty-text`,children:t(`terminal.no_terminal`)}),(0,Z.jsx)(`p`,{className:`bottom-terminal-empty-hint`,children:t(`terminal.empty_hint`)}),(0,Z.jsxs)(`button`,{className:`btn btn-primary btn-sm`,onClick:l,children:[(0,Z.jsx)(vf,{size:14}),(0,Z.jsx)(`span`,{children:t(`terminal.new_terminal`)})]})]})})]})}function Ng({controller:e,className:t,iconSize:n,dataTestId:r}){let i=X();if(!e?.supported)return null;let a=e.isFullscreen?i(`tooltip.exit_fullscreen`):i(`tooltip.enter_fullscreen`);return(0,Z.jsx)(`button`,{type:`button`,className:t,"aria-label":a,title:a,"data-testid":r,onClick:()=>{e.toggleFullscreen()},children:(0,Z.jsx)(e.isFullscreen?uf:cf,{size:n})})}var Pg=()=>{let e=X(),t=R(Hu);return t===`connected`?null:(0,Z.jsxs)(`div`,{className:`connection-status ${`connection-status-${t}`}`,title:e(`status.${t}`),"aria-label":e(`status.${t}`),children:[(0,Z.jsx)(`span`,{className:`connection-status-dot connection-status-dot-${t}`}),(0,Z.jsx)(`span`,{className:`connection-status-text`,children:e(`status.${t}`)})]})};function Fg(){let e=Zt(),t=R(Yu),n=R(ed),r=z(Qu),i=z($u),a=z(ed);return(0,L.useCallback)(async(o,s)=>{let c=await t(`workspace.close`,{id:o});if(!c.ok)return console.error(`Failed to close workspace:`,c.error?.message),!1;let l=n.filter(e=>e!==o);return i(e=>{let t={...e};return delete t[o],t}),a(l),r(e=>e===o?l[0]??null:e),l.length===0&&s?.navigateHomeWhenEmpty&&e(`/`,{replace:!0}),!0},[t,e,r,a,i,n])}var Ig=({workspace:e,isActive:t})=>{let n=X(),r=z(Qu),i=Fg(),a=e.name||e.path?.split(`/`).filter(Boolean).pop()||e.path||e.id,o=()=>{r(e.id)};return(0,Z.jsxs)(`div`,{className:`topbar-tab ${t?`active`:``}`,onClick:o,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),o())},role:`button`,tabIndex:0,"aria-selected":t,title:e.path||e.id,children:[(0,Z.jsx)(`span`,{className:`topbar-dot ${e.isActive?`active`:`idle`}`}),(0,Z.jsx)(`span`,{className:`topbar-tab-name`,children:a}),e.unreadCount&&e.unreadCount>0?(0,Z.jsx)(`span`,{className:`topbar-unread`,children:e.unreadCount>9?`9+`:e.unreadCount}):null,(0,Z.jsx)(`button`,{className:`topbar-close`,onClick:async t=>{t.stopPropagation(),await i(e.id)},"aria-label":n(`action.close_workspace`),children:(0,Z.jsx)(Pf,{size:14})})]})},Lg=({fullscreenController:e})=>{let t=X(),n=Zt(),r=R(ad),i=R(od),[a,o]=Te(Gr),[s,c]=Te(Zf),[l,u]=Te(Xf),[d,f]=(0,L.useState)(!1);return(0,Z.jsxs)(`header`,{className:`app-topbar`,children:[(0,Z.jsxs)(`div`,{className:`topbar-tabs`,children:[r.length===0?(0,Z.jsx)(`div`,{className:`topbar-empty-state`,children:(0,Z.jsx)(`span`,{className:`topbar-hint`,children:t(`workspace.no_workspace`)})}):r.map(e=>(0,Z.jsx)(Ig,{workspace:e,isActive:e.id===i},e.id)),(0,Z.jsx)(`button`,{className:`topbar-add`,onClick:()=>f(!0),"aria-label":t(`tooltip.new_workspace`),title:t(`tooltip.new_workspace`),children:(0,Z.jsx)(vf,{size:14})})]}),(0,Z.jsxs)(`div`,{className:`topbar-actions`,children:[(0,Z.jsx)(Pg,{}),(0,Z.jsxs)(`button`,{className:`topbar-btn topbar-quick-actions`,onClick:()=>o(!a),"aria-label":t(`tooltip.quick_actions`),title:t(`tooltip.quick_actions`),children:[(0,Z.jsx)(Cf,{size:14}),(0,Z.jsx)(`span`,{className:`topbar-btn-label`,children:t(`tooltip.quick_actions`)})]}),(0,Z.jsx)(`button`,{className:`topbar-btn ${s?`topbar-btn--active`:`topbar-btn--muted`}`,onClick:()=>c(!s),"aria-label":t(s?`tooltip.hide_terminal`:`tooltip.show_terminal`),title:t(s?`tooltip.hide_terminal`:`tooltip.show_terminal`),children:(0,Z.jsx)(pf,{size:14})}),(0,Z.jsx)(`button`,{className:`topbar-btn ${l?`topbar-btn--muted`:`topbar-btn--active`}`,onClick:()=>u(!l),"aria-label":t(l?`tooltip.show_files`:`tooltip.hide_files`),title:t(l?`tooltip.show_files`:`tooltip.hide_files`),children:(0,Z.jsx)(mf,{size:14})}),(0,Z.jsx)(`button`,{className:`topbar-btn`,onClick:()=>n(`/settings`),"aria-label":t(`settings.title`),title:t(`settings.title`),"data-testid":`settings-open`,children:(0,Z.jsx)(Tf,{size:14})}),(0,Z.jsx)(Ng,{controller:e,className:`topbar-btn`,iconSize:14,dataTestId:`workspace-fullscreen-open`})]}),d?(0,Z.jsx)(tp,{onClose:()=>f(!1)}):null]})},Rg=180*1e3,zg={push:`git.operation_push`,pull:`git.operation_pull`};function Bg(e){let t=X(),n=R(Yu),r=z(cp),i=z(Hf(e)),a=z(Gf(e)),o=z(Lf(e)),[s,c]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),d=(0,L.useCallback)(e=>e.canPrompt?e.reason===`invalid_credentials`?t(`git.auth_failed_invalid`,{remote:e.remoteLabel}):e.reason===`authorization_failed`?t(`git.auth_failed_forbidden`,{remote:e.remoteLabel,operation:t(zg[e.operation])}):t(`git.auth_required_message`,{remote:e.remoteLabel}):t(`git.auth_failed_unsupported`,{remote:e.remoteLabel}),[t]),f=(0,L.useCallback)(async()=>{if(!e)return!1;let[t,r]=await Promise.all([n(`git.branches`,{workspaceId:e}),n(`git.status`,{workspaceId:e})]);return t.ok&&t.data?a({current:t.data.current,branches:t.data.branches,loading:!1}):a(e=>({...e,loading:!1})),r.ok&&r.data&&i(r.data),t.ok&&r.ok},[n,a,i,e]),p=(0,L.useCallback)(async(t,i)=>{if(!e)return!1;c(t===`git.push`?`push`:`pull`);try{let a=await n(t,{workspaceId:e,...i.auth?{auth:i.auth}:{}},{timeoutMs:Rg});if(!a.ok||!a.data?.success){let e=a.error?.message??a.data?.message;if((a.error?.code===`git_auth_required`||a.error?.code===`git_auth_failed`)&&a.error.details&&typeof a.error.details==`object`){let e=a.error.details;return u({intent:t===`git.push`?`push`:`pull`,details:{...e,usernameHint:l?.intent===(t===`git.push`?`push`:`pull`)?l.details.usernameHint:e.usernameHint}}),!1}return i.auth&&u(null),r({kind:`error`,title:i.errorTitle,body:e}),console.error(`Failed to run ${t}:`,e),!1}return await f(),i.markFileTreeStale&&o(!0),r({kind:`success`,title:i.successTitle,body:a.data.message||i.fallbackSuccessBody}),!0}finally{c(null)}},[l,n,r,f,o,e]),m=(0,L.useCallback)(async e=>p(`git.push`,{successTitle:t(`git.push_success_title`),fallbackSuccessBody:t(`git.push_success_body`),errorTitle:t(`git.push_failed_title`),auth:e}),[p,t]);return{authPrompt:l,clearAuthPrompt:()=>u(null),setAuthPrompt:u,getAuthPromptMessage:d,handlePull:(0,L.useCallback)(async e=>p(`git.pull`,{successTitle:t(`git.pull_success_title`),fallbackSuccessBody:t(`git.pull_success_body`),errorTitle:t(`git.pull_failed_title`),markFileTreeStale:!0,auth:e}),[p,t]),handlePush:m,refreshBranchState:f,syncingIntent:s}}function Vg(e){let t=[{title:`staged`,type:`staged`,changes:e.staged},{title:`modified`,type:`modified`,changes:e.modified},{title:`deleted`,type:`deleted`,changes:e.deleted},{title:`untracked`,type:`untracked`,changes:e.untracked}];for(let e of t)if(e.changes[0])return{change:e.changes[0],type:e.type};return null}function Hg(e,t){let n=[{type:`staged`,changes:e.staged},{type:`modified`,changes:e.modified},{type:`deleted`,changes:e.deleted},{type:`untracked`,changes:e.untracked}];for(let e of n){let n=e.changes.find(e=>e.path===t);if(n)return{change:n,type:e.type}}return null}function Ug({workspaceId:e,refreshToken:t=0,onPreviewOpen:n}){let r=X(),i=R(Hf(e)),a=R(Uf(e)),o=R(Wf(e)),s=R(Yu),c=z(Hf(e)),l=z(Gf(e)),u=z(Uf(e)),d=z(Wf(e)),[f,p]=(0,L.useState)(``),[m,h]=(0,L.useState)(!1),[g,_]=(0,L.useState)(null),v=(0,L.useRef)(!1),y=(0,L.useRef)(!1),b=(0,L.useCallback)(e=>{l({current:e?.current??``,branches:e?.branches??[],loading:!1})},[l]),x=(0,L.useCallback)(e=>{u(e)},[u]),S=(0,L.useCallback)(async(t,n)=>{let r=await s(`git.diff`,{workspaceId:e,path:t.path,staged:n===`staged`});if(!r.ok||!r.data)return console.error(`Failed to get diff:`,r.error?.message),null;let i={path:t.path,diff:r.data.diff,staged:n===`staged`};return d(!1),x(i),i},[s,d,x,e]),C=(0,L.useCallback)(async(e,t)=>{let r=await S(e,t);r&&n?.(r)},[n,S]),w=(0,L.useCallback)(async()=>{if(!e)return;l(e=>({...e,loading:!0,error:void 0}));let t=await s(`git.branches`,{workspaceId:e});if(!t.ok||!t.data){l(e=>({...e,loading:!1,error:t.error?.message??`Failed to load branches`})),console.error(`Failed to load git branches:`,t.error?.message);return}b(t.data)},[s,l,b,e]),T=(0,L.useCallback)(async()=>{if(e){if(v.current){y.current=!0;return}v.current=!0,h(!0);try{let t=await s(`git.status`,{workspaceId:e});if(!t.ok||!t.data){console.error(`Failed to load git status:`,t.error?.message);return}if(c(t.data),o){x(null);return}let n=(a?Hg(t.data,a.path):null)??Vg(t.data);if(!n){x(null);return}(!a||a.path!==n.change.path||!!a.staged!=(n.type===`staged`))&&await S(n.change,n.type)}finally{v.current=!1,h(!1),y.current&&(y.current=!1,queueMicrotask(()=>{T()}))}}},[a,o,s,S,c,x,e]);(0,L.useEffect)(()=>{!i&&!v.current&&T()},[i,T]),(0,L.useEffect)(()=>{w()},[w]),(0,L.useEffect)(()=>{if(!i||o)return;if(a){let e=Hg(i,a.path);if(e&&!!a.staged==(e.type===`staged`))return}let e=Vg(i);if(!e){x(null);return}S(e.change,e.type)},[a,o,i,S,x]),(0,L.useEffect)(()=>{t>0&&!v.current&&T()},[t,T]);let E=(0,L.useCallback)(async(e,t,n,r)=>{let i=await s(e,t);return i.ok?(r?.(),await T(),!0):(console.error(n,i.error?.message),!1)},[s,T]),D=(0,L.useCallback)(async()=>{await E(`git.stage`,{workspaceId:e,paths:[...i?.modified.map(e=>e.path)??[],...i?.deleted.map(e=>e.path)??[],...i?.untracked.map(e=>e.path)??[]]},`Failed to stage all:`)},[i,E,e]),O=(0,L.useCallback)(async()=>{await E(`git.unstage`,{workspaceId:e,paths:i?.staged.map(e=>e.path)??[]},`Failed to unstage all:`)},[i,E,e]),k=(0,L.useCallback)(()=>{let e=[...i?.staged.map(e=>e.path)??[],...i?.modified.map(e=>e.path)??[],...i?.deleted.map(e=>e.path)??[],...i?.untracked.map(e=>e.path)??[]];e.length&&_({scope:`all`,paths:e})},[i]),A=(0,L.useCallback)(e=>{_({scope:`single`,paths:[e],filePath:e})},[]),j=(0,L.useCallback)(()=>{_(null)},[]),ee=(0,L.useCallback)(async()=>{if(!g)return;let t=g;_(null),await E(`git.discard`,{workspaceId:e,paths:t.paths},t.scope===`all`?`Failed to discard all:`:`Failed to discard:`)},[g,E,e]),M=(0,L.useCallback)(async()=>{!f.trim()||!i?.staged.length||await E(`git.commit`,{workspaceId:e,message:f.trim()},`Failed to commit:`,()=>p(``))},[f,i?.staged.length,E,e]),N=!!(i&&(i.staged.length>0||i.modified.length>0||i.untracked.length>0||i.deleted.length>0));return{commitMessage:f,diffPreview:a,gitState:i,groups:(0,L.useMemo)(()=>[{title:`staged`,type:`staged`,changes:i?.staged??[]},{title:`changes`,type:`modified`,changes:i?.modified??[]},{title:`deleted`,type:`deleted`,changes:i?.deleted??[]},{title:`untracked`,type:`untracked`,changes:i?.untracked??[]}].filter(e=>e.changes.length>0),[i]),hasChanges:N,isLoading:m,pendingDiscard:g,setCommitMessage:p,handleCancelDiscard:j,handleCommit:M,handleConfirmDiscard:ee,handleDiscardAll:k,handleRequestDiscardSingle:A,handleStageAll:D,handleUnstageAll:O,loadGitStatus:T,openDiff:C,requestDiff:S,runGitMutation:E,t:r}}function Wg(e){let t=R(Uf(e)),n=z(Uf(e)),r=z(Wf(e));return{closePreview:()=>{r(!0),n(null)},preview:t}}function Gg(){let e=X(),t=R(Kf),n=z(Kf),r=R(Yu),i=t.workspaceId,a=R(Gf(i??``)),o=z(Gf(i??``)),{refreshBranchState:s}=Bg(i??``),[c,l]=(0,L.useState)(t.inputValue),[u,d]=(0,L.useState)(0),[f,p]=(0,L.useState)(null);(0,L.useEffect)(()=>{l(t.inputValue)},[t.inputValue]),(0,L.useEffect)(()=>{t.visible&&(d(0),p(null))},[t.visible]),(0,L.useEffect)(()=>{if(!t.visible||!i)return;if(a.branches.length>0){o(e=>({...e,loading:!1,error:void 0}));return}let e=!1;return o(e=>({...e,loading:!0,error:void 0})),r(`git.branches`,{workspaceId:i}).then(t=>{if(!e){if(!t.ok||!t.data){o(e=>({...e,loading:!1,error:t.error?.message??`Failed to load branches`})),console.error(`Failed to load git branches:`,t.error?.message);return}o({current:t.data.current,branches:t.data.branches,loading:!1})}}).catch(t=>{e||(o(e=>({...e,loading:!1,error:t instanceof Error?t.message:`Failed to load branches`})),console.error(`Failed to load git branches:`,t))}),()=>{e=!0}},[a.branches.length,r,t.visible,o,i]);let m=c.trim(),h=(0,L.useMemo)(()=>a.branches.filter(e=>e.name.toLowerCase().includes(c.toLowerCase())),[a.branches,c]),g=h.find(e=>e.name.toLowerCase()===c.toLowerCase()),_=(0,L.useMemo)(()=>{let t=[];return h.forEach(e=>{t.push({type:`branch`,branch:e,label:e.name})}),!g&&m&&!a.loading&&t.push({type:f===m?`confirm-create`:`create`,label:e(f===m?`git.quick_pick.confirm_create`:`git.quick_pick.create`,{name:m})}),t},[a.loading,g,h,f,e,m]),v=(0,L.useCallback)(()=>{p(null),n({visible:!1,inputValue:``})},[n]),y=(0,L.useCallback)(e=>{e&&p(e)},[]),b=(0,L.useCallback)(async e=>{if(!i)return;let t=await r(`git.checkout`,{workspaceId:i,ref:e});if(!t.ok||!t.data?.success){console.error(`Failed to checkout branch:`,t.error?.message??t.data?.message);return}await s(),v()},[r,v,s,i]);return{branchList:a,displayItems:_,filteredBranches:h,handleBranchCreate:(0,L.useCallback)(async e=>{if(!i||!e)return;let t=await r(`git.checkout`,{workspaceId:i,ref:e,createBranch:!0});if(!t.ok||!t.data?.success){console.error(`Failed to create branch:`,t.error?.message??t.data?.message);return}await s(),v()},[r,v,s,i]),handleBranchSelect:b,handleClose:v,handleRequestBranchCreate:y,inputValue:c,pendingCreateBranchName:f,quickPickState:t,selectedIndex:u,setInputValue:l,setPendingCreateBranchName:p,setSelectedIndex:d,trimmedInput:m}}function Kg(e){return!!(document.fullscreenEnabled&&e&&typeof e.requestFullscreen==`function`&&typeof document.exitFullscreen==`function`)}function qg(e){let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let t=()=>{let t=e.current;n(Kg(t)),i(!!(t&&document.fullscreenElement===t))};return t(),document.addEventListener(`fullscreenchange`,t),()=>{document.removeEventListener(`fullscreenchange`,t)}},[e]);let a=(0,L.useCallback)(async()=>{let t=e.current;if(Kg(t))try{await t.requestFullscreen()}catch(e){console.warn(`Failed to enter fullscreen`,e)}},[e]),o=(0,L.useCallback)(async()=>{if(!(typeof document.exitFullscreen!=`function`||!document.fullscreenElement))try{await document.exitFullscreen()}catch(e){console.warn(`Failed to exit fullscreen`,e)}},[]);return{supported:t,isFullscreen:r,enterFullscreen:a,exitFullscreen:o,toggleFullscreen:(0,L.useCallback)(async()=>{if(e.current&&document.fullscreenElement===e.current){await o();return}await a()},[a,o,e])}}var Jg=280,Yg=220,Xg=480,Zg=120,Qg=400;function $g(){let[e,t]=Te(Jf),[n,r]=Te(Yf);(0,L.useEffect)(()=>{(e===200||e===220||e===264)&&t(Jg)},[e,t]);let i=(0,L.useRef)(!1),a=(0,L.useRef)(0),o=(0,L.useRef)(0),s=(0,L.useCallback)(n=>{i.current=!0,a.current=n.clientX,o.current=e;let r=e=>{if(!i.current)return;let n=e.clientX-a.current;t(Math.min(Xg,Math.max(Yg,o.current+n)))},s=()=>{i.current=!1,document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,s)};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,s)},[e,t]),c=(0,L.useRef)(!1),l=(0,L.useRef)(0),u=(0,L.useRef)(0);return{bottomPanelHeight:n,handleBottomMouseDown:(0,L.useCallback)(e=>{c.current=!0,l.current=e.clientY,u.current=n;let t=e=>{if(!c.current)return;let t=l.current-e.clientY;r(Math.min(Qg,Math.max(Zg,u.current+t)))},i=()=>{c.current=!1,document.removeEventListener(`mousemove`,t),document.removeEventListener(`mouseup`,i)};document.addEventListener(`mousemove`,t),document.addEventListener(`mouseup`,i)},[n,r]),handleLeftMouseDown:s,leftPanelWidth:e}}function e_(){let e=R(sd),t=e?.id??`__workspace_placeholder__`,n=R(od),r=R(ad),i=R(Hf(t)),a=R(Bf(t)),o=R(Uf(t)),s=R(qf),c=R(Zf),l=R(Xf),{sessions:u,paneLayout:d}=Rm(e),f=R(Yu),p=z(Kf),m=ve(),h=$g(),g=Mm(t),_=Lm(),{persistUiState:v}=om(t),[y,b]=(0,L.useState)(`files`),[x,S]=(0,L.useState)(null),[C,w]=(0,L.useState)(0),[T,E]=(0,L.useState)(null),[D,O]=(0,L.useState)({kind:`root`}),[k,A]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(!e||i)return;let t=!1;return f(`git.status`,{workspaceId:e.id}).then(n=>{t||!n.ok||!n.data||m.set(Hf(e.id),n.data)}).catch(e=>{t||console.error(`Failed to load git status:`,e)}),()=>{t=!0}},[f,i,m,e]);let j=(0,L.useCallback)(()=>{e&&(b(`git`),p({visible:!0,workspaceId:e.id,inputValue:``}))},[p,e]),ee=(0,L.useCallback)(()=>{S(e=>({id:(e?.id??0)+1,mode:`file`,baseDir:null}))},[]),M=(0,L.useCallback)(()=>{S(e=>({id:(e?.id??0)+1,mode:`folder`,baseDir:null}))},[]),N=(0,L.useCallback)(()=>{S(null)},[]),te=(0,L.useCallback)(()=>{w(e=>e+1)},[]),ne=(0,L.useMemo)(()=>{let e=new Map(u.map(e=>[e.id,e]));return Array.from(new Set(Tm(d))).map(t=>e.get(t)).filter(e=>!!e)},[d,u]),re=e?.uiState?.activeSessionId??null;(0,L.useEffect)(()=>{if(ne.some(e=>e.id===k))return;if(re&&ne.some(e=>e.id===re)){A(re);return}let e=[...ne].sort((e,t)=>t.lastActiveAt-e.lastActiveAt)[0];A(e?.id??ne[0]?.id??null)},[k,ne,re]),(0,L.useEffect)(()=>{if(!e||k===null&&e.uiState.activeSessionId)return;let t=k??void 0;e.uiState.activeSessionId!==t&&v({activeSessionId:t})},[k,v,e]);let ie=ne.find(e=>e.id===k)??null,ae=(0,L.useCallback)(e=>{A(e)},[]),P=(0,L.useCallback)(e=>{g.appendSession(e,k,`vertical`),A(e)},[k,g]),F=(0,L.useCallback)(async e=>{g.closeSessionPane(e),await _.closeSession(e),A(t=>t===e?ne.filter(t=>t.id!==e)[0]?.id??null:t)},[ne,g,_]),oe=(0,L.useCallback)(e=>{E(e),e!==`files`&&O({kind:`root`})},[]),se=(0,L.useCallback)(()=>{E(null),O({kind:`root`})},[]),ce=(0,L.useCallback)(e=>{O(e)},[]);return{activeSession:ie,activeFilePath:a,activeWorkspaceId:n,createRequest:x,diffPreview:o,focusMode:s,gitState:i,handleConsumeCreateRequest:N,handleOpenBranchSwitcher:j,handleOpenFileCreate:ee,handleOpenFolderCreate:M,handleRefreshSidebarPanel:te,handleMobileSessionCreated:P,mainAreaMode:y===`git`&&o?`diff`:a?`editor`:`agent`,mobileActiveSessionId:k,mobileFilesRoute:D,mobileSheet:T,openMobileSheet:oe,orderedSessions:ne,paneLayout:d,panelRefreshToken:C,closeMobileSession:F,selectMobileSession:ae,sessions:u,setSidebarTab:b,sidebarCollapsed:l,sidebarTab:y,closeMobileSheet:se,terminalPanelVisible:c,updateMobileFilesRoute:ce,workspace:e,workspaces:r,workspaceId:t,...h}}function t_({workspaceId:e,refreshToken:t=0,createRequest:n=null,onCreateRequestConsumed:r,onSelectFile:i}){let a=X(),o=R(If(e)),s=R(Lf(e)),c=R(Bf(e)),l=R(Yu),u=z(If(e)),d=z(Lf(e)),f=z(Bf(e)),p=z(zf(e)),m=R(Rf(e)),h=z(Rf(e)),[g,_]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(null),[S,C]=(0,L.useState)(null),w=(0,L.useRef)(t),T=(0,L.useRef)(0),E=(0,L.useCallback)(async()=>{if(!e||g)return!1;_(!0);let t=await l(`file.readTree`,{workspaceId:e});if(t.ok&&t.data){let e=new Map;return e.set(`.`,t.data.children),u(e),h(new Set),_(!1),!0}return t.ok||console.error(`Failed to load file tree:`,t.error?.message),_(!1),!1},[e,g,l,u,h]),D=(0,L.useCallback)(async t=>{if(!e||v===t||m.has(t))return;y(t);let n=await l(`file.readTree`,{workspaceId:e,subPath:t});n.ok&&n.data&&(u(e=>{if(!e)return e;let r=new Map(e);return r.set(t,n.data.children),r}),h(e=>new Set(e).add(t))),y(null)},[e,v,m,l,u,h]),O=(0,L.useCallback)(async t=>{if(!e)return[];let n=await l(`file.search`,{workspaceId:e,query:t,limit:10});return!n.ok||!n.data?[]:n.data.files},[l,e]),k=(0,L.useCallback)((e,t)=>{x({mode:e,draftPath:t?`${t.replace(/\/+$/,``)}/`:``,error:null})},[]),A=(0,L.useCallback)(()=>{x(null)},[]),j=(0,L.useCallback)(e=>{x(t=>t&&{...t,draftPath:e,error:null})},[]),ee=(0,L.useCallback)(async()=>{if(!b)return;let t=b.draftPath.trim();if(!t){x(e=>e&&{...e,error:a(`file.path_required`)});return}if(b.mode===`file`&&t.endsWith(`/`)){x(e=>e&&{...e,error:a(`file.invalid_file_path`)});return}let n=await l(b.mode===`file`?`file.create`:`file.mkdir`,{workspaceId:e,path:t});if(!n.ok){x(e=>e&&{...e,error:n.error?.message??a(`file.create_failed`)});return}await E(),A(),b.mode===`file`&&f(t)},[b,l,e,E,A,f,a]),M=(0,L.useCallback)(()=>{C(null)},[]),N=(0,L.useCallback)(async()=>{if(!S)return;let t=await l(`file.delete`,{workspaceId:e,path:S.path});if(!t.ok){C(e=>e&&{...e,error:t.error?.message??a(`file.delete_failed`)});return}c===S.path&&f(null),p(e=>{if(!(S.path in e))return e;let t={...e};return delete t[S.path],t}),await E(),C(null)},[S,l,e,c,f,p,E,a]);return(0,L.useEffect)(()=>{!o&&!g&&E()},[o,g,E]),(0,L.useEffect)(()=>{s&&!g&&(d(!1),E())},[s,g,E,d]),(0,L.useEffect)(()=>{t<=w.current||g||(w.current=t,E())},[t,g,E]),(0,L.useEffect)(()=>{!n||n.id<=T.current||(T.current=n.id,k(n.mode,n.baseDir),r?.())},[n,k,r]),{activeFilePath:c,createDialog:b,fileTree:o,isLoading:g,isLoadingDir:v,pendingDelete:S,cancelDelete:M,confirmDelete:N,handleSelectFile:(0,L.useCallback)(e=>{f(e),i?.(e)},[i,f]),loadChildren:D,loadSearchResults:O,openCreateDialog:k,requestDelete:C,submitCreateDialog:ee,updateDraftPath:j,closeCreateDialog:A}}var n_=({workspaceId:e,refreshToken:t=0,createRequest:n=null,onCreateRequestConsumed:r,onSelectFile:i})=>{let a=X(),{activeFilePath:o,createDialog:s,fileTree:c,isLoading:l,isLoadingDir:u,pendingDelete:d,cancelDelete:f,confirmDelete:p,handleSelectFile:m,loadChildren:h,loadSearchResults:g,openCreateDialog:_,requestDelete:v,submitCreateDialog:y,updateDraftPath:b,closeCreateDialog:x}=t_({workspaceId:e,refreshToken:t,createRequest:n,onCreateRequestConsumed:r,onSelectFile:i}),[S,C]=(0,L.useState)(``),w=S.trim(),T=(0,L.useMemo)(()=>c?c_(s_(c)):[],[c]),[E,D]=(0,L.useState)([]),[O,k]=(0,L.useState)(!1),A=(0,L.useRef)(0),j=w.length>0;return(0,L.useEffect)(()=>{let e=!1;if(!j)return D([]),k(!1),()=>{e=!0};k(!0);let t=++A.current,n=setTimeout(()=>{(async()=>{let n=await g(w);e||t!==A.current||(D(n),k(!1))})()},150);return()=>{e=!0,clearTimeout(n)}},[j,g,w]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`file-tree-shell`,children:[(0,Z.jsxs)(`label`,{className:`file-tree-search`,htmlFor:`file-tree-search-${e}`,children:[(0,Z.jsx)(Cf,{size:14,className:`file-tree-search-icon`,"aria-hidden":`true`}),(0,Z.jsx)(`input`,{id:`file-tree-search-${e}`,className:`file-tree-search-input`,type:`search`,value:S,onChange:e=>C(e.target.value),placeholder:a(`action.search_files`),"aria-label":a(`action.search_files`)})]}),(0,Z.jsx)(`div`,{className:`file-tree`,children:j?O?(0,Z.jsx)(`div`,{className:`file-tree-empty`,children:(0,Z.jsx)(`p`,{children:a(`common.loading`)})}):E.length>0?E.map(e=>(0,Z.jsx)(r_,{node:e,selectedPath:o,onRequestDelete:(e,t)=>v({path:e,name:t,error:null}),onSelectFile:m},e.path)):(0,Z.jsx)(`div`,{className:`file-tree-empty`,children:(0,Z.jsx)(`p`,{children:a(`command.no_results`)})}):c&&c.size>0?T.map(e=>(0,Z.jsx)(i_,{node:e,depth:0,selectedPath:o,onRequestCreate:_,onRequestDelete:(e,t)=>v({path:e,name:t,error:null}),onSelectFile:m,onLoadChildren:h,isLoadingDir:u},e.path)):(0,Z.jsx)(`div`,{className:`file-tree-empty`,children:(0,Z.jsx)(`p`,{children:a(l?`common.loading`:`file.title`)})})})]}),(0,Z.jsx)(a_,{dialog:s,onCancel:x,onConfirm:y,onDraftPathChange:b}),(0,Z.jsx)(o_,{pendingDelete:d,onCancel:f,onConfirm:p})]})},r_=({node:e,selectedPath:t,onRequestDelete:n,onSelectFile:r})=>{let i=X(),a=l_(e,!1),o=e.path.includes(`/`)?e.path.slice(0,e.path.lastIndexOf(`/`)):``;return(0,Z.jsxs)(`div`,{className:`tree-item ${t===e.path?`selected`:``}`,onClick:()=>r(e.path),style:{paddingLeft:12},title:e.path,children:[(0,Z.jsx)(`span`,{className:`tree-chevron`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`tree-icon ${u_(e)}`,children:(0,Z.jsx)(a,{size:14})}),(0,Z.jsxs)(`span`,{className:`tree-search-labels`,children:[(0,Z.jsx)(`span`,{className:`tree-label`,children:e.name}),o?(0,Z.jsx)(`span`,{className:`tree-search-path`,children:o}):null]}),(0,Z.jsx)(`div`,{className:`tree-item-actions`,children:(0,Z.jsx)(`button`,{"aria-label":`${i(`file.delete`)} ${e.path}`,className:`git-row-action`,onClick:t=>{t.stopPropagation(),n(e.path,e.name)},title:i(`file.delete`),type:`button`,children:(0,Z.jsx)(Mf,{size:12})})})]})},i_=({node:e,depth:t,selectedPath:n,onRequestCreate:r,onRequestDelete:i,onSelectFile:a,onLoadChildren:o,isLoadingDir:s})=>{let c=X(),l=e.kind===`dir`,[u,d]=(0,L.useState)(l&&t===0&&[`app`,`packages`,`src`].includes(e.name.toLowerCase())),f=(0,L.useRef)(!1);(0,L.useEffect)(()=>{e.children&&(f.current=!1)},[e.children]),(0,L.useEffect)(()=>{l&&u&&!e.children&&!f.current&&(f.current=!0,o(e.path))},[l,u,e.children,e.path,o]);let p=()=>{l?(u||o(e.path),d(!u)):a(e.path)},m=t*14+12,h=l_(e,u);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`tree-item ${n===e.path?`selected`:``}`,onClick:p,style:{paddingLeft:m},title:e.path,children:[(0,Z.jsx)(`span`,{className:`tree-chevron`,"aria-hidden":`true`,children:l?u?(0,Z.jsx)(Fd,{size:14}):(0,Z.jsx)(Id,{size:14}):null}),(0,Z.jsx)(`span`,{className:`tree-icon ${u_(e)}`,children:(0,Z.jsx)(h,{size:14})}),(0,Z.jsx)(`span`,{className:`tree-label`,children:e.name}),(0,Z.jsx)(`div`,{className:`tree-item-actions`,children:l?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{"aria-label":`${c(`file.new_file`)} ${e.path}`,className:`git-row-action`,onClick:t=>{t.stopPropagation(),r(`file`,e.path)},title:c(`file.new_file`),type:`button`,children:(0,Z.jsx)(Jd,{size:12})}),(0,Z.jsx)(`button`,{"aria-label":`${c(`file.new_folder`)} ${e.path}`,className:`git-row-action`,onClick:t=>{t.stopPropagation(),r(`folder`,e.path)},title:c(`file.new_folder`),type:`button`,children:(0,Z.jsx)(Qd,{size:12})}),(0,Z.jsx)(`button`,{"aria-label":`${c(`file.delete`)} ${e.path}`,className:`git-row-action`,onClick:t=>{t.stopPropagation(),i(e.path,e.name)},title:c(`file.delete`),type:`button`,children:(0,Z.jsx)(Mf,{size:12})})]}):(0,Z.jsx)(`button`,{"aria-label":`${c(`file.delete`)} ${e.path}`,className:`git-row-action`,onClick:t=>{t.stopPropagation(),i(e.path,e.name)},title:c(`file.delete`),type:`button`,children:(0,Z.jsx)(Mf,{size:12})})})]}),l&&u&&e.children&&(0,Z.jsxs)(`div`,{className:`tree-children`,children:[c_(e.children).map(e=>(0,Z.jsx)(i_,{node:e,depth:t+1,selectedPath:n,onRequestCreate:r,onRequestDelete:i,onSelectFile:a,onLoadChildren:o,isLoadingDir:s},e.path)),e.children.length===0&&!s&&(0,Z.jsx)(`div`,{className:`tree-empty-hint`,children:c(`file.empty_directory`)})]}),l&&u&&!e.children&&s===e.path&&(0,Z.jsx)(`div`,{className:`tree-loading`,children:c(`common.loading`)})]})},a_=({dialog:e,onCancel:t,onConfirm:n,onDraftPathChange:r})=>{let i=X();if(!e)return null;let a=e.mode===`file`?i(`file.path_helper_file`):i(`file.path_helper_folder`);return(0,Z.jsx)(`div`,{className:`modal-overlay`,onClick:t,children:(0,Z.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`modal-header`,children:[(0,Z.jsxs)(`div`,{className:`modal-title`,children:[e.mode===`file`?(0,Z.jsx)(Jd,{size:16}):(0,Z.jsx)(Qd,{size:16}),(0,Z.jsx)(`h3`,{children:e.mode===`file`?i(`file.new_file`):i(`file.new_folder`)})]}),(0,Z.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:t,"aria-label":i(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})]}),(0,Z.jsx)(`div`,{className:`modal-body`,children:(0,Z.jsxs)(`div`,{className:`form-group`,children:[(0,Z.jsx)(`label`,{htmlFor:`file-path`,children:i(`file.path`)}),(0,Z.jsx)(`input`,{id:`file-path`,className:`input`,value:e.draftPath,onChange:e=>r(e.target.value),placeholder:e.mode===`file`?`src/demo/new-file.ts`:`src/demo/new-folder`,autoFocus:!0}),(0,Z.jsx)(`span`,{className:`dialog-helper`,children:a}),e.error?(0,Z.jsx)(`span`,{className:`form-error`,role:`alert`,children:e.error}):null]})}),(0,Z.jsxs)(`div`,{className:`modal-footer`,children:[(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:t,children:i(`action.cancel`)}),(0,Z.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>{n()},children:i(`action.confirm`)})]})]})})},o_=({pendingDelete:e,onCancel:t,onConfirm:n})=>{let r=X();return e?(0,Z.jsx)(`div`,{className:`modal-overlay`,onClick:t,children:(0,Z.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`modal-header`,children:[(0,Z.jsxs)(`div`,{className:`modal-title`,children:[(0,Z.jsx)(Nf,{size:16}),(0,Z.jsx)(`h3`,{children:r(`file.delete`)})]}),(0,Z.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:t,"aria-label":r(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})]}),(0,Z.jsxs)(`div`,{className:`modal-body`,children:[(0,Z.jsx)(`p`,{children:r(`file.delete_confirm`,{name:e.name})}),e.error?(0,Z.jsx)(`span`,{className:`form-error`,role:`alert`,children:e.error}):null]}),(0,Z.jsxs)(`div`,{className:`modal-footer`,children:[(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:t,children:r(`action.cancel`)}),(0,Z.jsx)(`button`,{className:`btn btn-danger`,onClick:()=>{n()},children:r(`action.confirm`)})]})]})}):null};function s_(e){let t=n=>n.map(n=>n.kind===`dir`&&e.has(n.path)?{...n,children:t(e.get(n.path))}:n);return t(e.get(`.`)??[])}function c_(e){return[...e].sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`dir`?-1:1)}function l_(e,t){if(e.kind===`dir`)return t?Zd:$d;switch(e.name.split(`.`).pop()?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:case`mjs`:case`cjs`:case`py`:case`go`:case`rs`:case`java`:return Kd;case`json`:case`yaml`:case`yml`:case`toml`:case`lock`:return Gd;case`md`:case`txt`:return Yd;case`png`:case`jpg`:case`jpeg`:case`gif`:case`svg`:case`webp`:return qd;default:return Xd}}function u_(e){if(e.kind===`dir`)return`folder`;switch(e.name.split(`.`).pop()?.toLowerCase()){case`ts`:case`tsx`:case`js`:case`jsx`:return`code`;case`json`:case`yaml`:case`yml`:return`data`;case`md`:case`txt`:return`doc`;case`png`:case`jpg`:case`jpeg`:case`gif`:case`svg`:case`webp`:return`media`;default:return`file`}}function d_(e){return e.startsWith(`diff --git`)||e.startsWith(`index `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`@@`)?`meta`:e.startsWith(`+`)?`added`:e.startsWith(`-`)?`removed`:`context`}var f_=({workspaceId:e,onClose:t,showCloseButton:n=!0})=>{let r=X(),{preview:i,closePreview:a}=Wg(e),o=t??a,s=(0,L.useMemo)(()=>i?.diff.split(`
110
- `).map((e,t)=>({id:`${t}:${e}`,line:e,tone:d_(e),lineNumber:t+1}))??[],[i]);return(0,Z.jsx)(`div`,{className:`workspace-git-view`,children:(0,Z.jsxs)(`div`,{className:`code-editor workspace-git-editor`,children:[(0,Z.jsxs)(`div`,{className:`code-editor-header`,children:[(0,Z.jsx)(`span`,{className:`code-file-path`,children:i?.path??`Select a changed file to inspect`}),i&&n?(0,Z.jsx)(`div`,{className:`code-mode-toggle`,children:(0,Z.jsx)(`button`,{type:`button`,className:`code-mode-btn`,onClick:o,title:r(`action.close`),"aria-label":r(`action.close`),children:(0,Z.jsx)(Pf,{size:12})})}):null]}),(0,Z.jsx)(`div`,{className:`code-editor-body`,children:i?(0,Z.jsx)(`div`,{className:`code-lines git-diff-lines`,children:s.map(e=>(0,Z.jsxs)(`div`,{className:`code-line git-diff-line git-diff-line-${e.tone}`,children:[(0,Z.jsx)(`span`,{className:`code-line-num`,children:e.lineNumber}),(0,Z.jsx)(`span`,{className:`git-diff-line-text`,children:e.line||` `})]},e.id))}):(0,Z.jsxs)(`div`,{className:`git-diff-empty`,children:[(0,Z.jsx)(`p`,{className:`git-diff-empty-title`,children:r(`label.git`)}),(0,Z.jsx)(`p`,{className:`git-diff-empty-body`,children:`Select a staged or modified file on the left to inspect its diff.`})]})})]})})},p_=({workspaceId:e,refreshToken:t=0,onPreviewOpen:n})=>{let r=X(),{commitMessage:i,diffPreview:a,gitState:o,groups:s,hasChanges:c,isLoading:l,pendingDiscard:u,setCommitMessage:d,handleCancelDiscard:f,handleCommit:p,handleConfirmDiscard:m,handleDiscardAll:h,handleRequestDiscardSingle:g,handleStageAll:_,handleUnstageAll:v,loadGitStatus:y,openDiff:b,runGitMutation:x}=Ug({workspaceId:e,refreshToken:t,onPreviewOpen:n});return(0,Z.jsxs)(`div`,{className:`git-panel`,children:[(0,Z.jsx)(`div`,{className:`panel-toolbar git-panel-toolbar`,children:(0,Z.jsxs)(`div`,{className:`git-toolbar-cluster`,children:[(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,onClick:()=>void y(),disabled:l,title:r(`action.refresh`),type:`button`,children:(0,Z.jsx)(bf,{size:14,className:l?`spin`:void 0})}),c&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,onClick:()=>void _(),title:r(`git.stage_all`),type:`button`,children:(0,Z.jsx)(vf,{size:14})}),(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,onClick:()=>void v(),title:r(`git.unstage_all`),type:`button`,children:(0,Z.jsx)(df,{size:14})}),(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,onClick:()=>void h(),title:r(`git.discard_all`),type:`button`,children:(0,Z.jsx)(xf,{size:14})}),(0,Z.jsx)(`button`,{className:`panel-toolbar-btn git-panel-commit-btn`,onClick:()=>void p(),disabled:!i.trim()||!o?.staged.length,title:r(`git.commit`),type:`button`,children:(0,Z.jsx)(Md,{size:14})})]})]})}),(0,Z.jsx)(`textarea`,{className:`git-commit-input`,placeholder:r(`git.commit_placeholder`),value:i,onChange:e=>d(e.target.value),rows:1}),o?.headShortSha||o?.headSubject?(0,Z.jsxs)(`div`,{className:`git-head-summary`,"aria-label":r(`git.latest_commit`),children:[(0,Z.jsx)(`span`,{className:`git-head-summary__label`,children:r(`git.latest_commit`)}),(0,Z.jsxs)(`span`,{className:`git-head-summary__value`,children:[o.headShortSha?(0,Z.jsx)(`code`,{children:o.headShortSha}):null,o.headSubject?(0,Z.jsx)(`span`,{children:o.headSubject}):null]})]}):null,(0,Z.jsx)(`div`,{className:`git-list`,children:o?s.length>0?s.map(t=>(0,Z.jsx)(m_,{title:t.title,changes:t.changes,type:t.type,selectedPath:a?.path??null,onViewDiff:b,onRunMutation:x,onRequestDiscard:g,workspaceId:e},t.title)):(0,Z.jsx)(`div`,{className:`git-empty`,children:r(`git.no_changes`)}):(0,Z.jsx)(`div`,{className:`git-empty`,children:r(l?`common.loading`:`git.no_changes`)})}),(0,Z.jsx)(g_,{discard:u,onCancel:f,onConfirm:m})]})},m_=({title:e,changes:t,type:n,selectedPath:r,workspaceId:i,onViewDiff:a,onRunMutation:o,onRequestDiscard:s})=>(0,Z.jsxs)(`div`,{className:`git-group`,children:[(0,Z.jsxs)(`div`,{className:`git-group-header`,children:[(0,Z.jsx)(`span`,{children:X()(e===`staged`?`git.staged`:e===`changes`?`git.changes`:e===`deleted`?`git.deleted`:`git.untracked`)}),(0,Z.jsx)(`span`,{className:`git-group-count`,children:t.length})]}),t.map(e=>(0,Z.jsx)(h_,{change:e,type:n,workspaceId:i,selected:r===e.path,onViewDiff:a,onRunMutation:o,onRequestDiscard:s},e.path))]}),h_=({change:e,type:t,workspaceId:n,selected:r,onViewDiff:i,onRunMutation:a,onRequestDiscard:o})=>{let s=X(),c=(0,L.useMemo)(()=>e.path.split(`/`),[e.path]),l=c[c.length-1]??e.path,u=c.length>1?`${c.slice(0,-1).join(`/`)}/`:``,d=s(t===`staged`?`git.staged`:t===`modified`?`git.modified`:t===`deleted`?`git.deleted`:`git.untracked`),f=t===`modified`?`modified`:t===`deleted`?`deleted`:t===`staged`?`staged`:`untracked`,p=async()=>{if(t===`staged`){await a(`git.unstage`,{workspaceId:n,paths:[e.path]},`Failed to unstage:`);return}await a(`git.stage`,{workspaceId:n,paths:[e.path]},`Failed to stage:`)};return(0,Z.jsxs)(`div`,{className:`git-row ${r?`active`:``}`,onClick:()=>void i(e,t),role:`button`,tabIndex:0,onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),i(e,t))},children:[(0,Z.jsx)(`span`,{className:`git-row-icon git-row-icon-${f}`,children:(0,Z.jsx)(Xd,{size:14})}),(0,Z.jsxs)(`div`,{className:`git-row-content`,children:[(0,Z.jsx)(`span`,{className:`git-row-name`,children:l}),(0,Z.jsxs)(`span`,{className:`git-row-meta`,children:[u?(0,Z.jsx)(`span`,{className:`git-row-dir`,children:u}):null,(0,Z.jsx)(`span`,{className:`git-row-status git-row-status-end git-row-status-${f}`,children:d})]})]}),(0,Z.jsxs)(`div`,{className:`git-row-actions`,children:[(0,Z.jsx)(`button`,{className:`git-row-action`,onClick:e=>{e.stopPropagation(),p()},title:s(t===`staged`?`git.unstage`:`git.stage`),type:`button`,children:t===`staged`?(0,Z.jsx)(df,{size:12}):(0,Z.jsx)(vf,{size:12})}),(0,Z.jsx)(`button`,{className:`git-row-action`,onClick:t=>{t.stopPropagation(),o(e.path)},title:s(`git.discard`),type:`button`,children:(0,Z.jsx)(xf,{size:12})})]})]})},g_=({discard:e,onCancel:t,onConfirm:n})=>{let r=X();if(!e)return null;let i=e.scope===`all`?r(`git.discard_all_confirm_title`):r(`git.discard_file_confirm_title`),a=e.scope===`all`?r(`git.discard_all_confirm_message`,{count:e.paths.length}):r(`git.discard_file_confirm_message`,{path:e.filePath??e.paths[0]??``});return(0,Z.jsx)(`div`,{className:`modal-overlay`,onClick:t,children:(0,Z.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`modal-header`,children:[(0,Z.jsxs)(`div`,{className:`modal-title`,children:[(0,Z.jsx)(Nf,{size:16}),(0,Z.jsx)(`h3`,{children:i})]}),(0,Z.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:t,"aria-label":r(`action.close`),children:(0,Z.jsx)(Pf,{size:14})})]}),(0,Z.jsxs)(`div`,{className:`modal-body`,children:[(0,Z.jsx)(`p`,{children:a}),(0,Z.jsx)(`p`,{className:`dialog-helper`,children:r(`git.discard_confirm_irreversible`)})]}),(0,Z.jsxs)(`div`,{className:`modal-footer`,children:[(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:t,children:r(`action.cancel`)}),(0,Z.jsx)(`button`,{className:`btn btn-danger`,onClick:()=>{n()},children:r(`git.discard`)})]})]})})},__=({workspaceId:e,gitState:t,inline:n=!1})=>{let r=X(),{authPrompt:i,clearAuthPrompt:a,getAuthPromptMessage:o,handlePull:s,handlePush:c,syncingIntent:l}=Bg(e),u=`git-auth-form-${e}`,[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)({username:``,password:``});if((0,L.useLayoutEffect)(()=>{if(!i){m({username:``,password:``});return}m(e=>({username:e.username||i.details.usernameHint||``,password:``}))},[i]),!t)return null;let h=t.staged.length+t.modified.length+t.untracked.length+t.deleted.length,g=t.ahead,_=t.behind,v=d?.intent===`push`?r(`git.push_confirm_title`):r(`git.pull_confirm_title`),y=d?.intent===`push`?r(`git.push_confirm_message`,{count:d.count}):r(`git.pull_confirm_message`,{count:d?.count??0}),b=d?.intent===`push`?r(`action.push`):r(`action.pull`),x=d?.intent===`push`?r(`git.push_in_progress`):r(`git.pull_in_progress`),S=!!(d&&l===d.intent),C=i?.intent,w=r(C===`push`?`action.push`:`action.pull`),T=r(C===`push`?`git.push_in_progress`:`git.pull_in_progress`),E=!!(C&&l===C),D=S||E,O=(e,t)=>{t<=0||f({intent:e,count:t})},k=()=>{D||(f(null),a())},A=async()=>{if(d){if(d.intent===`push`){await c()&&f(null);return}await s()&&f(null)}},j=async()=>{if(!i)return;let e={username:p.username.trim(),password:p.password};!e.username||!e.password||(i.intent===`push`?await c(e):await s(e))&&(a(),f(null))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{className:`git-status-bar${n?` git-status-bar--inline`:``}`,children:[(0,Z.jsxs)(`span`,{className:`git-status-bar__item`,title:r(`git.statusbar.changes`),children:[(0,Z.jsx)(Ud,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`git-status-bar__value`,children:h})]}),(0,Z.jsxs)(`button`,{className:`git-status-bar__item git-status-bar__item--actionable git-status-bar__item--ahead`,title:r(`git.statusbar.ahead`),type:`button`,"aria-label":r(`action.push`),disabled:g<=0,onClick:()=>O(`push`,g),children:[(0,Z.jsx)(jd,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`git-status-bar__value`,children:g})]}),(0,Z.jsxs)(`button`,{className:`git-status-bar__item git-status-bar__item--actionable git-status-bar__item--behind`,title:r(`git.statusbar.behind`),type:`button`,"aria-label":r(`action.pull`),disabled:_<=0,onClick:()=>O(`pull`,_),children:[(0,Z.jsx)(Od,{size:13,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`git-status-bar__value`,children:_})]})]}),d?(0,Z.jsx)(`div`,{className:`modal-overlay`,onClick:k,children:(0,Z.jsxs)(`div`,{className:`modal-card git-status-bar__confirm`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{className:`modal-header`,children:[(0,Z.jsxs)(`div`,{className:`modal-title`,children:[(0,Z.jsx)(Nf,{size:16}),(0,Z.jsx)(`h3`,{children:v})]}),(0,Z.jsx)(`button`,{className:`btn btn-ghost btn-sm`,onClick:k,"aria-label":r(`action.close`),type:`button`,disabled:D,children:(0,Z.jsx)(Pf,{size:14})})]}),(0,Z.jsx)(`div`,{className:`modal-body`,children:i?i.details.canPrompt?(0,Z.jsxs)(`form`,{id:u,className:`form-group`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,Z.jsx)(`p`,{children:o(i.details)}),(0,Z.jsx)(`span`,{className:`dialog-helper`,children:r(`git.auth_helper_http`)}),(0,Z.jsx)(`label`,{htmlFor:`git-auth-username-${e}`,children:r(`git.auth_username`)}),(0,Z.jsx)(`input`,{id:`git-auth-username-${e}`,className:`input`,value:p.username,onChange:e=>m(t=>({...t,username:e.target.value})),placeholder:i.details.usernameHint??r(`git.auth_username_placeholder`),autoFocus:!0,disabled:E}),(0,Z.jsx)(`label`,{htmlFor:`git-auth-password-${e}`,children:r(`git.auth_password`)}),(0,Z.jsx)(`input`,{id:`git-auth-password-${e}`,className:`input`,type:`password`,value:p.password,onChange:e=>m(t=>({...t,password:e.target.value})),placeholder:r(`git.auth_password_placeholder`),disabled:E})]}):(0,Z.jsxs)(`div`,{className:`form-group`,children:[(0,Z.jsx)(`p`,{children:o(i.details)}),(0,Z.jsx)(`span`,{className:`dialog-helper`,children:r(`git.auth_helper_unsupported`)})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{children:y}),(0,Z.jsx)(`p`,{className:`dialog-helper`,children:r(`git.sync_confirm_helper`)})]})}),(0,Z.jsxs)(`div`,{className:`modal-footer`,children:[(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:k,type:`button`,disabled:D,children:r(`action.cancel`)}),i?(0,Z.jsx)(`button`,{className:`btn btn-primary`,form:i.details.canPrompt?u:void 0,type:i.details.canPrompt?`submit`:`button`,disabled:!i.details.canPrompt||E||!p.username.trim()||!p.password,children:E?T:w}):(0,Z.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>void A(),type:`button`,disabled:S,children:S?x:b})]})]})}):null]})},v_=()=>{let e=(0,L.useRef)(null),t=qg(e),n=X(),{createRequest:r,focusMode:i,gitState:a,handleBottomMouseDown:o,handleConsumeCreateRequest:s,handleLeftMouseDown:c,handleOpenBranchSwitcher:l,handleOpenFileCreate:u,handleOpenFolderCreate:d,handleRefreshSidebarPanel:f,leftPanelWidth:p,mainAreaMode:m,panelRefreshToken:h,setSidebarTab:g,sidebarCollapsed:_,sidebarTab:v,terminalPanelVisible:y,workspace:b,bottomPanelHeight:x,workspaceId:S}=e_(),C=z(Bf(S)),{closePreview:w}=Wg(S);if(!b)return(0,Z.jsx)(`div`,{className:`workspace-page workspace-page-empty`,children:(0,Z.jsx)(`div`,{className:`workspace-empty-content`,children:(0,Z.jsx)(`div`,{className:`workspace-empty-inner`,children:(0,Z.jsx)(`p`,{children:n(`workspace.no_workspace`)})})})});let T=n(v===`files`?`label.file`:`label.git`),E=a?.branch??`—`,D=v===`files`?`file tree`:`git`;return(0,Z.jsxs)(`div`,{ref:e,className:`workspace-page`,children:[(0,Z.jsx)(Lg,{fullscreenController:t}),(0,Z.jsxs)(`div`,{className:`workspace-body`,children:[!i&&!_&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`aside`,{className:`left-panel`,style:{width:`${p}px`},children:(0,Z.jsxs)(`div`,{className:`nav-panel`,children:[(0,Z.jsxs)(`div`,{className:`panel-header`,children:[(0,Z.jsx)(`div`,{className:`panel-kicker`,children:T}),(0,Z.jsxs)(`button`,{className:`panel-branch panel-branch-button`,onClick:l,"aria-label":`Open branch switcher for ${E}`,type:`button`,children:[(0,Z.jsx)(ef,{size:12}),(0,Z.jsx)(`span`,{children:E})]}),(0,Z.jsxs)(`div`,{className:`panel-tabs-row`,children:[(0,Z.jsxs)(`div`,{className:`panel-tabs`,children:[(0,Z.jsx)(`button`,{className:`panel-tab ${v===`files`?`active`:``}`,onClick:()=>g(`files`),children:`Files`}),(0,Z.jsx)(`button`,{className:`panel-tab ${v===`git`?`active`:``}`,onClick:()=>g(`git`),children:n(`label.git`)})]}),(0,Z.jsx)(__,{workspaceId:b.id,gitState:a,inline:!0})]})]}),v===`files`?(0,Z.jsxs)(`div`,{className:`panel-toolbar`,children:[(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,title:n(`file.new_file`),"aria-label":n(`file.new_file`),onClick:u,children:(0,Z.jsx)(Jd,{size:14})}),(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,title:n(`file.new_folder`),"aria-label":n(`file.new_folder`),onClick:d,children:(0,Z.jsx)(Qd,{size:14})}),(0,Z.jsx)(`button`,{className:`panel-toolbar-btn`,title:`Refresh ${D}`,"aria-label":`Refresh ${D}`,onClick:f,children:(0,Z.jsx)(bf,{size:14})})]}):null,(0,Z.jsx)(`div`,{className:`panel-body`,children:v===`files`?(0,Z.jsx)(n_,{workspaceId:b.id,refreshToken:h,createRequest:r,onCreateRequestConsumed:s}):(0,Z.jsx)(p_,{workspaceId:b.id,refreshToken:h})})]})}),(0,Z.jsx)(`div`,{className:`split-divider-v`,onMouseDown:c,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize left panel`})]}),(0,Z.jsxs)(`div`,{className:`workspace-main-area`,children:[m===`diff`?(0,Z.jsx)(f_,{workspaceId:b.id,onClose:()=>{w(),C(null)}}):m===`editor`?(0,Z.jsx)(xg,{}):(0,Z.jsx)(`div`,{className:`agent-panes`,children:(0,Z.jsx)(pg,{hydrateSessions:!1})}),!i&&y&&(0,Z.jsx)(`div`,{className:`split-divider-h`,onMouseDown:o,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize bottom panel`}),!i&&y&&(0,Z.jsx)(`div`,{className:`workspace-bottom-panel`,style:{height:`${x}px`},children:(0,Z.jsx)(Mg,{})})]})]})]})};function y_(){let e=Ir(),t=X(),{branchList:n,displayItems:r,handleBranchCreate:i,handleBranchSelect:a,handleClose:o,handleRequestBranchCreate:s,inputValue:c,quickPickState:l,selectedIndex:u,setInputValue:d,setPendingCreateBranchName:f,setSelectedIndex:p,trimmedInput:m}=Gg(),h=(0,L.useRef)(null),g=(0,L.useRef)(null);(0,L.useEffect)(()=>{l.visible&&h.current?.focus()},[l.visible]),(0,L.useEffect)(()=>{e===`mobile`||!g.current||g.current.querySelector(`.branch-quick-pick-item:nth-child(${u+1})`)?.scrollIntoView({block:`nearest`})},[u,e]);let _=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),p(e=>e<r.length-1?e+1:e);break;case`ArrowUp`:e.preventDefault(),p(e=>e>0?e-1:e);break;case`Enter`:if(e.preventDefault(),r[u]){let e=r[u];e.type===`branch`&&e.branch?a(e.branch.name):e.type===`create`?s(m):e.type===`confirm-create`&&i(m)}break;case`Escape`:e.preventDefault(),o();break}};if(!l.visible)return null;if(e!==`mobile`)return(0,Z.jsx)(`div`,{className:`branch-quick-pick-overlay`,onClick:e=>{e.target===e.currentTarget&&o()},children:(0,Z.jsxs)(`div`,{className:`branch-quick-pick`,children:[(0,Z.jsx)(`div`,{className:`branch-quick-pick-search`,children:(0,Z.jsx)(`input`,{ref:h,type:`text`,className:`branch-quick-pick-input`,placeholder:`Search branches or create new branch...`,value:c,onChange:e=>{d(e.target.value),f(null),p(0)},onKeyDown:_})}),(0,Z.jsx)(`div`,{className:`branch-quick-pick-list`,ref:g,children:n.loading?(0,Z.jsx)(`div`,{className:`branch-quick-pick-empty`,children:`Loading branches...`}):r.length>0?r.map((e,t)=>(0,Z.jsx)(`div`,{className:`branch-quick-pick-item ${t===u?`branch-quick-pick-item-selected`:``}`,onClick:()=>{e.type===`branch`&&e.branch?a(e.branch.name):e.type===`create`?s(m):e.type===`confirm-create`&&i(m)},onMouseEnter:()=>p(t),children:e.type===`branch`&&e.branch?(0,Z.jsxs)(Z.Fragment,{children:[e.branch.isCurrent&&(0,Z.jsx)(`span`,{className:`branch-quick-pick-check`,children:(0,Z.jsx)(Pd,{size:14})}),(0,Z.jsx)(`span`,{className:`branch-quick-pick-name`,children:e.branch.name}),e.branch.isRemote&&(0,Z.jsx)(`span`,{className:`branch-quick-pick-badge`,children:`Remote`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`branch-quick-pick-create-icon`,children:(0,Z.jsx)(vf,{size:14})}),(0,Z.jsx)(`span`,{className:`branch-quick-pick-create-label`,children:e.label})]})},e.type===`branch`?e.branch?.name:`create`)):(0,Z.jsx)(`div`,{className:`branch-quick-pick-empty`,children:c?`No branches found`:`Type to search branches`})}),(0,Z.jsxs)(`div`,{className:`branch-quick-pick-hint`,children:[(0,Z.jsx)(`span`,{children:`↑↓ Navigate`}),(0,Z.jsx)(`span`,{children:`↵ Select`}),(0,Z.jsx)(`span`,{children:`Esc Close`})]})]})});let v=r[u]??null,y=v?.type===`branch`&&v.branch?v.branch.name:null,b=r.some(e=>e.type===`branch`&&e.branch?.name.toLowerCase()===m.toLowerCase()),x=r.filter(e=>e.type===`branch`&&e.branch).map(e=>({id:e.branch.name,label:e.branch.name,badge:e.branch.isRemote?t(`git.branch_remote`):void 0})),S=r.find(e=>e.type===`create`||e.type===`confirm-create`);return(0,Z.jsx)(`div`,{onKeyDown:_,children:(0,Z.jsx)(Sg,{title:t(`git.branch`),searchable:!0,searchPlaceholder:t(`git.quick_pick.search_placeholder`),searchValue:c,onSearchValueChange:e=>{d(e),f(null),p(0)},sections:[{kind:`options`,id:`branches`,items:x}],selectedId:y,loading:n.loading,loadingText:t(`git.quick_pick.loading`),emptyText:t(c?`git.quick_pick.empty_filtered`:`git.quick_pick.empty_idle`),create:{visible:!!m&&!b,label:()=>S?.label??t(`git.quick_pick.create`,{name:m}),onCreate:async()=>{if(S?.type===`confirm-create`){await i(m);return}s(m),p(r.length-1)}},onClose:o,onSelect:a})})}function b_({title:e,description:t}){let n=X();return(0,Z.jsx)(`div`,{className:`workspace-resolving-shell`,children:(0,Z.jsxs)(`div`,{className:`workspace-resolving-card`,children:[(0,Z.jsx)(`div`,{className:`workspace-resolving-kicker`,children:n(`workspace.title`)}),(0,Z.jsx)(`div`,{className:`workspace-resolving-title`,children:e??n(`workspace.load_failed_title`)}),(0,Z.jsx)(`div`,{className:`workspace-resolving-desc`,children:t??n(`workspace.load_failed_description`)})]})})}function x_(){let e=X();return(0,Z.jsx)(`div`,{className:`workspace-resolving-shell`,"data-testid":`workspace-resolving-shell`,children:(0,Z.jsxs)(`div`,{className:`workspace-resolving-card`,children:[(0,Z.jsx)(`div`,{className:`workspace-resolving-kicker`,children:e(`workspace.title`)}),(0,Z.jsx)(`div`,{className:`workspace-resolving-title`,children:e(`workspace.loading_title`)}),(0,Z.jsx)(`div`,{className:`workspace-resolving-desc`,children:e(`workspace.loading_description`)})]})})}function S_({children:e}){let t=R(sd),n=R(td),r=R(nd);return!t&&n===`error`?(0,Z.jsx)(b_,{description:r??`Failed to fetch workspace list`}):!t&&(n===`idle`||n===`loading`)?(0,Z.jsx)(x_,{}):(0,Z.jsx)(Z.Fragment,{children:e})}function C_(){let e=R(Hu);return e===`connected`||e===`connecting`?null:e===`reconnecting`?(0,Z.jsx)(`div`,{className:`connection-banner`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(`span`,{children:`正在重新连接...`})}):(0,Z.jsx)(`div`,{className:`connection-banner connection-banner--error`,role:`status`,"aria-live":`polite`,children:(0,Z.jsx)(`span`,{children:e===`rejected`?`另一个标签页已激活`:`连接已断开`})})}function w_(){im();let e=R(Wr),t=R(Ju),n=Jt(),r=t===!0,i=t===null,a=!(r&&!e&&n.pathname===`/login`)&&!i&&!n.pathname.startsWith(`/settings`);return(0,Z.jsxs)(`div`,{className:`app`,children:[(0,Z.jsx)(C_,{}),a&&(0,Z.jsx)(ip,{}),(0,Z.jsx)(`main`,{className:`main-content`,children:i?(0,Z.jsx)(`div`,{className:`app-loading-shell`,children:(0,Z.jsxs)(`div`,{className:`app-loading-card`,children:[(0,Z.jsx)(`div`,{className:`app-loading-kicker`,children:`CODER STUDIO`}),(0,Z.jsx)(`h1`,{className:`app-loading-title`,children:`正在连接工作区...`}),(0,Z.jsx)(`p`,{className:`app-loading-desc`,children:`正在同步认证与连接状态,随后会自动进入当前 workspace。`})]})}):(0,Z.jsxs)(Tn,{children:[(0,Z.jsx)(Cn,{path:`/`,element:(0,Z.jsx)(rm,{})}),(0,Z.jsx)(Cn,{path:`/login`,element:(0,Z.jsx)(yd,{})}),(0,Z.jsx)(Cn,{path:`/workspace`,element:(0,Z.jsx)(S_,{children:(0,Z.jsx)(v_,{})})}),(0,Z.jsx)(Cn,{path:`/settings`,element:(0,Z.jsx)(Qp,{})}),(0,Z.jsx)(Cn,{path:`*`,element:(0,Z.jsx)(ap,{})})]})}),(0,Z.jsx)(np,{}),(0,Z.jsx)(y_,{}),(0,Z.jsx)(pp,{})]})}function T_({sessionId:e,onOpen:t}){let n=R(Gm),r=R(Km),i=X(),a=(0,L.useMemo)(()=>{if(!e)return null;let t=n.get(e);if(!t)return{state:`inactive`,label:i(`supervisor.title`)};let a=r.get(t.id)??t.cycles??[],o=[...a].sort((e,t)=>(t.completedAt??t.createdAt)-(e.completedAt??e.createdAt))[0];return{state:t.state,label:o?.result??o?.errorReason??(a.length>0?`cycle ${a.length}`:t.objective)}},[r,e,n,i]);return a?(0,Z.jsxs)(`button`,{type:`button`,className:`mobile-supervisor-badge mobile-supervisor-badge--${a.state}`,"aria-label":i(`mobile.supervisor.open_sheet`),onClick:t,children:[(0,Z.jsx)(`span`,{className:`mobile-supervisor-badge__icon`,"aria-hidden":`true`,children:(0,Z.jsx)(Wd,{size:13})}),(0,Z.jsx)(`span`,{className:`mobile-supervisor-badge__label`,children:a.label})]}):null}function E_({sessionId:e,workspaceId:t,onClose:n}){let r=X(),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(!1),c=z(Jm),{dialog:l,supervisor:u,mode:d,copy:f,isDisable:p,disableObjective:m,close:h,updateDraft:g,confirm:_}=$m({workspaceId:t,sessionId:e});(0,L.useEffect)(()=>{if(!l.open||l.sessionId!==e){a(null),s(!1);return}a(l.mode)},[l.mode,l.open,l.sessionId,e]);let v=t=>{c({open:!0,sessionId:e,mode:t,draftObjective:u?.objective??``,draftEvaluatorProviderId:u?.evaluatorProviderId??`claude`}),s(!1),a(t)};return i&&o?(0,Z.jsx)(Sg,{title:r(`supervisor.field.evaluator`),sections:[{kind:`options`,id:`evaluator-providers`,items:Zm.map(e=>({id:e.id,label:e.label}))}],selectedId:l.draftEvaluatorProviderId,onBack:()=>s(!1),onClose:()=>s(!1),onSelect:e=>{g({draftEvaluatorProviderId:e}),s(!1)}}):i?(0,Z.jsx)($f,{title:f.title,kicker:r(`supervisor.title`),onBack:()=>{s(!1),h(),a(null)},onClose:()=>{s(!1),h(),a(null),n()},bodyClassName:`mobile-sheet__body--supervisor-detail`,contentClassName:`mobile-supervisor-sheet mobile-supervisor-sheet--detail`,body:(0,Z.jsxs)(`div`,{className:`mobile-supervisor-sheet__detail`,children:[(0,Z.jsxs)(`div`,{className:`mobile-supervisor-sheet__detail-header`,children:[(0,Z.jsx)(`span`,{className:`supervisor-dialog-header-icon`,"aria-hidden":`true`,children:(0,Z.jsx)(eh,{mode:d})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h3`,{children:f.title}),(0,Z.jsx)(`p`,{children:f.subtitle})]})]}),(0,Z.jsx)(th,{mode:d,draftObjective:l.draftObjective,draftEvaluatorProviderId:l.draftEvaluatorProviderId,disableObjective:m,onDraftObjectiveChange:e=>g({draftObjective:e}),onDraftEvaluatorProviderChange:e=>g({draftEvaluatorProviderId:e}),mobileEvaluatorPicker:{onOpen:()=>s(!0),isMobile:!0}})]}),footer:(0,Z.jsxs)(`div`,{className:`mobile-supervisor-sheet__footer`,children:[(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:()=>{s(!1),h(),a(null)},children:r(`action.cancel`)}),(0,Z.jsx)(`button`,{className:`btn ${p?`btn-danger`:`btn-primary`}`,onClick:()=>{_()},disabled:!p&&!l.draftObjective.trim(),children:f.confirm})]})}):(0,Z.jsx)($f,{title:r(`supervisor.title`),kicker:r(`supervisor.title`),onClose:n,contentClassName:`mobile-supervisor-sheet mobile-supervisor-sheet--root`,body:(0,Z.jsx)(`div`,{className:`mobile-supervisor-sheet__root`,children:u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ah,{sessionId:e,workspaceId:t}),(0,Z.jsxs)(`div`,{className:`mobile-supervisor-sheet__actions`,children:[(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:()=>v(`edit`),children:r(`supervisor.action.edit_objective`)}),(0,Z.jsx)(`button`,{className:`btn btn-secondary`,onClick:()=>v(`disable`),children:r(`supervisor.action.disable`)})]})]}):(0,Z.jsxs)(`div`,{className:`mobile-supervisor-sheet__empty`,children:[(0,Z.jsx)(`h3`,{children:r(`supervisor.title`)}),(0,Z.jsx)(`p`,{children:r(`supervisor.empty`)}),(0,Z.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>v(`enable`),children:r(`supervisor.action.enable_objective`)})]})})})}var D_=`(orientation: landscape)`,O_=`(max-height: 540px)`;function k_(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return`default`;let e=window.matchMedia(D_).matches,t=window.matchMedia(O_).matches;return e&&t?`landscape-compact`:`default`}function A_(){let[e,t]=(0,L.useState)(k_);return(0,L.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(D_),n=window.matchMedia(O_),r=()=>{t(k_())};return e.addEventListener(`change`,r),n.addEventListener(`change`,r),r(),()=>{e.removeEventListener(`change`,r),n.removeEventListener(`change`,r)}},[]),e}var j_=`(prefers-reduced-motion: reduce)`;function M_(){return typeof window>`u`||typeof window.matchMedia!=`function`?`default`:window.matchMedia(j_).matches?`reduced`:`default`}function N_(){let[e,t]=(0,L.useState)(M_);return(0,L.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(j_),n=()=>{t(e.matches?`reduced`:`default`)};return e.addEventListener(`change`,n),n(),()=>{e.removeEventListener(`change`,n)}},[]),e}function P_(){let[e,t]=(0,L.useState)(0);return(0,L.useEffect)(()=>{let e=window.visualViewport;if(!e){t(0);return}let n=()=>{let n=Math.max(window.innerHeight-e.height-e.offsetTop,0);t(Math.round(n))};return n(),e.addEventListener(`resize`,n),e.addEventListener(`scroll`,n),()=>{e.removeEventListener(`resize`,n),e.removeEventListener(`scroll`,n)}},[]),e}function F_(e){if(e.title?.trim())return e.title.trim();if(e.providerId)return e.providerId.replace(/\b\w/g,e=>e.toUpperCase());let t=e.id.match(/(\d+)/)?.[1];return t?`SESSION-${t.slice(-2).padStart(2,`0`)}`:e.id.replace(/[_-]/g,` `).toUpperCase()}function I_({activeSessionId:e,activeWorkspaceId:t,defaultMode:n=`list`,sessions:r,onClose:i,onCloseSession:a,onSelectSession:o,onSessionCreated:s}){let c=R(Yu),l=z(cd),u=X(),[d,f]=(0,L.useState)(n===`create`?`providers`:`sessions`),p=r.find(t=>t.id===e)??r[0]??null,m=!!t,h=[{id:`claude`,title:`Claude`,icon:(0,Z.jsx)(Ef,{size:16})},{id:`codex`,title:`Codex`,icon:(0,Z.jsx)(Nd,{size:16})}],g=()=>{f(n===`create`?`providers`:`sessions`),i()},{states:_,launch:v}=Hm(c,t??`__workspace_placeholder__`,(e,t)=>{l(t=>({...t,[e.id]:e})),s(e.id),g()}),y=[{kind:`actions`,id:`agent-actions`,items:[{id:`create`,label:u(`action.create_session`),icon:(0,Z.jsx)(vf,{size:16}),onAction:()=>f(`providers`),disabled:!m}]},{kind:`options`,id:`sessions`,items:r.length>0?r.map(e=>({id:e.id,label:F_(e),description:u(`mobile.agent.switch_to_agent`,{name:F_(e)}),meta:e.providerId.toUpperCase(),trailingAction:{id:`${e.id}-close`,ariaLabel:u(`mobile.agent.close_current_session`),icon:(0,Z.jsx)(Pf,{size:16}),tone:`danger`,onAction:async()=>{await a(e.id),g()}}})):[]}],b=[{kind:`options`,id:`providers`,items:h.map(e=>{let t=_[e.id],n=t.loading||t.installJob?.status===`queued`||t.installJob?.status===`running`;return{id:e.id,label:e.title,description:u(`mobile.agent.start_session`,{provider:e.title}),meta:u(n?`mobile.agent.starting`:`mobile.agent.start_new_session`),icon:e.icon,disabled:!m||n}})}];return(0,Z.jsx)(Sg,{title:u(d===`sessions`?`mobile.agent.title`:`session.provider_select`),sections:d===`sessions`?y:b,selectedId:d===`sessions`?p?.id??null:null,emptyText:d===`sessions`?u(`mobile.agent.empty`):void 0,closeOnSelect:!1,onBack:d===`providers`?()=>f(`sessions`):void 0,onClose:g,onSelect:e=>{if(d===`sessions`){o(e),g();return}return v(e)}})}function L_({activeItem:e,onSelectItem:t}){let n=X();return(0,Z.jsxs)(`nav`,{className:`mobile-dock`,"aria-label":n(`mobile.dock.aria_label`),children:[(0,Z.jsxs)(`button`,{type:`button`,className:`mobile-dock__item ${e===`agent`?`mobile-dock__item--active`:``}`,onClick:()=>t(`agent`),"aria-label":n(`mobile.dock.open_agent`),children:[(0,Z.jsx)(`span`,{className:`mobile-dock__icon`,"aria-hidden":`true`,children:(0,Z.jsx)(Nd,{size:18})}),(0,Z.jsx)(`span`,{className:`mobile-dock__label`,children:n(`label.agent`)})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`mobile-dock__item ${e===`files`?`mobile-dock__item--active`:``}`,onClick:()=>t(`files`),"aria-label":n(`mobile.dock.open_files`),children:[(0,Z.jsx)(`span`,{className:`mobile-dock__icon`,"aria-hidden":`true`,children:(0,Z.jsx)(Zd,{size:18})}),(0,Z.jsx)(`span`,{className:`mobile-dock__label`,children:n(`file.title`)})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`mobile-dock__item ${e===`terminal`?`mobile-dock__item--active`:``}`,onClick:()=>t(`terminal`),"aria-label":n(`mobile.dock.open_terminal`),children:[(0,Z.jsx)(`span`,{className:`mobile-dock__icon`,"aria-hidden":`true`,children:(0,Z.jsx)(kf,{size:18})}),(0,Z.jsx)(`span`,{className:`mobile-dock__label`,children:n(`label.terminal`)})]})]})}function R_({workspaceId:e,route:t,onRouteChange:n,onCloseSheet:r,detailBackMode:i=`inline`,editorState:a}){let o=X(),s=R(Hf(e)),c=z(Kf),[l,u]=(0,L.useState)(`files`),{closePreview:d}=Wg(e),f=s?.branch?.trim()||o(`git.no_branch`),p=e=>{n?.({kind:`editor`,path:e})},m=e=>{n?.({kind:`diff`,path:e.path})},h=()=>{n?.({kind:`root`})};return t.kind===`editor`?(0,Z.jsxs)(`div`,{className:`mobile-files-sheet`,children:[i===`inline`?(0,Z.jsx)(`div`,{className:`mobile-files-sheet__detail-toolbar`,children:(0,Z.jsx)(`button`,{type:`button`,className:`mobile-files-sheet__back`,"aria-label":o(`action.back`),onClick:h,children:o(`action.back`)})}):null,(0,Z.jsx)(`div`,{className:`mobile-files-sheet__detail`,children:(0,Z.jsx)(xg,{chrome:`content-only`,editorState:a})})]}):t.kind===`diff`?(0,Z.jsxs)(`div`,{className:`mobile-files-sheet`,children:[i===`inline`?(0,Z.jsx)(`div`,{className:`mobile-files-sheet__detail-toolbar`,children:(0,Z.jsx)(`button`,{type:`button`,className:`mobile-files-sheet__back`,"aria-label":o(`action.back`),onClick:h,children:o(`action.back`)})}):null,(0,Z.jsx)(`div`,{className:`mobile-files-sheet__detail`,children:(0,Z.jsx)(f_,{workspaceId:e,onClose:()=>{d(),r?.()},showCloseButton:!1})})]}):(0,Z.jsxs)(`div`,{className:`mobile-files-sheet`,children:[(0,Z.jsx)(`div`,{className:`mobile-files-sheet__branch-row`,children:(0,Z.jsxs)(`button`,{className:`panel-branch panel-branch-button mobile-files-sheet__branch`,onClick:()=>{c({visible:!0,workspaceId:e,inputValue:``})},"aria-label":`${o(`git.current_branch`)}: ${f}`,title:f,type:`button`,children:[(0,Z.jsx)(`span`,{className:`mobile-files-sheet__branch-icon`,"aria-hidden":`true`,children:(0,Z.jsx)(ef,{size:12})}),(0,Z.jsxs)(`span`,{className:`mobile-files-sheet__branch-copy`,children:[(0,Z.jsx)(`span`,{className:`mobile-files-sheet__branch-label`,children:o(`git.current_branch`)}),(0,Z.jsx)(`span`,{className:`mobile-files-sheet__branch-name`,children:f})]}),(0,Z.jsx)(`span`,{className:`mobile-files-sheet__branch-chevron`,"aria-hidden":`true`,children:(0,Z.jsx)(Fd,{size:14})})]})}),(0,Z.jsxs)(`div`,{className:`panel-tabs-row mobile-files-sheet__tabs-row`,children:[(0,Z.jsxs)(`div`,{className:`panel-tabs mobile-files-sheet__tabs`,role:`tablist`,"aria-label":o(`mobile.files.tabs`),children:[(0,Z.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`files`,className:`panel-tab ${l===`files`?`active`:``}`,onClick:()=>u(`files`),children:o(`file.title`)}),(0,Z.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`git`,className:`panel-tab ${l===`git`?`active`:``}`,onClick:()=>u(`git`),children:o(`label.git`)})]}),(0,Z.jsx)(__,{workspaceId:e,gitState:s,inline:!0})]}),(0,Z.jsx)(`div`,{className:`mobile-files-sheet__content`,children:l===`files`?(0,Z.jsx)(n_,{workspaceId:e,onSelectFile:p}):(0,Z.jsx)(p_,{workspaceId:e,onPreviewOpen:m})})]})}function z_({activeWorkspace:e,drawerOpen:t,fullscreenController:n,onOpenSettings:r,onToggleDrawer:i}){let a=X(),o=e?.name??e?.path?.split(`/`).filter(Boolean).pop()??e?.path??a(`mobile.workspace_drawer.select_title`);return(0,Z.jsxs)(`header`,{className:`mobile-topbar`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`mobile-topbar__workspace-button`,onClick:()=>{i()},"aria-label":a(`mobile.topbar.switch_workspace`),"aria-expanded":t,children:[(0,Z.jsx)(`span`,{className:`mobile-topbar__workspace-leading`,"aria-hidden":`true`,children:(0,Z.jsx)(lf,{size:18})}),(0,Z.jsxs)(`span`,{className:`mobile-topbar__workspace-copy`,children:[(0,Z.jsx)(`span`,{className:`mobile-topbar__workspace-label`,children:a(`label.workspace`)}),(0,Z.jsx)(`span`,{className:`mobile-topbar__workspace-name`,children:o})]})]}),(0,Z.jsxs)(`div`,{className:`mobile-topbar__actions`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`mobile-topbar__icon-button`,"aria-label":a(`mobile.topbar.open_settings`),onClick:()=>{r()},children:(0,Z.jsx)(wf,{size:18})}),(0,Z.jsx)(Ng,{controller:n,className:`mobile-topbar__icon-button`,iconSize:18,dataTestId:`mobile-fullscreen-toggle`})]})]})}function B_({activeWorkspaceId:e,isOpen:t,workspaces:n,onClose:r,onOpenWorkspaceLauncher:i}){let a=Zt(),o=z(Qu),s=X(),c=Fg();return t?(0,Z.jsxs)(`div`,{className:`mobile-drawer-layer`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`mobile-drawer-layer__backdrop`,"aria-label":s(`mobile.workspace_drawer.close`),onClick:r}),(0,Z.jsxs)(`aside`,{className:`mobile-workspace-drawer`,"aria-label":s(`mobile.workspace_drawer.aria_label`),children:[(0,Z.jsxs)(`div`,{className:`mobile-workspace-drawer__header`,children:[(0,Z.jsx)(`div`,{className:`mobile-workspace-drawer__kicker`,children:s(`label.workspace`)}),(0,Z.jsx)(`h2`,{className:`mobile-workspace-drawer__title`,children:s(`mobile.workspace_drawer.select_title`)})]}),(0,Z.jsx)(`div`,{className:`mobile-workspace-drawer__list`,children:n.map(t=>{let n=t.name||t.path?.split(`/`).filter(Boolean).pop()||t.path||t.id;return(0,Z.jsxs)(`div`,{className:`mobile-workspace-drawer__item ${t.id===e?`mobile-workspace-drawer__item--active`:``}`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:`mobile-workspace-drawer__item-main`,"aria-label":s(`mobile.workspace_drawer.switch_to_workspace`,{name:n}),onClick:()=>{o(t.id),a(`/workspace`),r()},children:[(0,Z.jsx)(`span`,{className:`mobile-workspace-drawer__item-name`,children:n}),(0,Z.jsx)(`span`,{className:`mobile-workspace-drawer__item-path`,children:t.path})]}),(0,Z.jsx)(`button`,{type:`button`,className:`mobile-workspace-drawer__item-close`,"aria-label":s(`mobile.workspace_drawer.close_workspace`,{name:n}),onClick:()=>{c(t.id,{navigateHomeWhenEmpty:!0}).then(e=>{e&&r()})},children:(0,Z.jsx)(Pf,{size:16})})]},t.id)})}),(0,Z.jsx)(`div`,{className:`mobile-workspace-drawer__footer`,children:(0,Z.jsx)(`button`,{type:`button`,className:`mobile-workspace-drawer__footer-button`,onClick:()=>{i(),r()},children:s(`tooltip.new_workspace`)})})]})]}):null}function V_(){let e=(0,L.useRef)(null),t=qg(e),n=X(),r=Zt(),i=R(Kr),a=z(qr),{activeSession:o,activeWorkspaceId:s,closeMobileSession:c,closeMobileSheet:l,handleMobileSessionCreated:u,mobileActiveSessionId:d,mobileFilesRoute:f,mobileSheet:p,openMobileSheet:m,orderedSessions:h,selectMobileSession:g,updateMobileFilesRoute:_,workspace:v,workspaces:y}=e_(),[b,x]=(0,L.useState)(!1),[S,C]=(0,L.useState)(!1),[w,T]=(0,L.useState)(!1),E=P_(),D=A_(),O=N_(),k=hg();(0,L.useEffect)(()=>{i&&i!==d&&h.some(e=>e.id===i)&&g(i)},[d,h,i,g]),(0,L.useEffect)(()=>(a(d),()=>{a(null)}),[d,a]);let A=p===`files`?{title:f.kind===`editor`?f.path.split(`/`).pop()??n(`mobile.files.editor_fallback`):f.kind===`diff`?f.path.split(`/`).pop()??n(`worktree.diff_tab`):n(`file.title`),body:s?(0,Z.jsx)(R_,{workspaceId:s,route:f,onRouteChange:_,onCloseSheet:l,detailBackMode:`sheet`,editorState:k}):null,kicker:f.kind===`root`?n(`label.workspace`):n(`file.title`),onBack:f.kind===`root`?void 0:()=>_({kind:`root`}),backLabel:n(`action.back`),headerAction:f.kind===`editor`?(0,Z.jsx)(yg,{state:k,variant:`mobile`}):null,fullscreen:!0,bodyClassName:`mobile-sheet__body--flush mobile-sheet__body--fullscreen`,contentClassName:`mobile-sheet--files`}:p===`terminal`?{title:n(`label.terminal`),body:(0,Z.jsx)(`div`,{className:`mobile-terminal-sheet mobile-terminal-sheet--fullscreen`,children:(0,Z.jsx)(Mg,{chrome:`mobile-fullscreen`})}),kicker:null,fullscreen:!0,bodyClassName:`mobile-sheet__body--flush mobile-sheet__body--fullscreen`,contentClassName:`mobile-sheet--terminal`}:null,j=e=>{if(e===`agent`){C(e=>!e);return}C(!1),m(e)},ee=S?`agent`:p===`files`||p===`terminal`?p:null;return(0,Z.jsxs)(`div`,{ref:e,className:`mobile-shell mobile-shell--${D} mobile-shell--motion-${O}`,"data-testid":`mobile-shell`,"data-layout-mode":D,"data-motion-mode":O,children:[(0,Z.jsx)(z_,{activeWorkspace:v,drawerOpen:b,fullscreenController:t,onOpenSettings:()=>{C(!1),r(`/settings`)},onToggleDrawer:()=>{C(!1),x(e=>!e)}}),(0,Z.jsx)(ip,{}),(0,Z.jsx)(`main`,{className:`mobile-shell__viewport`,children:(0,Z.jsx)(`div`,{className:`mobile-shell__content`,children:h.length>0?(0,Z.jsx)(Z.Fragment,{children:o?(0,Z.jsx)(`section`,{className:`mobile-shell__agent-stage`,children:(0,Z.jsx)(ig,{sessionId:o.id,showHeaderActions:!1,showSupervisorInline:!1,headerAccessory:(0,Z.jsx)(T_,{sessionId:o.id,onOpen:()=>{C(!1),m(`supervisor`)}})})}):null}):(0,Z.jsx)(`section`,{className:`mobile-shell__agent-empty`,"data-testid":`mobile-agent-empty`,children:(0,Z.jsxs)(`div`,{className:`mobile-shell__empty-content`,children:[(0,Z.jsxs)(`div`,{className:`mobile-shell__placeholder-copy`,children:[(0,Z.jsx)(`p`,{children:n(`mobile.empty.start_session`)}),(0,Z.jsx)(`p`,{children:n(`mobile.empty.files_terminal_hint`)})]}),(0,Z.jsx)(`button`,{type:`button`,className:`mobile-shell__empty-cta`,onClick:()=>C(!0),children:n(`action.create_session`)})]})})})}),(0,Z.jsx)(`div`,{className:`mobile-shell__bottom-stack`,"data-testid":`mobile-bottom-stack`,style:{"--mobile-keyboard-inset":`${E}px`},children:(0,Z.jsx)(`div`,{className:`mobile-dock-shell`,children:(0,Z.jsx)(L_,{activeItem:ee,onSelectItem:j})})}),S?(0,Z.jsx)(I_,{activeSessionId:d,activeWorkspaceId:s,defaultMode:h.length===0?`create`:`list`,sessions:h,onClose:()=>C(!1),onCloseSession:c,onSelectSession:g,onSessionCreated:u}):null,p===`supervisor`&&o?(0,Z.jsx)(E_,{sessionId:o.id,workspaceId:o.workspaceId,onClose:()=>{C(!1),l()}}):null,A?(0,Z.jsx)($f,{title:A.title,body:A.body,onClose:()=>{C(!1),l()},kicker:A.kicker??void 0,onBack:A.onBack,backLabel:A.backLabel,headerAction:`headerAction`in A?A.headerAction:void 0,bodyClassName:A.bodyClassName,contentClassName:A.contentClassName,fullscreen:A.fullscreen}):null,(0,Z.jsx)(B_,{activeWorkspaceId:s,isOpen:b,workspaces:y,onClose:()=>x(!1),onOpenWorkspaceLauncher:()=>{C(!1),T(!0)}}),w?(0,Z.jsx)(tp,{onClose:()=>T(!1)}):null]})}function H_(){im();let e=R(Ju)===null;return(0,Z.jsxs)(`div`,{className:`app`,children:[(0,Z.jsx)(C_,{}),(0,Z.jsx)(`main`,{className:`main-content`,children:e?(0,Z.jsx)(`div`,{className:`app-loading-shell`,children:(0,Z.jsxs)(`div`,{className:`app-loading-card`,children:[(0,Z.jsx)(`div`,{className:`app-loading-kicker`,children:`CODER STUDIO`}),(0,Z.jsx)(`h1`,{className:`app-loading-title`,children:`正在连接工作区...`}),(0,Z.jsx)(`p`,{className:`app-loading-desc`,children:`正在同步认证与连接状态,随后会自动进入当前 workspace。`})]})}):(0,Z.jsxs)(Tn,{children:[(0,Z.jsx)(Cn,{path:`/`,element:(0,Z.jsx)(rm,{})}),(0,Z.jsx)(Cn,{path:`/login`,element:(0,Z.jsx)(yd,{})}),(0,Z.jsx)(Cn,{path:`/workspace`,element:(0,Z.jsx)(S_,{children:(0,Z.jsx)(V_,{})})}),(0,Z.jsx)(Cn,{path:`/settings`,element:(0,Z.jsx)(Qp,{})}),(0,Z.jsx)(Cn,{path:`*`,element:(0,Z.jsx)(ap,{})})]})}),(0,Z.jsx)(np,{}),(0,Z.jsx)(y_,{}),(0,Z.jsx)(pp,{})]})}function U_(){return Ir()===`mobile`?(0,Z.jsx)(H_,{}):(0,Z.jsx)(w_,{})}function W_(){return(0,Z.jsx)(fr,{children:(0,Z.jsx)(U_,{})})}var G_=null,K_=null,q_={refreshGit:!1,refreshBranches:!1,markTreeStale:!1,refreshEditorBuffers:!1};function J_(e){return e===`fs_change`}function Y_(e,t){return{refreshGit:e.refreshGit||!!t.refreshGit,refreshBranches:e.refreshBranches||!!t.refreshBranches,markTreeStale:e.markTreeStale||!!t.markTreeStale,refreshEditorBuffers:e.refreshEditorBuffers||!!t.refreshEditorBuffers}}function X_(e,t){let n=e.match(/^workspace\.([^.]+)\.(fs\.dirty|git\.state)$/);if(!n)return null;let r=n[1];if(n[2]===`fs.dirty`){let e=t??{};return{workspaceId:r,hint:{refreshGit:!0,refreshBranches:!1,markTreeStale:J_(e.reason),refreshEditorBuffers:e.reason===`fs_change`||e.reason===`file_content`}}}let i=t??{};return{workspaceId:r,hint:{refreshGit:!0,refreshBranches:!!i.branchChanged,markTreeStale:!!i.treeChanged,refreshEditorBuffers:!!i.treeChanged}}}function Z_({children:e}){let[,t]=Te(Vu),n=R(Ju),r=R(Wr),i=z(Hu),a=z(Uu),o=z(qu),s=z(Ju),c=z(Ku),l=z(Gu),u=z(Wu),d=z($u),f=z(cd),p=z(Gm),m=z(Km),h=ve(),g=R(Yu);Ep();let _=(0,L.useRef)(null),v=(0,L.useRef)(g),y=(0,L.useRef)(new Map),b=(0,L.useRef)(new Map);return(0,L.useEffect)(()=>{v.current=g},[g]),(0,L.useEffect)(()=>{let e=localStorage.getItem(`ui.theme`);if(e)try{let t=JSON.parse(e);(t===`light`||t===`dark`)&&document.documentElement.setAttribute(`data-theme`,t)}catch{}},[]),(0,L.useEffect)(()=>{(async()=>{try{let e=await(await fetch(`/auth/status`)).json();s(!!e.authEnabled),h.set(Wr,!!e.authenticated||e.authEnabled===!1)}catch{h.set(Wr,!1)}})()},[s,h]),(0,L.useEffect)(()=>{if(n===null)return;if(n===!0&&!r){K_&&=(clearTimeout(K_),null),G_&&=(G_.disconnect(`auth_required`),null),_.current=null,t(null),i(`connecting`),a(null),o(null),c(0),l(null),u(!1);return}let e=e=>{i(e),e===`reconnecting`&&(c(e=>e+1),l(Date.now())),(e===`disconnected`||e===`rejected`)&&u(!1)},s=e=>{v.current(`git.status`,{workspaceId:e}).then(t=>{t.ok&&t.data&&h.set(Hf(e),t.data)}).catch(e=>{console.error(`[Git Status] git.status command threw error:`,e)})},d=e=>{v.current(`git.branches`,{workspaceId:e}).then(t=>{if(t.ok&&t.data){h.set(Gf(e),{current:t.data.current,branches:t.data.branches,loading:!1});return}h.set(Gf(e),e=>({...e,loading:!1,error:t.error?.message??e.error}))}).catch(e=>{console.error(`[Git Branches] git.branches command threw error:`,e)})},f=(e,t)=>{let n=Y_(b.current.get(e)??q_,t);if(b.current.set(e,n),y.current.get(e))return;let r=setTimeout(()=>{y.current.delete(e);let t=b.current.get(e)??q_;b.current.delete(e),t.markTreeStale&&h.set(Lf(e),!0),t.refreshEditorBuffers&&h.set(Vf(e),e=>e+1),t.refreshGit&&s(e),t.refreshBranches&&d(e)},60);y.current.set(e,r)},p=(e,t,n)=>{let r=X_(e,t);r&&f(r.workspaceId,r.hint);try{Q_(e,t,h)}catch(t){console.error(`Error handling event for topic ${e}:`,t)}},m=[`connection.*`,`workspace.*`];if(K_&&=(clearTimeout(K_),null),G_){_.current=G_,t(G_);let n=G_.getStatus();i(n);let r=G_.onStatus(e),a=G_.subscribe(m,p);(n===`disconnected`||n===`reconnecting`)&&G_.recoverConnection(`manual_retry`);let o=()=>{document.visibilityState===`visible`&&_.current?.recoverConnection(`visibility_resume`)},s=()=>{_.current?.recoverConnection(`network_online`)};return document.addEventListener(`visibilitychange`,o),window.addEventListener(`online`,s),()=>{document.removeEventListener(`visibilitychange`,o),window.removeEventListener(`online`,s),r(),a(),y.current.forEach(e=>clearTimeout(e)),y.current.clear(),b.current.clear(),_.current=null,G_&&(K_=setTimeout(()=>{G_&&=(G_.disconnect(`app_unmount`),null),K_=null},50))}}let g=new zu(Bu());G_=g,_.current=g,t(g);let x=g.onStatus(e),S=g.subscribe(m,p);g.connect().catch(e=>{console.error(`Failed to connect WebSocket:`,e),a(e.message||`Connection failed`)});let C=()=>{document.visibilityState===`visible`&&_.current?.recoverConnection(`visibility_resume`)},w=()=>{_.current?.recoverConnection(`network_online`)};return document.addEventListener(`visibilitychange`,C),window.addEventListener(`online`,w),()=>{document.removeEventListener(`visibilitychange`,C),window.removeEventListener(`online`,w),x(),S(),y.current.forEach(e=>clearTimeout(e)),y.current.clear(),b.current.clear(),_.current=null,K_=setTimeout(()=>{G_&&=(G_.disconnect(`app_unmount`),null),K_=null},50)}},[t,i,a,o,s,c,l,u,d,f,p,m,h,n,r]),(0,Z.jsx)(Z.Fragment,{children:e})}function Q_(e,t,n){if(e===`connection.ready`){let e=t;n.set(qu,{version:e.version,serverInstanceId:e.serverInstanceId}),n.set(Wu,e.isWriter),n.set(Uu,null);return}if(e===`connection.status`){let e=t;e.status===`connected`&&e.authEnabled===!1&&n.set(Wr,!0),e.status===`error`&&e.message&&n.set(Uu,e.message);return}let r=e.match(/^workspace\.([^.]+)\.(.+)$/);if(r){let e=r[1],i=r[2];if(i===`meta`){let r=t;if(!(n.get($u)[e]||r.path))return;n.set($u,t=>({...t,[e]:{...t[e],...r,id:e}})),n.set(ed,t=>t.includes(e)?t:[...t,e]),n.set(td,`ready`),n.set(nd,null);return}if(i===`fs.dirty`){if(J_((t??{}).reason)){let t=Lf(e);n.set(t,!0)}return}if(i===`git.state`)return;let a=i.match(/^session\.([^.]+)\.(.+)$/);if(a){let e=a[1],r=a[2];if(r===`lifecycle`){if(t.event===`removed`){let t=n.get(cd)[e];t?.terminalId&&n.set(sh(t.terminalId),null),n.set(cd,t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})}return}if(r===`state`){let e=t;n.set(cd,t=>({...t,[e.id]:e}));return}if(r===`progress`){console.log(`Session ${e} progress:`,t);return}if(r===`supervisor.state`){let e=t;e.event===`deleted`&&e.supervisorId?(n.set(Gm,t=>{let n=new Map(t);for(let[t,r]of n.entries())if(r.id===e.supervisorId){n.delete(t);break}return n}),n.set(Km,t=>{let n=new Map(t);return n.delete(e.supervisorId),n})):e.supervisor&&(n.set(Gm,t=>{let n=new Map(t);return n.set(e.supervisor.sessionId,e.supervisor),n}),Array.isArray(e.supervisor.cycles)&&n.set(Km,t=>{let n=new Map(t);return n.set(e.supervisor.id,e.supervisor.cycles),n}));return}if(r===`supervisor.cycle`){let e=t,r=e.cycle.supervisorId;n.set(Km,t=>{let n=new Map(t),i=(n.get(r)??[]).filter(t=>t.id!==e.cycle.id);return n.set(r,[e.cycle,...i].slice(0,20)),n});return}}let o=i.match(/^terminal\.([^.]+)\.(.+)$/);if(o){let r=o[1],i=o[2];if(i===`created`){let i=t,a=sh(r);n.set(a,{id:i.id,workspaceId:e,kind:i.kind,alive:!0,title:i.title});return}if(i===`output`)return;if(i===`exit`){let e=t,i=sh(r),a=n.get(i);a&&n.set(i,{...a,exitCode:e.code,alive:!1});return}}}console.log(`Unhandled event topic: ${e}`,t)}Nr.createRoot(document.getElementById(`root`)).render((0,Z.jsx)(ye,{children:(0,Z.jsx)(Z_,{children:(0,Z.jsx)(W_,{})})}));
111
- //# sourceMappingURL=index-A-2YPePM.js.map