@agent-team-foundation/first-tree-hub 0.11.4 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,390 @@
1
+ var x1=e=>{throw TypeError(e)};var tp=(e,t,n)=>t.has(e)||x1("Cannot "+n);var L=(e,t,n)=>(tp(e,t,"read from private field"),n?n.call(e):t.get(e)),je=(e,t,n)=>t.has(e)?x1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),pe=(e,t,n,a)=>(tp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Ue=(e,t,n)=>(tp(e,t,"access private method"),n);var wd=(e,t,n,a)=>({set _(s){pe(e,t,s,n)},get _(){return L(e,t,a)}});function yT(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(a,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function vf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var np={exports:{}},Wo={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var w1;function bT(){if(w1)return Wo;w1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,o){var c=null;if(o!==void 0&&(c=""+o),s.key!==void 0&&(c=""+s.key),"key"in s){o={};for(var f in s)f!=="key"&&(o[f]=s[f])}else o=s;return s=o.ref,{$$typeof:e,type:a,key:c,ref:s!==void 0?s:null,props:o}}return Wo.Fragment=t,Wo.jsx=n,Wo.jsxs=n,Wo}var S1;function xT(){return S1||(S1=1,np.exports=bT()),np.exports}var u=xT(),rp={exports:{}},Fe={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var k1;function wT(){if(k1)return Fe;k1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.iterator;function w(U){return U===null||typeof U!="object"?null:(U=b&&U[b]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function C(U,B,T){this.props=U,this.context=B,this.refs=N,this.updater=T||k}C.prototype.isReactComponent={},C.prototype.setState=function(U,B){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,B,"setState")},C.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function A(){}A.prototype=C.prototype;function O(U,B,T){this.props=U,this.context=B,this.refs=N,this.updater=T||k}var M=O.prototype=new A;M.constructor=O,j(M,C.prototype),M.isPureReactComponent=!0;var P=Array.isArray;function z(){}var $={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function Z(U,B,T){var V=T.ref;return{$$typeof:e,type:U,key:B,ref:V!==void 0?V:null,props:T}}function D(U,B){return Z(U.type,B,U.props)}function te(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function ae(U){var B={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(T){return B[T]})}var xe=/\/+/g;function G(U,B){return typeof U=="object"&&U!==null&&U.key!=null?ae(""+U.key):B.toString(36)}function X(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(z,z):(U.status="pending",U.then(function(B){U.status==="pending"&&(U.status="fulfilled",U.value=B)},function(B){U.status==="pending"&&(U.status="rejected",U.reason=B)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function q(U,B,T,V,W){var ce=typeof U;(ce==="undefined"||ce==="boolean")&&(U=null);var be=!1;if(U===null)be=!0;else switch(ce){case"bigint":case"string":case"number":be=!0;break;case"object":switch(U.$$typeof){case e:case t:be=!0;break;case v:return be=U._init,q(be(U._payload),B,T,V,W)}}if(be)return W=W(U),be=V===""?"."+G(U,0):V,P(W)?(T="",be!=null&&(T=be.replace(xe,"$&/")+"/"),q(W,B,T,"",function(Ge){return Ge})):W!=null&&(te(W)&&(W=D(W,T+(W.key==null||U&&U.key===W.key?"":(""+W.key).replace(xe,"$&/")+"/")+be)),B.push(W)),1;be=0;var ge=V===""?".":V+":";if(P(U))for(var fe=0;fe<U.length;fe++)V=U[fe],ce=ge+G(V,fe),be+=q(V,B,T,ce,W);else if(fe=w(U),typeof fe=="function")for(U=fe.call(U),fe=0;!(V=U.next()).done;)V=V.value,ce=ge+G(V,fe++),be+=q(V,B,T,ce,W);else if(ce==="object"){if(typeof U.then=="function")return q(X(U),B,T,V,W);throw B=String(U),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return be}function ee(U,B,T){if(U==null)return U;var V=[],W=0;return q(U,V,"","",function(ce){return B.call(T,ce,W++)}),V}function ye(U){if(U._status===-1){var B=U._result;B=B(),B.then(function(T){(U._status===0||U._status===-1)&&(U._status=1,U._result=T)},function(T){(U._status===0||U._status===-1)&&(U._status=2,U._result=T)}),U._status===-1&&(U._status=0,U._result=B)}if(U._status===1)return U._result.default;throw U._result}var Ae=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},R={map:ee,forEach:function(U,B,T){ee(U,function(){B.apply(this,arguments)},T)},count:function(U){var B=0;return ee(U,function(){B++}),B},toArray:function(U){return ee(U,function(B){return B})||[]},only:function(U){if(!te(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Fe.Activity=p,Fe.Children=R,Fe.Component=C,Fe.Fragment=n,Fe.Profiler=s,Fe.PureComponent=O,Fe.StrictMode=a,Fe.Suspense=m,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(U){return $.H.useMemoCache(U)}},Fe.cache=function(U){return function(){return U.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(U,B,T){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var V=j({},U.props),W=U.key;if(B!=null)for(ce in B.key!==void 0&&(W=""+B.key),B)!I.call(B,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&B.ref===void 0||(V[ce]=B[ce]);var ce=arguments.length-2;if(ce===1)V.children=T;else if(1<ce){for(var be=Array(ce),ge=0;ge<ce;ge++)be[ge]=arguments[ge+2];V.children=be}return Z(U.type,W,V)},Fe.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:o,_context:U},U},Fe.createElement=function(U,B,T){var V,W={},ce=null;if(B!=null)for(V in B.key!==void 0&&(ce=""+B.key),B)I.call(B,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(W[V]=B[V]);var be=arguments.length-2;if(be===1)W.children=T;else if(1<be){for(var ge=Array(be),fe=0;fe<be;fe++)ge[fe]=arguments[fe+2];W.children=ge}if(U&&U.defaultProps)for(V in be=U.defaultProps,be)W[V]===void 0&&(W[V]=be[V]);return Z(U,ce,W)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(U){return{$$typeof:f,render:U}},Fe.isValidElement=te,Fe.lazy=function(U){return{$$typeof:v,_payload:{_status:-1,_result:U},_init:ye}},Fe.memo=function(U,B){return{$$typeof:h,type:U,compare:B===void 0?null:B}},Fe.startTransition=function(U){var B=$.T,T={};$.T=T;try{var V=U(),W=$.S;W!==null&&W(T,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(z,Ae)}catch(ce){Ae(ce)}finally{B!==null&&T.types!==null&&(B.types=T.types),$.T=B}},Fe.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Fe.use=function(U){return $.H.use(U)},Fe.useActionState=function(U,B,T){return $.H.useActionState(U,B,T)},Fe.useCallback=function(U,B){return $.H.useCallback(U,B)},Fe.useContext=function(U){return $.H.useContext(U)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(U,B){return $.H.useDeferredValue(U,B)},Fe.useEffect=function(U,B){return $.H.useEffect(U,B)},Fe.useEffectEvent=function(U){return $.H.useEffectEvent(U)},Fe.useId=function(){return $.H.useId()},Fe.useImperativeHandle=function(U,B,T){return $.H.useImperativeHandle(U,B,T)},Fe.useInsertionEffect=function(U,B){return $.H.useInsertionEffect(U,B)},Fe.useLayoutEffect=function(U,B){return $.H.useLayoutEffect(U,B)},Fe.useMemo=function(U,B){return $.H.useMemo(U,B)},Fe.useOptimistic=function(U,B){return $.H.useOptimistic(U,B)},Fe.useReducer=function(U,B,T){return $.H.useReducer(U,B,T)},Fe.useRef=function(U){return $.H.useRef(U)},Fe.useState=function(U){return $.H.useState(U)},Fe.useSyncExternalStore=function(U,B,T){return $.H.useSyncExternalStore(U,B,T)},Fe.useTransition=function(){return $.H.useTransition()},Fe.version="19.2.4",Fe}var j1;function sv(){return j1||(j1=1,rp.exports=wT()),rp.exports}var x=sv();const ST=vf(x),lv=yT({__proto__:null,default:ST},[x]);var ap={exports:{}},eu={},ip={exports:{}},sp={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var C1;function kT(){return C1||(C1=1,(function(e){function t(q,ee){var ye=q.length;q.push(ee);e:for(;0<ye;){var Ae=ye-1>>>1,R=q[Ae];if(0<s(R,ee))q[Ae]=ee,q[ye]=R,ye=Ae;else break e}}function n(q){return q.length===0?null:q[0]}function a(q){if(q.length===0)return null;var ee=q[0],ye=q.pop();if(ye!==ee){q[0]=ye;e:for(var Ae=0,R=q.length,U=R>>>1;Ae<U;){var B=2*(Ae+1)-1,T=q[B],V=B+1,W=q[V];if(0>s(T,ye))V<R&&0>s(W,T)?(q[Ae]=W,q[V]=ye,Ae=V):(q[Ae]=T,q[B]=ye,Ae=B);else if(V<R&&0>s(W,ye))q[Ae]=W,q[V]=ye,Ae=V;else break e}}return ee}function s(q,ee){var ye=q.sortIndex-ee.sortIndex;return ye!==0?ye:q.id-ee.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,f=c.now();e.unstable_now=function(){return c.now()-f}}var m=[],h=[],v=1,p=null,b=3,w=!1,k=!1,j=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function M(q){for(var ee=n(h);ee!==null;){if(ee.callback===null)a(h);else if(ee.startTime<=q)a(h),ee.sortIndex=ee.expirationTime,t(m,ee);else break;ee=n(h)}}function P(q){if(j=!1,M(q),!k)if(n(m)!==null)k=!0,z||(z=!0,ae());else{var ee=n(h);ee!==null&&X(P,ee.startTime-q)}}var z=!1,$=-1,I=5,Z=-1;function D(){return N?!0:!(e.unstable_now()-Z<I)}function te(){if(N=!1,z){var q=e.unstable_now();Z=q;var ee=!0;try{e:{k=!1,j&&(j=!1,A($),$=-1),w=!0;var ye=b;try{t:{for(M(q),p=n(m);p!==null&&!(p.expirationTime>q&&D());){var Ae=p.callback;if(typeof Ae=="function"){p.callback=null,b=p.priorityLevel;var R=Ae(p.expirationTime<=q);if(q=e.unstable_now(),typeof R=="function"){p.callback=R,M(q),ee=!0;break t}p===n(m)&&a(m),M(q)}else a(m);p=n(m)}if(p!==null)ee=!0;else{var U=n(h);U!==null&&X(P,U.startTime-q),ee=!1}}break e}finally{p=null,b=ye,w=!1}ee=void 0}}finally{ee?ae():z=!1}}}var ae;if(typeof O=="function")ae=function(){O(te)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,G=xe.port2;xe.port1.onmessage=te,ae=function(){G.postMessage(null)}}else ae=function(){C(te,0)};function X(q,ee){$=C(function(){q(e.unstable_now())},ee)}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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(q){switch(b){case 1:case 2:case 3:var ee=3;break;default:ee=b}var ye=b;b=ee;try{return q()}finally{b=ye}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(q,ee){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ye=b;b=q;try{return ee()}finally{b=ye}},e.unstable_scheduleCallback=function(q,ee,ye){var Ae=e.unstable_now();switch(typeof ye=="object"&&ye!==null?(ye=ye.delay,ye=typeof ye=="number"&&0<ye?Ae+ye:Ae):ye=Ae,q){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=ye+R,q={id:v++,callback:ee,priorityLevel:q,startTime:ye,expirationTime:R,sortIndex:-1},ye>Ae?(q.sortIndex=ye,t(h,q),n(m)===null&&q===n(h)&&(j?(A($),$=-1):j=!0,X(P,ye-Ae))):(q.sortIndex=R,t(m,q),k||w||(k=!0,z||(z=!0,ae()))),q},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(q){var ee=b;return function(){var ye=b;b=ee;try{return q.apply(this,arguments)}finally{b=ye}}}})(sp)),sp}var N1;function jT(){return N1||(N1=1,ip.exports=kT()),ip.exports}var lp={exports:{}},Cn={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var E1;function CT(){if(E1)return Cn;E1=1;var e=sv();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,h,v){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:p==null?null:""+p,children:m,containerInfo:h,implementation:v}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Cn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Cn.createPortal=function(m,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(m,h,null,v)},Cn.flushSync=function(m){var h=c.T,v=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=v,a.d.f()}},Cn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(m,h))},Cn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Cn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var v=h.as,p=f(v,h.crossOrigin),b=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:p,integrity:b,fetchPriority:w}):v==="script"&&a.d.X(m,{crossOrigin:p,integrity:b,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Cn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Cn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,p=f(v,h.crossOrigin);a.d.L(m,v,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Cn.preloadModule=function(m,h){if(typeof m=="string")if(h){var v=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Cn.requestFormReset=function(m){a.d.r(m)},Cn.unstable_batchedUpdates=function(m,h){return m(h)},Cn.useFormState=function(m,h,v){return c.H.useFormState(m,h,v)},Cn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Cn.version="19.2.4",Cn}var _1;function gk(){if(_1)return lp.exports;_1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),lp.exports=CT(),lp.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var T1;function NT(){if(T1)return eu;T1=1;var e=jT(),t=sv(),n=gk();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,l=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(l=i.return),r=i.return;while(r)}return i.tag===3?l:null}function c(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(o(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(a(188));return i!==r?null:r}for(var l=r,d=i;;){var g=l.return;if(g===null)break;var y=g.alternate;if(y===null){if(d=g.return,d!==null){l=d;continue}break}if(g.child===y.child){for(y=g.child;y;){if(y===l)return m(g),r;if(y===d)return m(g),i;y=y.sibling}throw Error(a(188))}if(l.return!==d.return)l=g,d=y;else{for(var S=!1,_=g.child;_;){if(_===l){S=!0,l=g,d=y;break}if(_===d){S=!0,d=g,l=y;break}_=_.sibling}if(!S){for(_=y.child;_;){if(_===l){S=!0,l=y,d=g;break}if(_===d){S=!0,d=y,l=g;break}_=_.sibling}if(!S)throw Error(a(189))}}if(l.alternate!==d)throw Error(a(190))}if(l.tag!==3)throw Error(a(188));return l.stateNode.current===l?r:i}function v(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=v(r),i!==null)return i;r=r.sibling}return null}var p=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),O=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function ae(r){return r===null||typeof r!="object"?null:(r=te&&r[te]||r["@@iterator"],typeof r=="function"?r:null)}var xe=Symbol.for("react.client.reference");function G(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===xe?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case C:return"Profiler";case N:return"StrictMode";case P:return"Suspense";case z:return"SuspenseList";case Z:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case k:return"Portal";case O:return r.displayName||"Context";case A:return(r._context.displayName||"Context")+".Consumer";case M:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case $:return i=r.displayName||null,i!==null?i:G(r.type)||"Memo";case I:i=r._payload,r=r._init;try{return G(r(i))}catch{}}return null}var X=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye={pending:!1,data:null,method:null,action:null},Ae=[],R=-1;function U(r){return{current:r}}function B(r){0>R||(r.current=Ae[R],Ae[R]=null,R--)}function T(r,i){R++,Ae[R]=r.current,r.current=i}var V=U(null),W=U(null),ce=U(null),be=U(null);function ge(r,i){switch(T(ce,i),T(W,r),T(V,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?q0(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=q0(i),r=H0(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}B(V),T(V,r)}function fe(){B(V),B(W),B(ce)}function Ge(r){r.memoizedState!==null&&T(be,r);var i=V.current,l=H0(i,r.type);i!==l&&(T(W,r),T(V,l))}function Oe(r){W.current===r&&(B(V),B(W)),be.current===r&&(B(be),Ko._currentValue=ye)}var jt,ie;function ke(r){if(jt===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);jt=i&&i[1]||"",ie=-1<l.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+jt+r+ie}var De=!1;function Ke(r,i){if(!r||De)return"";De=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ne){var J=ne}Reflect.construct(r,[],de)}else{try{de.call()}catch(ne){J=ne}r.call(de.prototype)}}else{try{throw Error()}catch(ne){J=ne}(de=r())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(ne){if(ne&&J&&typeof ne.stack=="string")return[ne.stack,J.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=d.DetermineComponentFrameRoot(),S=y[0],_=y[1];if(S&&_){var F=S.split(`
44
+ `),Y=_.split(`
45
+ `);for(g=d=0;d<F.length&&!F[d].includes("DetermineComponentFrameRoot");)d++;for(;g<Y.length&&!Y[g].includes("DetermineComponentFrameRoot");)g++;if(d===F.length||g===Y.length)for(d=F.length-1,g=Y.length-1;1<=d&&0<=g&&F[d]!==Y[g];)g--;for(;1<=d&&0<=g;d--,g--)if(F[d]!==Y[g]){if(d!==1||g!==1)do if(d--,g--,0>g||F[d]!==Y[g]){var se=`
46
+ `+F[d].replace(" at new "," at ");return r.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",r.displayName)),se}while(1<=d&&0<=g);break}}}finally{De=!1,Error.prepareStackTrace=l}return(l=r?r.displayName||r.name:"")?ke(l):""}function zn(r,i){switch(r.tag){case 26:case 27:case 5:return ke(r.type);case 16:return ke("Lazy");case 13:return r.child!==i&&i!==null?ke("Suspense Fallback"):ke("Suspense");case 19:return ke("SuspenseList");case 0:case 15:return Ke(r.type,!1);case 11:return Ke(r.type.render,!1);case 1:return Ke(r.type,!0);case 31:return ke("Activity");default:return""}}function On(r){try{var i="",l=null;do i+=zn(r,l),l=r,r=r.return;while(r);return i}catch(d){return`
47
+ Error generating stack: `+d.message+`
48
+ `+d.stack}}var Ma=Object.prototype.hasOwnProperty,Ia=e.unstable_scheduleCallback,ra=e.unstable_cancelCallback,io=e.unstable_shouldYield,so=e.unstable_requestPaint,mn=e.unstable_now,lo=e.unstable_getCurrentPriorityLevel,oe=e.unstable_ImmediatePriority,ve=e.unstable_UserBlockingPriority,Pe=e.unstable_NormalPriority,$e=e.unstable_LowPriority,rt=e.unstable_IdlePriority,pn=e.log,pr=e.unstable_setDisableYieldValue,rn=null,Ht=null;function gn(r){if(typeof pn=="function"&&pr(r),Ht&&typeof Ht.setStrictMode=="function")try{Ht.setStrictMode(rn,r)}catch{}}var ht=Math.clz32?Math.clz32:sc,Mr=Math.log,Bn=Math.LN2;function sc(r){return r>>>=0,r===0?32:31-(Mr(r)/Bn|0)|0}var Ii=256,Li=262144,Ui=4194304;function Zr(r){var i=r&42;if(i!==0)return i;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Pi(r,i,l){var d=r.pendingLanes;if(d===0)return 0;var g=0,y=r.suspendedLanes,S=r.pingedLanes;r=r.warmLanes;var _=d&134217727;return _!==0?(d=_&~y,d!==0?g=Zr(d):(S&=_,S!==0?g=Zr(S):l||(l=_&~r,l!==0&&(g=Zr(l))))):(_=d&~y,_!==0?g=Zr(_):S!==0?g=Zr(S):l||(l=d&~r,l!==0&&(g=Zr(l)))),g===0?0:i!==0&&i!==g&&(i&y)===0&&(y=g&-g,l=i&-i,y>=l||y===32&&(l&4194048)!==0)?i:g}function La(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function lc(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 we(){var r=Ui;return Ui<<=1,(Ui&62914560)===0&&(Ui=4194304),r}function Ye(r){for(var i=[],l=0;31>l;l++)i.push(r);return i}function vn(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function aa(r,i,l,d,g,y){var S=r.pendingLanes;r.pendingLanes=l,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=l,r.entangledLanes&=l,r.errorRecoveryDisabledLanes&=l,r.shellSuspendCounter=0;var _=r.entanglements,F=r.expirationTimes,Y=r.hiddenUpdates;for(l=S&~l;0<l;){var se=31-ht(l),de=1<<se;_[se]=0,F[se]=-1;var J=Y[se];if(J!==null)for(Y[se]=null,se=0;se<J.length;se++){var ne=J[se];ne!==null&&(ne.lane&=-536870913)}l&=~de}d!==0&&oo(r,d,0),y!==0&&g===0&&r.tag!==0&&(r.suspendedLanes|=y&~(S&~i))}function oo(r,i,l){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-ht(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|l&261930}function oc(r,i){var l=r.entangledLanes|=i;for(r=r.entanglements;l;){var d=31-ht(l),g=1<<d;g&i|r[d]&i&&(r[d]|=i),l&=~g}}function Ey(r,i){var l=i&-i;return l=(l&42)!==0?1:Hf(l),(l&(r.suspendedLanes|i))!==0?0:l}function Hf(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Zf(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function _y(){var r=ee.p;return r!==0?r:(r=window.event,r===void 0?32:h1(r.type))}function Ty(r,i){var l=ee.p;try{return ee.p=r,i()}finally{ee.p=l}}var Ua=Math.random().toString(36).slice(2),yn="__reactFiber$"+Ua,$n="__reactProps$"+Ua,Ns="__reactContainer$"+Ua,Vf="__reactEvents$"+Ua,l_="__reactListeners$"+Ua,o_="__reactHandles$"+Ua,Ry="__reactResources$"+Ua,uo="__reactMarker$"+Ua;function Qf(r){delete r[yn],delete r[$n],delete r[Vf],delete r[l_],delete r[o_]}function Es(r){var i=r[yn];if(i)return i;for(var l=r.parentNode;l;){if(i=l[Ns]||l[yn]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(r=X0(r);r!==null;){if(l=r[yn])return l;r=X0(r)}return i}r=l,l=r.parentNode}return null}function _s(r){if(r=r[yn]||r[Ns]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function co(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function Ts(r){var i=r[Ry];return i||(i=r[Ry]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function un(r){r[uo]=!0}var Ay=new Set,zy={};function Bi(r,i){Rs(r,i),Rs(r+"Capture",i)}function Rs(r,i){for(zy[r]=i,r=0;r<i.length;r++)Ay.add(i[r])}var u_=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]*$"),Oy={},Dy={};function c_(r){return Ma.call(Dy,r)?!0:Ma.call(Oy,r)?!1:u_.test(r)?Dy[r]=!0:(Oy[r]=!0,!1)}function uc(r,i,l){if(c_(i))if(l===null)r.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+l)}}function cc(r,i,l){if(l===null)r.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+l)}}function ia(r,i,l,d){if(d===null)r.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(l);return}r.setAttributeNS(i,l,""+d)}}function gr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function My(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function d_(r,i,l){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,y=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return g.call(this)},set:function(S){l=""+S,y.call(this,S)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(S){l=""+S},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Gf(r){if(!r._valueTracker){var i=My(r)?"checked":"value";r._valueTracker=d_(r,i,""+r[i])}}function Iy(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var l=i.getValue(),d="";return r&&(d=My(r)?r.checked?"true":"false":r.value),r=d,r!==l?(i.setValue(r),!0):!1}function dc(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var f_=/[\n"\\]/g;function vr(r){return r.replace(f_,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Kf(r,i,l,d,g,y,S,_){r.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?r.type=S:r.removeAttribute("type"),i!=null?S==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+gr(i)):r.value!==""+gr(i)&&(r.value=""+gr(i)):S!=="submit"&&S!=="reset"||r.removeAttribute("value"),i!=null?Yf(r,S,gr(i)):l!=null?Yf(r,S,gr(l)):d!=null&&r.removeAttribute("value"),g==null&&y!=null&&(r.defaultChecked=!!y),g!=null&&(r.checked=g&&typeof g!="function"&&typeof g!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?r.name=""+gr(_):r.removeAttribute("name")}function Ly(r,i,l,d,g,y,S,_){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(r.type=y),i!=null||l!=null){if(!(y!=="submit"&&y!=="reset"||i!=null)){Gf(r);return}l=l!=null?""+gr(l):"",i=i!=null?""+gr(i):l,_||i===r.value||(r.value=i),r.defaultValue=i}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=_?r.checked:!!d,r.defaultChecked=!!d,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(r.name=S),Gf(r)}function Yf(r,i,l){i==="number"&&dc(r.ownerDocument)===r||r.defaultValue===""+l||(r.defaultValue=""+l)}function As(r,i,l,d){if(r=r.options,i){i={};for(var g=0;g<l.length;g++)i["$"+l[g]]=!0;for(l=0;l<r.length;l++)g=i.hasOwnProperty("$"+r[l].value),r[l].selected!==g&&(r[l].selected=g),g&&d&&(r[l].defaultSelected=!0)}else{for(l=""+gr(l),i=null,g=0;g<r.length;g++){if(r[g].value===l){r[g].selected=!0,d&&(r[g].defaultSelected=!0);return}i!==null||r[g].disabled||(i=r[g])}i!==null&&(i.selected=!0)}}function Uy(r,i,l){if(i!=null&&(i=""+gr(i),i!==r.value&&(r.value=i),l==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=l!=null?""+gr(l):""}function Py(r,i,l,d){if(i==null){if(d!=null){if(l!=null)throw Error(a(92));if(X(d)){if(1<d.length)throw Error(a(93));d=d[0]}l=d}l==null&&(l=""),i=l}l=gr(i),r.defaultValue=l,d=r.textContent,d===l&&d!==""&&d!==null&&(r.value=d),Gf(r)}function zs(r,i){if(i){var l=r.firstChild;if(l&&l===r.lastChild&&l.nodeType===3){l.nodeValue=i;return}}r.textContent=i}var h_=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 By(r,i,l){var d=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,l):typeof l!="number"||l===0||h_.has(i)?i==="float"?r.cssFloat=l:r[i]=(""+l).trim():r[i]=l+"px"}function $y(r,i,l){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var g in i)d=i[g],i.hasOwnProperty(g)&&l[g]!==d&&By(r,g,d)}else for(var y in i)i.hasOwnProperty(y)&&By(r,y,i[y])}function Xf(r){if(r.indexOf("-")===-1)return!1;switch(r){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 m_=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"]]),p_=/^[\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 fc(r){return p_.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function sa(){}var Jf=null;function Wf(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Os=null,Ds=null;function Fy(r){var i=_s(r);if(i&&(r=i.stateNode)){var l=r[$n]||null;e:switch(r=i.stateNode,i.type){case"input":if(Kf(r,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=r;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+vr(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var d=l[i];if(d!==r&&d.form===r.form){var g=d[$n]||null;if(!g)throw Error(a(90));Kf(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(i=0;i<l.length;i++)d=l[i],d.form===r.form&&Iy(d)}break e;case"textarea":Uy(r,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&As(r,!!l.multiple,i,!1)}}}var eh=!1;function qy(r,i,l){if(eh)return r(i,l);eh=!0;try{var d=r(i);return d}finally{if(eh=!1,(Os!==null||Ds!==null)&&(Wc(),Os&&(i=Os,r=Ds,Ds=Os=null,Fy(i),r)))for(i=0;i<r.length;i++)Fy(r[i])}}function fo(r,i){var l=r.stateNode;if(l===null)return null;var d=l[$n]||null;if(d===null)return null;l=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(l&&typeof l!="function")throw Error(a(231,i,typeof l));return l}var la=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),th=!1;if(la)try{var ho={};Object.defineProperty(ho,"passive",{get:function(){th=!0}}),window.addEventListener("test",ho,ho),window.removeEventListener("test",ho,ho)}catch{th=!1}var Pa=null,nh=null,hc=null;function Hy(){if(hc)return hc;var r,i=nh,l=i.length,d,g="value"in Pa?Pa.value:Pa.textContent,y=g.length;for(r=0;r<l&&i[r]===g[r];r++);var S=l-r;for(d=1;d<=S&&i[l-d]===g[y-d];d++);return hc=g.slice(r,1<d?1-d:void 0)}function mc(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function pc(){return!0}function Zy(){return!1}function Fn(r){function i(l,d,g,y,S){this._reactName=l,this._targetInst=g,this.type=d,this.nativeEvent=y,this.target=S,this.currentTarget=null;for(var _ in r)r.hasOwnProperty(_)&&(l=r[_],this[_]=l?l(y):y[_]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?pc:Zy,this.isPropagationStopped=Zy,this}return p(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=pc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=pc)},persist:function(){},isPersistent:pc}),i}var $i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gc=Fn($i),mo=p({},$i,{view:0,detail:0}),g_=Fn(mo),rh,ah,po,vc=p({},mo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sh,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==po&&(po&&r.type==="mousemove"?(rh=r.screenX-po.screenX,ah=r.screenY-po.screenY):ah=rh=0,po=r),rh)},movementY:function(r){return"movementY"in r?r.movementY:ah}}),Vy=Fn(vc),v_=p({},vc,{dataTransfer:0}),y_=Fn(v_),b_=p({},mo,{relatedTarget:0}),ih=Fn(b_),x_=p({},$i,{animationName:0,elapsedTime:0,pseudoElement:0}),w_=Fn(x_),S_=p({},$i,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),k_=Fn(S_),j_=p({},$i,{data:0}),Qy=Fn(j_),C_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},N_={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"},E_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function __(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=E_[r])?!!i[r]:!1}function sh(){return __}var T_=p({},mo,{key:function(r){if(r.key){var i=C_[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=mc(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?N_[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sh,charCode:function(r){return r.type==="keypress"?mc(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?mc(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),R_=Fn(T_),A_=p({},vc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gy=Fn(A_),z_=p({},mo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sh}),O_=Fn(z_),D_=p({},$i,{propertyName:0,elapsedTime:0,pseudoElement:0}),M_=Fn(D_),I_=p({},vc,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),L_=Fn(I_),U_=p({},$i,{newState:0,oldState:0}),P_=Fn(U_),B_=[9,13,27,32],lh=la&&"CompositionEvent"in window,go=null;la&&"documentMode"in document&&(go=document.documentMode);var $_=la&&"TextEvent"in window&&!go,Ky=la&&(!lh||go&&8<go&&11>=go),Yy=" ",Xy=!1;function Jy(r,i){switch(r){case"keyup":return B_.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wy(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ms=!1;function F_(r,i){switch(r){case"compositionend":return Wy(i);case"keypress":return i.which!==32?null:(Xy=!0,Yy);case"textInput":return r=i.data,r===Yy&&Xy?null:r;default:return null}}function q_(r,i){if(Ms)return r==="compositionend"||!lh&&Jy(r,i)?(r=Hy(),hc=nh=Pa=null,Ms=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Ky&&i.locale!=="ko"?null:i.data;default:return null}}var H_={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 eb(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!H_[r.type]:i==="textarea"}function tb(r,i,l,d){Os?Ds?Ds.push(d):Ds=[d]:Os=d,i=sd(i,"onChange"),0<i.length&&(l=new gc("onChange","change",null,l,d),r.push({event:l,listeners:i}))}var vo=null,yo=null;function Z_(r){L0(r,0)}function yc(r){var i=co(r);if(Iy(i))return r}function nb(r,i){if(r==="change")return i}var rb=!1;if(la){var oh;if(la){var uh="oninput"in document;if(!uh){var ab=document.createElement("div");ab.setAttribute("oninput","return;"),uh=typeof ab.oninput=="function"}oh=uh}else oh=!1;rb=oh&&(!document.documentMode||9<document.documentMode)}function ib(){vo&&(vo.detachEvent("onpropertychange",sb),yo=vo=null)}function sb(r){if(r.propertyName==="value"&&yc(yo)){var i=[];tb(i,yo,r,Wf(r)),qy(Z_,i)}}function V_(r,i,l){r==="focusin"?(ib(),vo=i,yo=l,vo.attachEvent("onpropertychange",sb)):r==="focusout"&&ib()}function Q_(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return yc(yo)}function G_(r,i){if(r==="click")return yc(i)}function K_(r,i){if(r==="input"||r==="change")return yc(i)}function Y_(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var nr=typeof Object.is=="function"?Object.is:Y_;function bo(r,i){if(nr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var l=Object.keys(r),d=Object.keys(i);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var g=l[d];if(!Ma.call(i,g)||!nr(r[g],i[g]))return!1}return!0}function lb(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function ob(r,i){var l=lb(r);r=0;for(var d;l;){if(l.nodeType===3){if(d=r+l.textContent.length,r<=i&&d>=i)return{node:l,offset:i-r};r=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=lb(l)}}function ub(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?ub(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function cb(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=dc(r.document);i instanceof r.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)r=i.contentWindow;else break;i=dc(r.document)}return i}function ch(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var X_=la&&"documentMode"in document&&11>=document.documentMode,Is=null,dh=null,xo=null,fh=!1;function db(r,i,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;fh||Is==null||Is!==dc(d)||(d=Is,"selectionStart"in d&&ch(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),xo&&bo(xo,d)||(xo=d,d=sd(dh,"onSelect"),0<d.length&&(i=new gc("onSelect","select",null,i,l),r.push({event:i,listeners:d}),i.target=Is)))}function Fi(r,i){var l={};return l[r.toLowerCase()]=i.toLowerCase(),l["Webkit"+r]="webkit"+i,l["Moz"+r]="moz"+i,l}var Ls={animationend:Fi("Animation","AnimationEnd"),animationiteration:Fi("Animation","AnimationIteration"),animationstart:Fi("Animation","AnimationStart"),transitionrun:Fi("Transition","TransitionRun"),transitionstart:Fi("Transition","TransitionStart"),transitioncancel:Fi("Transition","TransitionCancel"),transitionend:Fi("Transition","TransitionEnd")},hh={},fb={};la&&(fb=document.createElement("div").style,"AnimationEvent"in window||(delete Ls.animationend.animation,delete Ls.animationiteration.animation,delete Ls.animationstart.animation),"TransitionEvent"in window||delete Ls.transitionend.transition);function qi(r){if(hh[r])return hh[r];if(!Ls[r])return r;var i=Ls[r],l;for(l in i)if(i.hasOwnProperty(l)&&l in fb)return hh[r]=i[l];return r}var hb=qi("animationend"),mb=qi("animationiteration"),pb=qi("animationstart"),J_=qi("transitionrun"),W_=qi("transitionstart"),e2=qi("transitioncancel"),gb=qi("transitionend"),vb=new Map,mh="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(" ");mh.push("scrollEnd");function Ir(r,i){vb.set(r,i),Bi(i,[r])}var bc=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},yr=[],Us=0,ph=0;function xc(){for(var r=Us,i=ph=Us=0;i<r;){var l=yr[i];yr[i++]=null;var d=yr[i];yr[i++]=null;var g=yr[i];yr[i++]=null;var y=yr[i];if(yr[i++]=null,d!==null&&g!==null){var S=d.pending;S===null?g.next=g:(g.next=S.next,S.next=g),d.pending=g}y!==0&&yb(l,g,y)}}function wc(r,i,l,d){yr[Us++]=r,yr[Us++]=i,yr[Us++]=l,yr[Us++]=d,ph|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function gh(r,i,l,d){return wc(r,i,l,d),Sc(r)}function Hi(r,i){return wc(r,null,null,i),Sc(r)}function yb(r,i,l){r.lanes|=l;var d=r.alternate;d!==null&&(d.lanes|=l);for(var g=!1,y=r.return;y!==null;)y.childLanes|=l,d=y.alternate,d!==null&&(d.childLanes|=l),y.tag===22&&(r=y.stateNode,r===null||r._visibility&1||(g=!0)),r=y,y=y.return;return r.tag===3?(y=r.stateNode,g&&i!==null&&(g=31-ht(l),r=y.hiddenUpdates,d=r[g],d===null?r[g]=[i]:d.push(i),i.lane=l|536870912),y):null}function Sc(r){if(50<Fo)throw Fo=0,Cm=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var Ps={};function t2(r,i,l,d){this.tag=r,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rr(r,i,l,d){return new t2(r,i,l,d)}function vh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function oa(r,i){var l=r.alternate;return l===null?(l=rr(r.tag,i,r.key,r.mode),l.elementType=r.elementType,l.type=r.type,l.stateNode=r.stateNode,l.alternate=r,r.alternate=l):(l.pendingProps=i,l.type=r.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=r.flags&65011712,l.childLanes=r.childLanes,l.lanes=r.lanes,l.child=r.child,l.memoizedProps=r.memoizedProps,l.memoizedState=r.memoizedState,l.updateQueue=r.updateQueue,i=r.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=r.sibling,l.index=r.index,l.ref=r.ref,l.refCleanup=r.refCleanup,l}function bb(r,i){r.flags&=65011714;var l=r.alternate;return l===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=l.childLanes,r.lanes=l.lanes,r.child=l.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=l.memoizedProps,r.memoizedState=l.memoizedState,r.updateQueue=l.updateQueue,r.type=l.type,i=l.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function kc(r,i,l,d,g,y){var S=0;if(d=r,typeof r=="function")vh(r)&&(S=1);else if(typeof r=="string")S=sT(r,l,V.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case Z:return r=rr(31,l,i,g),r.elementType=Z,r.lanes=y,r;case j:return Zi(l.children,g,y,i);case N:S=8,g|=24;break;case C:return r=rr(12,l,i,g|2),r.elementType=C,r.lanes=y,r;case P:return r=rr(13,l,i,g),r.elementType=P,r.lanes=y,r;case z:return r=rr(19,l,i,g),r.elementType=z,r.lanes=y,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case O:S=10;break e;case A:S=9;break e;case M:S=11;break e;case $:S=14;break e;case I:S=16,d=null;break e}S=29,l=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=rr(S,l,i,g),i.elementType=r,i.type=d,i.lanes=y,i}function Zi(r,i,l,d){return r=rr(7,r,d,i),r.lanes=l,r}function yh(r,i,l){return r=rr(6,r,null,i),r.lanes=l,r}function xb(r){var i=rr(18,null,null,0);return i.stateNode=r,i}function bh(r,i,l){return i=rr(4,r.children!==null?r.children:[],r.key,i),i.lanes=l,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var wb=new WeakMap;function br(r,i){if(typeof r=="object"&&r!==null){var l=wb.get(r);return l!==void 0?l:(i={value:r,source:i,stack:On(i)},wb.set(r,i),i)}return{value:r,source:i,stack:On(i)}}var Bs=[],$s=0,jc=null,wo=0,xr=[],wr=0,Ba=null,Vr=1,Qr="";function ua(r,i){Bs[$s++]=wo,Bs[$s++]=jc,jc=r,wo=i}function Sb(r,i,l){xr[wr++]=Vr,xr[wr++]=Qr,xr[wr++]=Ba,Ba=r;var d=Vr;r=Qr;var g=32-ht(d)-1;d&=~(1<<g),l+=1;var y=32-ht(i)+g;if(30<y){var S=g-g%5;y=(d&(1<<S)-1).toString(32),d>>=S,g-=S,Vr=1<<32-ht(i)+g|l<<g|d,Qr=y+r}else Vr=1<<y|l<<g|d,Qr=r}function xh(r){r.return!==null&&(ua(r,1),Sb(r,1,0))}function wh(r){for(;r===jc;)jc=Bs[--$s],Bs[$s]=null,wo=Bs[--$s],Bs[$s]=null;for(;r===Ba;)Ba=xr[--wr],xr[wr]=null,Qr=xr[--wr],xr[wr]=null,Vr=xr[--wr],xr[wr]=null}function kb(r,i){xr[wr++]=Vr,xr[wr++]=Qr,xr[wr++]=Ba,Vr=i.id,Qr=i.overflow,Ba=r}var bn=null,Tt=null,at=!1,$a=null,Sr=!1,Sh=Error(a(519));function Fa(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw So(br(i,r)),Sh}function jb(r){var i=r.stateNode,l=r.type,d=r.memoizedProps;switch(i[yn]=r,i[$n]=d,l){case"dialog":Je("cancel",i),Je("close",i);break;case"iframe":case"object":case"embed":Je("load",i);break;case"video":case"audio":for(l=0;l<Ho.length;l++)Je(Ho[l],i);break;case"source":Je("error",i);break;case"img":case"image":case"link":Je("error",i),Je("load",i);break;case"details":Je("toggle",i);break;case"input":Je("invalid",i),Ly(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Je("invalid",i);break;case"textarea":Je("invalid",i),Py(i,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||d.suppressHydrationWarning===!0||$0(i.textContent,l)?(d.popover!=null&&(Je("beforetoggle",i),Je("toggle",i)),d.onScroll!=null&&Je("scroll",i),d.onScrollEnd!=null&&Je("scrollend",i),d.onClick!=null&&(i.onclick=sa),i=!0):i=!1,i||Fa(r,!0)}function Cb(r){for(bn=r.return;bn;)switch(bn.tag){case 5:case 31:case 13:Sr=!1;return;case 27:case 3:Sr=!0;return;default:bn=bn.return}}function Fs(r){if(r!==bn)return!1;if(!at)return Cb(r),at=!0,!1;var i=r.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=r.type,l=!(l!=="form"&&l!=="button")||Bm(r.type,r.memoizedProps)),l=!l),l&&Tt&&Fa(r),Cb(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Tt=Y0(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Tt=Y0(r)}else i===27?(i=Tt,ni(r.type)?(r=Zm,Zm=null,Tt=r):Tt=i):Tt=bn?jr(r.stateNode.nextSibling):null;return!0}function Vi(){Tt=bn=null,at=!1}function kh(){var r=$a;return r!==null&&(Vn===null?Vn=r:Vn.push.apply(Vn,r),$a=null),r}function So(r){$a===null?$a=[r]:$a.push(r)}var jh=U(null),Qi=null,ca=null;function qa(r,i,l){T(jh,i._currentValue),i._currentValue=l}function da(r){r._currentValue=jh.current,B(jh)}function Ch(r,i,l){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===l)break;r=r.return}}function Nh(r,i,l,d){var g=r.child;for(g!==null&&(g.return=r);g!==null;){var y=g.dependencies;if(y!==null){var S=g.child;y=y.firstContext;e:for(;y!==null;){var _=y;y=g;for(var F=0;F<i.length;F++)if(_.context===i[F]){y.lanes|=l,_=y.alternate,_!==null&&(_.lanes|=l),Ch(y.return,l,r),d||(S=null);break e}y=_.next}}else if(g.tag===18){if(S=g.return,S===null)throw Error(a(341));S.lanes|=l,y=S.alternate,y!==null&&(y.lanes|=l),Ch(S,l,r),S=null}else S=g.child;if(S!==null)S.return=g;else for(S=g;S!==null;){if(S===r){S=null;break}if(g=S.sibling,g!==null){g.return=S.return,S=g;break}S=S.return}g=S}}function qs(r,i,l,d){r=null;for(var g=i,y=!1;g!==null;){if(!y){if((g.flags&524288)!==0)y=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var S=g.alternate;if(S===null)throw Error(a(387));if(S=S.memoizedProps,S!==null){var _=g.type;nr(g.pendingProps.value,S.value)||(r!==null?r.push(_):r=[_])}}else if(g===be.current){if(S=g.alternate,S===null)throw Error(a(387));S.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(r!==null?r.push(Ko):r=[Ko])}g=g.return}r!==null&&Nh(i,r,l,d),i.flags|=262144}function Cc(r){for(r=r.firstContext;r!==null;){if(!nr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Gi(r){Qi=r,ca=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function xn(r){return Nb(Qi,r)}function Nc(r,i){return Qi===null&&Gi(r),Nb(r,i)}function Nb(r,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},ca===null){if(r===null)throw Error(a(308));ca=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else ca=ca.next=i;return l}var n2=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(l,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(l){return l()})}},r2=e.unstable_scheduleCallback,a2=e.unstable_NormalPriority,Qt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Eh(){return{controller:new n2,data:new Map,refCount:0}}function ko(r){r.refCount--,r.refCount===0&&r2(a2,function(){r.controller.abort()})}var jo=null,_h=0,Hs=0,Zs=null;function i2(r,i){if(jo===null){var l=jo=[];_h=0,Hs=Am(),Zs={status:"pending",value:void 0,then:function(d){l.push(d)}}}return _h++,i.then(Eb,Eb),i}function Eb(){if(--_h===0&&jo!==null){Zs!==null&&(Zs.status="fulfilled");var r=jo;jo=null,Hs=0,Zs=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function s2(r,i){var l=[],d={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var g=0;g<l.length;g++)(0,l[g])(i)},function(g){for(d.status="rejected",d.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),d}var _b=q.S;q.S=function(r,i){d0=mn(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&i2(r,i),_b!==null&&_b(r,i)};var Ki=U(null);function Th(){var r=Ki.current;return r!==null?r:Ct.pooledCache}function Ec(r,i){i===null?T(Ki,Ki.current):T(Ki,i.pool)}function Tb(){var r=Th();return r===null?null:{parent:Qt._currentValue,pool:r}}var Vs=Error(a(460)),Rh=Error(a(474)),_c=Error(a(542)),Tc={then:function(){}};function Rb(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Ab(r,i,l){switch(l=r[l],l===void 0?r.push(i):l!==i&&(i.then(sa,sa),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Ob(r),r;default:if(typeof i.status=="string")i.then(sa,sa);else{if(r=Ct,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var g=i;g.status="fulfilled",g.value=d}},function(d){if(i.status==="pending"){var g=i;g.status="rejected",g.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Ob(r),r}throw Xi=i,Vs}}function Yi(r){try{var i=r._init;return i(r._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Xi=l,Vs):l}}var Xi=null;function zb(){if(Xi===null)throw Error(a(459));var r=Xi;return Xi=null,r}function Ob(r){if(r===Vs||r===_c)throw Error(a(483))}var Qs=null,Co=0;function Rc(r){var i=Co;return Co+=1,Qs===null&&(Qs=[]),Ab(Qs,r,i)}function No(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function Ac(r,i){throw i.$$typeof===b?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function Db(r){function i(Q,H){if(r){var K=Q.deletions;K===null?(Q.deletions=[H],Q.flags|=16):K.push(H)}}function l(Q,H){if(!r)return null;for(;H!==null;)i(Q,H),H=H.sibling;return null}function d(Q){for(var H=new Map;Q!==null;)Q.key!==null?H.set(Q.key,Q):H.set(Q.index,Q),Q=Q.sibling;return H}function g(Q,H){return Q=oa(Q,H),Q.index=0,Q.sibling=null,Q}function y(Q,H,K){return Q.index=K,r?(K=Q.alternate,K!==null?(K=K.index,K<H?(Q.flags|=67108866,H):K):(Q.flags|=67108866,H)):(Q.flags|=1048576,H)}function S(Q){return r&&Q.alternate===null&&(Q.flags|=67108866),Q}function _(Q,H,K,ue){return H===null||H.tag!==6?(H=yh(K,Q.mode,ue),H.return=Q,H):(H=g(H,K),H.return=Q,H)}function F(Q,H,K,ue){var ze=K.type;return ze===j?se(Q,H,K.props.children,ue,K.key):H!==null&&(H.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===I&&Yi(ze)===H.type)?(H=g(H,K.props),No(H,K),H.return=Q,H):(H=kc(K.type,K.key,K.props,null,Q.mode,ue),No(H,K),H.return=Q,H)}function Y(Q,H,K,ue){return H===null||H.tag!==4||H.stateNode.containerInfo!==K.containerInfo||H.stateNode.implementation!==K.implementation?(H=bh(K,Q.mode,ue),H.return=Q,H):(H=g(H,K.children||[]),H.return=Q,H)}function se(Q,H,K,ue,ze){return H===null||H.tag!==7?(H=Zi(K,Q.mode,ue,ze),H.return=Q,H):(H=g(H,K),H.return=Q,H)}function de(Q,H,K){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=yh(""+H,Q.mode,K),H.return=Q,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case w:return K=kc(H.type,H.key,H.props,null,Q.mode,K),No(K,H),K.return=Q,K;case k:return H=bh(H,Q.mode,K),H.return=Q,H;case I:return H=Yi(H),de(Q,H,K)}if(X(H)||ae(H))return H=Zi(H,Q.mode,K,null),H.return=Q,H;if(typeof H.then=="function")return de(Q,Rc(H),K);if(H.$$typeof===O)return de(Q,Nc(Q,H),K);Ac(Q,H)}return null}function J(Q,H,K,ue){var ze=H!==null?H.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return ze!==null?null:_(Q,H,""+K,ue);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case w:return K.key===ze?F(Q,H,K,ue):null;case k:return K.key===ze?Y(Q,H,K,ue):null;case I:return K=Yi(K),J(Q,H,K,ue)}if(X(K)||ae(K))return ze!==null?null:se(Q,H,K,ue,null);if(typeof K.then=="function")return J(Q,H,Rc(K),ue);if(K.$$typeof===O)return J(Q,H,Nc(Q,K),ue);Ac(Q,K)}return null}function ne(Q,H,K,ue,ze){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return Q=Q.get(K)||null,_(H,Q,""+ue,ze);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case w:return Q=Q.get(ue.key===null?K:ue.key)||null,F(H,Q,ue,ze);case k:return Q=Q.get(ue.key===null?K:ue.key)||null,Y(H,Q,ue,ze);case I:return ue=Yi(ue),ne(Q,H,K,ue,ze)}if(X(ue)||ae(ue))return Q=Q.get(K)||null,se(H,Q,ue,ze,null);if(typeof ue.then=="function")return ne(Q,H,K,Rc(ue),ze);if(ue.$$typeof===O)return ne(Q,H,K,Nc(H,ue),ze);Ac(H,ue)}return null}function Ce(Q,H,K,ue){for(var ze=null,ut=null,_e=H,Ze=H=0,nt=null;_e!==null&&Ze<K.length;Ze++){_e.index>Ze?(nt=_e,_e=null):nt=_e.sibling;var ct=J(Q,_e,K[Ze],ue);if(ct===null){_e===null&&(_e=nt);break}r&&_e&&ct.alternate===null&&i(Q,_e),H=y(ct,H,Ze),ut===null?ze=ct:ut.sibling=ct,ut=ct,_e=nt}if(Ze===K.length)return l(Q,_e),at&&ua(Q,Ze),ze;if(_e===null){for(;Ze<K.length;Ze++)_e=de(Q,K[Ze],ue),_e!==null&&(H=y(_e,H,Ze),ut===null?ze=_e:ut.sibling=_e,ut=_e);return at&&ua(Q,Ze),ze}for(_e=d(_e);Ze<K.length;Ze++)nt=ne(_e,Q,Ze,K[Ze],ue),nt!==null&&(r&&nt.alternate!==null&&_e.delete(nt.key===null?Ze:nt.key),H=y(nt,H,Ze),ut===null?ze=nt:ut.sibling=nt,ut=nt);return r&&_e.forEach(function(li){return i(Q,li)}),at&&ua(Q,Ze),ze}function Le(Q,H,K,ue){if(K==null)throw Error(a(151));for(var ze=null,ut=null,_e=H,Ze=H=0,nt=null,ct=K.next();_e!==null&&!ct.done;Ze++,ct=K.next()){_e.index>Ze?(nt=_e,_e=null):nt=_e.sibling;var li=J(Q,_e,ct.value,ue);if(li===null){_e===null&&(_e=nt);break}r&&_e&&li.alternate===null&&i(Q,_e),H=y(li,H,Ze),ut===null?ze=li:ut.sibling=li,ut=li,_e=nt}if(ct.done)return l(Q,_e),at&&ua(Q,Ze),ze;if(_e===null){for(;!ct.done;Ze++,ct=K.next())ct=de(Q,ct.value,ue),ct!==null&&(H=y(ct,H,Ze),ut===null?ze=ct:ut.sibling=ct,ut=ct);return at&&ua(Q,Ze),ze}for(_e=d(_e);!ct.done;Ze++,ct=K.next())ct=ne(_e,Q,Ze,ct.value,ue),ct!==null&&(r&&ct.alternate!==null&&_e.delete(ct.key===null?Ze:ct.key),H=y(ct,H,Ze),ut===null?ze=ct:ut.sibling=ct,ut=ct);return r&&_e.forEach(function(vT){return i(Q,vT)}),at&&ua(Q,Ze),ze}function wt(Q,H,K,ue){if(typeof K=="object"&&K!==null&&K.type===j&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case w:e:{for(var ze=K.key;H!==null;){if(H.key===ze){if(ze=K.type,ze===j){if(H.tag===7){l(Q,H.sibling),ue=g(H,K.props.children),ue.return=Q,Q=ue;break e}}else if(H.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===I&&Yi(ze)===H.type){l(Q,H.sibling),ue=g(H,K.props),No(ue,K),ue.return=Q,Q=ue;break e}l(Q,H);break}else i(Q,H);H=H.sibling}K.type===j?(ue=Zi(K.props.children,Q.mode,ue,K.key),ue.return=Q,Q=ue):(ue=kc(K.type,K.key,K.props,null,Q.mode,ue),No(ue,K),ue.return=Q,Q=ue)}return S(Q);case k:e:{for(ze=K.key;H!==null;){if(H.key===ze)if(H.tag===4&&H.stateNode.containerInfo===K.containerInfo&&H.stateNode.implementation===K.implementation){l(Q,H.sibling),ue=g(H,K.children||[]),ue.return=Q,Q=ue;break e}else{l(Q,H);break}else i(Q,H);H=H.sibling}ue=bh(K,Q.mode,ue),ue.return=Q,Q=ue}return S(Q);case I:return K=Yi(K),wt(Q,H,K,ue)}if(X(K))return Ce(Q,H,K,ue);if(ae(K)){if(ze=ae(K),typeof ze!="function")throw Error(a(150));return K=ze.call(K),Le(Q,H,K,ue)}if(typeof K.then=="function")return wt(Q,H,Rc(K),ue);if(K.$$typeof===O)return wt(Q,H,Nc(Q,K),ue);Ac(Q,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,H!==null&&H.tag===6?(l(Q,H.sibling),ue=g(H,K),ue.return=Q,Q=ue):(l(Q,H),ue=yh(K,Q.mode,ue),ue.return=Q,Q=ue),S(Q)):l(Q,H)}return function(Q,H,K,ue){try{Co=0;var ze=wt(Q,H,K,ue);return Qs=null,ze}catch(_e){if(_e===Vs||_e===_c)throw _e;var ut=rr(29,_e,null,Q.mode);return ut.lanes=ue,ut.return=Q,ut}finally{}}}var Ji=Db(!0),Mb=Db(!1),Ha=!1;function Ah(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zh(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Za(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Va(r,i,l){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(ft&2)!==0){var g=d.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),d.pending=i,i=Sc(r),yb(r,null,l),i}return wc(r,d,i,l),Sc(r)}function Eo(r,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,l|=d,i.lanes=l,oc(r,l)}}function Oh(r,i){var l=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var g=null,y=null;if(l=l.firstBaseUpdate,l!==null){do{var S={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};y===null?g=y=S:y=y.next=S,l=l.next}while(l!==null);y===null?g=y=i:y=y.next=i}else g=y=i;l={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},r.updateQueue=l;return}r=l.lastBaseUpdate,r===null?l.firstBaseUpdate=i:r.next=i,l.lastBaseUpdate=i}var Dh=!1;function _o(){if(Dh){var r=Zs;if(r!==null)throw r}}function To(r,i,l,d){Dh=!1;var g=r.updateQueue;Ha=!1;var y=g.firstBaseUpdate,S=g.lastBaseUpdate,_=g.shared.pending;if(_!==null){g.shared.pending=null;var F=_,Y=F.next;F.next=null,S===null?y=Y:S.next=Y,S=F;var se=r.alternate;se!==null&&(se=se.updateQueue,_=se.lastBaseUpdate,_!==S&&(_===null?se.firstBaseUpdate=Y:_.next=Y,se.lastBaseUpdate=F))}if(y!==null){var de=g.baseState;S=0,se=Y=F=null,_=y;do{var J=_.lane&-536870913,ne=J!==_.lane;if(ne?(tt&J)===J:(d&J)===J){J!==0&&J===Hs&&(Dh=!0),se!==null&&(se=se.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Ce=r,Le=_;J=i;var wt=l;switch(Le.tag){case 1:if(Ce=Le.payload,typeof Ce=="function"){de=Ce.call(wt,de,J);break e}de=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Le.payload,J=typeof Ce=="function"?Ce.call(wt,de,J):Ce,J==null)break e;de=p({},de,J);break e;case 2:Ha=!0}}J=_.callback,J!==null&&(r.flags|=64,ne&&(r.flags|=8192),ne=g.callbacks,ne===null?g.callbacks=[J]:ne.push(J))}else ne={lane:J,tag:_.tag,payload:_.payload,callback:_.callback,next:null},se===null?(Y=se=ne,F=de):se=se.next=ne,S|=J;if(_=_.next,_===null){if(_=g.shared.pending,_===null)break;ne=_,_=ne.next,ne.next=null,g.lastBaseUpdate=ne,g.shared.pending=null}}while(!0);se===null&&(F=de),g.baseState=F,g.firstBaseUpdate=Y,g.lastBaseUpdate=se,y===null&&(g.shared.lanes=0),Xa|=S,r.lanes=S,r.memoizedState=de}}function Ib(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Lb(r,i){var l=r.callbacks;if(l!==null)for(r.callbacks=null,r=0;r<l.length;r++)Ib(l[r],i)}var Gs=U(null),zc=U(0);function Ub(r,i){r=xa,T(zc,r),T(Gs,i),xa=r|i.baseLanes}function Mh(){T(zc,xa),T(Gs,Gs.current)}function Ih(){xa=zc.current,B(Gs),B(zc)}var ar=U(null),kr=null;function Qa(r){var i=r.alternate;T(Zt,Zt.current&1),T(ar,r),kr===null&&(i===null||Gs.current!==null||i.memoizedState!==null)&&(kr=r)}function Lh(r){T(Zt,Zt.current),T(ar,r),kr===null&&(kr=r)}function Pb(r){r.tag===22?(T(Zt,Zt.current),T(ar,r),kr===null&&(kr=r)):Ga()}function Ga(){T(Zt,Zt.current),T(ar,ar.current)}function ir(r){B(ar),kr===r&&(kr=null),B(Zt)}var Zt=U(0);function Oc(r){for(var i=r;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||qm(l)||Hm(l)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var fa=0,qe=null,bt=null,Gt=null,Dc=!1,Ks=!1,Wi=!1,Mc=0,Ro=0,Ys=null,l2=0;function Pt(){throw Error(a(321))}function Uh(r,i){if(i===null)return!1;for(var l=0;l<i.length&&l<r.length;l++)if(!nr(r[l],i[l]))return!1;return!0}function Ph(r,i,l,d,g,y){return fa=y,qe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,q.H=r===null||r.memoizedState===null?Sx:em,Wi=!1,y=l(d,g),Wi=!1,Ks&&(y=$b(i,l,d,g)),Bb(r),y}function Bb(r){q.H=Oo;var i=bt!==null&&bt.next!==null;if(fa=0,Gt=bt=qe=null,Dc=!1,Ro=0,Ys=null,i)throw Error(a(300));r===null||Kt||(r=r.dependencies,r!==null&&Cc(r)&&(Kt=!0))}function $b(r,i,l,d){qe=r;var g=0;do{if(Ks&&(Ys=null),Ro=0,Ks=!1,25<=g)throw Error(a(301));if(g+=1,Gt=bt=null,r.updateQueue!=null){var y=r.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}q.H=kx,y=i(l,d)}while(Ks);return y}function o2(){var r=q.H,i=r.useState()[0];return i=typeof i.then=="function"?Ao(i):i,r=r.useState()[0],(bt!==null?bt.memoizedState:null)!==r&&(qe.flags|=1024),i}function Bh(){var r=Mc!==0;return Mc=0,r}function $h(r,i,l){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~l}function Fh(r){if(Dc){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Dc=!1}fa=0,Gt=bt=qe=null,Ks=!1,Ro=Mc=0,Ys=null}function Dn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?qe.memoizedState=Gt=r:Gt=Gt.next=r,Gt}function Vt(){if(bt===null){var r=qe.alternate;r=r!==null?r.memoizedState:null}else r=bt.next;var i=Gt===null?qe.memoizedState:Gt.next;if(i!==null)Gt=i,bt=r;else{if(r===null)throw qe.alternate===null?Error(a(467)):Error(a(310));bt=r,r={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Gt===null?qe.memoizedState=Gt=r:Gt=Gt.next=r}return Gt}function Ic(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ao(r){var i=Ro;return Ro+=1,Ys===null&&(Ys=[]),r=Ab(Ys,r,i),i=qe,(Gt===null?i.memoizedState:Gt.next)===null&&(i=i.alternate,q.H=i===null||i.memoizedState===null?Sx:em),r}function Lc(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Ao(r);if(r.$$typeof===O)return xn(r)}throw Error(a(438,String(r)))}function qh(r){var i=null,l=qe.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var d=qe.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(g){return g.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=Ic(),qe.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(r),d=0;d<r;d++)l[d]=D;return i.index++,l}function ha(r,i){return typeof i=="function"?i(r):i}function Uc(r){var i=Vt();return Hh(i,bt,r)}function Hh(r,i,l){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=l;var g=r.baseQueue,y=d.pending;if(y!==null){if(g!==null){var S=g.next;g.next=y.next,y.next=S}i.baseQueue=g=y,d.pending=null}if(y=r.baseState,g===null)r.memoizedState=y;else{i=g.next;var _=S=null,F=null,Y=i,se=!1;do{var de=Y.lane&-536870913;if(de!==Y.lane?(tt&de)===de:(fa&de)===de){var J=Y.revertLane;if(J===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),de===Hs&&(se=!0);else if((fa&J)===J){Y=Y.next,J===Hs&&(se=!0);continue}else de={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},F===null?(_=F=de,S=y):F=F.next=de,qe.lanes|=J,Xa|=J;de=Y.action,Wi&&l(y,de),y=Y.hasEagerState?Y.eagerState:l(y,de)}else J={lane:de,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},F===null?(_=F=J,S=y):F=F.next=J,qe.lanes|=de,Xa|=de;Y=Y.next}while(Y!==null&&Y!==i);if(F===null?S=y:F.next=_,!nr(y,r.memoizedState)&&(Kt=!0,se&&(l=Zs,l!==null)))throw l;r.memoizedState=y,r.baseState=S,r.baseQueue=F,d.lastRenderedState=y}return g===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Zh(r){var i=Vt(),l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=r;var d=l.dispatch,g=l.pending,y=i.memoizedState;if(g!==null){l.pending=null;var S=g=g.next;do y=r(y,S.action),S=S.next;while(S!==g);nr(y,i.memoizedState)||(Kt=!0),i.memoizedState=y,i.baseQueue===null&&(i.baseState=y),l.lastRenderedState=y}return[y,d]}function Fb(r,i,l){var d=qe,g=Vt(),y=at;if(y){if(l===void 0)throw Error(a(407));l=l()}else l=i();var S=!nr((bt||g).memoizedState,l);if(S&&(g.memoizedState=l,Kt=!0),g=g.queue,Gh(Zb.bind(null,d,g,r),[r]),g.getSnapshot!==i||S||Gt!==null&&Gt.memoizedState.tag&1){if(d.flags|=2048,Xs(9,{destroy:void 0},Hb.bind(null,d,g,l,i),null),Ct===null)throw Error(a(349));y||(fa&127)!==0||qb(d,i,l)}return l}function qb(r,i,l){r.flags|=16384,r={getSnapshot:i,value:l},i=qe.updateQueue,i===null?(i=Ic(),qe.updateQueue=i,i.stores=[r]):(l=i.stores,l===null?i.stores=[r]:l.push(r))}function Hb(r,i,l,d){i.value=l,i.getSnapshot=d,Vb(i)&&Qb(r)}function Zb(r,i,l){return l(function(){Vb(i)&&Qb(r)})}function Vb(r){var i=r.getSnapshot;r=r.value;try{var l=i();return!nr(r,l)}catch{return!0}}function Qb(r){var i=Hi(r,2);i!==null&&Qn(i,r,2)}function Vh(r){var i=Dn();if(typeof r=="function"){var l=r;if(r=l(),Wi){gn(!0);try{l()}finally{gn(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:r},i}function Gb(r,i,l,d){return r.baseState=l,Hh(r,bt,typeof d=="function"?d:ha)}function u2(r,i,l,d,g){if($c(r))throw Error(a(485));if(r=i.action,r!==null){var y={payload:g,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){y.listeners.push(S)}};q.T!==null?l(!0):y.isTransition=!1,d(y),l=i.pending,l===null?(y.next=i.pending=y,Kb(i,y)):(y.next=l.next,i.pending=l.next=y)}}function Kb(r,i){var l=i.action,d=i.payload,g=r.state;if(i.isTransition){var y=q.T,S={};q.T=S;try{var _=l(g,d),F=q.S;F!==null&&F(S,_),Yb(r,i,_)}catch(Y){Qh(r,i,Y)}finally{y!==null&&S.types!==null&&(y.types=S.types),q.T=y}}else try{y=l(g,d),Yb(r,i,y)}catch(Y){Qh(r,i,Y)}}function Yb(r,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){Xb(r,i,d)},function(d){return Qh(r,i,d)}):Xb(r,i,l)}function Xb(r,i,l){i.status="fulfilled",i.value=l,Jb(i),r.state=l,i=r.pending,i!==null&&(l=i.next,l===i?r.pending=null:(l=l.next,i.next=l,Kb(r,l)))}function Qh(r,i,l){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=l,Jb(i),i=i.next;while(i!==d)}r.action=null}function Jb(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function Wb(r,i){return i}function ex(r,i){if(at){var l=Ct.formState;if(l!==null){e:{var d=qe;if(at){if(Tt){t:{for(var g=Tt,y=Sr;g.nodeType!==8;){if(!y){g=null;break t}if(g=jr(g.nextSibling),g===null){g=null;break t}}y=g.data,g=y==="F!"||y==="F"?g:null}if(g){Tt=jr(g.nextSibling),d=g.data==="F!";break e}}Fa(d)}d=!1}d&&(i=l[0])}}return l=Dn(),l.memoizedState=l.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wb,lastRenderedState:i},l.queue=d,l=bx.bind(null,qe,d),d.dispatch=l,d=Vh(!1),y=Wh.bind(null,qe,!1,d.queue),d=Dn(),g={state:i,dispatch:null,action:r,pending:null},d.queue=g,l=u2.bind(null,qe,g,y,l),g.dispatch=l,d.memoizedState=r,[i,l,!1]}function tx(r){var i=Vt();return nx(i,bt,r)}function nx(r,i,l){if(i=Hh(r,i,Wb)[0],r=Uc(ha)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=Ao(i)}catch(S){throw S===Vs?_c:S}else d=i;i=Vt();var g=i.queue,y=g.dispatch;return l!==i.memoizedState&&(qe.flags|=2048,Xs(9,{destroy:void 0},c2.bind(null,g,l),null)),[d,y,r]}function c2(r,i){r.action=i}function rx(r){var i=Vt(),l=bt;if(l!==null)return nx(i,l,r);Vt(),i=i.memoizedState,l=Vt();var d=l.queue.dispatch;return l.memoizedState=r,[i,d,!1]}function Xs(r,i,l,d){return r={tag:r,create:l,deps:d,inst:i,next:null},i=qe.updateQueue,i===null&&(i=Ic(),qe.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=r.next=r:(d=l.next,l.next=r,r.next=d,i.lastEffect=r),r}function ax(){return Vt().memoizedState}function Pc(r,i,l,d){var g=Dn();qe.flags|=r,g.memoizedState=Xs(1|i,{destroy:void 0},l,d===void 0?null:d)}function Bc(r,i,l,d){var g=Vt();d=d===void 0?null:d;var y=g.memoizedState.inst;bt!==null&&d!==null&&Uh(d,bt.memoizedState.deps)?g.memoizedState=Xs(i,y,l,d):(qe.flags|=r,g.memoizedState=Xs(1|i,y,l,d))}function ix(r,i){Pc(8390656,8,r,i)}function Gh(r,i){Bc(2048,8,r,i)}function d2(r){qe.flags|=4;var i=qe.updateQueue;if(i===null)i=Ic(),qe.updateQueue=i,i.events=[r];else{var l=i.events;l===null?i.events=[r]:l.push(r)}}function sx(r){var i=Vt().memoizedState;return d2({ref:i,nextImpl:r}),function(){if((ft&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function lx(r,i){return Bc(4,2,r,i)}function ox(r,i){return Bc(4,4,r,i)}function ux(r,i){if(typeof i=="function"){r=r();var l=i(r);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function cx(r,i,l){l=l!=null?l.concat([r]):null,Bc(4,4,ux.bind(null,i,r),l)}function Kh(){}function dx(r,i){var l=Vt();i=i===void 0?null:i;var d=l.memoizedState;return i!==null&&Uh(i,d[1])?d[0]:(l.memoizedState=[r,i],r)}function fx(r,i){var l=Vt();i=i===void 0?null:i;var d=l.memoizedState;if(i!==null&&Uh(i,d[1]))return d[0];if(d=r(),Wi){gn(!0);try{r()}finally{gn(!1)}}return l.memoizedState=[d,i],d}function Yh(r,i,l){return l===void 0||(fa&1073741824)!==0&&(tt&261930)===0?r.memoizedState=i:(r.memoizedState=l,r=h0(),qe.lanes|=r,Xa|=r,l)}function hx(r,i,l,d){return nr(l,i)?l:Gs.current!==null?(r=Yh(r,l,d),nr(r,i)||(Kt=!0),r):(fa&42)===0||(fa&1073741824)!==0&&(tt&261930)===0?(Kt=!0,r.memoizedState=l):(r=h0(),qe.lanes|=r,Xa|=r,i)}function mx(r,i,l,d,g){var y=ee.p;ee.p=y!==0&&8>y?y:8;var S=q.T,_={};q.T=_,Wh(r,!1,i,l);try{var F=g(),Y=q.S;if(Y!==null&&Y(_,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var se=s2(F,d);zo(r,i,se,or(r))}else zo(r,i,d,or(r))}catch(de){zo(r,i,{then:function(){},status:"rejected",reason:de},or())}finally{ee.p=y,S!==null&&_.types!==null&&(S.types=_.types),q.T=S}}function f2(){}function Xh(r,i,l,d){if(r.tag!==5)throw Error(a(476));var g=px(r).queue;mx(r,g,i,ye,l===null?f2:function(){return gx(r),l(d)})}function px(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:ye,baseState:ye,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:ye},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ha,lastRenderedState:l},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function gx(r){var i=px(r);i.next===null&&(i=r.alternate.memoizedState),zo(r,i.next.queue,{},or())}function Jh(){return xn(Ko)}function vx(){return Vt().memoizedState}function yx(){return Vt().memoizedState}function h2(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var l=or();r=Za(l);var d=Va(i,r,l);d!==null&&(Qn(d,i,l),Eo(d,i,l)),i={cache:Eh()},r.payload=i;return}i=i.return}}function m2(r,i,l){var d=or();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},$c(r)?xx(i,l):(l=gh(r,i,l,d),l!==null&&(Qn(l,r,d),wx(l,i,d)))}function bx(r,i,l){var d=or();zo(r,i,l,d)}function zo(r,i,l,d){var g={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if($c(r))xx(i,g);else{var y=r.alternate;if(r.lanes===0&&(y===null||y.lanes===0)&&(y=i.lastRenderedReducer,y!==null))try{var S=i.lastRenderedState,_=y(S,l);if(g.hasEagerState=!0,g.eagerState=_,nr(_,S))return wc(r,i,g,0),Ct===null&&xc(),!1}catch{}finally{}if(l=gh(r,i,g,d),l!==null)return Qn(l,r,d),wx(l,i,d),!0}return!1}function Wh(r,i,l,d){if(d={lane:2,revertLane:Am(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},$c(r)){if(i)throw Error(a(479))}else i=gh(r,l,d,2),i!==null&&Qn(i,r,2)}function $c(r){var i=r.alternate;return r===qe||i!==null&&i===qe}function xx(r,i){Ks=Dc=!0;var l=r.pending;l===null?i.next=i:(i.next=l.next,l.next=i),r.pending=i}function wx(r,i,l){if((l&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,l|=d,i.lanes=l,oc(r,l)}}var Oo={readContext:xn,use:Lc,useCallback:Pt,useContext:Pt,useEffect:Pt,useImperativeHandle:Pt,useLayoutEffect:Pt,useInsertionEffect:Pt,useMemo:Pt,useReducer:Pt,useRef:Pt,useState:Pt,useDebugValue:Pt,useDeferredValue:Pt,useTransition:Pt,useSyncExternalStore:Pt,useId:Pt,useHostTransitionStatus:Pt,useFormState:Pt,useActionState:Pt,useOptimistic:Pt,useMemoCache:Pt,useCacheRefresh:Pt};Oo.useEffectEvent=Pt;var Sx={readContext:xn,use:Lc,useCallback:function(r,i){return Dn().memoizedState=[r,i===void 0?null:i],r},useContext:xn,useEffect:ix,useImperativeHandle:function(r,i,l){l=l!=null?l.concat([r]):null,Pc(4194308,4,ux.bind(null,i,r),l)},useLayoutEffect:function(r,i){return Pc(4194308,4,r,i)},useInsertionEffect:function(r,i){Pc(4,2,r,i)},useMemo:function(r,i){var l=Dn();i=i===void 0?null:i;var d=r();if(Wi){gn(!0);try{r()}finally{gn(!1)}}return l.memoizedState=[d,i],d},useReducer:function(r,i,l){var d=Dn();if(l!==void 0){var g=l(i);if(Wi){gn(!0);try{l(i)}finally{gn(!1)}}}else g=i;return d.memoizedState=d.baseState=g,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:g},d.queue=r,r=r.dispatch=m2.bind(null,qe,r),[d.memoizedState,r]},useRef:function(r){var i=Dn();return r={current:r},i.memoizedState=r},useState:function(r){r=Vh(r);var i=r.queue,l=bx.bind(null,qe,i);return i.dispatch=l,[r.memoizedState,l]},useDebugValue:Kh,useDeferredValue:function(r,i){var l=Dn();return Yh(l,r,i)},useTransition:function(){var r=Vh(!1);return r=mx.bind(null,qe,r.queue,!0,!1),Dn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,l){var d=qe,g=Dn();if(at){if(l===void 0)throw Error(a(407));l=l()}else{if(l=i(),Ct===null)throw Error(a(349));(tt&127)!==0||qb(d,i,l)}g.memoizedState=l;var y={value:l,getSnapshot:i};return g.queue=y,ix(Zb.bind(null,d,y,r),[r]),d.flags|=2048,Xs(9,{destroy:void 0},Hb.bind(null,d,y,l,i),null),l},useId:function(){var r=Dn(),i=Ct.identifierPrefix;if(at){var l=Qr,d=Vr;l=(d&~(1<<32-ht(d)-1)).toString(32)+l,i="_"+i+"R_"+l,l=Mc++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=l2++,i="_"+i+"r_"+l.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Jh,useFormState:ex,useActionState:ex,useOptimistic:function(r){var i=Dn();i.memoizedState=i.baseState=r;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=Wh.bind(null,qe,!0,l),l.dispatch=i,[r,i]},useMemoCache:qh,useCacheRefresh:function(){return Dn().memoizedState=h2.bind(null,qe)},useEffectEvent:function(r){var i=Dn(),l={impl:r};return i.memoizedState=l,function(){if((ft&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}},em={readContext:xn,use:Lc,useCallback:dx,useContext:xn,useEffect:Gh,useImperativeHandle:cx,useInsertionEffect:lx,useLayoutEffect:ox,useMemo:fx,useReducer:Uc,useRef:ax,useState:function(){return Uc(ha)},useDebugValue:Kh,useDeferredValue:function(r,i){var l=Vt();return hx(l,bt.memoizedState,r,i)},useTransition:function(){var r=Uc(ha)[0],i=Vt().memoizedState;return[typeof r=="boolean"?r:Ao(r),i]},useSyncExternalStore:Fb,useId:vx,useHostTransitionStatus:Jh,useFormState:tx,useActionState:tx,useOptimistic:function(r,i){var l=Vt();return Gb(l,bt,r,i)},useMemoCache:qh,useCacheRefresh:yx};em.useEffectEvent=sx;var kx={readContext:xn,use:Lc,useCallback:dx,useContext:xn,useEffect:Gh,useImperativeHandle:cx,useInsertionEffect:lx,useLayoutEffect:ox,useMemo:fx,useReducer:Zh,useRef:ax,useState:function(){return Zh(ha)},useDebugValue:Kh,useDeferredValue:function(r,i){var l=Vt();return bt===null?Yh(l,r,i):hx(l,bt.memoizedState,r,i)},useTransition:function(){var r=Zh(ha)[0],i=Vt().memoizedState;return[typeof r=="boolean"?r:Ao(r),i]},useSyncExternalStore:Fb,useId:vx,useHostTransitionStatus:Jh,useFormState:rx,useActionState:rx,useOptimistic:function(r,i){var l=Vt();return bt!==null?Gb(l,bt,r,i):(l.baseState=r,[r,l.queue.dispatch])},useMemoCache:qh,useCacheRefresh:yx};kx.useEffectEvent=sx;function tm(r,i,l,d){i=r.memoizedState,l=l(d,i),l=l==null?i:p({},i,l),r.memoizedState=l,r.lanes===0&&(r.updateQueue.baseState=l)}var nm={enqueueSetState:function(r,i,l){r=r._reactInternals;var d=or(),g=Za(d);g.payload=i,l!=null&&(g.callback=l),i=Va(r,g,d),i!==null&&(Qn(i,r,d),Eo(i,r,d))},enqueueReplaceState:function(r,i,l){r=r._reactInternals;var d=or(),g=Za(d);g.tag=1,g.payload=i,l!=null&&(g.callback=l),i=Va(r,g,d),i!==null&&(Qn(i,r,d),Eo(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var l=or(),d=Za(l);d.tag=2,i!=null&&(d.callback=i),i=Va(r,d,l),i!==null&&(Qn(i,r,l),Eo(i,r,l))}};function jx(r,i,l,d,g,y,S){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,y,S):i.prototype&&i.prototype.isPureReactComponent?!bo(l,d)||!bo(g,y):!0}function Cx(r,i,l,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,d),i.state!==r&&nm.enqueueReplaceState(i,i.state,null)}function es(r,i){var l=i;if("ref"in i){l={};for(var d in i)d!=="ref"&&(l[d]=i[d])}if(r=r.defaultProps){l===i&&(l=p({},l));for(var g in r)l[g]===void 0&&(l[g]=r[g])}return l}function Nx(r){bc(r)}function Ex(r){console.error(r)}function _x(r){bc(r)}function Fc(r,i){try{var l=r.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function Tx(r,i,l){try{var d=r.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function rm(r,i,l){return l=Za(l),l.tag=3,l.payload={element:null},l.callback=function(){Fc(r,i)},l}function Rx(r){return r=Za(r),r.tag=3,r}function Ax(r,i,l,d){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var y=d.value;r.payload=function(){return g(y)},r.callback=function(){Tx(i,l,d)}}var S=l.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(r.callback=function(){Tx(i,l,d),typeof g!="function"&&(Ja===null?Ja=new Set([this]):Ja.add(this));var _=d.stack;this.componentDidCatch(d.value,{componentStack:_!==null?_:""})})}function p2(r,i,l,d,g){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=l.alternate,i!==null&&qs(i,l,g,!0),l=ar.current,l!==null){switch(l.tag){case 31:case 13:return kr===null?ed():l.alternate===null&&Bt===0&&(Bt=3),l.flags&=-257,l.flags|=65536,l.lanes=g,d===Tc?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([d]):i.add(d),_m(r,d,g)),!1;case 22:return l.flags|=65536,d===Tc?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([d]):l.add(d)),_m(r,d,g)),!1}throw Error(a(435,l.tag))}return _m(r,d,g),ed(),!1}if(at)return i=ar.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=g,d!==Sh&&(r=Error(a(422),{cause:d}),So(br(r,l)))):(d!==Sh&&(i=Error(a(423),{cause:d}),So(br(i,l))),r=r.current.alternate,r.flags|=65536,g&=-g,r.lanes|=g,d=br(d,l),g=rm(r.stateNode,d,g),Oh(r,g),Bt!==4&&(Bt=2)),!1;var y=Error(a(520),{cause:d});if(y=br(y,l),$o===null?$o=[y]:$o.push(y),Bt!==4&&(Bt=2),i===null)return!0;d=br(d,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,r=g&-g,l.lanes|=r,r=rm(l.stateNode,d,r),Oh(l,r),!1;case 1:if(i=l.type,y=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Ja===null||!Ja.has(y))))return l.flags|=65536,g&=-g,l.lanes|=g,g=Rx(g),Ax(g,r,l,d),Oh(l,g),!1}l=l.return}while(l!==null);return!1}var am=Error(a(461)),Kt=!1;function wn(r,i,l,d){i.child=r===null?Mb(i,null,l,d):Ji(i,r.child,l,d)}function zx(r,i,l,d,g){l=l.render;var y=i.ref;if("ref"in d){var S={};for(var _ in d)_!=="ref"&&(S[_]=d[_])}else S=d;return Gi(i),d=Ph(r,i,l,S,y,g),_=Bh(),r!==null&&!Kt?($h(r,i,g),ma(r,i,g)):(at&&_&&xh(i),i.flags|=1,wn(r,i,d,g),i.child)}function Ox(r,i,l,d,g){if(r===null){var y=l.type;return typeof y=="function"&&!vh(y)&&y.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=y,Dx(r,i,y,d,g)):(r=kc(l.type,null,d,i,i.mode,g),r.ref=i.ref,r.return=i,i.child=r)}if(y=r.child,!fm(r,g)){var S=y.memoizedProps;if(l=l.compare,l=l!==null?l:bo,l(S,d)&&r.ref===i.ref)return ma(r,i,g)}return i.flags|=1,r=oa(y,d),r.ref=i.ref,r.return=i,i.child=r}function Dx(r,i,l,d,g){if(r!==null){var y=r.memoizedProps;if(bo(y,d)&&r.ref===i.ref)if(Kt=!1,i.pendingProps=d=y,fm(r,g))(r.flags&131072)!==0&&(Kt=!0);else return i.lanes=r.lanes,ma(r,i,g)}return im(r,i,l,d,g)}function Mx(r,i,l,d){var g=d.children,y=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(y=y!==null?y.baseLanes|l:l,r!==null){for(d=i.child=r.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~y}else d=0,i.child=null;return Ix(r,i,y,l,d)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&Ec(i,y!==null?y.cachePool:null),y!==null?Ub(i,y):Mh(),Pb(i);else return d=i.lanes=536870912,Ix(r,i,y!==null?y.baseLanes|l:l,l,d)}else y!==null?(Ec(i,y.cachePool),Ub(i,y),Ga(),i.memoizedState=null):(r!==null&&Ec(i,null),Mh(),Ga());return wn(r,i,g,l),i.child}function Do(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Ix(r,i,l,d,g){var y=Th();return y=y===null?null:{parent:Qt._currentValue,pool:y},i.memoizedState={baseLanes:l,cachePool:y},r!==null&&Ec(i,null),Mh(),Pb(i),r!==null&&qs(r,i,d,!0),i.childLanes=g,null}function qc(r,i){return i=Zc({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function Lx(r,i,l){return Ji(i,r.child,null,l),r=qc(i,i.pendingProps),r.flags|=2,ir(i),i.memoizedState=null,r}function g2(r,i,l){var d=i.pendingProps,g=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(at){if(d.mode==="hidden")return r=qc(i,d),i.lanes=536870912,Do(null,r);if(Lh(i),(r=Tt)?(r=K0(r,Sr),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ba!==null?{id:Vr,overflow:Qr}:null,retryLane:536870912,hydrationErrors:null},l=xb(r),l.return=i,i.child=l,bn=i,Tt=null)):r=null,r===null)throw Fa(i);return i.lanes=536870912,null}return qc(i,d)}var y=r.memoizedState;if(y!==null){var S=y.dehydrated;if(Lh(i),g)if(i.flags&256)i.flags&=-257,i=Lx(r,i,l);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(Kt||qs(r,i,l,!1),g=(l&r.childLanes)!==0,Kt||g){if(d=Ct,d!==null&&(S=Ey(d,l),S!==0&&S!==y.retryLane))throw y.retryLane=S,Hi(r,S),Qn(d,r,S),am;ed(),i=Lx(r,i,l)}else r=y.treeContext,Tt=jr(S.nextSibling),bn=i,at=!0,$a=null,Sr=!1,r!==null&&kb(i,r),i=qc(i,d),i.flags|=4096;return i}return r=oa(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Hc(r,i){var l=i.ref;if(l===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(a(284));(r===null||r.ref!==l)&&(i.flags|=4194816)}}function im(r,i,l,d,g){return Gi(i),l=Ph(r,i,l,d,void 0,g),d=Bh(),r!==null&&!Kt?($h(r,i,g),ma(r,i,g)):(at&&d&&xh(i),i.flags|=1,wn(r,i,l,g),i.child)}function Ux(r,i,l,d,g,y){return Gi(i),i.updateQueue=null,l=$b(i,d,l,g),Bb(r),d=Bh(),r!==null&&!Kt?($h(r,i,y),ma(r,i,y)):(at&&d&&xh(i),i.flags|=1,wn(r,i,l,y),i.child)}function Px(r,i,l,d,g){if(Gi(i),i.stateNode===null){var y=Ps,S=l.contextType;typeof S=="object"&&S!==null&&(y=xn(S)),y=new l(d,y),i.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=nm,i.stateNode=y,y._reactInternals=i,y=i.stateNode,y.props=d,y.state=i.memoizedState,y.refs={},Ah(i),S=l.contextType,y.context=typeof S=="object"&&S!==null?xn(S):Ps,y.state=i.memoizedState,S=l.getDerivedStateFromProps,typeof S=="function"&&(tm(i,l,S,d),y.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(S=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),S!==y.state&&nm.enqueueReplaceState(y,y.state,null),To(i,d,y,g),_o(),y.state=i.memoizedState),typeof y.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){y=i.stateNode;var _=i.memoizedProps,F=es(l,_);y.props=F;var Y=y.context,se=l.contextType;S=Ps,typeof se=="object"&&se!==null&&(S=xn(se));var de=l.getDerivedStateFromProps;se=typeof de=="function"||typeof y.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,se||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(_||Y!==S)&&Cx(i,y,d,S),Ha=!1;var J=i.memoizedState;y.state=J,To(i,d,y,g),_o(),Y=i.memoizedState,_||J!==Y||Ha?(typeof de=="function"&&(tm(i,l,de,d),Y=i.memoizedState),(F=Ha||jx(i,l,F,d,J,Y,S))?(se||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(i.flags|=4194308)):(typeof y.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=Y),y.props=d,y.state=Y,y.context=S,d=F):(typeof y.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{y=i.stateNode,zh(r,i),S=i.memoizedProps,se=es(l,S),y.props=se,de=i.pendingProps,J=y.context,Y=l.contextType,F=Ps,typeof Y=="object"&&Y!==null&&(F=xn(Y)),_=l.getDerivedStateFromProps,(Y=typeof _=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==de||J!==F)&&Cx(i,y,d,F),Ha=!1,J=i.memoizedState,y.state=J,To(i,d,y,g),_o();var ne=i.memoizedState;S!==de||J!==ne||Ha||r!==null&&r.dependencies!==null&&Cc(r.dependencies)?(typeof _=="function"&&(tm(i,l,_,d),ne=i.memoizedState),(se=Ha||jx(i,l,se,d,J,ne,F)||r!==null&&r.dependencies!==null&&Cc(r.dependencies))?(Y||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,ne,F),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,ne,F)),typeof y.componentDidUpdate=="function"&&(i.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof y.componentDidUpdate!="function"||S===r.memoizedProps&&J===r.memoizedState||(i.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&J===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=ne),y.props=d,y.state=ne,y.context=F,d=se):(typeof y.componentDidUpdate!="function"||S===r.memoizedProps&&J===r.memoizedState||(i.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&J===r.memoizedState||(i.flags|=1024),d=!1)}return y=d,Hc(r,i),d=(i.flags&128)!==0,y||d?(y=i.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:y.render(),i.flags|=1,r!==null&&d?(i.child=Ji(i,r.child,null,g),i.child=Ji(i,null,l,g)):wn(r,i,l,g),i.memoizedState=y.state,r=i.child):r=ma(r,i,g),r}function Bx(r,i,l,d){return Vi(),i.flags|=256,wn(r,i,l,d),i.child}var sm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lm(r){return{baseLanes:r,cachePool:Tb()}}function om(r,i,l){return r=r!==null?r.childLanes&~l:0,i&&(r|=lr),r}function $x(r,i,l){var d=i.pendingProps,g=!1,y=(i.flags&128)!==0,S;if((S=y)||(S=r!==null&&r.memoizedState===null?!1:(Zt.current&2)!==0),S&&(g=!0,i.flags&=-129),S=(i.flags&32)!==0,i.flags&=-33,r===null){if(at){if(g?Qa(i):Ga(),(r=Tt)?(r=K0(r,Sr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ba!==null?{id:Vr,overflow:Qr}:null,retryLane:536870912,hydrationErrors:null},l=xb(r),l.return=i,i.child=l,bn=i,Tt=null)):r=null,r===null)throw Fa(i);return Hm(r)?i.lanes=32:i.lanes=536870912,null}var _=d.children;return d=d.fallback,g?(Ga(),g=i.mode,_=Zc({mode:"hidden",children:_},g),d=Zi(d,g,l,null),_.return=i,d.return=i,_.sibling=d,i.child=_,d=i.child,d.memoizedState=lm(l),d.childLanes=om(r,S,l),i.memoizedState=sm,Do(null,d)):(Qa(i),um(i,_))}var F=r.memoizedState;if(F!==null&&(_=F.dehydrated,_!==null)){if(y)i.flags&256?(Qa(i),i.flags&=-257,i=cm(r,i,l)):i.memoizedState!==null?(Ga(),i.child=r.child,i.flags|=128,i=null):(Ga(),_=d.fallback,g=i.mode,d=Zc({mode:"visible",children:d.children},g),_=Zi(_,g,l,null),_.flags|=2,d.return=i,_.return=i,d.sibling=_,i.child=d,Ji(i,r.child,null,l),d=i.child,d.memoizedState=lm(l),d.childLanes=om(r,S,l),i.memoizedState=sm,i=Do(null,d));else if(Qa(i),Hm(_)){if(S=_.nextSibling&&_.nextSibling.dataset,S)var Y=S.dgst;S=Y,d=Error(a(419)),d.stack="",d.digest=S,So({value:d,source:null,stack:null}),i=cm(r,i,l)}else if(Kt||qs(r,i,l,!1),S=(l&r.childLanes)!==0,Kt||S){if(S=Ct,S!==null&&(d=Ey(S,l),d!==0&&d!==F.retryLane))throw F.retryLane=d,Hi(r,d),Qn(S,r,d),am;qm(_)||ed(),i=cm(r,i,l)}else qm(_)?(i.flags|=192,i.child=r.child,i=null):(r=F.treeContext,Tt=jr(_.nextSibling),bn=i,at=!0,$a=null,Sr=!1,r!==null&&kb(i,r),i=um(i,d.children),i.flags|=4096);return i}return g?(Ga(),_=d.fallback,g=i.mode,F=r.child,Y=F.sibling,d=oa(F,{mode:"hidden",children:d.children}),d.subtreeFlags=F.subtreeFlags&65011712,Y!==null?_=oa(Y,_):(_=Zi(_,g,l,null),_.flags|=2),_.return=i,d.return=i,d.sibling=_,i.child=d,Do(null,d),d=i.child,_=r.child.memoizedState,_===null?_=lm(l):(g=_.cachePool,g!==null?(F=Qt._currentValue,g=g.parent!==F?{parent:F,pool:F}:g):g=Tb(),_={baseLanes:_.baseLanes|l,cachePool:g}),d.memoizedState=_,d.childLanes=om(r,S,l),i.memoizedState=sm,Do(r.child,d)):(Qa(i),l=r.child,r=l.sibling,l=oa(l,{mode:"visible",children:d.children}),l.return=i,l.sibling=null,r!==null&&(S=i.deletions,S===null?(i.deletions=[r],i.flags|=16):S.push(r)),i.child=l,i.memoizedState=null,l)}function um(r,i){return i=Zc({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Zc(r,i){return r=rr(22,r,null,i),r.lanes=0,r}function cm(r,i,l){return Ji(i,r.child,null,l),r=um(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function Fx(r,i,l){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),Ch(r.return,i,l)}function dm(r,i,l,d,g,y){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:g,treeForkCount:y}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=l,S.tailMode=g,S.treeForkCount=y)}function qx(r,i,l){var d=i.pendingProps,g=d.revealOrder,y=d.tail;d=d.children;var S=Zt.current,_=(S&2)!==0;if(_?(S=S&1|2,i.flags|=128):S&=1,T(Zt,S),wn(r,i,d,l),d=at?wo:0,!_&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Fx(r,l,i);else if(r.tag===19)Fx(r,l,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(g){case"forwards":for(l=i.child,g=null;l!==null;)r=l.alternate,r!==null&&Oc(r)===null&&(g=l),l=l.sibling;l=g,l===null?(g=i.child,i.child=null):(g=l.sibling,l.sibling=null),dm(i,!1,g,l,y,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=i.child,i.child=null;g!==null;){if(r=g.alternate,r!==null&&Oc(r)===null){i.child=g;break}r=g.sibling,g.sibling=l,l=g,g=r}dm(i,!0,l,null,y,d);break;case"together":dm(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function ma(r,i,l){if(r!==null&&(i.dependencies=r.dependencies),Xa|=i.lanes,(l&i.childLanes)===0)if(r!==null){if(qs(r,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(a(153));if(i.child!==null){for(r=i.child,l=oa(r,r.pendingProps),i.child=l,l.return=i;r.sibling!==null;)r=r.sibling,l=l.sibling=oa(r,r.pendingProps),l.return=i;l.sibling=null}return i.child}function fm(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&Cc(r)))}function v2(r,i,l){switch(i.tag){case 3:ge(i,i.stateNode.containerInfo),qa(i,Qt,r.memoizedState.cache),Vi();break;case 27:case 5:Ge(i);break;case 4:ge(i,i.stateNode.containerInfo);break;case 10:qa(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Lh(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Qa(i),i.flags|=128,null):(l&i.child.childLanes)!==0?$x(r,i,l):(Qa(i),r=ma(r,i,l),r!==null?r.sibling:null);Qa(i);break;case 19:var g=(r.flags&128)!==0;if(d=(l&i.childLanes)!==0,d||(qs(r,i,l,!1),d=(l&i.childLanes)!==0),g){if(d)return qx(r,i,l);i.flags|=128}if(g=i.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),T(Zt,Zt.current),d)break;return null;case 22:return i.lanes=0,Mx(r,i,l,i.pendingProps);case 24:qa(i,Qt,r.memoizedState.cache)}return ma(r,i,l)}function Hx(r,i,l){if(r!==null)if(r.memoizedProps!==i.pendingProps)Kt=!0;else{if(!fm(r,l)&&(i.flags&128)===0)return Kt=!1,v2(r,i,l);Kt=(r.flags&131072)!==0}else Kt=!1,at&&(i.flags&1048576)!==0&&Sb(i,wo,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Yi(i.elementType),i.type=r,typeof r=="function")vh(r)?(d=es(r,d),i.tag=1,i=Px(null,i,r,d,l)):(i.tag=0,i=im(null,i,r,d,l));else{if(r!=null){var g=r.$$typeof;if(g===M){i.tag=11,i=zx(null,i,r,d,l);break e}else if(g===$){i.tag=14,i=Ox(null,i,r,d,l);break e}}throw i=G(r)||r,Error(a(306,i,""))}}return i;case 0:return im(r,i,i.type,i.pendingProps,l);case 1:return d=i.type,g=es(d,i.pendingProps),Px(r,i,d,g,l);case 3:e:{if(ge(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var y=i.memoizedState;g=y.element,zh(r,i),To(i,d,null,l);var S=i.memoizedState;if(d=S.cache,qa(i,Qt,d),d!==y.cache&&Nh(i,[Qt],l,!0),_o(),d=S.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:S.cache},i.updateQueue.baseState=y,i.memoizedState=y,i.flags&256){i=Bx(r,i,d,l);break e}else if(d!==g){g=br(Error(a(424)),i),So(g),i=Bx(r,i,d,l);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Tt=jr(r.firstChild),bn=i,at=!0,$a=null,Sr=!0,l=Mb(i,null,d,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Vi(),d===g){i=ma(r,i,l);break e}wn(r,i,d,l)}i=i.child}return i;case 26:return Hc(r,i),r===null?(l=t1(i.type,null,i.pendingProps,null))?i.memoizedState=l:at||(l=i.type,r=i.pendingProps,d=ld(ce.current).createElement(l),d[yn]=i,d[$n]=r,Sn(d,l,r),un(d),i.stateNode=d):i.memoizedState=t1(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ge(i),r===null&&at&&(d=i.stateNode=J0(i.type,i.pendingProps,ce.current),bn=i,Sr=!0,g=Tt,ni(i.type)?(Zm=g,Tt=jr(d.firstChild)):Tt=g),wn(r,i,i.pendingProps.children,l),Hc(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&at&&((g=d=Tt)&&(d=Q2(d,i.type,i.pendingProps,Sr),d!==null?(i.stateNode=d,bn=i,Tt=jr(d.firstChild),Sr=!1,g=!0):g=!1),g||Fa(i)),Ge(i),g=i.type,y=i.pendingProps,S=r!==null?r.memoizedProps:null,d=y.children,Bm(g,y)?d=null:S!==null&&Bm(g,S)&&(i.flags|=32),i.memoizedState!==null&&(g=Ph(r,i,o2,null,null,l),Ko._currentValue=g),Hc(r,i),wn(r,i,d,l),i.child;case 6:return r===null&&at&&((r=l=Tt)&&(l=G2(l,i.pendingProps,Sr),l!==null?(i.stateNode=l,bn=i,Tt=null,r=!0):r=!1),r||Fa(i)),null;case 13:return $x(r,i,l);case 4:return ge(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Ji(i,null,d,l):wn(r,i,d,l),i.child;case 11:return zx(r,i,i.type,i.pendingProps,l);case 7:return wn(r,i,i.pendingProps,l),i.child;case 8:return wn(r,i,i.pendingProps.children,l),i.child;case 12:return wn(r,i,i.pendingProps.children,l),i.child;case 10:return d=i.pendingProps,qa(i,i.type,d.value),wn(r,i,d.children,l),i.child;case 9:return g=i.type._context,d=i.pendingProps.children,Gi(i),g=xn(g),d=d(g),i.flags|=1,wn(r,i,d,l),i.child;case 14:return Ox(r,i,i.type,i.pendingProps,l);case 15:return Dx(r,i,i.type,i.pendingProps,l);case 19:return qx(r,i,l);case 31:return g2(r,i,l);case 22:return Mx(r,i,l,i.pendingProps);case 24:return Gi(i),d=xn(Qt),r===null?(g=Th(),g===null&&(g=Ct,y=Eh(),g.pooledCache=y,y.refCount++,y!==null&&(g.pooledCacheLanes|=l),g=y),i.memoizedState={parent:d,cache:g},Ah(i),qa(i,Qt,g)):((r.lanes&l)!==0&&(zh(r,i),To(i,null,null,l),_o()),g=r.memoizedState,y=i.memoizedState,g.parent!==d?(g={parent:d,cache:d},i.memoizedState=g,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=g),qa(i,Qt,d)):(d=y.cache,qa(i,Qt,d),d!==g.cache&&Nh(i,[Qt],l,!0))),wn(r,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function pa(r){r.flags|=4}function hm(r,i,l,d,g){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(g&335544128)===g)if(r.stateNode.complete)r.flags|=8192;else if(v0())r.flags|=8192;else throw Xi=Tc,Rh}else r.flags&=-16777217}function Zx(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!s1(i))if(v0())r.flags|=8192;else throw Xi=Tc,Rh}function Vc(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?we():536870912,r.lanes|=i,tl|=i)}function Mo(r,i){if(!at)switch(r.tailMode){case"hidden":i=r.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?r.tail=null:l.sibling=null;break;case"collapsed":l=r.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Rt(r){var i=r.alternate!==null&&r.alternate.child===r.child,l=0,d=0;if(i)for(var g=r.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=d,r.childLanes=l,i}function y2(r,i,l){var d=i.pendingProps;switch(wh(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(i),null;case 1:return Rt(i),null;case 3:return l=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),da(Qt),fe(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(r===null||r.child===null)&&(Fs(i)?pa(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,kh())),Rt(i),null;case 26:var g=i.type,y=i.memoizedState;return r===null?(pa(i),y!==null?(Rt(i),Zx(i,y)):(Rt(i),hm(i,g,null,d,l))):y?y!==r.memoizedState?(pa(i),Rt(i),Zx(i,y)):(Rt(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&pa(i),Rt(i),hm(i,g,r,d,l)),null;case 27:if(Oe(i),l=ce.current,g=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&pa(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Rt(i),null}r=V.current,Fs(i)?jb(i):(r=J0(g,d,l),i.stateNode=r,pa(i))}return Rt(i),null;case 5:if(Oe(i),g=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&pa(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Rt(i),null}if(y=V.current,Fs(i))jb(i);else{var S=ld(ce.current);switch(y){case 1:y=S.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:y=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":y=S.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":y=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":y=S.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?S.createElement(g,{is:d.is}):S.createElement(g)}}y[yn]=i,y[$n]=d;e:for(S=i.child;S!==null;){if(S.tag===5||S.tag===6)y.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===i)break e;for(;S.sibling===null;){if(S.return===null||S.return===i)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}i.stateNode=y;e:switch(Sn(y,g,d),g){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&pa(i)}}return Rt(i),hm(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,l),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&pa(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=ce.current,Fs(i)){if(r=i.stateNode,l=i.memoizedProps,d=null,g=bn,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}r[yn]=i,r=!!(r.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||$0(r.nodeValue,l)),r||Fa(i,!0)}else r=ld(r).createTextNode(d),r[yn]=i,i.stateNode=r}return Rt(i),null;case 31:if(l=i.memoizedState,r===null||r.memoizedState!==null){if(d=Fs(i),l!==null){if(r===null){if(!d)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[yn]=i}else Vi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),r=!1}else l=kh(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=l),r=!0;if(!r)return i.flags&256?(ir(i),i):(ir(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Rt(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(g=Fs(i),d!==null&&d.dehydrated!==null){if(r===null){if(!g)throw Error(a(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[yn]=i}else Vi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Rt(i),g=!1}else g=kh(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(ir(i),i):(ir(i),null)}return ir(i),(i.flags&128)!==0?(i.lanes=l,i):(l=d!==null,r=r!==null&&r.memoizedState!==null,l&&(d=i.child,g=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(g=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==g&&(d.flags|=2048)),l!==r&&l&&(i.child.flags|=8192),Vc(i,i.updateQueue),Rt(i),null);case 4:return fe(),r===null&&Mm(i.stateNode.containerInfo),Rt(i),null;case 10:return da(i.type),Rt(i),null;case 19:if(B(Zt),d=i.memoizedState,d===null)return Rt(i),null;if(g=(i.flags&128)!==0,y=d.rendering,y===null)if(g)Mo(d,!1);else{if(Bt!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(y=Oc(r),y!==null){for(i.flags|=128,Mo(d,!1),r=y.updateQueue,i.updateQueue=r,Vc(i,r),i.subtreeFlags=0,r=l,l=i.child;l!==null;)bb(l,r),l=l.sibling;return T(Zt,Zt.current&1|2),at&&ua(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&mn()>Xc&&(i.flags|=128,g=!0,Mo(d,!1),i.lanes=4194304)}else{if(!g)if(r=Oc(y),r!==null){if(i.flags|=128,g=!0,r=r.updateQueue,i.updateQueue=r,Vc(i,r),Mo(d,!0),d.tail===null&&d.tailMode==="hidden"&&!y.alternate&&!at)return Rt(i),null}else 2*mn()-d.renderingStartTime>Xc&&l!==536870912&&(i.flags|=128,g=!0,Mo(d,!1),i.lanes=4194304);d.isBackwards?(y.sibling=i.child,i.child=y):(r=d.last,r!==null?r.sibling=y:i.child=y,d.last=y)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=mn(),r.sibling=null,l=Zt.current,T(Zt,g?l&1|2:l&1),at&&ua(i,d.treeForkCount),r):(Rt(i),null);case 22:case 23:return ir(i),Ih(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(l&536870912)!==0&&(i.flags&128)===0&&(Rt(i),i.subtreeFlags&6&&(i.flags|=8192)):Rt(i),l=i.updateQueue,l!==null&&Vc(i,l.retryQueue),l=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==l&&(i.flags|=2048),r!==null&&B(Ki),null;case 24:return l=null,r!==null&&(l=r.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),da(Qt),Rt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function b2(r,i){switch(wh(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return da(Qt),fe(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Oe(i),null;case 31:if(i.memoizedState!==null){if(ir(i),i.alternate===null)throw Error(a(340));Vi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(ir(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Vi()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return B(Zt),null;case 4:return fe(),null;case 10:return da(i.type),null;case 22:case 23:return ir(i),Ih(),r!==null&&B(Ki),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return da(Qt),null;case 25:return null;default:return null}}function Vx(r,i){switch(wh(i),i.tag){case 3:da(Qt),fe();break;case 26:case 27:case 5:Oe(i);break;case 4:fe();break;case 31:i.memoizedState!==null&&ir(i);break;case 13:ir(i);break;case 19:B(Zt);break;case 10:da(i.type);break;case 22:case 23:ir(i),Ih(),r!==null&&B(Ki);break;case 24:da(Qt)}}function Io(r,i){try{var l=i.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var g=d.next;l=g;do{if((l.tag&r)===r){d=void 0;var y=l.create,S=l.inst;d=y(),S.destroy=d}l=l.next}while(l!==g)}}catch(_){yt(i,i.return,_)}}function Ka(r,i,l){try{var d=i.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var y=g.next;d=y;do{if((d.tag&r)===r){var S=d.inst,_=S.destroy;if(_!==void 0){S.destroy=void 0,g=i;var F=l,Y=_;try{Y()}catch(se){yt(g,F,se)}}}d=d.next}while(d!==y)}}catch(se){yt(i,i.return,se)}}function Qx(r){var i=r.updateQueue;if(i!==null){var l=r.stateNode;try{Lb(i,l)}catch(d){yt(r,r.return,d)}}}function Gx(r,i,l){l.props=es(r.type,r.memoizedProps),l.state=r.memoizedState;try{l.componentWillUnmount()}catch(d){yt(r,i,d)}}function Lo(r,i){try{var l=r.ref;if(l!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof l=="function"?r.refCleanup=l(d):l.current=d}}catch(g){yt(r,i,g)}}function Gr(r,i){var l=r.ref,d=r.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(g){yt(r,i,g)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){yt(r,i,g)}else l.current=null}function Kx(r){var i=r.type,l=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(g){yt(r,r.return,g)}}function mm(r,i,l){try{var d=r.stateNode;$2(d,r.type,l,i),d[$n]=i}catch(g){yt(r,r.return,g)}}function Yx(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ni(r.type)||r.tag===4}function pm(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Yx(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ni(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function gm(r,i,l){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(r,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(r),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=sa));else if(d!==4&&(d===27&&ni(r.type)&&(l=r.stateNode,i=null),r=r.child,r!==null))for(gm(r,i,l),r=r.sibling;r!==null;)gm(r,i,l),r=r.sibling}function Qc(r,i,l){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?l.insertBefore(r,i):l.appendChild(r);else if(d!==4&&(d===27&&ni(r.type)&&(l=r.stateNode),r=r.child,r!==null))for(Qc(r,i,l),r=r.sibling;r!==null;)Qc(r,i,l),r=r.sibling}function Xx(r){var i=r.stateNode,l=r.memoizedProps;try{for(var d=r.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Sn(i,d,l),i[yn]=r,i[$n]=l}catch(y){yt(r,r.return,y)}}var ga=!1,Yt=!1,vm=!1,Jx=typeof WeakSet=="function"?WeakSet:Set,cn=null;function x2(r,i){if(r=r.containerInfo,Um=md,r=cb(r),ch(r)){if("selectionStart"in r)var l={start:r.selectionStart,end:r.selectionEnd};else e:{l=(l=r.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var g=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var S=0,_=-1,F=-1,Y=0,se=0,de=r,J=null;t:for(;;){for(var ne;de!==l||g!==0&&de.nodeType!==3||(_=S+g),de!==y||d!==0&&de.nodeType!==3||(F=S+d),de.nodeType===3&&(S+=de.nodeValue.length),(ne=de.firstChild)!==null;)J=de,de=ne;for(;;){if(de===r)break t;if(J===l&&++Y===g&&(_=S),J===y&&++se===d&&(F=S),(ne=de.nextSibling)!==null)break;de=J,J=de.parentNode}de=ne}l=_===-1||F===-1?null:{start:_,end:F}}else l=null}l=l||{start:0,end:0}}else l=null;for(Pm={focusedElem:r,selectionRange:l},md=!1,cn=i;cn!==null;)if(i=cn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,cn=r;else for(;cn!==null;){switch(i=cn,y=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(l=0;l<r.length;l++)g=r[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&y!==null){r=void 0,l=i,g=y.memoizedProps,y=y.memoizedState,d=l.stateNode;try{var Ce=es(l.type,g);r=d.getSnapshotBeforeUpdate(Ce,y),d.__reactInternalSnapshotBeforeUpdate=r}catch(Le){yt(l,l.return,Le)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,l=r.nodeType,l===9)Fm(r);else if(l===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Fm(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,cn=r;break}cn=i.return}}function Wx(r,i,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:ya(r,l),d&4&&Io(5,l);break;case 1:if(ya(r,l),d&4)if(r=l.stateNode,i===null)try{r.componentDidMount()}catch(S){yt(l,l.return,S)}else{var g=es(l.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(g,i,r.__reactInternalSnapshotBeforeUpdate)}catch(S){yt(l,l.return,S)}}d&64&&Qx(l),d&512&&Lo(l,l.return);break;case 3:if(ya(r,l),d&64&&(r=l.updateQueue,r!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{Lb(r,i)}catch(S){yt(l,l.return,S)}}break;case 27:i===null&&d&4&&Xx(l);case 26:case 5:ya(r,l),i===null&&d&4&&Kx(l),d&512&&Lo(l,l.return);break;case 12:ya(r,l);break;case 31:ya(r,l),d&4&&n0(r,l);break;case 13:ya(r,l),d&4&&r0(r,l),d&64&&(r=l.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(l=T2.bind(null,l),K2(r,l))));break;case 22:if(d=l.memoizedState!==null||ga,!d){i=i!==null&&i.memoizedState!==null||Yt,g=ga;var y=Yt;ga=d,(Yt=i)&&!y?ba(r,l,(l.subtreeFlags&8772)!==0):ya(r,l),ga=g,Yt=y}break;case 30:break;default:ya(r,l)}}function e0(r){var i=r.alternate;i!==null&&(r.alternate=null,e0(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Qf(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Ot=null,qn=!1;function va(r,i,l){for(l=l.child;l!==null;)t0(r,i,l),l=l.sibling}function t0(r,i,l){if(Ht&&typeof Ht.onCommitFiberUnmount=="function")try{Ht.onCommitFiberUnmount(rn,l)}catch{}switch(l.tag){case 26:Yt||Gr(l,i),va(r,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Yt||Gr(l,i);var d=Ot,g=qn;ni(l.type)&&(Ot=l.stateNode,qn=!1),va(r,i,l),Vo(l.stateNode),Ot=d,qn=g;break;case 5:Yt||Gr(l,i);case 6:if(d=Ot,g=qn,Ot=null,va(r,i,l),Ot=d,qn=g,Ot!==null)if(qn)try{(Ot.nodeType===9?Ot.body:Ot.nodeName==="HTML"?Ot.ownerDocument.body:Ot).removeChild(l.stateNode)}catch(y){yt(l,i,y)}else try{Ot.removeChild(l.stateNode)}catch(y){yt(l,i,y)}break;case 18:Ot!==null&&(qn?(r=Ot,Q0(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,l.stateNode),ul(r)):Q0(Ot,l.stateNode));break;case 4:d=Ot,g=qn,Ot=l.stateNode.containerInfo,qn=!0,va(r,i,l),Ot=d,qn=g;break;case 0:case 11:case 14:case 15:Ka(2,l,i),Yt||Ka(4,l,i),va(r,i,l);break;case 1:Yt||(Gr(l,i),d=l.stateNode,typeof d.componentWillUnmount=="function"&&Gx(l,i,d)),va(r,i,l);break;case 21:va(r,i,l);break;case 22:Yt=(d=Yt)||l.memoizedState!==null,va(r,i,l),Yt=d;break;default:va(r,i,l)}}function n0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{ul(r)}catch(l){yt(i,i.return,l)}}}function r0(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{ul(r)}catch(l){yt(i,i.return,l)}}function w2(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new Jx),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new Jx),i;default:throw Error(a(435,r.tag))}}function Gc(r,i){var l=w2(r);i.forEach(function(d){if(!l.has(d)){l.add(d);var g=R2.bind(null,r,d);d.then(g,g)}})}function Hn(r,i){var l=i.deletions;if(l!==null)for(var d=0;d<l.length;d++){var g=l[d],y=r,S=i,_=S;e:for(;_!==null;){switch(_.tag){case 27:if(ni(_.type)){Ot=_.stateNode,qn=!1;break e}break;case 5:Ot=_.stateNode,qn=!1;break e;case 3:case 4:Ot=_.stateNode.containerInfo,qn=!0;break e}_=_.return}if(Ot===null)throw Error(a(160));t0(y,S,g),Ot=null,qn=!1,y=g.alternate,y!==null&&(y.return=null),g.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)a0(i,r),i=i.sibling}var Lr=null;function a0(r,i){var l=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Hn(i,r),Zn(r),d&4&&(Ka(3,r,r.return),Io(3,r),Ka(5,r,r.return));break;case 1:Hn(i,r),Zn(r),d&512&&(Yt||l===null||Gr(l,l.return)),d&64&&ga&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(l=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var g=Lr;if(Hn(i,r),Zn(r),d&512&&(Yt||l===null||Gr(l,l.return)),d&4){var y=l!==null?l.memoizedState:null;if(d=r.memoizedState,l===null)if(d===null)if(r.stateNode===null){e:{d=r.type,l=r.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":y=g.getElementsByTagName("title")[0],(!y||y[uo]||y[yn]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=g.createElement(d),g.head.insertBefore(y,g.querySelector("head > title"))),Sn(y,d,l),y[yn]=r,un(y),d=y;break e;case"link":var S=a1("link","href",g).get(d+(l.href||""));if(S){for(var _=0;_<S.length;_++)if(y=S[_],y.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&y.getAttribute("rel")===(l.rel==null?null:l.rel)&&y.getAttribute("title")===(l.title==null?null:l.title)&&y.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){S.splice(_,1);break t}}y=g.createElement(d),Sn(y,d,l),g.head.appendChild(y);break;case"meta":if(S=a1("meta","content",g).get(d+(l.content||""))){for(_=0;_<S.length;_++)if(y=S[_],y.getAttribute("content")===(l.content==null?null:""+l.content)&&y.getAttribute("name")===(l.name==null?null:l.name)&&y.getAttribute("property")===(l.property==null?null:l.property)&&y.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&y.getAttribute("charset")===(l.charSet==null?null:l.charSet)){S.splice(_,1);break t}}y=g.createElement(d),Sn(y,d,l),g.head.appendChild(y);break;default:throw Error(a(468,d))}y[yn]=r,un(y),d=y}r.stateNode=d}else i1(g,r.type,r.stateNode);else r.stateNode=r1(g,d,r.memoizedProps);else y!==d?(y===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):y.count--,d===null?i1(g,r.type,r.stateNode):r1(g,d,r.memoizedProps)):d===null&&r.stateNode!==null&&mm(r,r.memoizedProps,l.memoizedProps)}break;case 27:Hn(i,r),Zn(r),d&512&&(Yt||l===null||Gr(l,l.return)),l!==null&&d&4&&mm(r,r.memoizedProps,l.memoizedProps);break;case 5:if(Hn(i,r),Zn(r),d&512&&(Yt||l===null||Gr(l,l.return)),r.flags&32){g=r.stateNode;try{zs(g,"")}catch(Ce){yt(r,r.return,Ce)}}d&4&&r.stateNode!=null&&(g=r.memoizedProps,mm(r,g,l!==null?l.memoizedProps:g)),d&1024&&(vm=!0);break;case 6:if(Hn(i,r),Zn(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,l=r.stateNode;try{l.nodeValue=d}catch(Ce){yt(r,r.return,Ce)}}break;case 3:if(cd=null,g=Lr,Lr=od(i.containerInfo),Hn(i,r),Lr=g,Zn(r),d&4&&l!==null&&l.memoizedState.isDehydrated)try{ul(i.containerInfo)}catch(Ce){yt(r,r.return,Ce)}vm&&(vm=!1,i0(r));break;case 4:d=Lr,Lr=od(r.stateNode.containerInfo),Hn(i,r),Zn(r),Lr=d;break;case 12:Hn(i,r),Zn(r);break;case 31:Hn(i,r),Zn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Gc(r,d)));break;case 13:Hn(i,r),Zn(r),r.child.flags&8192&&r.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Yc=mn()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Gc(r,d)));break;case 22:g=r.memoizedState!==null;var F=l!==null&&l.memoizedState!==null,Y=ga,se=Yt;if(ga=Y||g,Yt=se||F,Hn(i,r),Yt=se,ga=Y,Zn(r),d&8192)e:for(i=r.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(l===null||F||ga||Yt||ts(r)),l=null,i=r;;){if(i.tag===5||i.tag===26){if(l===null){F=l=i;try{if(y=F.stateNode,g)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{_=F.stateNode;var de=F.memoizedProps.style,J=de!=null&&de.hasOwnProperty("display")?de.display:null;_.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(Ce){yt(F,F.return,Ce)}}}else if(i.tag===6){if(l===null){F=i;try{F.stateNode.nodeValue=g?"":F.memoizedProps}catch(Ce){yt(F,F.return,Ce)}}}else if(i.tag===18){if(l===null){F=i;try{var ne=F.stateNode;g?G0(ne,!0):G0(F.stateNode,!1)}catch(Ce){yt(F,F.return,Ce)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,Gc(r,l))));break;case 19:Hn(i,r),Zn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Gc(r,d)));break;case 30:break;case 21:break;default:Hn(i,r),Zn(r)}}function Zn(r){var i=r.flags;if(i&2){try{for(var l,d=r.return;d!==null;){if(Yx(d)){l=d;break}d=d.return}if(l==null)throw Error(a(160));switch(l.tag){case 27:var g=l.stateNode,y=pm(r);Qc(r,y,g);break;case 5:var S=l.stateNode;l.flags&32&&(zs(S,""),l.flags&=-33);var _=pm(r);Qc(r,_,S);break;case 3:case 4:var F=l.stateNode.containerInfo,Y=pm(r);gm(r,Y,F);break;default:throw Error(a(161))}}catch(se){yt(r,r.return,se)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function i0(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;i0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function ya(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)Wx(r,i.alternate,i),i=i.sibling}function ts(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ka(4,i,i.return),ts(i);break;case 1:Gr(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&Gx(i,i.return,l),ts(i);break;case 27:Vo(i.stateNode);case 26:case 5:Gr(i,i.return),ts(i);break;case 22:i.memoizedState===null&&ts(i);break;case 30:ts(i);break;default:ts(i)}r=r.sibling}}function ba(r,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,g=r,y=i,S=y.flags;switch(y.tag){case 0:case 11:case 15:ba(g,y,l),Io(4,y);break;case 1:if(ba(g,y,l),d=y,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(Y){yt(d,d.return,Y)}if(d=y,g=d.updateQueue,g!==null){var _=d.stateNode;try{var F=g.shared.hiddenCallbacks;if(F!==null)for(g.shared.hiddenCallbacks=null,g=0;g<F.length;g++)Ib(F[g],_)}catch(Y){yt(d,d.return,Y)}}l&&S&64&&Qx(y),Lo(y,y.return);break;case 27:Xx(y);case 26:case 5:ba(g,y,l),l&&d===null&&S&4&&Kx(y),Lo(y,y.return);break;case 12:ba(g,y,l);break;case 31:ba(g,y,l),l&&S&4&&n0(g,y);break;case 13:ba(g,y,l),l&&S&4&&r0(g,y);break;case 22:y.memoizedState===null&&ba(g,y,l),Lo(y,y.return);break;case 30:break;default:ba(g,y,l)}i=i.sibling}}function ym(r,i){var l=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==l&&(r!=null&&r.refCount++,l!=null&&ko(l))}function bm(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&ko(r))}function Ur(r,i,l,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)s0(r,i,l,d),i=i.sibling}function s0(r,i,l,d){var g=i.flags;switch(i.tag){case 0:case 11:case 15:Ur(r,i,l,d),g&2048&&Io(9,i);break;case 1:Ur(r,i,l,d);break;case 3:Ur(r,i,l,d),g&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&ko(r)));break;case 12:if(g&2048){Ur(r,i,l,d),r=i.stateNode;try{var y=i.memoizedProps,S=y.id,_=y.onPostCommit;typeof _=="function"&&_(S,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(F){yt(i,i.return,F)}}else Ur(r,i,l,d);break;case 31:Ur(r,i,l,d);break;case 13:Ur(r,i,l,d);break;case 23:break;case 22:y=i.stateNode,S=i.alternate,i.memoizedState!==null?y._visibility&2?Ur(r,i,l,d):Uo(r,i):y._visibility&2?Ur(r,i,l,d):(y._visibility|=2,Js(r,i,l,d,(i.subtreeFlags&10256)!==0||!1)),g&2048&&ym(S,i);break;case 24:Ur(r,i,l,d),g&2048&&bm(i.alternate,i);break;default:Ur(r,i,l,d)}}function Js(r,i,l,d,g){for(g=g&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var y=r,S=i,_=l,F=d,Y=S.flags;switch(S.tag){case 0:case 11:case 15:Js(y,S,_,F,g),Io(8,S);break;case 23:break;case 22:var se=S.stateNode;S.memoizedState!==null?se._visibility&2?Js(y,S,_,F,g):Uo(y,S):(se._visibility|=2,Js(y,S,_,F,g)),g&&Y&2048&&ym(S.alternate,S);break;case 24:Js(y,S,_,F,g),g&&Y&2048&&bm(S.alternate,S);break;default:Js(y,S,_,F,g)}i=i.sibling}}function Uo(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=r,d=i,g=d.flags;switch(d.tag){case 22:Uo(l,d),g&2048&&ym(d.alternate,d);break;case 24:Uo(l,d),g&2048&&bm(d.alternate,d);break;default:Uo(l,d)}i=i.sibling}}var Po=8192;function Ws(r,i,l){if(r.subtreeFlags&Po)for(r=r.child;r!==null;)l0(r,i,l),r=r.sibling}function l0(r,i,l){switch(r.tag){case 26:Ws(r,i,l),r.flags&Po&&r.memoizedState!==null&&lT(l,Lr,r.memoizedState,r.memoizedProps);break;case 5:Ws(r,i,l);break;case 3:case 4:var d=Lr;Lr=od(r.stateNode.containerInfo),Ws(r,i,l),Lr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=Po,Po=16777216,Ws(r,i,l),Po=d):Ws(r,i,l));break;default:Ws(r,i,l)}}function o0(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function Bo(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];cn=d,c0(d,r)}o0(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)u0(r),r=r.sibling}function u0(r){switch(r.tag){case 0:case 11:case 15:Bo(r),r.flags&2048&&Ka(9,r,r.return);break;case 3:Bo(r);break;case 12:Bo(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Kc(r)):Bo(r);break;default:Bo(r)}}function Kc(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];cn=d,c0(d,r)}o0(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ka(8,i,i.return),Kc(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,Kc(i));break;default:Kc(i)}r=r.sibling}}function c0(r,i){for(;cn!==null;){var l=cn;switch(l.tag){case 0:case 11:case 15:Ka(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:ko(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,cn=d;else e:for(l=r;cn!==null;){d=cn;var g=d.sibling,y=d.return;if(e0(d),d===l){cn=null;break e}if(g!==null){g.return=y,cn=g;break e}cn=y}}}var S2={getCacheForType:function(r){var i=xn(Qt),l=i.data.get(r);return l===void 0&&(l=r(),i.data.set(r,l)),l},cacheSignal:function(){return xn(Qt).controller.signal}},k2=typeof WeakMap=="function"?WeakMap:Map,ft=0,Ct=null,Xe=null,tt=0,vt=0,sr=null,Ya=!1,el=!1,xm=!1,xa=0,Bt=0,Xa=0,ns=0,wm=0,lr=0,tl=0,$o=null,Vn=null,Sm=!1,Yc=0,d0=0,Xc=1/0,Jc=null,Ja=null,an=0,Wa=null,nl=null,wa=0,km=0,jm=null,f0=null,Fo=0,Cm=null;function or(){return(ft&2)!==0&&tt!==0?tt&-tt:q.T!==null?Am():_y()}function h0(){if(lr===0)if((tt&536870912)===0||at){var r=Li;Li<<=1,(Li&3932160)===0&&(Li=262144),lr=r}else lr=536870912;return r=ar.current,r!==null&&(r.flags|=32),lr}function Qn(r,i,l){(r===Ct&&(vt===2||vt===9)||r.cancelPendingCommit!==null)&&(rl(r,0),ei(r,tt,lr,!1)),vn(r,l),((ft&2)===0||r!==Ct)&&(r===Ct&&((ft&2)===0&&(ns|=l),Bt===4&&ei(r,tt,lr,!1)),Kr(r))}function m0(r,i,l){if((ft&6)!==0)throw Error(a(327));var d=!l&&(i&127)===0&&(i&r.expiredLanes)===0||La(r,i),g=d?N2(r,i):Em(r,i,!0),y=d;do{if(g===0){el&&!d&&ei(r,i,0,!1);break}else{if(l=r.current.alternate,y&&!j2(l)){g=Em(r,i,!1),y=!1;continue}if(g===2){if(y=i,r.errorRecoveryDisabledLanes&y)var S=0;else S=r.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){i=S;e:{var _=r;g=$o;var F=_.current.memoizedState.isDehydrated;if(F&&(rl(_,S).flags|=256),S=Em(_,S,!1),S!==2){if(xm&&!F){_.errorRecoveryDisabledLanes|=y,ns|=y,g=4;break e}y=Vn,Vn=g,y!==null&&(Vn===null?Vn=y:Vn.push.apply(Vn,y))}g=S}if(y=!1,g!==2)continue}}if(g===1){rl(r,0),ei(r,i,0,!0);break}e:{switch(d=r,y=g,y){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:ei(d,i,lr,!Ya);break e;case 2:Vn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(g=Yc+300-mn(),10<g)){if(ei(d,i,lr,!Ya),Pi(d,0,!0)!==0)break e;wa=i,d.timeoutHandle=Z0(p0.bind(null,d,l,Vn,Jc,Sm,i,lr,ns,tl,Ya,y,"Throttled",-0,0),g);break e}p0(d,l,Vn,Jc,Sm,i,lr,ns,tl,Ya,y,null,-0,0)}}break}while(!0);Kr(r)}function p0(r,i,l,d,g,y,S,_,F,Y,se,de,J,ne){if(r.timeoutHandle=-1,de=i.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:sa},l0(i,y,de);var Ce=(y&62914560)===y?Yc-mn():(y&4194048)===y?d0-mn():0;if(Ce=oT(de,Ce),Ce!==null){wa=y,r.cancelPendingCommit=Ce(k0.bind(null,r,i,y,l,d,g,S,_,F,se,de,null,J,ne)),ei(r,y,S,!Y);return}}k0(r,i,y,l,d,g,S,_,F)}function j2(r){for(var i=r;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var g=l[d],y=g.getSnapshot;g=g.value;try{if(!nr(y(),g))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function ei(r,i,l,d){i&=~wm,i&=~ns,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var g=i;0<g;){var y=31-ht(g),S=1<<y;d[y]=-1,g&=~S}l!==0&&oo(r,l,i)}function Wc(){return(ft&6)===0?(qo(0),!1):!0}function Nm(){if(Xe!==null){if(vt===0)var r=Xe.return;else r=Xe,ca=Qi=null,Fh(r),Qs=null,Co=0,r=Xe;for(;r!==null;)Vx(r.alternate,r),r=r.return;Xe=null}}function rl(r,i){var l=r.timeoutHandle;l!==-1&&(r.timeoutHandle=-1,H2(l)),l=r.cancelPendingCommit,l!==null&&(r.cancelPendingCommit=null,l()),wa=0,Nm(),Ct=r,Xe=l=oa(r.current,null),tt=i,vt=0,sr=null,Ya=!1,el=La(r,i),xm=!1,tl=lr=wm=ns=Xa=Bt=0,Vn=$o=null,Sm=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var g=31-ht(d),y=1<<g;i|=r[g],d&=~y}return xa=i,xc(),l}function g0(r,i){qe=null,q.H=Oo,i===Vs||i===_c?(i=zb(),vt=3):i===Rh?(i=zb(),vt=4):vt=i===am?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,sr=i,Xe===null&&(Bt=1,Fc(r,br(i,r.current)))}function v0(){var r=ar.current;return r===null?!0:(tt&4194048)===tt?kr===null:(tt&62914560)===tt||(tt&536870912)!==0?r===kr:!1}function y0(){var r=q.H;return q.H=Oo,r===null?Oo:r}function b0(){var r=q.A;return q.A=S2,r}function ed(){Bt=4,Ya||(tt&4194048)!==tt&&ar.current!==null||(el=!0),(Xa&134217727)===0&&(ns&134217727)===0||Ct===null||ei(Ct,tt,lr,!1)}function Em(r,i,l){var d=ft;ft|=2;var g=y0(),y=b0();(Ct!==r||tt!==i)&&(Jc=null,rl(r,i)),i=!1;var S=Bt;e:do try{if(vt!==0&&Xe!==null){var _=Xe,F=sr;switch(vt){case 8:Nm(),S=6;break e;case 3:case 2:case 9:case 6:ar.current===null&&(i=!0);var Y=vt;if(vt=0,sr=null,al(r,_,F,Y),l&&el){S=0;break e}break;default:Y=vt,vt=0,sr=null,al(r,_,F,Y)}}C2(),S=Bt;break}catch(se){g0(r,se)}while(!0);return i&&r.shellSuspendCounter++,ca=Qi=null,ft=d,q.H=g,q.A=y,Xe===null&&(Ct=null,tt=0,xc()),S}function C2(){for(;Xe!==null;)x0(Xe)}function N2(r,i){var l=ft;ft|=2;var d=y0(),g=b0();Ct!==r||tt!==i?(Jc=null,Xc=mn()+500,rl(r,i)):el=La(r,i);e:do try{if(vt!==0&&Xe!==null){i=Xe;var y=sr;t:switch(vt){case 1:vt=0,sr=null,al(r,i,y,1);break;case 2:case 9:if(Rb(y)){vt=0,sr=null,w0(i);break}i=function(){vt!==2&&vt!==9||Ct!==r||(vt=7),Kr(r)},y.then(i,i);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:Rb(y)?(vt=0,sr=null,w0(i)):(vt=0,sr=null,al(r,i,y,7));break;case 5:var S=null;switch(Xe.tag){case 26:S=Xe.memoizedState;case 5:case 27:var _=Xe;if(S?s1(S):_.stateNode.complete){vt=0,sr=null;var F=_.sibling;if(F!==null)Xe=F;else{var Y=_.return;Y!==null?(Xe=Y,td(Y)):Xe=null}break t}}vt=0,sr=null,al(r,i,y,5);break;case 6:vt=0,sr=null,al(r,i,y,6);break;case 8:Nm(),Bt=6;break e;default:throw Error(a(462))}}E2();break}catch(se){g0(r,se)}while(!0);return ca=Qi=null,q.H=d,q.A=g,ft=l,Xe!==null?0:(Ct=null,tt=0,xc(),Bt)}function E2(){for(;Xe!==null&&!io();)x0(Xe)}function x0(r){var i=Hx(r.alternate,r,xa);r.memoizedProps=r.pendingProps,i===null?td(r):Xe=i}function w0(r){var i=r,l=i.alternate;switch(i.tag){case 15:case 0:i=Ux(l,i,i.pendingProps,i.type,void 0,tt);break;case 11:i=Ux(l,i,i.pendingProps,i.type.render,i.ref,tt);break;case 5:Fh(i);default:Vx(l,i),i=Xe=bb(i,xa),i=Hx(l,i,xa)}r.memoizedProps=r.pendingProps,i===null?td(r):Xe=i}function al(r,i,l,d){ca=Qi=null,Fh(i),Qs=null,Co=0;var g=i.return;try{if(p2(r,g,i,l,tt)){Bt=1,Fc(r,br(l,r.current)),Xe=null;return}}catch(y){if(g!==null)throw Xe=g,y;Bt=1,Fc(r,br(l,r.current)),Xe=null;return}i.flags&32768?(at||d===1?r=!0:el||(tt&536870912)!==0?r=!1:(Ya=r=!0,(d===2||d===9||d===3||d===6)&&(d=ar.current,d!==null&&d.tag===13&&(d.flags|=16384))),S0(i,r)):td(i)}function td(r){var i=r;do{if((i.flags&32768)!==0){S0(i,Ya);return}r=i.return;var l=y2(i.alternate,i,xa);if(l!==null){Xe=l;return}if(i=i.sibling,i!==null){Xe=i;return}Xe=i=r}while(i!==null);Bt===0&&(Bt=5)}function S0(r,i){do{var l=b2(r.alternate,r);if(l!==null){l.flags&=32767,Xe=l;return}if(l=r.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(r=r.sibling,r!==null)){Xe=r;return}Xe=r=l}while(r!==null);Bt=6,Xe=null}function k0(r,i,l,d,g,y,S,_,F){r.cancelPendingCommit=null;do nd();while(an!==0);if((ft&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(y=i.lanes|i.childLanes,y|=ph,aa(r,l,y,S,_,F),r===Ct&&(Xe=Ct=null,tt=0),nl=i,Wa=r,wa=l,km=y,jm=g,f0=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,A2(Pe,function(){return _0(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,g=ee.p,ee.p=2,S=ft,ft|=4;try{x2(r,i,l)}finally{ft=S,ee.p=g,q.T=d}}an=1,j0(),C0(),N0()}}function j0(){if(an===1){an=0;var r=Wa,i=nl,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=q.T,q.T=null;var d=ee.p;ee.p=2;var g=ft;ft|=4;try{a0(i,r);var y=Pm,S=cb(r.containerInfo),_=y.focusedElem,F=y.selectionRange;if(S!==_&&_&&_.ownerDocument&&ub(_.ownerDocument.documentElement,_)){if(F!==null&&ch(_)){var Y=F.start,se=F.end;if(se===void 0&&(se=Y),"selectionStart"in _)_.selectionStart=Y,_.selectionEnd=Math.min(se,_.value.length);else{var de=_.ownerDocument||document,J=de&&de.defaultView||window;if(J.getSelection){var ne=J.getSelection(),Ce=_.textContent.length,Le=Math.min(F.start,Ce),wt=F.end===void 0?Le:Math.min(F.end,Ce);!ne.extend&&Le>wt&&(S=wt,wt=Le,Le=S);var Q=ob(_,Le),H=ob(_,wt);if(Q&&H&&(ne.rangeCount!==1||ne.anchorNode!==Q.node||ne.anchorOffset!==Q.offset||ne.focusNode!==H.node||ne.focusOffset!==H.offset)){var K=de.createRange();K.setStart(Q.node,Q.offset),ne.removeAllRanges(),Le>wt?(ne.addRange(K),ne.extend(H.node,H.offset)):(K.setEnd(H.node,H.offset),ne.addRange(K))}}}}for(de=[],ne=_;ne=ne.parentNode;)ne.nodeType===1&&de.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<de.length;_++){var ue=de[_];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}md=!!Um,Pm=Um=null}finally{ft=g,ee.p=d,q.T=l}}r.current=i,an=2}}function C0(){if(an===2){an=0;var r=Wa,i=nl,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=q.T,q.T=null;var d=ee.p;ee.p=2;var g=ft;ft|=4;try{Wx(r,i.alternate,i)}finally{ft=g,ee.p=d,q.T=l}}an=3}}function N0(){if(an===4||an===3){an=0,so();var r=Wa,i=nl,l=wa,d=f0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?an=5:(an=0,nl=Wa=null,E0(r,r.pendingLanes));var g=r.pendingLanes;if(g===0&&(Ja=null),Zf(l),i=i.stateNode,Ht&&typeof Ht.onCommitFiberRoot=="function")try{Ht.onCommitFiberRoot(rn,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=q.T,g=ee.p,ee.p=2,q.T=null;try{for(var y=r.onRecoverableError,S=0;S<d.length;S++){var _=d[S];y(_.value,{componentStack:_.stack})}}finally{q.T=i,ee.p=g}}(wa&3)!==0&&nd(),Kr(r),g=r.pendingLanes,(l&261930)!==0&&(g&42)!==0?r===Cm?Fo++:(Fo=0,Cm=r):Fo=0,qo(0)}}function E0(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,ko(i)))}function nd(){return j0(),C0(),N0(),_0()}function _0(){if(an!==5)return!1;var r=Wa,i=km;km=0;var l=Zf(wa),d=q.T,g=ee.p;try{ee.p=32>l?32:l,q.T=null,l=jm,jm=null;var y=Wa,S=wa;if(an=0,nl=Wa=null,wa=0,(ft&6)!==0)throw Error(a(331));var _=ft;if(ft|=4,u0(y.current),s0(y,y.current,S,l),ft=_,qo(0,!1),Ht&&typeof Ht.onPostCommitFiberRoot=="function")try{Ht.onPostCommitFiberRoot(rn,y)}catch{}return!0}finally{ee.p=g,q.T=d,E0(r,i)}}function T0(r,i,l){i=br(l,i),i=rm(r.stateNode,i,2),r=Va(r,i,2),r!==null&&(vn(r,2),Kr(r))}function yt(r,i,l){if(r.tag===3)T0(r,r,l);else for(;i!==null;){if(i.tag===3){T0(i,r,l);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ja===null||!Ja.has(d))){r=br(l,r),l=Rx(2),d=Va(i,l,2),d!==null&&(Ax(l,d,i,r),vn(d,2),Kr(d));break}}i=i.return}}function _m(r,i,l){var d=r.pingCache;if(d===null){d=r.pingCache=new k2;var g=new Set;d.set(i,g)}else g=d.get(i),g===void 0&&(g=new Set,d.set(i,g));g.has(l)||(xm=!0,g.add(l),r=_2.bind(null,r,i,l),i.then(r,r))}function _2(r,i,l){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&l,r.warmLanes&=~l,Ct===r&&(tt&l)===l&&(Bt===4||Bt===3&&(tt&62914560)===tt&&300>mn()-Yc?(ft&2)===0&&rl(r,0):wm|=l,tl===tt&&(tl=0)),Kr(r)}function R0(r,i){i===0&&(i=we()),r=Hi(r,i),r!==null&&(vn(r,i),Kr(r))}function T2(r){var i=r.memoizedState,l=0;i!==null&&(l=i.retryLane),R0(r,l)}function R2(r,i){var l=0;switch(r.tag){case 31:case 13:var d=r.stateNode,g=r.memoizedState;g!==null&&(l=g.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(i),R0(r,l)}function A2(r,i){return Ia(r,i)}var rd=null,il=null,Tm=!1,ad=!1,Rm=!1,ti=0;function Kr(r){r!==il&&r.next===null&&(il===null?rd=il=r:il=il.next=r),ad=!0,Tm||(Tm=!0,O2())}function qo(r,i){if(!Rm&&ad){Rm=!0;do for(var l=!1,d=rd;d!==null;){if(r!==0){var g=d.pendingLanes;if(g===0)var y=0;else{var S=d.suspendedLanes,_=d.pingedLanes;y=(1<<31-ht(42|r)+1)-1,y&=g&~(S&~_),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(l=!0,D0(d,y))}else y=tt,y=Pi(d,d===Ct?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||La(d,y)||(l=!0,D0(d,y));d=d.next}while(l);Rm=!1}}function z2(){A0()}function A0(){ad=Tm=!1;var r=0;ti!==0&&q2()&&(r=ti);for(var i=mn(),l=null,d=rd;d!==null;){var g=d.next,y=z0(d,i);y===0?(d.next=null,l===null?rd=g:l.next=g,g===null&&(il=l)):(l=d,(r!==0||(y&3)!==0)&&(ad=!0)),d=g}an!==0&&an!==5||qo(r),ti!==0&&(ti=0)}function z0(r,i){for(var l=r.suspendedLanes,d=r.pingedLanes,g=r.expirationTimes,y=r.pendingLanes&-62914561;0<y;){var S=31-ht(y),_=1<<S,F=g[S];F===-1?((_&l)===0||(_&d)!==0)&&(g[S]=lc(_,i)):F<=i&&(r.expiredLanes|=_),y&=~_}if(i=Ct,l=tt,l=Pi(r,r===i?l:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,l===0||r===i&&(vt===2||vt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&ra(d),r.callbackNode=null,r.callbackPriority=0;if((l&3)===0||La(r,l)){if(i=l&-l,i===r.callbackPriority)return i;switch(d!==null&&ra(d),Zf(l)){case 2:case 8:l=ve;break;case 32:l=Pe;break;case 268435456:l=rt;break;default:l=Pe}return d=O0.bind(null,r),l=Ia(l,d),r.callbackPriority=i,r.callbackNode=l,i}return d!==null&&d!==null&&ra(d),r.callbackPriority=2,r.callbackNode=null,2}function O0(r,i){if(an!==0&&an!==5)return r.callbackNode=null,r.callbackPriority=0,null;var l=r.callbackNode;if(nd()&&r.callbackNode!==l)return null;var d=tt;return d=Pi(r,r===Ct?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(m0(r,d,i),z0(r,mn()),r.callbackNode!=null&&r.callbackNode===l?O0.bind(null,r):null)}function D0(r,i){if(nd())return null;m0(r,i,!0)}function O2(){Z2(function(){(ft&6)!==0?Ia(oe,z2):A0()})}function Am(){if(ti===0){var r=Hs;r===0&&(r=Ii,Ii<<=1,(Ii&261888)===0&&(Ii=256)),ti=r}return ti}function M0(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:fc(""+r)}function I0(r,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,r.id&&l.setAttribute("form",r.id),i.parentNode.insertBefore(l,i),r=new FormData(r),l.parentNode.removeChild(l),r}function D2(r,i,l,d,g){if(i==="submit"&&l&&l.stateNode===g){var y=M0((g[$n]||null).action),S=d.submitter;S&&(i=(i=S[$n]||null)?M0(i.formAction):S.getAttribute("formAction"),i!==null&&(y=i,S=null));var _=new gc("action","action",null,d,g);r.push({event:_,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ti!==0){var F=S?I0(g,S):new FormData(g);Xh(l,{pending:!0,data:F,method:g.method,action:y},null,F)}}else typeof y=="function"&&(_.preventDefault(),F=S?I0(g,S):new FormData(g),Xh(l,{pending:!0,data:F,method:g.method,action:y},y,F))},currentTarget:g}]})}}for(var zm=0;zm<mh.length;zm++){var Om=mh[zm],M2=Om.toLowerCase(),I2=Om[0].toUpperCase()+Om.slice(1);Ir(M2,"on"+I2)}Ir(hb,"onAnimationEnd"),Ir(mb,"onAnimationIteration"),Ir(pb,"onAnimationStart"),Ir("dblclick","onDoubleClick"),Ir("focusin","onFocus"),Ir("focusout","onBlur"),Ir(J_,"onTransitionRun"),Ir(W_,"onTransitionStart"),Ir(e2,"onTransitionCancel"),Ir(gb,"onTransitionEnd"),Rs("onMouseEnter",["mouseout","mouseover"]),Rs("onMouseLeave",["mouseout","mouseover"]),Rs("onPointerEnter",["pointerout","pointerover"]),Rs("onPointerLeave",["pointerout","pointerover"]),Bi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ho="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(" "),L2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ho));function L0(r,i){i=(i&4)!==0;for(var l=0;l<r.length;l++){var d=r[l],g=d.event;d=d.listeners;e:{var y=void 0;if(i)for(var S=d.length-1;0<=S;S--){var _=d[S],F=_.instance,Y=_.currentTarget;if(_=_.listener,F!==y&&g.isPropagationStopped())break e;y=_,g.currentTarget=Y;try{y(g)}catch(se){bc(se)}g.currentTarget=null,y=F}else for(S=0;S<d.length;S++){if(_=d[S],F=_.instance,Y=_.currentTarget,_=_.listener,F!==y&&g.isPropagationStopped())break e;y=_,g.currentTarget=Y;try{y(g)}catch(se){bc(se)}g.currentTarget=null,y=F}}}}function Je(r,i){var l=i[Vf];l===void 0&&(l=i[Vf]=new Set);var d=r+"__bubble";l.has(d)||(U0(i,r,2,!1),l.add(d))}function Dm(r,i,l){var d=0;i&&(d|=4),U0(l,r,d,i)}var id="_reactListening"+Math.random().toString(36).slice(2);function Mm(r){if(!r[id]){r[id]=!0,Ay.forEach(function(l){l!=="selectionchange"&&(L2.has(l)||Dm(l,!1,r),Dm(l,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[id]||(i[id]=!0,Dm("selectionchange",!1,i))}}function U0(r,i,l,d){switch(h1(i)){case 2:var g=dT;break;case 8:g=fT;break;default:g=Ym}l=g.bind(null,i,l,r),g=void 0,!th||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(g=!0),d?g!==void 0?r.addEventListener(i,l,{capture:!0,passive:g}):r.addEventListener(i,l,!0):g!==void 0?r.addEventListener(i,l,{passive:g}):r.addEventListener(i,l,!1)}function Im(r,i,l,d,g){var y=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var S=d.tag;if(S===3||S===4){var _=d.stateNode.containerInfo;if(_===g)break;if(S===4)for(S=d.return;S!==null;){var F=S.tag;if((F===3||F===4)&&S.stateNode.containerInfo===g)return;S=S.return}for(;_!==null;){if(S=Es(_),S===null)return;if(F=S.tag,F===5||F===6||F===26||F===27){d=y=S;continue e}_=_.parentNode}}d=d.return}qy(function(){var Y=y,se=Wf(l),de=[];e:{var J=vb.get(r);if(J!==void 0){var ne=gc,Ce=r;switch(r){case"keypress":if(mc(l)===0)break e;case"keydown":case"keyup":ne=R_;break;case"focusin":Ce="focus",ne=ih;break;case"focusout":Ce="blur",ne=ih;break;case"beforeblur":case"afterblur":ne=ih;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=Vy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=y_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=O_;break;case hb:case mb:case pb:ne=w_;break;case gb:ne=M_;break;case"scroll":case"scrollend":ne=g_;break;case"wheel":ne=L_;break;case"copy":case"cut":case"paste":ne=k_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=Gy;break;case"toggle":case"beforetoggle":ne=P_}var Le=(i&4)!==0,wt=!Le&&(r==="scroll"||r==="scrollend"),Q=Le?J!==null?J+"Capture":null:J;Le=[];for(var H=Y,K;H!==null;){var ue=H;if(K=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||K===null||Q===null||(ue=fo(H,Q),ue!=null&&Le.push(Zo(H,ue,K))),wt)break;H=H.return}0<Le.length&&(J=new ne(J,Ce,null,l,se),de.push({event:J,listeners:Le}))}}if((i&7)===0){e:{if(J=r==="mouseover"||r==="pointerover",ne=r==="mouseout"||r==="pointerout",J&&l!==Jf&&(Ce=l.relatedTarget||l.fromElement)&&(Es(Ce)||Ce[Ns]))break e;if((ne||J)&&(J=se.window===se?se:(J=se.ownerDocument)?J.defaultView||J.parentWindow:window,ne?(Ce=l.relatedTarget||l.toElement,ne=Y,Ce=Ce?Es(Ce):null,Ce!==null&&(wt=o(Ce),Le=Ce.tag,Ce!==wt||Le!==5&&Le!==27&&Le!==6)&&(Ce=null)):(ne=null,Ce=Y),ne!==Ce)){if(Le=Vy,ue="onMouseLeave",Q="onMouseEnter",H="mouse",(r==="pointerout"||r==="pointerover")&&(Le=Gy,ue="onPointerLeave",Q="onPointerEnter",H="pointer"),wt=ne==null?J:co(ne),K=Ce==null?J:co(Ce),J=new Le(ue,H+"leave",ne,l,se),J.target=wt,J.relatedTarget=K,ue=null,Es(se)===Y&&(Le=new Le(Q,H+"enter",Ce,l,se),Le.target=K,Le.relatedTarget=wt,ue=Le),wt=ue,ne&&Ce)t:{for(Le=U2,Q=ne,H=Ce,K=0,ue=Q;ue;ue=Le(ue))K++;ue=0;for(var ze=H;ze;ze=Le(ze))ue++;for(;0<K-ue;)Q=Le(Q),K--;for(;0<ue-K;)H=Le(H),ue--;for(;K--;){if(Q===H||H!==null&&Q===H.alternate){Le=Q;break t}Q=Le(Q),H=Le(H)}Le=null}else Le=null;ne!==null&&P0(de,J,ne,Le,!1),Ce!==null&&wt!==null&&P0(de,wt,Ce,Le,!0)}}e:{if(J=Y?co(Y):window,ne=J.nodeName&&J.nodeName.toLowerCase(),ne==="select"||ne==="input"&&J.type==="file")var ut=nb;else if(eb(J))if(rb)ut=K_;else{ut=Q_;var _e=V_}else ne=J.nodeName,!ne||ne.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Y&&Xf(Y.elementType)&&(ut=nb):ut=G_;if(ut&&(ut=ut(r,Y))){tb(de,ut,l,se);break e}_e&&_e(r,J,Y),r==="focusout"&&Y&&J.type==="number"&&Y.memoizedProps.value!=null&&Yf(J,"number",J.value)}switch(_e=Y?co(Y):window,r){case"focusin":(eb(_e)||_e.contentEditable==="true")&&(Is=_e,dh=Y,xo=null);break;case"focusout":xo=dh=Is=null;break;case"mousedown":fh=!0;break;case"contextmenu":case"mouseup":case"dragend":fh=!1,db(de,l,se);break;case"selectionchange":if(X_)break;case"keydown":case"keyup":db(de,l,se)}var Ze;if(lh)e:{switch(r){case"compositionstart":var nt="onCompositionStart";break e;case"compositionend":nt="onCompositionEnd";break e;case"compositionupdate":nt="onCompositionUpdate";break e}nt=void 0}else Ms?Jy(r,l)&&(nt="onCompositionEnd"):r==="keydown"&&l.keyCode===229&&(nt="onCompositionStart");nt&&(Ky&&l.locale!=="ko"&&(Ms||nt!=="onCompositionStart"?nt==="onCompositionEnd"&&Ms&&(Ze=Hy()):(Pa=se,nh="value"in Pa?Pa.value:Pa.textContent,Ms=!0)),_e=sd(Y,nt),0<_e.length&&(nt=new Qy(nt,r,null,l,se),de.push({event:nt,listeners:_e}),Ze?nt.data=Ze:(Ze=Wy(l),Ze!==null&&(nt.data=Ze)))),(Ze=$_?F_(r,l):q_(r,l))&&(nt=sd(Y,"onBeforeInput"),0<nt.length&&(_e=new Qy("onBeforeInput","beforeinput",null,l,se),de.push({event:_e,listeners:nt}),_e.data=Ze)),D2(de,r,Y,l,se)}L0(de,i)})}function Zo(r,i,l){return{instance:r,listener:i,currentTarget:l}}function sd(r,i){for(var l=i+"Capture",d=[];r!==null;){var g=r,y=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||y===null||(g=fo(r,l),g!=null&&d.unshift(Zo(r,g,y)),g=fo(r,i),g!=null&&d.push(Zo(r,g,y))),r.tag===3)return d;r=r.return}return[]}function U2(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function P0(r,i,l,d,g){for(var y=i._reactName,S=[];l!==null&&l!==d;){var _=l,F=_.alternate,Y=_.stateNode;if(_=_.tag,F!==null&&F===d)break;_!==5&&_!==26&&_!==27||Y===null||(F=Y,g?(Y=fo(l,y),Y!=null&&S.unshift(Zo(l,Y,F))):g||(Y=fo(l,y),Y!=null&&S.push(Zo(l,Y,F)))),l=l.return}S.length!==0&&r.push({event:i,listeners:S})}var P2=/\r\n?/g,B2=/\u0000|\uFFFD/g;function B0(r){return(typeof r=="string"?r:""+r).replace(P2,`
49
+ `).replace(B2,"")}function $0(r,i){return i=B0(i),B0(r)===i}function xt(r,i,l,d,g,y){switch(l){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||zs(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&zs(r,""+d);break;case"className":cc(r,"class",d);break;case"tabIndex":cc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":cc(r,l,d);break;case"style":$y(r,d,y);break;case"data":if(i!=="object"){cc(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||l!=="href")){r.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(l);break}d=fc(""+d),r.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(l,"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 y=="function"&&(l==="formAction"?(i!=="input"&&xt(r,i,"name",g.name,g,null),xt(r,i,"formEncType",g.formEncType,g,null),xt(r,i,"formMethod",g.formMethod,g,null),xt(r,i,"formTarget",g.formTarget,g,null)):(xt(r,i,"encType",g.encType,g,null),xt(r,i,"method",g.method,g,null),xt(r,i,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(l);break}d=fc(""+d),r.setAttribute(l,d);break;case"onClick":d!=null&&(r.onclick=sa);break;case"onScroll":d!=null&&Je("scroll",r);break;case"onScrollEnd":d!=null&&Je("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(g.children!=null)throw Error(a(60));r.innerHTML=l}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}l=fc(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,""+d):r.removeAttribute(l);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":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,""):r.removeAttribute(l);break;case"capture":case"download":d===!0?r.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,d):r.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(l,d):r.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(l):r.setAttribute(l,d);break;case"popover":Je("beforetoggle",r),Je("toggle",r),uc(r,"popover",d);break;case"xlinkActuate":ia(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":ia(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":ia(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":ia(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":ia(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":ia(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":ia(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":ia(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":ia(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":uc(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=m_.get(l)||l,uc(r,l,d))}}function Lm(r,i,l,d,g,y){switch(l){case"style":$y(r,d,y);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(g.children!=null)throw Error(a(60));r.innerHTML=l}}break;case"children":typeof d=="string"?zs(r,d):(typeof d=="number"||typeof d=="bigint")&&zs(r,""+d);break;case"onScroll":d!=null&&Je("scroll",r);break;case"onScrollEnd":d!=null&&Je("scrollend",r);break;case"onClick":d!=null&&(r.onclick=sa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zy.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),i=l.slice(2,g?l.length-7:void 0),y=r[$n]||null,y=y!=null?y[l]:null,typeof y=="function"&&r.removeEventListener(i,y,g),typeof d=="function")){typeof y!="function"&&y!==null&&(l in r?r[l]=null:r.hasAttribute(l)&&r.removeAttribute(l)),r.addEventListener(i,d,g);break e}l in r?r[l]=d:d===!0?r.setAttribute(l,""):uc(r,l,d)}}}function Sn(r,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",r),Je("load",r);var d=!1,g=!1,y;for(y in l)if(l.hasOwnProperty(y)){var S=l[y];if(S!=null)switch(y){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:xt(r,i,y,S,l,null)}}g&&xt(r,i,"srcSet",l.srcSet,l,null),d&&xt(r,i,"src",l.src,l,null);return;case"input":Je("invalid",r);var _=y=S=g=null,F=null,Y=null;for(d in l)if(l.hasOwnProperty(d)){var se=l[d];if(se!=null)switch(d){case"name":g=se;break;case"type":S=se;break;case"checked":F=se;break;case"defaultChecked":Y=se;break;case"value":y=se;break;case"defaultValue":_=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,i));break;default:xt(r,i,d,se,l,null)}}Ly(r,y,_,F,Y,S,g,!1);return;case"select":Je("invalid",r),d=S=y=null;for(g in l)if(l.hasOwnProperty(g)&&(_=l[g],_!=null))switch(g){case"value":y=_;break;case"defaultValue":S=_;break;case"multiple":d=_;default:xt(r,i,g,_,l,null)}i=y,l=S,r.multiple=!!d,i!=null?As(r,!!d,i,!1):l!=null&&As(r,!!d,l,!0);return;case"textarea":Je("invalid",r),y=g=d=null;for(S in l)if(l.hasOwnProperty(S)&&(_=l[S],_!=null))switch(S){case"value":d=_;break;case"defaultValue":g=_;break;case"children":y=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(a(91));break;default:xt(r,i,S,_,l,null)}Py(r,d,g,y);return;case"option":for(F in l)if(l.hasOwnProperty(F)&&(d=l[F],d!=null))switch(F){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:xt(r,i,F,d,l,null)}return;case"dialog":Je("beforetoggle",r),Je("toggle",r),Je("cancel",r),Je("close",r);break;case"iframe":case"object":Je("load",r);break;case"video":case"audio":for(d=0;d<Ho.length;d++)Je(Ho[d],r);break;case"image":Je("error",r),Je("load",r);break;case"details":Je("toggle",r);break;case"embed":case"source":case"link":Je("error",r),Je("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in l)if(l.hasOwnProperty(Y)&&(d=l[Y],d!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:xt(r,i,Y,d,l,null)}return;default:if(Xf(i)){for(se in l)l.hasOwnProperty(se)&&(d=l[se],d!==void 0&&Lm(r,i,se,d,l,void 0));return}}for(_ in l)l.hasOwnProperty(_)&&(d=l[_],d!=null&&xt(r,i,_,d,l,null))}function $2(r,i,l,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,y=null,S=null,_=null,F=null,Y=null,se=null;for(ne in l){var de=l[ne];if(l.hasOwnProperty(ne)&&de!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":F=de;default:d.hasOwnProperty(ne)||xt(r,i,ne,null,d,de)}}for(var J in d){var ne=d[J];if(de=l[J],d.hasOwnProperty(J)&&(ne!=null||de!=null))switch(J){case"type":y=ne;break;case"name":g=ne;break;case"checked":Y=ne;break;case"defaultChecked":se=ne;break;case"value":S=ne;break;case"defaultValue":_=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(a(137,i));break;default:ne!==de&&xt(r,i,J,ne,d,de)}}Kf(r,S,_,F,Y,se,y,g);return;case"select":ne=S=_=J=null;for(y in l)if(F=l[y],l.hasOwnProperty(y)&&F!=null)switch(y){case"value":break;case"multiple":ne=F;default:d.hasOwnProperty(y)||xt(r,i,y,null,d,F)}for(g in d)if(y=d[g],F=l[g],d.hasOwnProperty(g)&&(y!=null||F!=null))switch(g){case"value":J=y;break;case"defaultValue":_=y;break;case"multiple":S=y;default:y!==F&&xt(r,i,g,y,d,F)}i=_,l=S,d=ne,J!=null?As(r,!!l,J,!1):!!d!=!!l&&(i!=null?As(r,!!l,i,!0):As(r,!!l,l?[]:"",!1));return;case"textarea":ne=J=null;for(_ in l)if(g=l[_],l.hasOwnProperty(_)&&g!=null&&!d.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:xt(r,i,_,null,d,g)}for(S in d)if(g=d[S],y=l[S],d.hasOwnProperty(S)&&(g!=null||y!=null))switch(S){case"value":J=g;break;case"defaultValue":ne=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(a(91));break;default:g!==y&&xt(r,i,S,g,d,y)}Uy(r,J,ne);return;case"option":for(var Ce in l)if(J=l[Ce],l.hasOwnProperty(Ce)&&J!=null&&!d.hasOwnProperty(Ce))switch(Ce){case"selected":r.selected=!1;break;default:xt(r,i,Ce,null,d,J)}for(F in d)if(J=d[F],ne=l[F],d.hasOwnProperty(F)&&J!==ne&&(J!=null||ne!=null))switch(F){case"selected":r.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:xt(r,i,F,J,d,ne)}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 Le in l)J=l[Le],l.hasOwnProperty(Le)&&J!=null&&!d.hasOwnProperty(Le)&&xt(r,i,Le,null,d,J);for(Y in d)if(J=d[Y],ne=l[Y],d.hasOwnProperty(Y)&&J!==ne&&(J!=null||ne!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(a(137,i));break;default:xt(r,i,Y,J,d,ne)}return;default:if(Xf(i)){for(var wt in l)J=l[wt],l.hasOwnProperty(wt)&&J!==void 0&&!d.hasOwnProperty(wt)&&Lm(r,i,wt,void 0,d,J);for(se in d)J=d[se],ne=l[se],!d.hasOwnProperty(se)||J===ne||J===void 0&&ne===void 0||Lm(r,i,se,J,d,ne);return}}for(var Q in l)J=l[Q],l.hasOwnProperty(Q)&&J!=null&&!d.hasOwnProperty(Q)&&xt(r,i,Q,null,d,J);for(de in d)J=d[de],ne=l[de],!d.hasOwnProperty(de)||J===ne||J==null&&ne==null||xt(r,i,de,J,d,ne)}function F0(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function F2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var g=l[d],y=g.transferSize,S=g.initiatorType,_=g.duration;if(y&&_&&F0(S)){for(S=0,_=g.responseEnd,d+=1;d<l.length;d++){var F=l[d],Y=F.startTime;if(Y>_)break;var se=F.transferSize,de=F.initiatorType;se&&F0(de)&&(F=F.responseEnd,S+=se*(F<_?1:(_-Y)/(F-Y)))}if(--d,i+=8*(y+S)/(g.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Um=null,Pm=null;function ld(r){return r.nodeType===9?r:r.ownerDocument}function q0(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function H0(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Bm(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var $m=null;function q2(){var r=window.event;return r&&r.type==="popstate"?r===$m?!1:($m=r,!0):($m=null,!1)}var Z0=typeof setTimeout=="function"?setTimeout:void 0,H2=typeof clearTimeout=="function"?clearTimeout:void 0,V0=typeof Promise=="function"?Promise:void 0,Z2=typeof queueMicrotask=="function"?queueMicrotask:typeof V0<"u"?function(r){return V0.resolve(null).then(r).catch(V2)}:Z0;function V2(r){setTimeout(function(){throw r})}function ni(r){return r==="head"}function Q0(r,i){var l=i,d=0;do{var g=l.nextSibling;if(r.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(d===0){r.removeChild(g),ul(i);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")Vo(r.ownerDocument.documentElement);else if(l==="head"){l=r.ownerDocument.head,Vo(l);for(var y=l.firstChild;y;){var S=y.nextSibling,_=y.nodeName;y[uo]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&y.rel.toLowerCase()==="stylesheet"||l.removeChild(y),y=S}}else l==="body"&&Vo(r.ownerDocument.body);l=g}while(l);ul(i)}function G0(r,i){var l=r;r=0;do{var d=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(r===0)break;r--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||r++;l=d}while(l)}function Fm(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Fm(l),Qf(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}r.removeChild(l)}}function Q2(r,i,l,d){for(;r.nodeType===1;){var g=l;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[uo])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(y=r.getAttribute("rel"),y==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(y!==g.rel||r.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||r.getAttribute("title")!==(g.title==null?null:g.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(y=r.getAttribute("src"),(y!==(g.src==null?null:g.src)||r.getAttribute("type")!==(g.type==null?null:g.type)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&y&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var y=g.name==null?null:""+g.name;if(g.type==="hidden"&&r.getAttribute("name")===y)return r}else return r;if(r=jr(r.nextSibling),r===null)break}return null}function G2(r,i,l){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!l||(r=jr(r.nextSibling),r===null))return null;return r}function K0(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=jr(r.nextSibling),r===null))return null;return r}function qm(r){return r.data==="$?"||r.data==="$~"}function Hm(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function K2(r,i){var l=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||l.readyState!=="loading")i();else{var d=function(){i(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function jr(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Zm=null;function Y0(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var l=r.data;if(l==="/$"||l==="/&"){if(i===0)return jr(r.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}r=r.nextSibling}return null}function X0(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var l=r.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return r;i--}else l!=="/$"&&l!=="/&"||i++}r=r.previousSibling}return null}function J0(r,i,l){switch(i=ld(l),r){case"html":if(r=i.documentElement,!r)throw Error(a(452));return r;case"head":if(r=i.head,!r)throw Error(a(453));return r;case"body":if(r=i.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function Vo(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Qf(r)}var Cr=new Map,W0=new Set;function od(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Sa=ee.d;ee.d={f:Y2,r:X2,D:J2,C:W2,L:eT,m:tT,X:rT,S:nT,M:aT};function Y2(){var r=Sa.f(),i=Wc();return r||i}function X2(r){var i=_s(r);i!==null&&i.tag===5&&i.type==="form"?gx(i):Sa.r(r)}var sl=typeof document>"u"?null:document;function e1(r,i,l){var d=sl;if(d&&typeof i=="string"&&i){var g=vr(i);g='link[rel="'+r+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),W0.has(g)||(W0.add(g),r={rel:r,crossOrigin:l,href:i},d.querySelector(g)===null&&(i=d.createElement("link"),Sn(i,"link",r),un(i),d.head.appendChild(i)))}}function J2(r){Sa.D(r),e1("dns-prefetch",r,null)}function W2(r,i){Sa.C(r,i),e1("preconnect",r,i)}function eT(r,i,l){Sa.L(r,i,l);var d=sl;if(d&&r&&i){var g='link[rel="preload"][as="'+vr(i)+'"]';i==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+vr(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+vr(l.imageSizes)+'"]')):g+='[href="'+vr(r)+'"]';var y=g;switch(i){case"style":y=ll(r);break;case"script":y=ol(r)}Cr.has(y)||(r=p({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:r,as:i},l),Cr.set(y,r),d.querySelector(g)!==null||i==="style"&&d.querySelector(Qo(y))||i==="script"&&d.querySelector(Go(y))||(i=d.createElement("link"),Sn(i,"link",r),un(i),d.head.appendChild(i)))}}function tT(r,i){Sa.m(r,i);var l=sl;if(l&&r){var d=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+vr(d)+'"][href="'+vr(r)+'"]',y=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=ol(r)}if(!Cr.has(y)&&(r=p({rel:"modulepreload",href:r},i),Cr.set(y,r),l.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Go(y)))return}d=l.createElement("link"),Sn(d,"link",r),un(d),l.head.appendChild(d)}}}function nT(r,i,l){Sa.S(r,i,l);var d=sl;if(d&&r){var g=Ts(d).hoistableStyles,y=ll(r);i=i||"default";var S=g.get(y);if(!S){var _={loading:0,preload:null};if(S=d.querySelector(Qo(y)))_.loading=5;else{r=p({rel:"stylesheet",href:r,"data-precedence":i},l),(l=Cr.get(y))&&Vm(r,l);var F=S=d.createElement("link");un(F),Sn(F,"link",r),F._p=new Promise(function(Y,se){F.onload=Y,F.onerror=se}),F.addEventListener("load",function(){_.loading|=1}),F.addEventListener("error",function(){_.loading|=2}),_.loading|=4,ud(S,i,d)}S={type:"stylesheet",instance:S,count:1,state:_},g.set(y,S)}}}function rT(r,i){Sa.X(r,i);var l=sl;if(l&&r){var d=Ts(l).hoistableScripts,g=ol(r),y=d.get(g);y||(y=l.querySelector(Go(g)),y||(r=p({src:r,async:!0},i),(i=Cr.get(g))&&Qm(r,i),y=l.createElement("script"),un(y),Sn(y,"link",r),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(g,y))}}function aT(r,i){Sa.M(r,i);var l=sl;if(l&&r){var d=Ts(l).hoistableScripts,g=ol(r),y=d.get(g);y||(y=l.querySelector(Go(g)),y||(r=p({src:r,async:!0,type:"module"},i),(i=Cr.get(g))&&Qm(r,i),y=l.createElement("script"),un(y),Sn(y,"link",r),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(g,y))}}function t1(r,i,l,d){var g=(g=ce.current)?od(g):null;if(!g)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=ll(l.href),l=Ts(g).hoistableStyles,d=l.get(i),d||(d={type:"style",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){r=ll(l.href);var y=Ts(g).hoistableStyles,S=y.get(r);if(S||(g=g.ownerDocument||g,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(r,S),(y=g.querySelector(Qo(r)))&&!y._p&&(S.instance=y,S.state.loading=5),Cr.has(r)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Cr.set(r,l),y||iT(g,r,l,S.state))),i&&d===null)throw Error(a(528,""));return S}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=ol(l),l=Ts(g).hoistableScripts,d=l.get(i),d||(d={type:"script",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function ll(r){return'href="'+vr(r)+'"'}function Qo(r){return'link[rel="stylesheet"]['+r+"]"}function n1(r){return p({},r,{"data-precedence":r.precedence,precedence:null})}function iT(r,i,l,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Sn(i,"link",l),un(i),r.head.appendChild(i))}function ol(r){return'[src="'+vr(r)+'"]'}function Go(r){return"script[async]"+r}function r1(r,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+vr(l.href)+'"]');if(d)return i.instance=d,un(d),d;var g=p({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),un(d),Sn(d,"style",g),ud(d,l.precedence,r),i.instance=d;case"stylesheet":g=ll(l.href);var y=r.querySelector(Qo(g));if(y)return i.state.loading|=4,i.instance=y,un(y),y;d=n1(l),(g=Cr.get(g))&&Vm(d,g),y=(r.ownerDocument||r).createElement("link"),un(y);var S=y;return S._p=new Promise(function(_,F){S.onload=_,S.onerror=F}),Sn(y,"link",d),i.state.loading|=4,ud(y,l.precedence,r),i.instance=y;case"script":return y=ol(l.src),(g=r.querySelector(Go(y)))?(i.instance=g,un(g),g):(d=l,(g=Cr.get(y))&&(d=p({},l),Qm(d,g)),r=r.ownerDocument||r,g=r.createElement("script"),un(g),Sn(g,"link",d),r.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,ud(d,l.precedence,r));return i.instance}function ud(r,i,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,y=g,S=0;S<d.length;S++){var _=d[S];if(_.dataset.precedence===i)y=_;else if(y!==g)break}y?y.parentNode.insertBefore(r,y.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(r,i.firstChild))}function Vm(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Qm(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var cd=null;function a1(r,i,l){if(cd===null){var d=new Map,g=cd=new Map;g.set(l,d)}else g=cd,d=g.get(l),d||(d=new Map,g.set(l,d));if(d.has(r))return d;for(d.set(r,null),l=l.getElementsByTagName(r),g=0;g<l.length;g++){var y=l[g];if(!(y[uo]||y[yn]||r==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var S=y.getAttribute(i)||"";S=r+S;var _=d.get(S);_?_.push(y):d.set(S,[y])}}return d}function i1(r,i,l){r=r.ownerDocument||r,r.head.insertBefore(l,i==="title"?r.querySelector("head > title"):null)}function sT(r,i,l){if(l===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function s1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function lT(r,i,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var g=ll(d.href),y=i.querySelector(Qo(g));if(y){i=y._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=dd.bind(r),i.then(r,r)),l.state.loading|=4,l.instance=y,un(y);return}y=i.ownerDocument||i,d=n1(d),(g=Cr.get(g))&&Vm(d,g),y=y.createElement("link"),un(y);var S=y;S._p=new Promise(function(_,F){S.onload=_,S.onerror=F}),Sn(y,"link",d),l.instance=y}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(r.count++,l=dd.bind(r),i.addEventListener("load",l),i.addEventListener("error",l))}}var Gm=0;function oT(r,i){return r.stylesheets&&r.count===0&&hd(r,r.stylesheets),0<r.count||0<r.imgCount?function(l){var d=setTimeout(function(){if(r.stylesheets&&hd(r,r.stylesheets),r.unsuspend){var y=r.unsuspend;r.unsuspend=null,y()}},6e4+i);0<r.imgBytes&&Gm===0&&(Gm=62500*F2());var g=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&hd(r,r.stylesheets),r.unsuspend)){var y=r.unsuspend;r.unsuspend=null,y()}},(r.imgBytes>Gm?50:800)+i);return r.unsuspend=l,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function dd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hd(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var fd=null;function hd(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,fd=new Map,i.forEach(uT,r),fd=null,dd.call(r))}function uT(r,i){if(!(i.state.loading&4)){var l=fd.get(r);if(l)var d=l.get(null);else{l=new Map,fd.set(r,l);for(var g=r.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<g.length;y++){var S=g[y];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(l.set(S.dataset.precedence,S),d=S)}d&&l.set(null,d)}g=i.instance,S=g.getAttribute("data-precedence"),y=l.get(S)||d,y===d&&l.set(null,g),l.set(S,g),this.count++,d=dd.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),y?y.parentNode.insertBefore(g,y.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(g,r.firstChild)),i.state.loading|=4}}var Ko={$$typeof:O,Provider:null,Consumer:null,_currentValue:ye,_currentValue2:ye,_threadCount:0};function cT(r,i,l,d,g,y,S,_,F){this.tag=1,this.containerInfo=r,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=Ye(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ye(0),this.hiddenUpdates=Ye(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function l1(r,i,l,d,g,y,S,_,F,Y,se,de){return r=new cT(r,i,l,S,F,Y,se,de,_),i=1,y===!0&&(i|=24),y=rr(3,null,null,i),r.current=y,y.stateNode=r,i=Eh(),i.refCount++,r.pooledCache=i,i.refCount++,y.memoizedState={element:d,isDehydrated:l,cache:i},Ah(y),r}function o1(r){return r?(r=Ps,r):Ps}function u1(r,i,l,d,g,y){g=o1(g),d.context===null?d.context=g:d.pendingContext=g,d=Za(i),d.payload={element:l},y=y===void 0?null:y,y!==null&&(d.callback=y),l=Va(r,d,i),l!==null&&(Qn(l,r,i),Eo(l,r,i))}function c1(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var l=r.retryLane;r.retryLane=l!==0&&l<i?l:i}}function Km(r,i){c1(r,i),(r=r.alternate)&&c1(r,i)}function d1(r){if(r.tag===13||r.tag===31){var i=Hi(r,67108864);i!==null&&Qn(i,r,67108864),Km(r,67108864)}}function f1(r){if(r.tag===13||r.tag===31){var i=or();i=Hf(i);var l=Hi(r,i);l!==null&&Qn(l,r,i),Km(r,i)}}var md=!0;function dT(r,i,l,d){var g=q.T;q.T=null;var y=ee.p;try{ee.p=2,Ym(r,i,l,d)}finally{ee.p=y,q.T=g}}function fT(r,i,l,d){var g=q.T;q.T=null;var y=ee.p;try{ee.p=8,Ym(r,i,l,d)}finally{ee.p=y,q.T=g}}function Ym(r,i,l,d){if(md){var g=Xm(d);if(g===null)Im(r,i,d,pd,l),m1(r,d);else if(mT(g,r,i,l,d))d.stopPropagation();else if(m1(r,d),i&4&&-1<hT.indexOf(r)){for(;g!==null;){var y=_s(g);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=Zr(y.pendingLanes);if(S!==0){var _=y;for(_.pendingLanes|=2,_.entangledLanes|=2;S;){var F=1<<31-ht(S);_.entanglements[1]|=F,S&=~F}Kr(y),(ft&6)===0&&(Xc=mn()+500,qo(0))}}break;case 31:case 13:_=Hi(y,2),_!==null&&Qn(_,y,2),Wc(),Km(y,2)}if(y=Xm(d),y===null&&Im(r,i,d,pd,l),y===g)break;g=y}g!==null&&d.stopPropagation()}else Im(r,i,d,null,l)}}function Xm(r){return r=Wf(r),Jm(r)}var pd=null;function Jm(r){if(pd=null,r=Es(r),r!==null){var i=o(r);if(i===null)r=null;else{var l=i.tag;if(l===13){if(r=c(i),r!==null)return r;r=null}else if(l===31){if(r=f(i),r!==null)return r;r=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return pd=r,null}function h1(r){switch(r){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(lo()){case oe:return 2;case ve:return 8;case Pe:case $e:return 32;case rt:return 268435456;default:return 32}default:return 32}}var Wm=!1,ri=null,ai=null,ii=null,Yo=new Map,Xo=new Map,si=[],hT="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 m1(r,i){switch(r){case"focusin":case"focusout":ri=null;break;case"dragenter":case"dragleave":ai=null;break;case"mouseover":case"mouseout":ii=null;break;case"pointerover":case"pointerout":Yo.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xo.delete(i.pointerId)}}function Jo(r,i,l,d,g,y){return r===null||r.nativeEvent!==y?(r={blockedOn:i,domEventName:l,eventSystemFlags:d,nativeEvent:y,targetContainers:[g]},i!==null&&(i=_s(i),i!==null&&d1(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,g!==null&&i.indexOf(g)===-1&&i.push(g),r)}function mT(r,i,l,d,g){switch(i){case"focusin":return ri=Jo(ri,r,i,l,d,g),!0;case"dragenter":return ai=Jo(ai,r,i,l,d,g),!0;case"mouseover":return ii=Jo(ii,r,i,l,d,g),!0;case"pointerover":var y=g.pointerId;return Yo.set(y,Jo(Yo.get(y)||null,r,i,l,d,g)),!0;case"gotpointercapture":return y=g.pointerId,Xo.set(y,Jo(Xo.get(y)||null,r,i,l,d,g)),!0}return!1}function p1(r){var i=Es(r.target);if(i!==null){var l=o(i);if(l!==null){if(i=l.tag,i===13){if(i=c(l),i!==null){r.blockedOn=i,Ty(r.priority,function(){f1(l)});return}}else if(i===31){if(i=f(l),i!==null){r.blockedOn=i,Ty(r.priority,function(){f1(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){r.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}r.blockedOn=null}function gd(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var l=Xm(r.nativeEvent);if(l===null){l=r.nativeEvent;var d=new l.constructor(l.type,l);Jf=d,l.target.dispatchEvent(d),Jf=null}else return i=_s(l),i!==null&&d1(i),r.blockedOn=l,!1;i.shift()}return!0}function g1(r,i,l){gd(r)&&l.delete(i)}function pT(){Wm=!1,ri!==null&&gd(ri)&&(ri=null),ai!==null&&gd(ai)&&(ai=null),ii!==null&&gd(ii)&&(ii=null),Yo.forEach(g1),Xo.forEach(g1)}function vd(r,i){r.blockedOn===i&&(r.blockedOn=null,Wm||(Wm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,pT)))}var yd=null;function v1(r){yd!==r&&(yd=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){yd===r&&(yd=null);for(var i=0;i<r.length;i+=3){var l=r[i],d=r[i+1],g=r[i+2];if(typeof d!="function"){if(Jm(d||l)===null)continue;break}var y=_s(l);y!==null&&(r.splice(i,3),i-=3,Xh(y,{pending:!0,data:g,method:l.method,action:d},d,g))}}))}function ul(r){function i(F){return vd(F,r)}ri!==null&&vd(ri,r),ai!==null&&vd(ai,r),ii!==null&&vd(ii,r),Yo.forEach(i),Xo.forEach(i);for(var l=0;l<si.length;l++){var d=si[l];d.blockedOn===r&&(d.blockedOn=null)}for(;0<si.length&&(l=si[0],l.blockedOn===null);)p1(l),l.blockedOn===null&&si.shift();if(l=(r.ownerDocument||r).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var g=l[d],y=l[d+1],S=g[$n]||null;if(typeof y=="function")S||v1(l);else if(S){var _=null;if(y&&y.hasAttribute("formAction")){if(g=y,S=y[$n]||null)_=S.formAction;else if(Jm(g)!==null)continue}else _=S.action;typeof _=="function"?l[d+1]=_:(l.splice(d,3),d-=3),v1(l)}}}function y1(){function r(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(S){return g=S})},focusReset:"manual",scroll:"manual"})}function i(){g!==null&&(g(),g=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,g=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),g!==null&&(g(),g=null)}}}function ep(r){this._internalRoot=r}bd.prototype.render=ep.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var l=i.current,d=or();u1(l,d,r,i,null,null)},bd.prototype.unmount=ep.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;u1(r.current,2,null,r,null,null),Wc(),i[Ns]=null}};function bd(r){this._internalRoot=r}bd.prototype.unstable_scheduleHydration=function(r){if(r){var i=_y();r={blockedOn:null,target:r,priority:i};for(var l=0;l<si.length&&i!==0&&i<si[l].priority;l++);si.splice(l,0,r),l===0&&p1(r)}};var b1=t.version;if(b1!=="19.2.4")throw Error(a(527,b1,"19.2.4"));ee.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?v(r):null,r=r===null?null:r.stateNode,r};var gT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xd.isDisabled&&xd.supportsFiber)try{rn=xd.inject(gT),Ht=xd}catch{}}return eu.createRoot=function(r,i){if(!s(r))throw Error(a(299));var l=!1,d="",g=Nx,y=Ex,S=_x;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(y=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError)),i=l1(r,1,!1,null,null,l,d,null,g,y,S,y1),r[Ns]=i.current,Mm(r),new ep(i)},eu.hydrateRoot=function(r,i,l){if(!s(r))throw Error(a(299));var d=!1,g="",y=Nx,S=Ex,_=_x,F=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(_=l.onRecoverableError),l.formState!==void 0&&(F=l.formState)),i=l1(r,1,!0,i,l??null,d,g,F,y,S,_,y1),i.context=o1(null),l=i.current,d=or(),d=Hf(d),g=Za(d),g.callback=null,Va(l,g,d),l=d,i.current.lanes=l,vn(i,l),Kr(i),r[Ns]=i.current,Mm(r),new bd(i)},eu.version="19.2.4",eu}var R1;function ET(){if(R1)return ap.exports;R1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ap.exports=NT(),ap.exports}var _T=ET(),xs=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ls,pi,jl,ak,TT=(ak=class extends xs{constructor(){super();je(this,ls);je(this,pi);je(this,jl);pe(this,jl,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){L(this,pi)||this.setEventListener(L(this,jl))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,pi))==null||t.call(this),pe(this,pi,void 0))}setEventListener(t){var n;pe(this,jl,t),(n=L(this,pi))==null||n.call(this),pe(this,pi,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){L(this,ls)!==t&&(pe(this,ls,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof L(this,ls)=="boolean"?L(this,ls):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ls=new WeakMap,pi=new WeakMap,jl=new WeakMap,ak),ov=new TT,RT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},gi,iv,ik,AT=(ik=class{constructor(){je(this,gi,RT);je(this,iv,!1)}setTimeoutProvider(e){pe(this,gi,e)}setTimeout(e,t){return L(this,gi).setTimeout(e,t)}clearTimeout(e){L(this,gi).clearTimeout(e)}setInterval(e,t){return L(this,gi).setInterval(e,t)}clearInterval(e){L(this,gi).clearInterval(e)}},gi=new WeakMap,iv=new WeakMap,ik),is=new AT;function zT(e){setTimeout(e,0)}var OT=typeof window>"u"||"Deno"in globalThis;function _n(){}function DT(e,t){return typeof e=="function"?e(t):e}function tg(e){return typeof e=="number"&&e>=0&&e!==1/0}function vk(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ci(e,t){return typeof e=="function"?e(t):e}function _r(e,t){return typeof e=="function"?e(t):e}function A1(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==uv(c,t.options))return!1}else if(!Su(t.queryKey,c))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||s&&s!==t.state.fetchStatus||o&&!o(t))}function z1(e,t){const{exact:n,status:a,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(gs(t.options.mutationKey)!==gs(o))return!1}else if(!Su(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function uv(e,t){return((t==null?void 0:t.queryKeyHashFn)||gs)(e)}function gs(e){return JSON.stringify(e,(t,n)=>ng(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function Su(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Su(e[n],t[n])):!1}var MT=Object.prototype.hasOwnProperty;function cv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=O1(e)&&O1(t);if(!a&&!(ng(e)&&ng(t)))return t;const o=(a?e:Object.keys(e)).length,c=a?t:Object.keys(t),f=c.length,m=a?new Array(f):{};let h=0;for(let v=0;v<f;v++){const p=a?v:c[v],b=e[p],w=t[p];if(b===w){m[p]=b,(a?v<o:MT.call(e,p))&&h++;continue}if(b===null||w===null||typeof b!="object"||typeof w!="object"){m[p]=w;continue}const k=cv(b,w,n+1);m[p]=k,k===b&&h++}return o===f&&h===o?e:m}function ku(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function O1(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ng(e){if(!D1(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!D1(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function D1(e){return Object.prototype.toString.call(e)==="[object Object]"}function IT(e){return new Promise(t=>{is.setTimeout(t,e)})}function rg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?cv(e,t):t}function LT(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function UT(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var dv=Symbol();function yk(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===dv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function fv(e,t){return typeof e=="function"?e(...t):!!e}function PT(e,t,n){let a=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),a||(a=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var ju=(()=>{let e=()=>OT;return{isServer(){return e()},setIsServer(t){e=t}}})();function ag(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function a(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{a({status:"fulfilled",value:s}),e(s)},n.reject=s=>{a({status:"rejected",reason:s}),t(s)},n}var BT=zT;function $T(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=BT;const o=f=>{t?e.push(f):s(()=>{n(f)})},c=()=>{const f=e;e=[],f.length&&s(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||c()}return m},batchCalls:f=>(...m)=>{o(()=>{f(...m)})},schedule:o,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{s=f}}}var Ft=$T(),Cl,vi,Nl,sk,FT=(sk=class extends xs{constructor(){super();je(this,Cl,!0);je(this,vi);je(this,Nl);pe(this,Nl,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){L(this,vi)||this.setEventListener(L(this,Nl))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,vi))==null||t.call(this),pe(this,vi,void 0))}setEventListener(t){var n;pe(this,Nl,t),(n=L(this,vi))==null||n.call(this),pe(this,vi,t(this.setOnline.bind(this)))}setOnline(t){L(this,Cl)!==t&&(pe(this,Cl,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return L(this,Cl)}},Cl=new WeakMap,vi=new WeakMap,Nl=new WeakMap,sk),Yd=new FT;function qT(e){return Math.min(1e3*2**e,3e4)}function bk(e){return(e??"online")==="online"?Yd.isOnline():!0}var ig=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function xk(e){let t=!1,n=0,a;const s=ag(),o=()=>s.status!=="pending",c=j=>{var N;if(!o()){const C=new ig(j);b(C),(N=e.onCancel)==null||N.call(e,C)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>ov.isFocused()&&(e.networkMode==="always"||Yd.isOnline())&&e.canRun(),v=()=>bk(e.networkMode)&&e.canRun(),p=j=>{o()||(a==null||a(),s.resolve(j))},b=j=>{o()||(a==null||a(),s.reject(j))},w=()=>new Promise(j=>{var N;a=C=>{(o()||h())&&j(C)},(N=e.onPause)==null||N.call(e)}).then(()=>{var j;a=void 0,o()||(j=e.onContinue)==null||j.call(e)}),k=()=>{if(o())return;let j;const N=n===0?e.initialPromise:void 0;try{j=N??e.fn()}catch(C){j=Promise.reject(C)}Promise.resolve(j).then(p).catch(C=>{var z;if(o())return;const A=e.retry??(ju.isServer()?0:3),O=e.retryDelay??qT,M=typeof O=="function"?O(n,C):O,P=A===!0||typeof A=="number"&&n<A||typeof A=="function"&&A(n,C);if(t||!P){b(C);return}n++,(z=e.onFail)==null||z.call(e,n,C),IT(M).then(()=>h()?void 0:w()).then(()=>{t?b(C):k()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:v,start:()=>(v()?k():w().then(k),s)}}var os,lk,wk=(lk=class{constructor(){je(this,os)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),tg(this.gcTime)&&pe(this,os,is.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ju.isServer()?1/0:300*1e3))}clearGcTimeout(){L(this,os)&&(is.clearTimeout(L(this,os)),pe(this,os,void 0))}},os=new WeakMap,lk),us,El,Nr,cs,dn,Lu,ds,fr,Sk,ja,ok,HT=(ok=class extends wk{constructor(t){super();je(this,fr);je(this,us);je(this,El);je(this,Nr);je(this,cs);je(this,dn);je(this,Lu);je(this,ds);pe(this,ds,!1),pe(this,Lu,t.defaultOptions),this.setOptions(t.options),this.observers=[],pe(this,cs,t.client),pe(this,Nr,L(this,cs).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,pe(this,us,I1(this.options)),this.state=t.state??L(this,us),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=L(this,dn))==null?void 0:t.promise}setOptions(t){if(this.options={...L(this,Lu),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=I1(this.options);n.data!==void 0&&(this.setState(M1(n.data,n.dataUpdatedAt)),pe(this,us,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,Nr).remove(this)}setData(t,n){const a=rg(this.state.data,t,this.options);return Ue(this,fr,ja).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){Ue(this,fr,ja).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=L(this,dn))==null?void 0:a.promise;return(s=L(this,dn))==null||s.cancel(t),n?n.then(_n).catch(_n):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return L(this,us)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>_r(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===dv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ci(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!vk(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,dn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=L(this,dn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,Nr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(L(this,dn)&&(L(this,ds)||Ue(this,fr,Sk).call(this)?L(this,dn).cancel({revert:!0}):L(this,dn).cancelRetry()),this.scheduleGc()),L(this,Nr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ue(this,fr,ja).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,v,p,b,w,k,j,N,C,A,O;if(this.state.fetchStatus!=="idle"&&((m=L(this,dn))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(L(this,dn))return L(this,dn).continueRetry(),L(this,dn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const M=this.observers.find(P=>P.options.queryFn);M&&this.setOptions(M.options)}const a=new AbortController,s=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(pe(this,ds,!0),a.signal)})},o=()=>{const M=yk(this.options,n),z=(()=>{const $={client:L(this,cs),queryKey:this.queryKey,meta:this.meta};return s($),$})();return pe(this,ds,!1),this.options.persister?this.options.persister(M,z,this):M(z)},f=(()=>{const M={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:L(this,cs),state:this.state,fetchFn:o};return s(M),M})();(h=this.options.behavior)==null||h.onFetch(f,this),pe(this,El,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=f.fetchOptions)==null?void 0:v.meta))&&Ue(this,fr,ja).call(this,{type:"fetch",meta:(p=f.fetchOptions)==null?void 0:p.meta}),pe(this,dn,xk({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:M=>{M instanceof ig&&M.revert&&this.setState({...L(this,El),fetchStatus:"idle"}),a.abort()},onFail:(M,P)=>{Ue(this,fr,ja).call(this,{type:"failed",failureCount:M,error:P})},onPause:()=>{Ue(this,fr,ja).call(this,{type:"pause"})},onContinue:()=>{Ue(this,fr,ja).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const M=await L(this,dn).start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(w=(b=L(this,Nr).config).onSuccess)==null||w.call(b,M,this),(j=(k=L(this,Nr).config).onSettled)==null||j.call(k,M,this.state.error,this),M}catch(M){if(M instanceof ig){if(M.silent)return L(this,dn).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw Ue(this,fr,ja).call(this,{type:"error",error:M}),(C=(N=L(this,Nr).config).onError)==null||C.call(N,M,this),(O=(A=L(this,Nr).config).onSettled)==null||O.call(A,this.state.data,M,this),M}finally{this.scheduleGc()}}},us=new WeakMap,El=new WeakMap,Nr=new WeakMap,cs=new WeakMap,dn=new WeakMap,Lu=new WeakMap,ds=new WeakMap,fr=new WeakSet,Sk=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ja=function(t){const n=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...kk(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...M1(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return pe(this,El,t.manual?s:void 0),s;case"error":const o=t.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=n(this.state),Ft.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),L(this,Nr).notify({query:this,type:"updated",action:t})})},ok);function kk(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:bk(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function M1(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function I1(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Kn,it,Uu,In,fs,_l,Ca,yi,Pu,Tl,Rl,hs,ms,bi,Al,gt,fu,sg,lg,og,ug,cg,dg,fg,jk,uk,hv=(uk=class extends xs{constructor(t,n){super();je(this,gt);je(this,Kn);je(this,it);je(this,Uu);je(this,In);je(this,fs);je(this,_l);je(this,Ca);je(this,yi);je(this,Pu);je(this,Tl);je(this,Rl);je(this,hs);je(this,ms);je(this,bi);je(this,Al,new Set);this.options=n,pe(this,Kn,t),pe(this,yi,null),pe(this,Ca,ag()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,it).addObserver(this),L1(L(this,it),this.options)?Ue(this,gt,fu).call(this):this.updateResult(),Ue(this,gt,ug).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return hg(L(this,it),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return hg(L(this,it),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ue(this,gt,cg).call(this),Ue(this,gt,dg).call(this),L(this,it).removeObserver(this)}setOptions(t){const n=this.options,a=L(this,it);if(this.options=L(this,Kn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof _r(this.options.enabled,L(this,it))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ue(this,gt,fg).call(this),L(this,it).setOptions(this.options),n._defaulted&&!ku(this.options,n)&&L(this,Kn).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,it),observer:this});const s=this.hasListeners();s&&U1(L(this,it),a,this.options,n)&&Ue(this,gt,fu).call(this),this.updateResult(),s&&(L(this,it)!==a||_r(this.options.enabled,L(this,it))!==_r(n.enabled,L(this,it))||Ci(this.options.staleTime,L(this,it))!==Ci(n.staleTime,L(this,it)))&&Ue(this,gt,sg).call(this);const o=Ue(this,gt,lg).call(this);s&&(L(this,it)!==a||_r(this.options.enabled,L(this,it))!==_r(n.enabled,L(this,it))||o!==L(this,bi))&&Ue(this,gt,og).call(this,o)}getOptimisticResult(t){const n=L(this,Kn).getQueryCache().build(L(this,Kn),t),a=this.createResult(n,t);return VT(this,a)&&(pe(this,In,a),pe(this,_l,this.options),pe(this,fs,L(this,it).state)),a}getCurrentResult(){return L(this,In)}trackResult(t,n){return new Proxy(t,{get:(a,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&L(this,Ca).status==="pending"&&L(this,Ca).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){L(this,Al).add(t)}getCurrentQuery(){return L(this,it)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=L(this,Kn).defaultQueryOptions(t),a=L(this,Kn).getQueryCache().build(L(this,Kn),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return Ue(this,gt,fu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,In)))}createResult(t,n){var Z;const a=L(this,it),s=this.options,o=L(this,In),c=L(this,fs),f=L(this,_l),h=t!==a?t.state:L(this,Uu),{state:v}=t;let p={...v},b=!1,w;if(n._optimisticResults){const D=this.hasListeners(),te=!D&&L1(t,n),ae=D&&U1(t,a,n,s);(te||ae)&&(p={...p,...kk(v.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:k,errorUpdatedAt:j,status:N}=p;w=p.data;let C=!1;if(n.placeholderData!==void 0&&w===void 0&&N==="pending"){let D;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(D=o.data,C=!0):D=typeof n.placeholderData=="function"?n.placeholderData((Z=L(this,Rl))==null?void 0:Z.state.data,L(this,Rl)):n.placeholderData,D!==void 0&&(N="success",w=rg(o==null?void 0:o.data,D,n),b=!0)}if(n.select&&w!==void 0&&!C)if(o&&w===(c==null?void 0:c.data)&&n.select===L(this,Pu))w=L(this,Tl);else try{pe(this,Pu,n.select),w=n.select(w),w=rg(o==null?void 0:o.data,w,n),pe(this,Tl,w),pe(this,yi,null)}catch(D){pe(this,yi,D)}L(this,yi)&&(k=L(this,yi),w=L(this,Tl),j=Date.now(),N="error");const A=p.fetchStatus==="fetching",O=N==="pending",M=N==="error",P=O&&A,z=w!==void 0,I={status:N,fetchStatus:p.fetchStatus,isPending:O,isSuccess:N==="success",isError:M,isInitialLoading:P,isLoading:P,data:w,dataUpdatedAt:p.dataUpdatedAt,error:k,errorUpdatedAt:j,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:p.dataUpdateCount>h.dataUpdateCount||p.errorUpdateCount>h.errorUpdateCount,isFetching:A,isRefetching:A&&!O,isLoadingError:M&&!z,isPaused:p.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:M&&z,isStale:mv(t,n),refetch:this.refetch,promise:L(this,Ca),isEnabled:_r(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const D=I.data!==void 0,te=I.status==="error"&&!D,ae=X=>{te?X.reject(I.error):D&&X.resolve(I.data)},xe=()=>{const X=pe(this,Ca,I.promise=ag());ae(X)},G=L(this,Ca);switch(G.status){case"pending":t.queryHash===a.queryHash&&ae(G);break;case"fulfilled":(te||I.data!==G.value)&&xe();break;case"rejected":(!te||I.error!==G.reason)&&xe();break}}return I}updateResult(){const t=L(this,In),n=this.createResult(L(this,it),this.options);if(pe(this,fs,L(this,it).state),pe(this,_l,this.options),L(this,fs).data!==void 0&&pe(this,Rl,L(this,it)),ku(n,t))return;pe(this,In,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!L(this,Al).size)return!0;const c=new Set(o??L(this,Al));return this.options.throwOnError&&c.add("error"),Object.keys(L(this,In)).some(f=>{const m=f;return L(this,In)[m]!==t[m]&&c.has(m)})};Ue(this,gt,jk).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ue(this,gt,ug).call(this)}},Kn=new WeakMap,it=new WeakMap,Uu=new WeakMap,In=new WeakMap,fs=new WeakMap,_l=new WeakMap,Ca=new WeakMap,yi=new WeakMap,Pu=new WeakMap,Tl=new WeakMap,Rl=new WeakMap,hs=new WeakMap,ms=new WeakMap,bi=new WeakMap,Al=new WeakMap,gt=new WeakSet,fu=function(t){Ue(this,gt,fg).call(this);let n=L(this,it).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(_n)),n},sg=function(){Ue(this,gt,cg).call(this);const t=Ci(this.options.staleTime,L(this,it));if(ju.isServer()||L(this,In).isStale||!tg(t))return;const a=vk(L(this,In).dataUpdatedAt,t)+1;pe(this,hs,is.setTimeout(()=>{L(this,In).isStale||this.updateResult()},a))},lg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,it)):this.options.refetchInterval)??!1},og=function(t){Ue(this,gt,dg).call(this),pe(this,bi,t),!(ju.isServer()||_r(this.options.enabled,L(this,it))===!1||!tg(L(this,bi))||L(this,bi)===0)&&pe(this,ms,is.setInterval(()=>{(this.options.refetchIntervalInBackground||ov.isFocused())&&Ue(this,gt,fu).call(this)},L(this,bi)))},ug=function(){Ue(this,gt,sg).call(this),Ue(this,gt,og).call(this,Ue(this,gt,lg).call(this))},cg=function(){L(this,hs)&&(is.clearTimeout(L(this,hs)),pe(this,hs,void 0))},dg=function(){L(this,ms)&&(is.clearInterval(L(this,ms)),pe(this,ms,void 0))},fg=function(){const t=L(this,Kn).getQueryCache().build(L(this,Kn),this.options);if(t===L(this,it))return;const n=L(this,it);pe(this,it,t),pe(this,Uu,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},jk=function(t){Ft.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(L(this,In))}),L(this,Kn).getQueryCache().notify({query:L(this,it),type:"observerResultsUpdated"})})},uk);function ZT(e,t){return _r(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function L1(e,t){return ZT(e,t)||e.state.data!==void 0&&hg(e,t,t.refetchOnMount)}function hg(e,t,n){if(_r(t.enabled,e)!==!1&&Ci(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&mv(e,t)}return!1}function U1(e,t,n,a){return(e!==t||_r(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&mv(e,n)}function mv(e,t){return _r(t.enabled,e)!==!1&&e.isStaleByTime(Ci(t.staleTime,e))}function VT(e,t){return!ku(e.getCurrentResult(),t)}function P1(e){return{onFetch:(t,n)=>{var v,p,b,w,k;const a=t.options,s=(b=(p=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:p.fetchMore)==null?void 0:b.direction,o=((w=t.state.data)==null?void 0:w.pages)||[],c=((k=t.state.data)==null?void 0:k.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let j=!1;const N=O=>{PT(O,()=>t.signal,()=>j=!0)},C=yk(t.options,t.fetchOptions),A=async(O,M,P)=>{if(j)return Promise.reject();if(M==null&&O.pages.length)return Promise.resolve(O);const $=(()=>{const te={client:t.client,queryKey:t.queryKey,pageParam:M,direction:P?"backward":"forward",meta:t.options.meta};return N(te),te})(),I=await C($),{maxPages:Z}=t.options,D=P?UT:LT;return{pages:D(O.pages,I,Z),pageParams:D(O.pageParams,M,Z)}};if(s&&o.length){const O=s==="backward",M=O?QT:B1,P={pages:o,pageParams:c},z=M(a,P);f=await A(P,z,O)}else{const O=e??o.length;do{const M=m===0?c[0]??a.initialPageParam:B1(a,f);if(m>0&&M==null)break;f=await A(f,M),m++}while(m<O)}return f};t.options.persister?t.fetchFn=()=>{var j,N;return(N=(j=t.options).persister)==null?void 0:N.call(j,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function B1(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function QT(e,{pages:t,pageParams:n}){var a;return t.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,t[0],t,n[0],n):void 0}var Bu,Xr,Nn,ps,Jr,di,ck,GT=(ck=class extends wk{constructor(t){super();je(this,Jr);je(this,Bu);je(this,Xr);je(this,Nn);je(this,ps);pe(this,Bu,t.client),this.mutationId=t.mutationId,pe(this,Nn,t.mutationCache),pe(this,Xr,[]),this.state=t.state||Ck(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){L(this,Xr).includes(t)||(L(this,Xr).push(t),this.clearGcTimeout(),L(this,Nn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){pe(this,Xr,L(this,Xr).filter(n=>n!==t)),this.scheduleGc(),L(this,Nn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,Xr).length||(this.state.status==="pending"?this.scheduleGc():L(this,Nn).remove(this))}continue(){var t;return((t=L(this,ps))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,v,p,b,w,k,j,N,C,A,O,M,P,z,$;const n=()=>{Ue(this,Jr,di).call(this,{type:"continue"})},a={client:L(this,Bu),meta:this.options.meta,mutationKey:this.options.mutationKey};pe(this,ps,xk({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(I,Z)=>{Ue(this,Jr,di).call(this,{type:"failed",failureCount:I,error:Z})},onPause:()=>{Ue(this,Jr,di).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,Nn).canRun(this)}));const s=this.state.status==="pending",o=!L(this,ps).canStart();try{if(s)n();else{Ue(this,Jr,di).call(this,{type:"pending",variables:t,isPaused:o}),L(this,Nn).config.onMutate&&await L(this,Nn).config.onMutate(t,this,a);const Z=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));Z!==this.state.context&&Ue(this,Jr,di).call(this,{type:"pending",context:Z,variables:t,isPaused:o})}const I=await L(this,ps).start();return await((h=(m=L(this,Nn).config).onSuccess)==null?void 0:h.call(m,I,t,this.state.context,this,a)),await((p=(v=this.options).onSuccess)==null?void 0:p.call(v,I,t,this.state.context,a)),await((w=(b=L(this,Nn).config).onSettled)==null?void 0:w.call(b,I,null,this.state.variables,this.state.context,this,a)),await((j=(k=this.options).onSettled)==null?void 0:j.call(k,I,null,t,this.state.context,a)),Ue(this,Jr,di).call(this,{type:"success",data:I}),I}catch(I){try{await((C=(N=L(this,Nn).config).onError)==null?void 0:C.call(N,I,t,this.state.context,this,a))}catch(Z){Promise.reject(Z)}try{await((O=(A=this.options).onError)==null?void 0:O.call(A,I,t,this.state.context,a))}catch(Z){Promise.reject(Z)}try{await((P=(M=L(this,Nn).config).onSettled)==null?void 0:P.call(M,void 0,I,this.state.variables,this.state.context,this,a))}catch(Z){Promise.reject(Z)}try{await(($=(z=this.options).onSettled)==null?void 0:$.call(z,void 0,I,t,this.state.context,a))}catch(Z){Promise.reject(Z)}throw Ue(this,Jr,di).call(this,{type:"error",error:I}),I}finally{L(this,Nn).runNext(this)}}},Bu=new WeakMap,Xr=new WeakMap,Nn=new WeakMap,ps=new WeakMap,Jr=new WeakSet,di=function(t){const n=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ft.batch(()=>{L(this,Xr).forEach(a=>{a.onMutationUpdate(t)}),L(this,Nn).notify({mutation:this,type:"updated",action:t})})},ck);function Ck(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Na,Pr,$u,dk,KT=(dk=class extends xs{constructor(t={}){super();je(this,Na);je(this,Pr);je(this,$u);this.config=t,pe(this,Na,new Set),pe(this,Pr,new Map),pe(this,$u,0)}build(t,n,a){const s=new GT({client:t,mutationCache:this,mutationId:++wd(this,$u)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){L(this,Na).add(t);const n=Sd(t);if(typeof n=="string"){const a=L(this,Pr).get(n);a?a.push(t):L(this,Pr).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,Na).delete(t)){const n=Sd(t);if(typeof n=="string"){const a=L(this,Pr).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&L(this,Pr).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Sd(t);if(typeof n=="string"){const a=L(this,Pr).get(n),s=a==null?void 0:a.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var a;const n=Sd(t);if(typeof n=="string"){const s=(a=L(this,Pr).get(n))==null?void 0:a.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ft.batch(()=>{L(this,Na).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,Na).clear(),L(this,Pr).clear()})}getAll(){return Array.from(L(this,Na))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>z1(n,a))}findAll(t={}){return this.getAll().filter(n=>z1(t,n))}notify(t){Ft.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ft.batch(()=>Promise.all(t.map(n=>n.continue().catch(_n))))}},Na=new WeakMap,Pr=new WeakMap,$u=new WeakMap,dk);function Sd(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Ea,xi,Yn,_a,Ra,$d,mg,fk,YT=(fk=class extends xs{constructor(n,a){super();je(this,Ra);je(this,Ea);je(this,xi);je(this,Yn);je(this,_a);pe(this,Ea,n),this.setOptions(a),this.bindMethods(),Ue(this,Ra,$d).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const a=this.options;this.options=L(this,Ea).defaultMutationOptions(n),ku(this.options,a)||L(this,Ea).getMutationCache().notify({type:"observerOptionsUpdated",mutation:L(this,Yn),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&gs(a.mutationKey)!==gs(this.options.mutationKey)?this.reset():((s=L(this,Yn))==null?void 0:s.state.status)==="pending"&&L(this,Yn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=L(this,Yn))==null||n.removeObserver(this)}onMutationUpdate(n){Ue(this,Ra,$d).call(this),Ue(this,Ra,mg).call(this,n)}getCurrentResult(){return L(this,xi)}reset(){var n;(n=L(this,Yn))==null||n.removeObserver(this),pe(this,Yn,void 0),Ue(this,Ra,$d).call(this),Ue(this,Ra,mg).call(this)}mutate(n,a){var s;return pe(this,_a,a),(s=L(this,Yn))==null||s.removeObserver(this),pe(this,Yn,L(this,Ea).getMutationCache().build(L(this,Ea),this.options)),L(this,Yn).addObserver(this),L(this,Yn).execute(n)}},Ea=new WeakMap,xi=new WeakMap,Yn=new WeakMap,_a=new WeakMap,Ra=new WeakSet,$d=function(){var a;const n=((a=L(this,Yn))==null?void 0:a.state)??Ck();pe(this,xi,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},mg=function(n){Ft.batch(()=>{var a,s,o,c,f,m,h,v;if(L(this,_a)&&this.hasListeners()){const p=L(this,xi).variables,b=L(this,xi).context,w={client:L(this,Ea),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=L(this,_a)).onSuccess)==null||s.call(a,n.data,p,b,w)}catch(k){Promise.reject(k)}try{(c=(o=L(this,_a)).onSettled)==null||c.call(o,n.data,null,p,b,w)}catch(k){Promise.reject(k)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=L(this,_a)).onError)==null||m.call(f,n.error,p,b,w)}catch(k){Promise.reject(k)}try{(v=(h=L(this,_a)).onSettled)==null||v.call(h,void 0,n.error,p,b,w)}catch(k){Promise.reject(k)}}}this.listeners.forEach(p=>{p(L(this,xi))})})},fk);function $1(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function XT(e,t,n){const a=e.slice(0);return a[t]=n,a}var zl,cr,Ol,Dl,Er,wi,Fu,qu,Hu,Zu,kn,pg,gg,vg,yg,bg,hk,JT=(hk=class extends xs{constructor(t,n,a){super();je(this,kn);je(this,zl);je(this,cr);je(this,Ol);je(this,Dl);je(this,Er);je(this,wi);je(this,Fu);je(this,qu);je(this,Hu);je(this,Zu,[]);pe(this,zl,t),pe(this,Dl,a),pe(this,Ol,[]),pe(this,Er,[]),pe(this,cr,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&L(this,Er).forEach(t=>{t.subscribe(n=>{Ue(this,kn,yg).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,L(this,Er).forEach(t=>{t.destroy()})}setQueries(t,n){pe(this,Ol,t),pe(this,Dl,n),Ft.batch(()=>{const a=L(this,Er),s=Ue(this,kn,vg).call(this,L(this,Ol));s.forEach(p=>p.observer.setOptions(p.defaultedQueryOptions));const o=s.map(p=>p.observer),c=o.map(p=>p.getCurrentResult()),f=a.length!==o.length,m=o.some((p,b)=>p!==a[b]),h=f||m,v=h?!0:c.some((p,b)=>{const w=L(this,cr)[b];return!w||!ku(p,w)});!h&&!v||(h&&(pe(this,Zu,s),pe(this,Er,o)),pe(this,cr,c),this.hasListeners()&&(h&&($1(a,o).forEach(p=>{p.destroy()}),$1(o,a).forEach(p=>{p.subscribe(b=>{Ue(this,kn,yg).call(this,p,b)})})),Ue(this,kn,bg).call(this)))})}getCurrentResult(){return L(this,cr)}getQueries(){return L(this,Er).map(t=>t.getCurrentQuery())}getObservers(){return L(this,Er)}getOptimisticResult(t,n){const a=Ue(this,kn,vg).call(this,t),s=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=a.map(c=>c.defaultedQueryOptions.queryHash);return[s,c=>Ue(this,kn,gg).call(this,c??s,n,o),()=>Ue(this,kn,pg).call(this,s,a)]}},zl=new WeakMap,cr=new WeakMap,Ol=new WeakMap,Dl=new WeakMap,Er=new WeakMap,wi=new WeakMap,Fu=new WeakMap,qu=new WeakMap,Hu=new WeakMap,Zu=new WeakMap,kn=new WeakSet,pg=function(t,n){return n.map((a,s)=>{const o=t[s];return a.defaultedQueryOptions.notifyOnChangeProps?o:a.observer.trackResult(o,c=>{n.forEach(f=>{f.observer.trackProp(c)})})})},gg=function(t,n,a){if(n){const s=L(this,Hu),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,f)=>c!==s[f]));return(!L(this,wi)||L(this,cr)!==L(this,qu)||o||n!==L(this,Fu))&&(pe(this,Fu,n),pe(this,qu,L(this,cr)),a!==void 0&&pe(this,Hu,a),pe(this,wi,cv(L(this,wi),n(t)))),L(this,wi)}return t},vg=function(t){const n=new Map;L(this,Er).forEach(s=>{const o=s.options.queryHash;if(!o)return;const c=n.get(o);c?c.push(s):n.set(o,[s])});const a=[];return t.forEach(s=>{var m;const o=L(this,zl).defaultQueryOptions(s),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new hv(L(this,zl),o);a.push({defaultedQueryOptions:o,observer:f})}),a},yg=function(t,n){const a=L(this,Er).indexOf(t);a!==-1&&(pe(this,cr,XT(L(this,cr),a,n)),Ue(this,kn,bg).call(this))},bg=function(){var t;if(this.hasListeners()){const n=L(this,wi),a=Ue(this,kn,pg).call(this,L(this,cr),L(this,Zu)),s=Ue(this,kn,gg).call(this,a,(t=L(this,Dl))==null?void 0:t.combine);n!==s&&Ft.batch(()=>{this.listeners.forEach(o=>{o(L(this,cr))})})}},hk),Wr,mk,WT=(mk=class extends xs{constructor(t={}){super();je(this,Wr);this.config=t,pe(this,Wr,new Map)}build(t,n,a){const s=n.queryKey,o=n.queryHash??uv(s,n);let c=this.get(o);return c||(c=new HT({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){L(this,Wr).has(t.queryHash)||(L(this,Wr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=L(this,Wr).get(t.queryHash);n&&(t.destroy(),n===t&&L(this,Wr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ft.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,Wr).get(t)}getAll(){return[...L(this,Wr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>A1(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>A1(t,a)):n}notify(t){Ft.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ft.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ft.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Wr=new WeakMap,mk),$t,Si,ki,Ml,Il,ji,Ll,Ul,pk,eR=(pk=class{constructor(e={}){je(this,$t);je(this,Si);je(this,ki);je(this,Ml);je(this,Il);je(this,ji);je(this,Ll);je(this,Ul);pe(this,$t,e.queryCache||new WT),pe(this,Si,e.mutationCache||new KT),pe(this,ki,e.defaultOptions||{}),pe(this,Ml,new Map),pe(this,Il,new Map),pe(this,ji,0)}mount(){wd(this,ji)._++,L(this,ji)===1&&(pe(this,Ll,ov.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,$t).onFocus())})),pe(this,Ul,Yd.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,$t).onOnline())})))}unmount(){var e,t;wd(this,ji)._--,L(this,ji)===0&&((e=L(this,Ll))==null||e.call(this),pe(this,Ll,void 0),(t=L(this,Ul))==null||t.call(this),pe(this,Ul,void 0))}isFetching(e){return L(this,$t).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return L(this,Si).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,$t).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=L(this,$t).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ci(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return L(this,$t).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),s=L(this,$t).get(a.queryHash),o=s==null?void 0:s.state.data,c=DT(t,o);if(c!==void 0)return L(this,$t).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return Ft.batch(()=>L(this,$t).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=L(this,$t).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=L(this,$t);Ft.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=L(this,$t);return Ft.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=Ft.batch(()=>L(this,$t).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(_n).catch(_n)}invalidateQueries(e,t={}){return Ft.batch(()=>(L(this,$t).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=Ft.batch(()=>L(this,$t).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(_n)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(_n)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=L(this,$t).build(this,t);return n.isStaleByTime(Ci(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_n).catch(_n)}fetchInfiniteQuery(e){return e.behavior=P1(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_n).catch(_n)}ensureInfiniteQueryData(e){return e.behavior=P1(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Yd.isOnline()?L(this,Si).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,$t)}getMutationCache(){return L(this,Si)}getDefaultOptions(){return L(this,ki)}setDefaultOptions(e){pe(this,ki,e)}setQueryDefaults(e,t){L(this,Ml).set(gs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...L(this,Ml).values()],n={};return t.forEach(a=>{Su(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){L(this,Il).set(gs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...L(this,Il).values()],n={};return t.forEach(a=>{Su(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...L(this,ki).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=uv(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===dv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...L(this,ki).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){L(this,$t).clear(),L(this,Si).clear()}},$t=new WeakMap,Si=new WeakMap,ki=new WeakMap,Ml=new WeakMap,Il=new WeakMap,ji=new WeakMap,Ll=new WeakMap,Ul=new WeakMap,pk),Nk=x.createContext(void 0),nn=e=>{const t=x.useContext(Nk);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tR=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Nk.Provider,{value:e,children:t})),Ek=x.createContext(!1),_k=()=>x.useContext(Ek);Ek.Provider;function nR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var rR=x.createContext(nR()),Tk=()=>x.useContext(rR),Rk=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?fv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},Ak=e=>{x.useEffect(()=>{e.clearReset()},[e])},zk=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||fv(n,[e.error,a])),Ok=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...s)=>n(a(...s)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},aR=(e,t)=>e.isLoading&&e.isFetching&&!t,xg=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,wg=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function iR({queries:e,...t},n){const a=nn(),s=_k(),o=Tk(),c=x.useMemo(()=>e.map(j=>{const N=a.defaultQueryOptions(j);return N._optimisticResults=s?"isRestoring":"optimistic",N}),[e,a,s]);c.forEach(j=>{Ok(j);const N=a.getQueryCache().get(j.queryHash);Rk(j,o,N)}),Ak(o);const[f]=x.useState(()=>new JT(a,c,t)),[m,h,v]=f.getOptimisticResult(c,t.combine),p=!s&&t.subscribed!==!1;x.useSyncExternalStore(x.useCallback(j=>p?f.subscribe(Ft.batchCalls(j)):_n,[f,p]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),x.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const w=m.some((j,N)=>xg(c[N],j))?m.flatMap((j,N)=>{const C=c[N];if(C&&xg(C,j)){const A=new hv(a,C);return wg(C,A,o)}return[]}):[];if(w.length>0)throw Promise.all(w);const k=m.find((j,N)=>{const C=c[N];return C&&zk({result:j,errorResetBoundary:o,throwOnError:C.throwOnError,query:a.getQueryCache().get(C.queryHash),suspense:C.suspense})});if(k!=null&&k.error)throw k.error;return h(v())}function sR(e,t,n){var b,w,k,j;const a=_k(),s=Tk(),o=nn(),c=o.defaultQueryOptions(e);(w=(b=o.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||w.call(b,c);const f=o.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",Ok(c),Rk(c,s,f),Ak(s);const m=!o.getQueryCache().get(c.queryHash),[h]=x.useState(()=>new t(o,c)),v=h.getOptimisticResult(c),p=!a&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(N=>{const C=p?h.subscribe(Ft.batchCalls(N)):_n;return h.updateResult(),C},[h,p]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),x.useEffect(()=>{h.setOptions(c)},[c,h]),xg(c,v))throw wg(c,h,s);if(zk({result:v,errorResetBoundary:s,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw v.error;if((j=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||j.call(k,c,v),c.experimental_prefetchInRender&&!ju.isServer()&&aR(v,a)){const N=m?wg(c,h,s):f==null?void 0:f.promise;N==null||N.catch(_n).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?v:h.trackResult(v)}function He(e,t){return sR(e,hv)}function St(e,t){const n=nn(),[a]=x.useState(()=>new YT(n,e));x.useEffect(()=>{a.setOptions(e)},[a,e]);const s=x.useSyncExternalStore(x.useCallback(c=>a.subscribe(Ft.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=x.useCallback((c,f)=>{a.mutate(c,f).catch(_n)},[a]);if(s.error&&fv(a.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}/**
50
+ * react-router v7.13.1
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var F1="popstate";function q1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function lR(e={}){function t(a,s){var h;let o=(h=s.state)==null?void 0:h.masked,{pathname:c,search:f,hash:m}=o||a.location;return Sg("",{pathname:c,search:f,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:Cu(s)}return uR(t,n,null,e)}function Dt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Rr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function oR(){return Math.random().toString(36).substring(2,10)}function H1(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 Sg(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Kl(t):t,state:n,key:t&&t.key||a||oR(),unstable_mask:s}}function Cu({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 Kl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function uR(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:o=!1}=a,c=s.history,f="POP",m=null,h=v();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function v(){return(c.state||{idx:null}).idx}function p(){f="POP";let N=v(),C=N==null?null:N-h;h=N,m&&m({action:f,location:j.location,delta:C})}function b(N,C){f="PUSH";let A=q1(N)?N:Sg(j.location,N,C);h=v()+1;let O=H1(A,h),M=j.createHref(A.unstable_mask||A);try{c.pushState(O,"",M)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;s.location.assign(M)}o&&m&&m({action:f,location:j.location,delta:1})}function w(N,C){f="REPLACE";let A=q1(N)?N:Sg(j.location,N,C);h=v();let O=H1(A,h),M=j.createHref(A.unstable_mask||A);c.replaceState(O,"",M),o&&m&&m({action:f,location:j.location,delta:0})}function k(N){return cR(N)}let j={get action(){return f},get location(){return e(s,c)},listen(N){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(F1,p),m=N,()=>{s.removeEventListener(F1,p),m=null}},createHref(N){return t(s,N)},createURL:k,encodeLocation(N){let C=k(N);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:b,replace:w,go(N){return c.go(N)}};return j}function cR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Dt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:Cu(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function Dk(e,t,n="/"){return dR(e,t,n,!1)}function dR(e,t,n,a){let s=typeof t=="string"?Kl(t):t,o=Aa(s.pathname||"/",n);if(o==null)return null;let c=Mk(e);fR(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=kR(o);f=wR(c[m],h,a)}return f}function Mk(e,t=[],n=[],a="",s=!1){let o=(c,f,m=s,h)=>{let v={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(a)&&m)return;Dt(v.relativePath.startsWith(a),`Absolute route path "${v.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(a.length)}let p=ta([a,v.relativePath]),b=n.concat(v);c.children&&c.children.length>0&&(Dt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Mk(c.children,t,b,p,m)),!(c.path==null&&!c.index)&&t.push({path:p,score:bR(p,c.index),routesMeta:b})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,f);else for(let h of Ik(c.path))o(c,f,!0,h)}),t}function Ik(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(a.length===0)return s?[o,""]:[o];let c=Ik(a.join("/")),f=[];return f.push(...c.map(m=>m===""?o:[o,m].join("/"))),s&&f.push(...c),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function fR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:xR(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var hR=/^:[\w-]+$/,mR=3,pR=2,gR=1,vR=10,yR=-2,Z1=e=>e==="*";function bR(e,t){let n=e.split("/"),a=n.length;return n.some(Z1)&&(a+=yR),t&&(a+=pR),n.filter(s=>!Z1(s)).reduce((s,o)=>s+(hR.test(o)?mR:o===""?gR:vR),a)}function xR(e,t){return e.length===t.length&&e.slice(0,-1).every((a,s)=>a===t[s])?e[e.length-1]-t[t.length-1]:0}function wR(e,t,n=!1){let{routesMeta:a}=e,s={},o="/",c=[];for(let f=0;f<a.length;++f){let m=a[f],h=f===a.length-1,v=o==="/"?t:t.slice(o.length)||"/",p=Xd({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},v),b=m.route;if(!p&&h&&n&&!a[a.length-1].route.index&&(p=Xd({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!p)return null;Object.assign(s,p.params),c.push({params:s,pathname:ta([o,p.pathname]),pathnameBase:ER(ta([o,p.pathnameBase])),route:b}),p.pathnameBase!=="/"&&(o=ta([o,p.pathnameBase]))}return c}function Xd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=SR(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],c=o.replace(/(.)\/+$/,"$1"),f=s.slice(1);return{params:a.reduce((h,{paramName:v,isOptional:p},b)=>{if(v==="*"){let k=f[b]||"";c=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const w=f[b];return p&&!w?h[v]=void 0:h[v]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function SR(e,t=!1,n=!0){Rr(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 a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,f,m,h,v)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let p=v.charAt(h+c.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function kR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Rr(!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 Aa(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var jR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function CR(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?Kl(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=V1(n.substring(1),"/"):o=V1(n,t)):o=t,{pathname:o,search:_R(a),hash:TR(s)}}function V1(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function op(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. 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 NR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function pv(e){let t=NR(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function yf(e,t,n,a=!1){let s;typeof e=="string"?s=Kl(e):(s={...e},Dt(!s.pathname||!s.pathname.includes("?"),op("?","pathname","search",s)),Dt(!s.pathname||!s.pathname.includes("#"),op("#","pathname","hash",s)),Dt(!s.search||!s.search.includes("#"),op("#","search","hash",s)));let o=e===""||s.pathname==="",c=o?"/":s.pathname,f;if(c==null)f=n;else{let p=t.length-1;if(!a&&c.startsWith("..")){let b=c.split("/");for(;b[0]==="..";)b.shift(),p-=1;s.pathname=b.join("/")}f=p>=0?t[p]:"/"}let m=CR(s,f),h=c&&c!=="/"&&c.endsWith("/"),v=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||v)&&(m.pathname+="/"),m}var ta=e=>e.join("/").replace(/\/\/+/g,"/"),ER=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_R=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,TR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,RR=class{constructor(e,t,n,a=!1){this.status=e,this.statusText=t||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function AR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function zR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Lk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Uk(e,t){let n=e;if(typeof n!="string"||!jR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(Lk)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=Aa(c.pathname,t);c.origin===o.origin&&f!=null?n=f+c.search+c.hash:s=!0}catch{Rr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Pk=["POST","PUT","PATCH","DELETE"];new Set(Pk);var OR=["GET",...Pk];new Set(OR);var Yl=x.createContext(null);Yl.displayName="DataRouter";var bf=x.createContext(null);bf.displayName="DataRouterState";var DR=x.createContext(!1),Bk=x.createContext({isTransitioning:!1});Bk.displayName="ViewTransition";var MR=x.createContext(new Map);MR.displayName="Fetchers";var IR=x.createContext(null);IR.displayName="Await";var mr=x.createContext(null);mr.displayName="Navigation";var Vu=x.createContext(null);Vu.displayName="Location";var Ar=x.createContext({outlet:null,matches:[],isDataRoute:!1});Ar.displayName="Route";var gv=x.createContext(null);gv.displayName="RouteError";var $k="REACT_ROUTER_ERROR",LR="REDIRECT",UR="ROUTE_ERROR_RESPONSE";function PR(e){if(e.startsWith(`${$k}:${LR}:{`))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 BR(e){if(e.startsWith(`${$k}:${UR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new RR(t.status,t.statusText,t.data)}catch{}}function $R(e,{relative:t}={}){Dt(Xl(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=x.useContext(mr),{hash:s,pathname:o,search:c}=Qu(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:ta([n,o])),a.createHref({pathname:f,search:c,hash:s})}function Xl(){return x.useContext(Vu)!=null}function Jn(){return Dt(Xl(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Vu).location}var Fk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function qk(e){x.useContext(mr).static||x.useLayoutEffect(e)}function jn(){let{isDataRoute:e}=x.useContext(Ar);return e?nA():FR()}function FR(){Dt(Xl(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Yl),{basename:t,navigator:n}=x.useContext(mr),{matches:a}=x.useContext(Ar),{pathname:s}=Jn(),o=JSON.stringify(pv(a)),c=x.useRef(!1);return qk(()=>{c.current=!0}),x.useCallback((m,h={})=>{if(Rr(c.current,Fk),!c.current)return;if(typeof m=="number"){n.go(m);return}let v=yf(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:ta([t,v.pathname])),(h.replace?n.replace:n.push)(v,h.state,h)},[t,n,o,s,e])}var qR=x.createContext(null);function HR(e){let t=x.useContext(Ar).outlet;return x.useMemo(()=>t&&x.createElement(qR.Provider,{value:e},t),[t,e])}function Hk(){let{matches:e}=x.useContext(Ar),t=e[e.length-1];return t?t.params:{}}function Qu(e,{relative:t}={}){let{matches:n}=x.useContext(Ar),{pathname:a}=Jn(),s=JSON.stringify(pv(n));return x.useMemo(()=>yf(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function ZR(e,t){return Zk(e,t)}function Zk(e,t,n){var N;Dt(Xl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=x.useContext(mr),{matches:s}=x.useContext(Ar),o=s[s.length-1],c=o?o.params:{},f=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let C=h&&h.path||"";Qk(f,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${C}">) 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.
59
+
60
+ Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let v=Jn(),p;if(t){let C=typeof t=="string"?Kl(t):t;Dt(m==="/"||((N=C.pathname)==null?void 0:N.startsWith(m)),`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 "${m}" but pathname "${C.pathname}" was given in the \`location\` prop.`),p=C}else p=v;let b=p.pathname||"/",w=b;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let k=Dk(e,{pathname:w});Rr(h||k!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),Rr(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.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 j=YR(k&&k.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:ta([m,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:ta([m,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),s,n);return t&&j?x.createElement(Vu.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},j):j}function VR(){let e=tA(),t=AR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:o},"ErrorBoundary")," or"," ",x.createElement("code",{style:o},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),n?x.createElement("pre",{style:s},n):null,c)}var QR=x.createElement(VR,null),Vk=class extends x.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?e.error:t.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"){const n=BR(e.digest);n&&(e=n)}let t=e!==void 0?x.createElement(Ar.Provider,{value:this.props.routeContext},x.createElement(gv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(GR,{error:e},t):t}};Vk.contextType=DR;var up=new WeakMap;function GR({children:e,error:t}){let{basename:n}=x.useContext(mr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=PR(t.digest);if(a){let s=up.get(t);if(s)throw s;let o=Uk(a.location,n);if(Lk&&!up.get(t))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw up.set(t,c),c}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function KR({routeContext:e,match:t,children:n}){let a=x.useContext(Yl);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(Ar.Provider,{value:e},n)}function YR(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,o=a==null?void 0:a.errors;if(o!=null){let v=s.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);Dt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,v+1))}let c=!1,f=-1;if(n&&a){c=a.renderFallback;for(let v=0;v<s.length;v++){let p=s[v];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(f=v),p.route.id){let{loaderData:b,errors:w}=a,k=p.route.loader&&!b.hasOwnProperty(p.route.id)&&(!w||w[p.route.id]===void 0);if(p.route.lazy||k){n.isStatic&&(c=!0),f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(v,p)=>{var b,w;m(v,{location:a.location,params:((w=(b=a.matches)==null?void 0:b[0])==null?void 0:w.params)??{},unstable_pattern:zR(a.matches),errorInfo:p})}:void 0;return s.reduceRight((v,p,b)=>{let w,k=!1,j=null,N=null;a&&(w=o&&p.route.id?o[p.route.id]:void 0,j=p.route.errorElement||QR,c&&(f<0&&b===0?(Qk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,N=null):f===b&&(k=!0,N=p.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,b+1)),A=()=>{let O;return w?O=j:k?O=N:p.route.Component?O=x.createElement(p.route.Component,null):p.route.element?O=p.route.element:O=v,x.createElement(KR,{match:p,routeContext:{outlet:v,matches:C,isDataRoute:a!=null},children:O})};return a&&(p.route.ErrorBoundary||p.route.errorElement||b===0)?x.createElement(Vk,{location:a.location,revalidation:a.revalidation,component:j,error:w,children:A(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):A()},null)}function vv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function XR(e){let t=x.useContext(Yl);return Dt(t,vv(e)),t}function JR(e){let t=x.useContext(bf);return Dt(t,vv(e)),t}function WR(e){let t=x.useContext(Ar);return Dt(t,vv(e)),t}function yv(e){let t=WR(e),n=t.matches[t.matches.length-1];return Dt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function eA(){return yv("useRouteId")}function tA(){var a;let e=x.useContext(gv),t=JR("useRouteError"),n=yv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function nA(){let{router:e}=XR("useNavigate"),t=yv("useNavigate"),n=x.useRef(!1);return qk(()=>{n.current=!0}),x.useCallback(async(s,o={})=>{Rr(n.current,Fk),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var Q1={};function Qk(e,t,n){!t&&!Q1[e]&&(Q1[e]=!0,Rr(!1,n))}x.memo(rA);function rA({routes:e,future:t,state:n,isStatic:a,onError:s}){return Zk(e,void 0,{state:n,isStatic:a,onError:s})}function dr({to:e,replace:t,state:n,relative:a}){Dt(Xl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=x.useContext(mr);Rr(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=x.useContext(Ar),{pathname:c}=Jn(),f=jn(),m=yf(e,pv(o),c,a==="path"),h=JSON.stringify(m);return x.useEffect(()=>{f(JSON.parse(h),{replace:t,state:n,relative:a})},[f,h,a,t,n]),null}function Pl(e){return HR(e.context)}function At(e){Dt(!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 aA({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:o=!1,unstable_useTransitions:c}){Dt(!Xl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:f,navigator:s,static:o,unstable_useTransitions:c,future:{}}),[f,s,o,c]);typeof n=="string"&&(n=Kl(n));let{pathname:h="/",search:v="",hash:p="",state:b=null,key:w="default",unstable_mask:k}=n,j=x.useMemo(()=>{let N=Aa(h,f);return N==null?null:{location:{pathname:N,search:v,hash:p,state:b,key:w,unstable_mask:k},navigationType:a}},[f,h,v,p,b,w,a,k]);return Rr(j!=null,`<Router basename="${f}"> is not able to match the URL "${h}${v}${p}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(mr.Provider,{value:m},x.createElement(Vu.Provider,{children:t,value:j}))}function iA({children:e,location:t}){return ZR(kg(e),t)}function kg(e,t=[]){let n=[];return x.Children.forEach(e,(a,s)=>{if(!x.isValidElement(a))return;let o=[...t,s];if(a.type===x.Fragment){n.push.apply(n,kg(a.props.children,o));return}Dt(a.type===At,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Dt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let c={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(c.children=kg(a.props.children,o)),n.push(c)}),n}var Fd="get",qd="application/x-www-form-urlencoded";function xf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function sA(e){return xf(e)&&e.tagName.toLowerCase()==="button"}function lA(e){return xf(e)&&e.tagName.toLowerCase()==="form"}function oA(e){return xf(e)&&e.tagName.toLowerCase()==="input"}function uA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function cA(e,t){return e.button===0&&(!t||t==="_self")&&!uA(e)}function jg(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let a=e[n];return t.concat(Array.isArray(a)?a.map(s=>[n,s]):[[n,a]])},[]))}function dA(e,t){let n=jg(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var kd=null;function fA(){if(kd===null)try{new FormData(document.createElement("form"),0),kd=!1}catch{kd=!0}return kd}var hA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function cp(e){return e!=null&&!hA.has(e)?(Rr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${qd}"`),null):e}function mA(e,t){let n,a,s,o,c;if(lA(e)){let f=e.getAttribute("action");a=f?Aa(f,t):null,n=e.getAttribute("method")||Fd,s=cp(e.getAttribute("enctype"))||qd,o=new FormData(e)}else if(sA(e)||oA(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(a=m?Aa(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||Fd,s=cp(e.getAttribute("formenctype"))||cp(f.getAttribute("enctype"))||qd,o=new FormData(f,e),!fA()){let{name:h,type:v,value:p}=e;if(v==="image"){let b=h?`${h}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else h&&o.append(h,p)}}else{if(xf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Fd,a=null,s=qd,c=e}return o&&s==="text/plain"&&(c=o,o=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function bv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function pA(e,t,n,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${a}`:s.pathname=`${s.pathname}.${a}`:s.pathname==="/"?s.pathname=`_root.${a}`:t&&Aa(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function gA(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function vA(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 yA(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await gA(o,n);return c.links?c.links():[]}return[]}));return SA(a.flat(1).filter(vA).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function G1(e,t,n,a,s,o){let c=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,f=(m,h)=>{var v;return n[h].pathname!==m.pathname||((v=n[h].route.path)==null?void 0:v.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>c(m,h)||f(m,h)):o==="data"?t.filter((m,h)=>{var p;let v=a.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(c(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function bA(e,t,{includeHydrateFallback:n}={}){return xA(e.map(a=>{let s=t.routes[a.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function xA(e){return[...new Set(e)]}function wA(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function SA(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let o=JSON.stringify(wA(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function Gk(){let e=x.useContext(Yl);return bv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function kA(){let e=x.useContext(bf);return bv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var xv=x.createContext(void 0);xv.displayName="FrameworkContext";function Kk(){let e=x.useContext(xv);return bv(e,"You must render this element inside a <HydratedRouter> element"),e}function jA(e,t){let n=x.useContext(xv),[a,s]=x.useState(!1),[o,c]=x.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:v,onTouchStart:p}=t,b=x.useRef(null);x.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=C=>{C.forEach(A=>{c(A.isIntersecting)})},N=new IntersectionObserver(j,{threshold:.5});return b.current&&N.observe(b.current),()=>{N.disconnect()}}},[e]),x.useEffect(()=>{if(a){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[a]);let w=()=>{s(!0)},k=()=>{s(!1),c(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:tu(f,w),onBlur:tu(m,k),onMouseEnter:tu(h,w),onMouseLeave:tu(v,k),onTouchStart:tu(p,w)}]:[!1,b,{}]}function tu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function CA({page:e,...t}){let{router:n}=Gk(),a=x.useMemo(()=>Dk(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?x.createElement(EA,{page:e,matches:a,...t}):null}function NA(e){let{manifest:t,routeModules:n}=Kk(),[a,s]=x.useState([]);return x.useEffect(()=>{let o=!1;return yA(e,t,n).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,n]),a}function EA({page:e,matches:t,...n}){let a=Jn(),{future:s,manifest:o,routeModules:c}=Kk(),{basename:f}=Gk(),{loaderData:m,matches:h}=kA(),v=x.useMemo(()=>G1(e,t,h,o,a,"data"),[e,t,h,o,a]),p=x.useMemo(()=>G1(e,t,h,o,a,"assets"),[e,t,h,o,a]),b=x.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,N=!1;if(t.forEach(A=>{var M;let O=o.routes[A.route.id];!O||!O.hasLoader||(!v.some(P=>P.route.id===A.route.id)&&A.route.id in m&&((M=c[A.route.id])!=null&&M.shouldRevalidate)||O.hasClientLoader?N=!0:j.add(A.route.id))}),j.size===0)return[];let C=pA(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return N&&j.size>0&&C.searchParams.set("_routes",t.filter(A=>j.has(A.route.id)).map(A=>A.route.id).join(",")),[C.pathname+C.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,o,v,t,e,c]),w=x.useMemo(()=>bA(p,o),[p,o]),k=NA(p);return x.createElement(x.Fragment,null,b.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),w.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:N})=>x.createElement("link",{key:j,nonce:n.nonce,...N,crossOrigin:N.crossOrigin??n.crossOrigin})))}function _A(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var TA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{TA&&(window.__reactRouterVersion="7.13.1")}catch{}function RA({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=x.useRef();s.current==null&&(s.current=lR({window:a,v5Compat:!0}));let o=s.current,[c,f]=x.useState({action:o.action,location:o.location}),m=x.useCallback(h=>{n===!1?f(h):x.startTransition(()=>f(h))},[n]);return x.useLayoutEffect(()=>o.listen(m),[o,m]),x.createElement(aA,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var Yk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Gu=x.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:o,replace:c,unstable_mask:f,state:m,target:h,to:v,preventScrollReset:p,viewTransition:b,unstable_defaultShouldRevalidate:w,...k},j){let{basename:N,navigator:C,unstable_useTransitions:A}=x.useContext(mr),O=typeof v=="string"&&Yk.test(v),M=Uk(v,N);v=M.to;let P=$R(v,{relative:s}),z=Jn(),$=null;if(f){let X=yf(f,[],z.unstable_mask?z.unstable_mask.pathname:"/",!0);N!=="/"&&(X.pathname=X.pathname==="/"?N:ta([N,X.pathname])),$=C.createHref(X)}let[I,Z,D]=jA(a,k),te=OA(v,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:p,relative:s,viewTransition:b,unstable_defaultShouldRevalidate:w,unstable_useTransitions:A});function ae(X){t&&t(X),X.defaultPrevented||te(X)}let xe=!(M.isExternal||o),G=x.createElement("a",{...k,...D,href:(xe?$:void 0)||M.absoluteURL||P,onClick:xe?ae:t,ref:_A(j,Z),target:h,"data-discover":!O&&n==="render"?"true":void 0});return I&&!O?x.createElement(x.Fragment,null,G,x.createElement(CA,{page:P})):G});Gu.displayName="Link";var wf=x.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:o,to:c,viewTransition:f,children:m,...h},v){let p=Qu(c,{relative:h.relative}),b=Jn(),w=x.useContext(bf),{navigator:k,basename:j}=x.useContext(mr),N=w!=null&&UA(p)&&f===!0,C=k.encodeLocation?k.encodeLocation(p).pathname:p.pathname,A=b.pathname,O=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(A=A.toLowerCase(),O=O?O.toLowerCase():null,C=C.toLowerCase()),O&&j&&(O=Aa(O,j)||O);const M=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let P=A===C||!s&&A.startsWith(C)&&A.charAt(M)==="/",z=O!=null&&(O===C||!s&&O.startsWith(C)&&O.charAt(C.length)==="/"),$={isActive:P,isPending:z,isTransitioning:N},I=P?t:void 0,Z;typeof a=="function"?Z=a($):Z=[a,P?"active":null,z?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let D=typeof o=="function"?o($):o;return x.createElement(Gu,{...h,"aria-current":I,className:Z,ref:v,style:D,to:c,viewTransition:f},typeof m=="function"?m($):m)});wf.displayName="NavLink";var AA=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:o,method:c=Fd,action:f,onSubmit:m,relative:h,preventScrollReset:v,viewTransition:p,unstable_defaultShouldRevalidate:b,...w},k)=>{let{unstable_useTransitions:j}=x.useContext(mr),N=IA(),C=LA(f,{relative:h}),A=c.toLowerCase()==="get"?"get":"post",O=typeof f=="string"&&Yk.test(f),M=P=>{if(m&&m(P),P.defaultPrevented)return;P.preventDefault();let z=P.nativeEvent.submitter,$=(z==null?void 0:z.getAttribute("formmethod"))||c,I=()=>N(z||P.currentTarget,{fetcherKey:t,method:$,navigate:n,replace:s,state:o,relative:h,preventScrollReset:v,viewTransition:p,unstable_defaultShouldRevalidate:b});j&&n!==!1?x.startTransition(()=>I()):I()};return x.createElement("form",{ref:k,method:A,action:C,onSubmit:a?m:M,...w,"data-discover":!O&&e==="render"?"true":void 0})});AA.displayName="Form";function zA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Xk(e){let t=x.useContext(Yl);return Dt(t,zA(e)),t}function OA(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let v=jn(),p=Jn(),b=Qu(e,{relative:c});return x.useCallback(w=>{if(cA(w,t)){w.preventDefault();let k=n!==void 0?n:Cu(p)===Cu(b),j=()=>v(e,{replace:k,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?x.startTransition(()=>j()):j()}},[p,v,b,n,a,s,t,e,o,c,f,m,h])}function Sf(e){Rr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=x.useRef(jg(e)),n=x.useRef(!1),a=Jn(),s=x.useMemo(()=>dA(a.search,n.current?null:t.current),[a.search]),o=jn(),c=x.useCallback((f,m)=>{const h=jg(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,o("?"+h,m)},[o,s]);return[s,c]}var DA=0,MA=()=>`__${String(++DA)}__`;function IA(){let{router:e}=Xk("useSubmit"),{basename:t}=x.useContext(mr),n=eA(),a=e.fetch,s=e.navigate;return x.useCallback(async(o,c={})=>{let{action:f,method:m,encType:h,formData:v,body:p}=mA(o,t);if(c.navigate===!1){let b=c.fetcherKey||MA();await a(b,n,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:v,body:p,formMethod:c.method||m,formEncType:c.encType||h,flushSync:c.flushSync})}else await s(c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:v,body:p,formMethod:c.method||m,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[a,s,t,n])}function LA(e,{relative:t}={}){let{basename:n}=x.useContext(mr),a=x.useContext(Ar);Dt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Qu(e||".",{relative:t})},c=Jn();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),m=f.getAll("index");if(m.some(v=>v==="")){f.delete("index"),m.filter(p=>p).forEach(p=>f.append("index",p));let v=f.toString();o.search=v?`?${v}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:ta([n,o.pathname])),Cu(o)}function UA(e,{relative:t}={}){let n=x.useContext(Bk);Dt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Xk("useViewTransitionState"),s=Qu(e,{relative:t});if(!n.isTransitioning)return!1;let o=Aa(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=Aa(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Xd(s.pathname,c)!=null||Xd(s.pathname,o)!=null}const PA="/api/v1";async function BA(e,t){const n=await fetch(`${PA}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok){const a=await n.text();let s;try{s=JSON.parse(a).error??a}catch{s=a}throw new Error(s)}return await n.json()}const Jk="/api/v1",wv="first-tree-hub:tokens";let Cg=null;function nu(e){Cg=e}function hn(e){if(!Cg)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(Cg)}${e}`}function K1(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function kf(){const e=localStorage.getItem(wv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Ng(e){localStorage.setItem(wv,JSON.stringify(e))}function Wk(){localStorage.removeItem(wv)}class Ku extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let ru=null;async function $A(){const e=kf();return e!=null&&e.refreshToken?ej(e.refreshToken):null}async function ej(e){return ru||(ru=(async()=>{try{const t=await fetch(`${Jk}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(!t.ok)return null;const n=await t.json(),a={accessToken:n.accessToken,refreshToken:n.refreshToken??e};return Ng(a),a}catch{return null}finally{ru=null}})(),ru)}async function au(e,t){const{method:n="GET",body:a}=t??{},s=f=>{const m={};return f&&(m.Authorization=`Bearer ${f}`),a!==void 0&&(m["Content-Type"]="application/json"),fetch(`${Jk}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=kf();let c=await s(o==null?void 0:o.accessToken);if(c.status===401&&(o!=null&&o.refreshToken)){const f=await ej(o.refreshToken);f&&(c=await s(f.accessToken))}if(!c.ok){c.status===401&&(Wk(),window.dispatchEvent(new CustomEvent("auth:logout")));const f=await c.text();let m,h;try{const v=JSON.parse(f);m=v.error??f,Array.isArray(v.details)&&(h=v.details.filter(p=>typeof p=="object"&&p!==null&&Array.isArray(p.path)))}catch{m=f}throw new Ku(c.status,m,h)}if(c.status!==204)return await c.json()}const Se={get:e=>au(e),post:(e,t)=>au(e,{method:"POST",body:t}),patch:(e,t)=>au(e,{method:"PATCH",body:t}),put:(e,t)=>au(e,{method:"PUT",body:t}),delete:e=>au(e,{method:"DELETE"})},Sv="onboarding:joinPath",FA="onboarding:draft",Eg="onboarding:step1Confirmed";function tj(){return typeof window>"u"?!1:window.sessionStorage.getItem(Eg)==="1"}function qA(e){typeof window>"u"||(e?window.sessionStorage.setItem(Eg,"1"):window.sessionStorage.removeItem(Eg))}const _g="onboarding:agentUuid";function HA(){return typeof window>"u"?null:window.sessionStorage.getItem(_g)}function ZA(e){typeof window>"u"||(e?window.sessionStorage.setItem(_g,e):window.sessionStorage.removeItem(_g))}function nj(e){typeof window>"u"||window.sessionStorage.setItem(Sv,e)}function VA(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(Sv);return e==="solo"||e==="invite"?e:null}function QA(){typeof window>"u"||window.sessionStorage.removeItem(Sv)}function GA(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function kv(e){return`${FA}:${e}`}function KA(e){if(!e||typeof e!="object"||!("displayName"in e)||typeof e.displayName!="string")return null;const t="selectedRuntime"in e?e.selectedRuntime:null;if(t!==null&&typeof t!="string")return null;const n="connectToken"in e?e.connectToken:null;if(n!==null&&typeof n!="string")return null;const a="connectTokenExpiresAt"in e?e.connectTokenExpiresAt:null;return a!==null&&typeof a!="number"?null:{displayName:e.displayName,selectedRuntime:t,connectToken:n,connectTokenExpiresAt:a}}function YA(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(kv(e));if(!t)return null;try{return KA(JSON.parse(t))}catch{return null}}function XA(e,t){typeof window>"u"||window.sessionStorage.setItem(kv(e),JSON.stringify(t))}function JA(e){typeof window>"u"||window.sessionStorage.removeItem(kv(e))}function WA(){if(typeof window>"u")return;const e=window.sessionStorage,t=[];for(let n=0;n<e.length;n++){const a=e.key(n);a!=null&&a.startsWith("onboarding:")&&t.push(a)}for(const n of t)e.removeItem(n)}const rj=x.createContext(null),Tg="first-tree-hub:selectedOrganizationId";function ez(){try{return localStorage.getItem(Tg)}catch{return null}}function dp(e){try{e===null?localStorage.removeItem(Tg):localStorage.setItem(Tg,e)}catch{}}function tz({children:e}){const t=nn(),[n,a]=x.useState(()=>!!kf()),[s,o]=x.useState(null),[c,f]=x.useState([]),[m,h]=x.useState(()=>{const Z=ez();return nu(Z),Z}),[v,p]=x.useState(null),[b,w]=x.useState(null),[k,j]=x.useState(!1),N=x.useCallback(()=>{Wk(),dp(null),nu(null),t.clear(),WA(),a(!1),o(null),f([]),h(null),p(null),w(null),j(!1)},[t]),C=x.useCallback(async()=>{var Z,D;try{const te=await Se.get("/me");o(te.user??null);const ae=te.memberships??[];f(ae);const xe=((Z=te.onboarding)==null?void 0:Z.step)??null;p(xe),w(((D=te.onboarding)==null?void 0:D.dismissedAt)??null),xe==="completed"&&QA(),h(G=>{var ee;const X=G&&ae.some(ye=>ye.organizationId===G)?G:null;if(X)return nu(X),X;const q=te.defaultOrganizationId??((ee=ae[0])==null?void 0:ee.organizationId)??null;return dp(q),nu(q),q})}catch{}finally{j(!0)}},[]),A=x.useCallback(async(Z,D)=>{const te=await BA(Z,D);Ng({accessToken:te.accessToken,refreshToken:te.refreshToken}),a(!0),await C()},[C]),O=x.useCallback(async Z=>{Ng(Z),a(!0),await C()},[C]),M=x.useCallback(async Z=>{dp(Z),nu(Z),t.clear(),h(Z),await C()},[C,t]),P=x.useRef(null);x.useEffect(()=>{P.current=b},[b]);const z=x.useCallback(async()=>{const Z=P.current;w(new Date().toISOString());try{const D=await Se.patch("/me/onboarding",{dismissed:!0});D!=null&&D.dismissedAt&&w(D.dismissedAt)}catch{w(Z)}},[]),$=x.useCallback(async()=>{const Z=P.current;w(null);try{await Se.patch("/me/onboarding",{dismissed:!1})}catch{w(Z)}},[]);x.useEffect(()=>{n&&!s&&C()},[n,s,C]),x.useEffect(()=>{const Z=()=>N();return window.addEventListener("auth:logout",Z),()=>window.removeEventListener("auth:logout",Z)},[N]);const I=x.useMemo(()=>c.length===0?null:c.find(D=>D.organizationId===m)??c[0]??null,[c,m]);return u.jsx(rj.Provider,{value:{isAuthenticated:n,meLoaded:k,user:s,memberships:c,currentMembership:I,organizationId:(I==null?void 0:I.organizationId)??null,memberId:(I==null?void 0:I.id)??null,role:(I==null?void 0:I.role)??null,agentId:(I==null?void 0:I.agentId)??null,onboardingStep:v,onboardingDismissedAt:b,dismissOnboarding:z,restoreOnboarding:$,login:A,adoptTokens:O,selectOrganization:M,refreshMe:C,logout:N},children:e})}function kt(){const e=x.useContext(rj);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const nz="modulepreload",rz=function(e){return"/"+e},Y1={},az=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));s=c(n.map(h=>{if(h=rz(h),h in Y1)return;Y1[h]=!0;const v=h.endsWith(".css"),p=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":nz,v||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),v)return new Promise((w,k)=>{b.addEventListener("load",w),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return s.then(c=>{for(const f of c||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},iz=x.lazy(()=>az(()=>import("./index-B7noAoV-.js"),[]).then(e=>({default:e.LandingPage}))),X1=()=>u.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function sz(){const{isAuthenticated:e,meLoaded:t}=kt(),n=Jn();return e?t?u.jsx(Pl,{}):u.jsx(X1,{}):n.pathname==="/"?u.jsx(x.Suspense,{fallback:u.jsx(X1,{}),children:u.jsx(iz,{})}):u.jsx(dr,{to:"/login",replace:!0,state:{from:n}})}/**
61
+ * @license lucide-react v0.577.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const aj=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim();/**
66
+ * @license lucide-react v0.577.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const lz=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
71
+ * @license lucide-react v0.577.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const oz=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase());/**
76
+ * @license lucide-react v0.577.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const J1=e=>{const t=oz(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
81
+ * @license lucide-react v0.577.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */var uz={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"};/**
86
+ * @license lucide-react v0.577.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const cz=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
91
+ * @license lucide-react v0.577.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const dz=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:c,...f},m)=>x.createElement("svg",{ref:m,...uz,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:aj("lucide",s),...!o&&!cz(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,v])=>x.createElement(h,v)),...Array.isArray(o)?o:[o]]));/**
96
+ * @license lucide-react v0.577.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const lt=(e,t)=>{const n=x.forwardRef(({className:a,...s},o)=>x.createElement(dz,{ref:o,iconNode:t,className:aj(`lucide-${lz(J1(e))}`,`lucide-${e}`,a),...s}));return n.displayName=J1(e),n};/**
101
+ * @license lucide-react v0.577.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const fz=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],jv=lt("arrow-left",fz);/**
106
+ * @license lucide-react v0.577.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const hz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ij=lt("arrow-right",hz);/**
111
+ * @license lucide-react v0.577.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const mz=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],sj=lt("arrow-up",mz);/**
116
+ * @license lucide-react v0.577.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const pz=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],gz=lt("at-sign",pz);/**
121
+ * @license lucide-react v0.577.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const vz=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],yz=lt("bell",vz);/**
126
+ * @license lucide-react v0.577.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const bz=[["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"}]],xz=lt("bot",bz);/**
131
+ * @license lucide-react v0.577.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const wz=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Un=lt("check",wz);/**
136
+ * @license lucide-react v0.577.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const Sz=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Cv=lt("chevron-down",Sz);/**
141
+ * @license lucide-react v0.577.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const kz=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jz=lt("chevron-right",kz);/**
146
+ * @license lucide-react v0.577.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const Cz=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Nz=lt("circle-check",Cz);/**
151
+ * @license lucide-react v0.577.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const Ez=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],jf=lt("copy",Ez);/**
156
+ * @license lucide-react v0.577.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const _z=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Tz=lt("eye-off",_z);/**
161
+ * @license lucide-react v0.577.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const Rz=[["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"}]],lj=lt("eye",Rz);/**
166
+ * @license lucide-react v0.577.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const Az=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],zz=lt("folder-tree",Az);/**
171
+ * @license lucide-react v0.577.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const Oz=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],oj=lt("github",Oz);/**
176
+ * @license lucide-react v0.577.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const Dz=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Mz=lt("layout-dashboard",Dz);/**
181
+ * @license lucide-react v0.577.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const Iz=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Rg=lt("link-2",Iz);/**
186
+ * @license lucide-react v0.577.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const Lz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Uz=lt("loader-circle",Lz);/**
191
+ * @license lucide-react v0.577.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const Pz=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],uj=lt("lock",Pz);/**
196
+ * @license lucide-react v0.577.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const Bz=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],$z=lt("log-out",Bz);/**
201
+ * @license lucide-react v0.577.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const Fz=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Nv=lt("message-square",Fz);/**
206
+ * @license lucide-react v0.577.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const qz=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Hz=lt("moon",qz);/**
211
+ * @license lucide-react v0.577.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const Zz=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Vz=lt("paperclip",Zz);/**
216
+ * @license lucide-react v0.577.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const Qz=[["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"}]],Cf=lt("pencil",Qz);/**
221
+ * @license lucide-react v0.577.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const Gz=[["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"}]],cj=lt("play",Gz);/**
226
+ * @license lucide-react v0.577.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const Kz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],qr=lt("plus",Kz);/**
231
+ * @license lucide-react v0.577.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const Yz=[["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"}]],Xz=lt("refresh-cw",Yz);/**
236
+ * @license lucide-react v0.577.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const Jz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ev=lt("search",Jz);/**
241
+ * @license lucide-react v0.577.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const Wz=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],e3=lt("sun",Wz);/**
246
+ * @license lucide-react v0.577.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const t3=[["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"}]],Nu=lt("trash-2",t3);/**
251
+ * @license lucide-react v0.577.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const n3=[["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"}]],ws=lt("triangle-alert",n3);/**
256
+ * @license lucide-react v0.577.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const r3=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],a3=lt("undo-2",r3);/**
261
+ * @license lucide-react v0.577.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const i3=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],dj=lt("user-plus",i3);/**
266
+ * @license lucide-react v0.577.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const s3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Bl=lt("x",s3);/**
271
+ * @license lucide-react v0.577.0 - ISC
272
+ *
273
+ * This source code is licensed under the ISC license.
274
+ * See the LICENSE file in the root directory of this source tree.
275
+ */const l3=[["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"}]],o3=lt("zap",l3);function fj(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=fj(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function hj(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=fj(e))&&(a&&(a+=" "),a+=t);return a}const u3=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a<e.length;a++)n[a]=e[a];for(let a=0;a<t.length;a++)n[e.length+a]=t[a];return n},c3=(e,t)=>({classGroupId:e,validator:t}),mj=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Jd="-",W1=[],d3="arbitrary..",f3=e=>{const t=m3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return h3(c);const f=c.split(Jd),m=f[0]===""&&f.length>1?1:0;return pj(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?u3(h,m):m:h||W1}return n[c]||W1}}},pj=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=pj(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join(Jd):e.slice(t).join(Jd),m=c.length;for(let h=0;h<m;h++){const v=c[h];if(v.validator(f))return v.classGroupId}},h3=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?d3+a:void 0})(),m3=e=>{const{theme:t,classGroups:n}=e;return p3(n,t)},p3=(e,t)=>{const n=mj();for(const a in e){const s=e[a];_v(s,n,a,t)}return n},_v=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];g3(c,t,n,a)}},g3=(e,t,n,a)=>{if(typeof e=="string"){v3(e,t,n);return}if(typeof e=="function"){y3(e,t,n,a);return}b3(e,t,n,a)},v3=(e,t,n)=>{const a=e===""?t:gj(t,e);a.classGroupId=n},y3=(e,t,n,a)=>{if(x3(e)){_v(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(c3(n,e))},b3=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[f,m]=s[c];_v(m,gj(t,f),n,a)}},gj=(e,t)=>{let n=e;const a=t.split(Jd),s=a.length;for(let o=0;o<s;o++){const c=a[o];let f=n.nextPart.get(c);f||(f=mj(),n.nextPart.set(c,f)),n=f}return n},x3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,w3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const s=(o,c)=>{n[o]=c,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(o){let c=n[o];if(c!==void 0)return c;if((c=a[o])!==void 0)return s(o,c),c},set(o,c){o in n?n[o]=c:s(o,c)}}},Ag="!",ew=":",S3=[],tw=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),k3=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const o=[];let c=0,f=0,m=0,h;const v=s.length;for(let j=0;j<v;j++){const N=s[j];if(c===0&&f===0){if(N===ew){o.push(s.slice(m,j)),m=j+1;continue}if(N==="/"){h=j;continue}}N==="["?c++:N==="]"?c--:N==="("?f++:N===")"&&f--}const p=o.length===0?s:s.slice(m);let b=p,w=!1;p.endsWith(Ag)?(b=p.slice(0,-1),w=!0):p.startsWith(Ag)&&(b=p.slice(1),w=!0);const k=h&&h>m?h-m:void 0;return tw(o,w,b,k)};if(t){const s=t+ew,o=a;a=c=>c.startsWith(s)?o(c.slice(s.length)):tw(S3,!1,c,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},j3=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let s=[];for(let o=0;o<n.length;o++){const c=n[o],f=c[0]==="[",m=t.has(c);f||m?(s.length>0&&(s.sort(),a.push(...s),s=[]),a.push(c)):s.push(c)}return s.length>0&&(s.sort(),a.push(...s)),a}},C3=e=>({cache:w3(e.cacheSize),parseClassName:k3(e),sortModifiers:j3(e),...f3(e)}),N3=/\s+/,E3=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,c=[],f=e.trim().split(N3);let m="";for(let h=f.length-1;h>=0;h-=1){const v=f[h],{isExternal:p,modifiers:b,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:j}=n(v);if(p){m=v+(m.length>0?" "+m:m);continue}let N=!!j,C=a(N?k.substring(0,j):k);if(!C){if(!N){m=v+(m.length>0?" "+m:m);continue}if(C=a(k),!C){m=v+(m.length>0?" "+m:m);continue}N=!1}const A=b.length===0?"":b.length===1?b[0]:o(b).join(":"),O=w?A+Ag:A,M=O+C;if(c.indexOf(M)>-1)continue;c.push(M);const P=s(C,N);for(let z=0;z<P.length;++z){const $=P[z];c.push(O+$)}m=v+(m.length>0?" "+m:m)}return m},_3=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=vj(n))&&(s&&(s+=" "),s+=a);return s},vj=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=vj(e[a]))&&(n&&(n+=" "),n+=t);return n},T3=(e,...t)=>{let n,a,s,o;const c=m=>{const h=t.reduce((v,p)=>p(v),e());return n=C3(h),a=n.cache.get,s=n.cache.set,o=f,f(m)},f=m=>{const h=a(m);if(h)return h;const v=E3(m,n);return s(m,v),v};return o=c,(...m)=>o(_3(...m))},R3=[],sn=e=>{const t=n=>n[e]||R3;return t.isThemeGetter=!0,t},yj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,A3=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,z3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,O3=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,D3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,M3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,I3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oi=e=>A3.test(e),Qe=e=>!!e&&!Number.isNaN(Number(e)),ui=e=>!!e&&Number.isInteger(Number(e)),fp=e=>e.endsWith("%")&&Qe(e.slice(0,-1)),ka=e=>z3.test(e),xj=()=>!0,L3=e=>O3.test(e)&&!D3.test(e),Tv=()=>!1,U3=e=>M3.test(e),P3=e=>I3.test(e),B3=e=>!Ne(e)&&!Ee(e),$3=e=>zi(e,kj,Tv),Ne=e=>yj.test(e),rs=e=>zi(e,jj,L3),nw=e=>zi(e,K3,Qe),F3=e=>zi(e,Nj,xj),q3=e=>zi(e,Cj,Tv),rw=e=>zi(e,wj,Tv),H3=e=>zi(e,Sj,P3),jd=e=>zi(e,Ej,U3),Ee=e=>bj.test(e),iu=e=>Ss(e,jj),Z3=e=>Ss(e,Cj),aw=e=>Ss(e,wj),V3=e=>Ss(e,kj),Q3=e=>Ss(e,Sj),Cd=e=>Ss(e,Ej,!0),G3=e=>Ss(e,Nj,!0),zi=(e,t,n)=>{const a=yj.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Ss=(e,t,n=!1)=>{const a=bj.exec(e);return a?a[1]?t(a[1]):n:!1},wj=e=>e==="position"||e==="percentage",Sj=e=>e==="image"||e==="url",kj=e=>e==="length"||e==="size"||e==="bg-size",jj=e=>e==="length",K3=e=>e==="number",Cj=e=>e==="family-name",Nj=e=>e==="number"||e==="weight",Ej=e=>e==="shadow",Y3=()=>{const e=sn("color"),t=sn("font"),n=sn("text"),a=sn("font-weight"),s=sn("tracking"),o=sn("leading"),c=sn("breakpoint"),f=sn("container"),m=sn("spacing"),h=sn("radius"),v=sn("shadow"),p=sn("inset-shadow"),b=sn("text-shadow"),w=sn("drop-shadow"),k=sn("blur"),j=sn("perspective"),N=sn("aspect"),C=sn("ease"),A=sn("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...M(),Ee,Ne],z=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],I=()=>[Ee,Ne,m],Z=()=>[oi,"full","auto",...I()],D=()=>[ui,"none","subgrid",Ee,Ne],te=()=>["auto",{span:["full",ui,Ee,Ne]},ui,Ee,Ne],ae=()=>[ui,"auto",Ee,Ne],xe=()=>["auto","min","max","fr",Ee,Ne],G=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...I()],ee=()=>[oi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],ye=()=>[oi,"screen","full","dvw","lvw","svw","min","max","fit",...I()],Ae=()=>[oi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],R=()=>[e,Ee,Ne],U=()=>[...M(),aw,rw,{position:[Ee,Ne]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",V3,$3,{size:[Ee,Ne]}],V=()=>[fp,iu,rs],W=()=>["","none","full",h,Ee,Ne],ce=()=>["",Qe,iu,rs],be=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Qe,fp,aw,rw],Ge=()=>["","none",k,Ee,Ne],Oe=()=>["none",Qe,Ee,Ne],jt=()=>["none",Qe,Ee,Ne],ie=()=>[Qe,Ee,Ne],ke=()=>[oi,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ka],breakpoint:[ka],color:[xj],container:[ka],"drop-shadow":[ka],ease:["in","out","in-out"],font:[B3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ka],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ka],shadow:[ka],spacing:["px",Qe],text:[ka],"text-shadow":[ka],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",oi,Ne,Ee,N]}],container:["container"],columns:[{columns:[Qe,Ne,Ee,f]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Z()}],"inset-x":[{"inset-x":Z()}],"inset-y":[{"inset-y":Z()}],start:[{"inset-s":Z(),start:Z()}],end:[{"inset-e":Z(),end:Z()}],"inset-bs":[{"inset-bs":Z()}],"inset-be":[{"inset-be":Z()}],top:[{top:Z()}],right:[{right:Z()}],bottom:[{bottom:Z()}],left:[{left:Z()}],visibility:["visible","invisible","collapse"],z:[{z:[ui,"auto",Ee,Ne]}],basis:[{basis:[oi,"full","auto",f,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qe,oi,"auto","initial","none",Ne]}],grow:[{grow:["",Qe,Ee,Ne]}],shrink:[{shrink:["",Qe,Ee,Ne]}],order:[{order:[ui,"first","last","none",Ee,Ne]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:te()}],"col-start":[{"col-start":ae()}],"col-end":[{"col-end":ae()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:te()}],"row-start":[{"row-start":ae()}],"row-end":[{"row-end":ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":xe()}],"auto-rows":[{"auto-rows":xe()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...G(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...G()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":G()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:ee()}],"inline-size":[{inline:["auto",...ye()]}],"min-inline-size":[{"min-inline":["auto",...ye()]}],"max-inline-size":[{"max-inline":["none",...ye()]}],"block-size":[{block:["auto",...Ae()]}],"min-block-size":[{"min-block":["auto",...Ae()]}],"max-block-size":[{"max-block":["none",...Ae()]}],w:[{w:[f,"screen",...ee()]}],"min-w":[{"min-w":[f,"screen","none",...ee()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...ee()]}],h:[{h:["screen","lh",...ee()]}],"min-h":[{"min-h":["screen","lh","none",...ee()]}],"max-h":[{"max-h":["screen","lh",...ee()]}],"font-size":[{text:["base",n,iu,rs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,G3,F3]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fp,Ne]}],"font-family":[{font:[Z3,q3,t]}],"font-features":[{"font-features":[Ne]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ee,Ne]}],"line-clamp":[{"line-clamp":[Qe,"none",Ee,nw]}],leading:[{leading:[o,...I()]}],"list-image":[{"list-image":["none",Ee,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ee,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:[Qe,"from-font","auto",Ee,rs]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[Qe,"auto",Ee,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ee,Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ee,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ui,Ee,Ne],radial:["",Ee,Ne],conic:[ui,Ee,Ne]},Q3,H3]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:W()}],"rounded-s":[{"rounded-s":W()}],"rounded-e":[{"rounded-e":W()}],"rounded-t":[{"rounded-t":W()}],"rounded-r":[{"rounded-r":W()}],"rounded-b":[{"rounded-b":W()}],"rounded-l":[{"rounded-l":W()}],"rounded-ss":[{"rounded-ss":W()}],"rounded-se":[{"rounded-se":W()}],"rounded-ee":[{"rounded-ee":W()}],"rounded-es":[{"rounded-es":W()}],"rounded-tl":[{"rounded-tl":W()}],"rounded-tr":[{"rounded-tr":W()}],"rounded-br":[{"rounded-br":W()}],"rounded-bl":[{"rounded-bl":W()}],"border-w":[{border:ce()}],"border-w-x":[{"border-x":ce()}],"border-w-y":[{"border-y":ce()}],"border-w-s":[{"border-s":ce()}],"border-w-e":[{"border-e":ce()}],"border-w-bs":[{"border-bs":ce()}],"border-w-be":[{"border-be":ce()}],"border-w-t":[{"border-t":ce()}],"border-w-r":[{"border-r":ce()}],"border-w-b":[{"border-b":ce()}],"border-w-l":[{"border-l":ce()}],"divide-x":[{"divide-x":ce()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ce()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...be(),"hidden","none"]}],"divide-style":[{divide:[...be(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...be(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Qe,Ee,Ne]}],"outline-w":[{outline:["",Qe,iu,rs]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",v,Cd,jd]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",p,Cd,jd]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[Qe,rs]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",b,Cd,jd]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[Qe,Ee,Ne]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Qe]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[Ee,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[Qe]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ee,Ne]}],filter:[{filter:["","none",Ee,Ne]}],blur:[{blur:Ge()}],brightness:[{brightness:[Qe,Ee,Ne]}],contrast:[{contrast:[Qe,Ee,Ne]}],"drop-shadow":[{"drop-shadow":["","none",w,Cd,jd]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",Qe,Ee,Ne]}],"hue-rotate":[{"hue-rotate":[Qe,Ee,Ne]}],invert:[{invert:["",Qe,Ee,Ne]}],saturate:[{saturate:[Qe,Ee,Ne]}],sepia:[{sepia:["",Qe,Ee,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",Ee,Ne]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[Qe,Ee,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[Qe,Ee,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qe,Ee,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qe,Ee,Ne]}],"backdrop-invert":[{"backdrop-invert":["",Qe,Ee,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[Qe,Ee,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[Qe,Ee,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",Qe,Ee,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ee,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qe,"initial",Ee,Ne]}],ease:[{ease:["linear","initial",C,Ee,Ne]}],delay:[{delay:[Qe,Ee,Ne]}],animate:[{animate:["none",A,Ee,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,Ee,Ne]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:Oe()}],"rotate-x":[{"rotate-x":Oe()}],"rotate-y":[{"rotate-y":Oe()}],"rotate-z":[{"rotate-z":Oe()}],scale:[{scale:jt()}],"scale-x":[{"scale-x":jt()}],"scale-y":[{"scale-y":jt()}],"scale-z":[{"scale-z":jt()}],"scale-3d":["scale-3d"],skew:[{skew:ie()}],"skew-x":[{"skew-x":ie()}],"skew-y":[{"skew-y":ie()}],transform:[{transform:[Ee,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ke()}],"translate-x":[{"translate-x":ke()}],"translate-y":[{"translate-y":ke()}],"translate-z":[{"translate-z":ke()}],"translate-none":["translate-none"],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ee,Ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ee,Ne]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[Qe,iu,rs,nw]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},X3=T3(Y3);function Te(...e){return X3(hj(e))}function Eu(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e)):"—"}function _j(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function J3(e){return Se.delete(`/clients/${encodeURIComponent(e)}`)}function Yu(){return Se.get(hn("/activity"))}function Ei(){return Se.get("/me/clients")}function Rv(e){return Se.get(`/clients/${e}`)}function W3(e){return Se.post(`/clients/${e}/disconnect`)}function eO(){return Se.post("/me/connect-tokens")}const iw=e=>["agent-sessions",e];function tO(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.toolUseId!="string"||typeof t.name!="string"||t.status!=="pending"&&t.status!=="ok"&&t.status!=="error"?null:{toolUseId:t.toolUseId,name:t.name,args:t.args,status:t.status,durationMs:typeof t.durationMs=="number"?t.durationMs:void 0,resultPreview:typeof t.resultPreview=="string"?t.resultPreview:void 0}}function nO(e){if(typeof e!="object"||e===null)return null;const t=e;return t.source!=="sdk"&&t.source!=="runtime"&&t.source!=="tool"||typeof t.message!="string"?null:{source:t.source,message:t.message}}function rO(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function Tj(e,t){const n=new URLSearchParams;t!=null&&t.state&&n.set("state",t.state),t!=null&&t.runtimeState&&n.set("runtimeState",t.runtimeState);const a=n.toString();return Se.get(`/agents/${e}/sessions${a?`?${a}`:""}`)}function aO(e,t,n){const a=new URLSearchParams;a.set("limit",String(n.limit)),(n==null?void 0:n.cursor)!==void 0&&a.set("cursor",String(n.cursor)),n!=null&&n.direction&&a.set("direction",n.direction);const s=a.toString();return Se.get(`/agents/${e}/sessions/${t}/events${s?`?${s}`:""}`)}var sw=1,iO=.9,sO=.8,lO=.17,hp=.1,mp=.999,oO=.9999,uO=.99,cO=/[\\\/_+.#"@\[\(\{&]/,dO=/[\\\/_+.#"@\[\(\{&]/g,fO=/[\s-]/,Rj=/[\s-]/g;function zg(e,t,n,a,s,o,c){if(o===t.length)return s===e.length?sw:uO;var f=`${s},${o}`;if(c[f]!==void 0)return c[f];for(var m=a.charAt(o),h=n.indexOf(m,s),v=0,p,b,w,k;h>=0;)p=zg(e,t,n,a,h+1,o+1,c),p>v&&(h===s?p*=sw:cO.test(e.charAt(h-1))?(p*=sO,w=e.slice(s,h-1).match(dO),w&&s>0&&(p*=Math.pow(mp,w.length))):fO.test(e.charAt(h-1))?(p*=iO,k=e.slice(s,h-1).match(Rj),k&&s>0&&(p*=Math.pow(mp,k.length))):(p*=lO,s>0&&(p*=Math.pow(mp,h-s))),e.charAt(h)!==t.charAt(o)&&(p*=oO)),(p<hp&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(b=zg(e,t,n,a,h+1,o+2,c),b*hp>p&&(p=b*hp)),p>v&&(v=p),h=n.indexOf(m,h+1);return c[f]=v,v}function lw(e){return e.toLowerCase().replace(Rj," ")}function hO(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,zg(e,t,lw(e),lw(t),0,0,{})}function Ni(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function ow(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _i(...e){return t=>{let n=!1;const a=e.map(s=>{const o=ow(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<a.length;s++){const o=a[s];typeof o=="function"?o():ow(e[s],null)}}}}function ks(...e){return x.useCallback(_i(...e),e)}function mO(e,t){const n=x.createContext(t),a=o=>{const{children:c,...f}=o,m=x.useMemo(()=>f,Object.values(f));return u.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function s(o){const c=x.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[a,s]}function pO(e,t=[]){let n=[];function a(o,c){const f=x.createContext(c),m=n.length;n=[...n,c];const h=p=>{var C;const{scope:b,children:w,...k}=p,j=((C=b==null?void 0:b[e])==null?void 0:C[m])||f,N=x.useMemo(()=>k,Object.values(k));return u.jsx(j.Provider,{value:N,children:w})};h.displayName=o+"Provider";function v(p,b){var j;const w=((j=b==null?void 0:b[e])==null?void 0:j[m])||f,k=x.useContext(w);if(k)return k;if(c!==void 0)return c;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[h,v]}const s=()=>{const o=n.map(c=>x.createContext(c));return function(f){const m=(f==null?void 0:f[e])||o;return x.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return s.scopeName=e,[a,gO(s,...t)]}function gO(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const c=a.reduce((f,{useScope:m,scopeName:h})=>{const p=m(o)[`__scope${h}`];return{...f,...p}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var _u=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},vO=lv[" useId ".trim().toString()]||(()=>{}),yO=0;function Ta(e){const[t,n]=x.useState(vO());return _u(()=>{n(a=>a??String(yO++))},[e]),t?`radix-${t}`:""}var bO=lv[" useInsertionEffect ".trim().toString()]||_u;function xO({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,c]=wO({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:s;{const v=x.useRef(e!==void 0);x.useEffect(()=>{const p=v.current;p!==f&&console.warn(`${a} is changing from ${p?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=f},[f,a])}const h=x.useCallback(v=>{var p;if(f){const b=SO(v)?v(e):v;b!==e&&((p=c.current)==null||p.call(c,b))}else o(v)},[f,e,o,c]);return[m,h]}function wO({defaultProp:e,onChange:t}){const[n,a]=x.useState(e),s=x.useRef(n),o=x.useRef(t);return bO(()=>{o.current=t},[t]),x.useEffect(()=>{var c;s.current!==n&&((c=o.current)==null||c.call(o,n),s.current=n)},[n,s]),[n,a,o]}function SO(e){return typeof e=="function"}var Av=gk();const kO=vf(Av);function Aj(e){const t=jO(e),n=x.forwardRef((a,s)=>{const{children:o,...c}=a,f=x.Children.toArray(o),m=f.find(NO);if(m){const h=m.props.children,v=f.map(p=>p===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:p);return u.jsx(t,{...c,ref:s,children:x.isValidElement(h)?x.cloneElement(h,void 0,v):null})}return u.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function jO(e){const t=x.forwardRef((n,a)=>{const{children:s,...o}=n;if(x.isValidElement(s)){const c=_O(s),f=EO(o,s.props);return s.type!==x.Fragment&&(f.ref=a?_i(a,c):c),x.cloneElement(s,f)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var CO=Symbol("radix.slottable");function NO(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===CO}function EO(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function _O(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var TO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],za=TO.reduce((e,t)=>{const n=Aj(`Primitive.${t}`),a=x.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function RO(e,t){e&&Av.flushSync(()=>e.dispatchEvent(t))}function Tu(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function AO(e,t=globalThis==null?void 0:globalThis.document){const n=Tu(e);x.useEffect(()=>{const a=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var zO="DismissableLayer",Og="dismissableLayer.update",OO="dismissableLayer.pointerDownOutside",DO="dismissableLayer.focusOutside",uw,zj=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Oj=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:c,onDismiss:f,...m}=e,h=x.useContext(zj),[v,p]=x.useState(null),b=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=x.useState({}),k=ks(t,$=>p($)),j=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=j.indexOf(N),A=v?j.indexOf(v):-1,O=h.layersWithOutsidePointerEventsDisabled.size>0,M=A>=C,P=LO($=>{const I=$.target,Z=[...h.branches].some(D=>D.contains(I));!M||Z||(s==null||s($),c==null||c($),$.defaultPrevented||f==null||f())},b),z=UO($=>{const I=$.target;[...h.branches].some(D=>D.contains(I))||(o==null||o($),c==null||c($),$.defaultPrevented||f==null||f())},b);return AO($=>{A===h.layers.size-1&&(a==null||a($),!$.defaultPrevented&&f&&($.preventDefault(),f()))},b),x.useEffect(()=>{if(v)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(uw=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(v)),h.layers.add(v),cw(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=uw)}},[v,b,n,h]),x.useEffect(()=>()=>{v&&(h.layers.delete(v),h.layersWithOutsidePointerEventsDisabled.delete(v),cw())},[v,h]),x.useEffect(()=>{const $=()=>w({});return document.addEventListener(Og,$),()=>document.removeEventListener(Og,$)},[]),u.jsx(za.div,{...m,ref:k,style:{pointerEvents:O?M?"auto":"none":void 0,...e.style},onFocusCapture:Ni(e.onFocusCapture,z.onFocusCapture),onBlurCapture:Ni(e.onBlurCapture,z.onBlurCapture),onPointerDownCapture:Ni(e.onPointerDownCapture,P.onPointerDownCapture)})});Oj.displayName=zO;var MO="DismissableLayerBranch",IO=x.forwardRef((e,t)=>{const n=x.useContext(zj),a=x.useRef(null),s=ks(t,a);return x.useEffect(()=>{const o=a.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),u.jsx(za.div,{...e,ref:s})});IO.displayName=MO;function LO(e,t=globalThis==null?void 0:globalThis.document){const n=Tu(e),a=x.useRef(!1),s=x.useRef(()=>{});return x.useEffect(()=>{const o=f=>{if(f.target&&!a.current){let m=function(){Dj(OO,n,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);a.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function UO(e,t=globalThis==null?void 0:globalThis.document){const n=Tu(e),a=x.useRef(!1);return x.useEffect(()=>{const s=o=>{o.target&&!a.current&&Dj(DO,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function cw(){const e=new CustomEvent(Og);document.dispatchEvent(e)}function Dj(e,t,n,{discrete:a}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),a?RO(s,o):s.dispatchEvent(o)}var pp="focusScope.autoFocusOnMount",gp="focusScope.autoFocusOnUnmount",dw={bubbles:!1,cancelable:!0},PO="FocusScope",Mj=x.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[f,m]=x.useState(null),h=Tu(s),v=Tu(o),p=x.useRef(null),b=ks(t,j=>m(j)),w=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(a){let j=function(O){if(w.paused||!f)return;const M=O.target;f.contains(M)?p.current=M:fi(p.current,{select:!0})},N=function(O){if(w.paused||!f)return;const M=O.relatedTarget;M!==null&&(f.contains(M)||fi(p.current,{select:!0}))},C=function(O){if(document.activeElement===document.body)for(const P of O)P.removedNodes.length>0&&fi(f)};document.addEventListener("focusin",j),document.addEventListener("focusout",N);const A=new MutationObserver(C);return f&&A.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",N),A.disconnect()}}},[a,f,w.paused]),x.useEffect(()=>{if(f){hw.add(w);const j=document.activeElement;if(!f.contains(j)){const C=new CustomEvent(pp,dw);f.addEventListener(pp,h),f.dispatchEvent(C),C.defaultPrevented||(BO(ZO(Ij(f)),{select:!0}),document.activeElement===j&&fi(f))}return()=>{f.removeEventListener(pp,h),setTimeout(()=>{const C=new CustomEvent(gp,dw);f.addEventListener(gp,v),f.dispatchEvent(C),C.defaultPrevented||fi(j??document.body,{select:!0}),f.removeEventListener(gp,v),hw.remove(w)},0)}}},[f,h,v,w]);const k=x.useCallback(j=>{if(!n&&!a||w.paused)return;const N=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,C=document.activeElement;if(N&&C){const A=j.currentTarget,[O,M]=$O(A);O&&M?!j.shiftKey&&C===M?(j.preventDefault(),n&&fi(O,{select:!0})):j.shiftKey&&C===O&&(j.preventDefault(),n&&fi(M,{select:!0})):C===A&&j.preventDefault()}},[n,a,w.paused]);return u.jsx(za.div,{tabIndex:-1,...c,ref:b,onKeyDown:k})});Mj.displayName=PO;function BO(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(fi(a,{select:t}),document.activeElement!==n)return}function $O(e){const t=Ij(e),n=fw(t,e),a=fw(t.reverse(),e);return[n,a]}function Ij(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const s=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||s?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function fw(e,t){for(const n of e)if(!FO(n,{upTo:t}))return n}function FO(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function qO(e){return e instanceof HTMLInputElement&&"select"in e}function fi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qO(e)&&t&&e.select()}}var hw=HO();function HO(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=mw(e,t),e.unshift(t)},remove(t){var n;e=mw(e,t),(n=e[0])==null||n.resume()}}}function mw(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function ZO(e){return e.filter(t=>t.tagName!=="A")}var VO="Portal",Lj=x.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[s,o]=x.useState(!1);_u(()=>o(!0),[]);const c=n||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?kO.createPortal(u.jsx(za.div,{...a,ref:t}),c):null});Lj.displayName=VO;function QO(e,t){return x.useReducer((n,a)=>t[n][a]??n,e)}var Nf=e=>{const{present:t,children:n}=e,a=GO(t),s=typeof n=="function"?n({present:a.isPresent}):x.Children.only(n),o=ks(a.ref,KO(s));return typeof n=="function"||a.isPresent?x.cloneElement(s,{ref:o}):null};Nf.displayName="Presence";function GO(e){const[t,n]=x.useState(),a=x.useRef(null),s=x.useRef(e),o=x.useRef("none"),c=e?"mounted":"unmounted",[f,m]=QO(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const h=Nd(a.current);o.current=f==="mounted"?h:"none"},[f]),_u(()=>{const h=a.current,v=s.current;if(v!==e){const b=o.current,w=Nd(h);e?m("MOUNT"):w==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(v&&b!==w?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),_u(()=>{if(t){let h;const v=t.ownerDocument.defaultView??window,p=w=>{const j=Nd(a.current).includes(CSS.escape(w.animationName));if(w.target===t&&j&&(m("ANIMATION_END"),!s.current)){const N=t.style.animationFillMode;t.style.animationFillMode="forwards",h=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=N)})}},b=w=>{w.target===t&&(o.current=Nd(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{v.clearTimeout(h),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:x.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function Nd(e){return(e==null?void 0:e.animationName)||"none"}function KO(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var vp=0;function YO(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??pw()),document.body.insertAdjacentElement("beforeend",e[1]??pw()),vp++,()=>{vp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),vp--}},[])}function pw(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ea=function(){return ea=Object.assign||function(t){for(var n,a=1,s=arguments.length;a<s;a++){n=arguments[a];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ea.apply(this,arguments)};function Uj(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(n[a[s]]=e[a[s]]);return n}function XO(e,t,n){if(n||arguments.length===2)for(var a=0,s=t.length,o;a<s;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}var Hd="right-scroll-bar-position",Zd="width-before-scroll-bar",JO="with-scroll-bars-hidden",WO="--removed-body-scroll-bar-size";function yp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function eD(e,t){var n=x.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var s=n.value;s!==a&&(n.value=a,n.callback(a,s))}}}})[0];return n.callback=t,n.facade}var tD=typeof window<"u"?x.useLayoutEffect:x.useEffect,gw=new WeakMap;function nD(e,t){var n=eD(null,function(a){return e.forEach(function(s){return yp(s,a)})});return tD(function(){var a=gw.get(n);if(a){var s=new Set(a),o=new Set(e),c=n.current;s.forEach(function(f){o.has(f)||yp(f,null)}),o.forEach(function(f){s.has(f)||yp(f,c)})}gw.set(n,e)},[e]),n}function rD(e){return e}function aD(e,t){t===void 0&&(t=rD);var n=[],a=!1,s={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var c=t(o,a);return n.push(c),function(){n=n.filter(function(f){return f!==c})}},assignSyncMedium:function(o){for(a=!0;n.length;){var c=n;n=[],c.forEach(o)}n={push:function(f){return o(f)},filter:function(){return n}}},assignMedium:function(o){a=!0;var c=[];if(n.length){var f=n;n=[],f.forEach(o),c=n}var m=function(){var v=c;c=[],v.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(v){c.push(v),h()},filter:function(v){return c=c.filter(v),n}}}};return s}function iD(e){e===void 0&&(e={});var t=aD(null);return t.options=ea({async:!0,ssr:!1},e),t}var Pj=function(e){var t=e.sideCar,n=Uj(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return x.createElement(a,ea({},n))};Pj.isSideCarExport=!0;function sD(e,t){return e.useMedium(t),Pj}var Bj=iD(),bp=function(){},Ef=x.forwardRef(function(e,t){var n=x.useRef(null),a=x.useState({onScrollCapture:bp,onWheelCapture:bp,onTouchMoveCapture:bp}),s=a[0],o=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,v=e.enabled,p=e.shards,b=e.sideCar,w=e.noRelative,k=e.noIsolation,j=e.inert,N=e.allowPinchZoom,C=e.as,A=C===void 0?"div":C,O=e.gapMode,M=Uj(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=b,z=nD([n,t]),$=ea(ea({},M),s);return x.createElement(x.Fragment,null,v&&x.createElement(P,{sideCar:Bj,removeScrollBar:h,shards:p,noRelative:w,noIsolation:k,inert:j,setCallbacks:o,allowPinchZoom:!!N,lockRef:n,gapMode:O}),c?x.cloneElement(x.Children.only(f),ea(ea({},$),{ref:z})):x.createElement(A,ea({},$,{className:m,ref:z}),f))});Ef.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ef.classNames={fullWidth:Zd,zeroRight:Hd};var lD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function oD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=lD();return t&&e.setAttribute("nonce",t),e}function uD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function cD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var dD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=oD())&&(uD(t,n),cD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},fD=function(){var e=dD();return function(t,n){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},$j=function(){var e=fD(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},hD={left:0,top:0,right:0,gap:0},xp=function(e){return parseInt(e||"",10)||0},mD=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[xp(n),xp(a),xp(s)]},pD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return hD;var t=mD(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},gD=$j(),wl="data-scroll-locked",vD=function(e,t,n,a){var s=e.left,o=e.top,c=e.right,f=e.gap;return n===void 0&&(n="margin"),`
276
+ .`.concat(JO,` {
277
+ overflow: hidden `).concat(a,`;
278
+ padding-right: `).concat(f,"px ").concat(a,`;
279
+ }
280
+ body[`).concat(wl,`] {
281
+ overflow: hidden `).concat(a,`;
282
+ overscroll-behavior: contain;
283
+ `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
284
+ padding-left: `.concat(s,`px;
285
+ padding-top: `).concat(o,`px;
286
+ padding-right: `).concat(c,`px;
287
+ margin-left:0;
288
+ margin-top:0;
289
+ margin-right: `).concat(f,"px ").concat(a,`;
290
+ `),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
291
+ }
292
+
293
+ .`).concat(Hd,` {
294
+ right: `).concat(f,"px ").concat(a,`;
295
+ }
296
+
297
+ .`).concat(Zd,` {
298
+ margin-right: `).concat(f,"px ").concat(a,`;
299
+ }
300
+
301
+ .`).concat(Hd," .").concat(Hd,` {
302
+ right: 0 `).concat(a,`;
303
+ }
304
+
305
+ .`).concat(Zd," .").concat(Zd,` {
306
+ margin-right: 0 `).concat(a,`;
307
+ }
308
+
309
+ body[`).concat(wl,`] {
310
+ `).concat(WO,": ").concat(f,`px;
311
+ }
312
+ `)},vw=function(){var e=parseInt(document.body.getAttribute(wl)||"0",10);return isFinite(e)?e:0},yD=function(){x.useEffect(function(){return document.body.setAttribute(wl,(vw()+1).toString()),function(){var e=vw()-1;e<=0?document.body.removeAttribute(wl):document.body.setAttribute(wl,e.toString())}},[])},bD=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;yD();var o=x.useMemo(function(){return pD(s)},[s]);return x.createElement(gD,{styles:vD(o,!t,s,n?"":"!important")})},Dg=!1;if(typeof window<"u")try{var Ed=Object.defineProperty({},"passive",{get:function(){return Dg=!0,!0}});window.addEventListener("test",Ed,Ed),window.removeEventListener("test",Ed,Ed)}catch{Dg=!1}var cl=Dg?{passive:!1}:!1,xD=function(e){return e.tagName==="TEXTAREA"},Fj=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!xD(e)&&n[t]==="visible")},wD=function(e){return Fj(e,"overflowY")},SD=function(e){return Fj(e,"overflowX")},yw=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=qj(e,a);if(s){var o=Hj(e,a),c=o[1],f=o[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},kD=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},jD=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},qj=function(e,t){return e==="v"?wD(t):SD(t)},Hj=function(e,t){return e==="v"?kD(t):jD(t)},CD=function(e,t){return e==="h"&&t==="rtl"?-1:1},ND=function(e,t,n,a,s){var o=CD(e,window.getComputedStyle(t).direction),c=o*a,f=n.target,m=t.contains(f),h=!1,v=c>0,p=0,b=0;do{if(!f)break;var w=Hj(e,f),k=w[0],j=w[1],N=w[2],C=j-N-o*k;(k||C)&&qj(e,f)&&(p+=C,b+=k);var A=f.parentNode;f=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(v&&Math.abs(p)<1||!v&&Math.abs(b)<1)&&(h=!0),h},_d=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bw=function(e){return[e.deltaX,e.deltaY]},xw=function(e){return e&&"current"in e?e.current:e},ED=function(e,t){return e[0]===t[0]&&e[1]===t[1]},_D=function(e){return`
313
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
314
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
315
+ `)},TD=0,dl=[];function RD(e){var t=x.useRef([]),n=x.useRef([0,0]),a=x.useRef(),s=x.useState(TD++)[0],o=x.useState($j)[0],c=x.useRef(e);x.useEffect(function(){c.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var j=XO([e.lockRef.current],(e.shards||[]).map(xw),!0).filter(Boolean);return j.forEach(function(N){return N.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=x.useCallback(function(j,N){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var C=_d(j),A=n.current,O="deltaX"in j?j.deltaX:A[0]-C[0],M="deltaY"in j?j.deltaY:A[1]-C[1],P,z=j.target,$=Math.abs(O)>Math.abs(M)?"h":"v";if("touches"in j&&$==="h"&&z.type==="range")return!1;var I=window.getSelection(),Z=I&&I.anchorNode,D=Z?Z===z||Z.contains(z):!1;if(D)return!1;var te=yw($,z);if(!te)return!0;if(te?P=$:(P=$==="v"?"h":"v",te=yw($,z)),!te)return!1;if(!a.current&&"changedTouches"in j&&(O||M)&&(a.current=P),!P)return!0;var ae=a.current||P;return ND(ae,N,j,ae==="h"?O:M)},[]),m=x.useCallback(function(j){var N=j;if(!(!dl.length||dl[dl.length-1]!==o)){var C="deltaY"in N?bw(N):_d(N),A=t.current.filter(function(P){return P.name===N.type&&(P.target===N.target||N.target===P.shadowParent)&&ED(P.delta,C)})[0];if(A&&A.should){N.cancelable&&N.preventDefault();return}if(!A){var O=(c.current.shards||[]).map(xw).filter(Boolean).filter(function(P){return P.contains(N.target)}),M=O.length>0?f(N,O[0]):!c.current.noIsolation;M&&N.cancelable&&N.preventDefault()}}},[]),h=x.useCallback(function(j,N,C,A){var O={name:j,delta:N,target:C,should:A,shadowParent:AD(C)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(M){return M!==O})},1)},[]),v=x.useCallback(function(j){n.current=_d(j),a.current=void 0},[]),p=x.useCallback(function(j){h(j.type,bw(j),j.target,f(j,e.lockRef.current))},[]),b=x.useCallback(function(j){h(j.type,_d(j),j.target,f(j,e.lockRef.current))},[]);x.useEffect(function(){return dl.push(o),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:b}),document.addEventListener("wheel",m,cl),document.addEventListener("touchmove",m,cl),document.addEventListener("touchstart",v,cl),function(){dl=dl.filter(function(j){return j!==o}),document.removeEventListener("wheel",m,cl),document.removeEventListener("touchmove",m,cl),document.removeEventListener("touchstart",v,cl)}},[]);var w=e.removeScrollBar,k=e.inert;return x.createElement(x.Fragment,null,k?x.createElement(o,{styles:_D(s)}):null,w?x.createElement(bD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function AD(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const zD=sD(Bj,RD);var Zj=x.forwardRef(function(e,t){return x.createElement(Ef,ea({},e,{ref:t,sideCar:zD}))});Zj.classNames=Ef.classNames;var OD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},fl=new WeakMap,Td=new WeakMap,Rd={},wp=0,Vj=function(e){return e&&(e.host||Vj(e.parentNode))},DD=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=Vj(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},MD=function(e,t,n,a){var s=DD(t,Array.isArray(e)?e:[e]);Rd[n]||(Rd[n]=new WeakMap);var o=Rd[n],c=[],f=new Set,m=new Set(s),h=function(p){!p||f.has(p)||(f.add(p),h(p.parentNode))};s.forEach(h);var v=function(p){!p||m.has(p)||Array.prototype.forEach.call(p.children,function(b){if(f.has(b))v(b);else try{var w=b.getAttribute(a),k=w!==null&&w!=="false",j=(fl.get(b)||0)+1,N=(o.get(b)||0)+1;fl.set(b,j),o.set(b,N),c.push(b),j===1&&k&&Td.set(b,!0),N===1&&b.setAttribute(n,"true"),k||b.setAttribute(a,"true")}catch(C){console.error("aria-hidden: cannot operate on ",b,C)}})};return v(t),f.clear(),wp++,function(){c.forEach(function(p){var b=fl.get(p)-1,w=o.get(p)-1;fl.set(p,b),o.set(p,w),b||(Td.has(p)||p.removeAttribute(a),Td.delete(p)),w||p.removeAttribute(n)}),wp--,wp||(fl=new WeakMap,fl=new WeakMap,Td=new WeakMap,Rd={})}},ID=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=OD(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),MD(a,s,n,"aria-hidden")):function(){return null}},_f="Dialog",[Qj]=pO(_f),[LD,Hr]=Qj(_f),Gj=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:o,modal:c=!0}=e,f=x.useRef(null),m=x.useRef(null),[h,v]=xO({prop:a,defaultProp:s??!1,onChange:o,caller:_f});return u.jsx(LD,{scope:t,triggerRef:f,contentRef:m,contentId:Ta(),titleId:Ta(),descriptionId:Ta(),open:h,onOpenChange:v,onOpenToggle:x.useCallback(()=>v(p=>!p),[v]),modal:c,children:n})};Gj.displayName=_f;var Kj="DialogTrigger",UD=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Hr(Kj,n),o=ks(t,s.triggerRef);return u.jsx(za.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Dv(s.open),...a,ref:o,onClick:Ni(e.onClick,s.onOpenToggle)})});UD.displayName=Kj;var zv="DialogPortal",[PD,Yj]=Qj(zv,{forceMount:void 0}),Xj=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=Hr(zv,t);return u.jsx(PD,{scope:t,forceMount:n,children:x.Children.map(a,c=>u.jsx(Nf,{present:n||o.open,children:u.jsx(Lj,{asChild:!0,container:s,children:c})}))})};Xj.displayName=zv;var Wd="DialogOverlay",Jj=x.forwardRef((e,t)=>{const n=Yj(Wd,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=Hr(Wd,e.__scopeDialog);return o.modal?u.jsx(Nf,{present:a||o.open,children:u.jsx($D,{...s,ref:t})}):null});Jj.displayName=Wd;var BD=Aj("DialogOverlay.RemoveScroll"),$D=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Hr(Wd,n);return u.jsx(Zj,{as:BD,allowPinchZoom:!0,shards:[s.contentRef],children:u.jsx(za.div,{"data-state":Dv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),vs="DialogContent",Wj=x.forwardRef((e,t)=>{const n=Yj(vs,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=Hr(vs,e.__scopeDialog);return u.jsx(Nf,{present:a||o.open,children:o.modal?u.jsx(FD,{...s,ref:t}):u.jsx(qD,{...s,ref:t})})});Wj.displayName=vs;var FD=x.forwardRef((e,t)=>{const n=Hr(vs,e.__scopeDialog),a=x.useRef(null),s=ks(t,n.contentRef,a);return x.useEffect(()=>{const o=a.current;if(o)return ID(o)},[]),u.jsx(eC,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ni(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Ni(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&o.preventDefault()}),onFocusOutside:Ni(e.onFocusOutside,o=>o.preventDefault())})}),qD=x.forwardRef((e,t)=>{const n=Hr(vs,e.__scopeDialog),a=x.useRef(!1),s=x.useRef(!1);return u.jsx(eC,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,f;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(a.current||(f=n.triggerRef.current)==null||f.focus(),o.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:o=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const c=o.target;((h=n.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),eC=x.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,f=Hr(vs,n),m=x.useRef(null),h=ks(t,m);return YO(),u.jsxs(u.Fragment,{children:[u.jsx(Mj,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:u.jsx(Oj,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Dv(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(HD,{titleId:f.titleId}),u.jsx(VD,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Ov="DialogTitle",tC=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Hr(Ov,n);return u.jsx(za.h2,{id:s.titleId,...a,ref:t})});tC.displayName=Ov;var nC="DialogDescription",rC=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Hr(nC,n);return u.jsx(za.p,{id:s.descriptionId,...a,ref:t})});rC.displayName=nC;var aC="DialogClose",iC=x.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=Hr(aC,n);return u.jsx(za.button,{type:"button",...a,ref:t,onClick:Ni(e.onClick,()=>s.onOpenChange(!1))})});iC.displayName=aC;function Dv(e){return e?"open":"closed"}var sC="DialogTitleWarning",[BQ,lC]=mO(sC,{contentName:vs,titleName:Ov,docsSlug:"dialog"}),HD=({titleId:e})=>{const t=lC(sC),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
316
+
317
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
318
+
319
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},ZD="DialogDescriptionWarning",VD=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lC(ZD).contentName}}.`;return x.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},oC=Gj,uC=Xj,cC=Jj,dC=Wj,QD=tC,GD=rC,KD=iC,YD=Symbol.for("react.lazy"),ef=lv[" use ".trim().toString()];function XD(e){return typeof e=="object"&&e!==null&&"then"in e}function fC(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===YD&&"_payload"in e&&XD(e._payload)}function hC(e){const t=WD(e),n=x.forwardRef((a,s)=>{let{children:o,...c}=a;fC(o)&&typeof ef=="function"&&(o=ef(o._payload));const f=x.Children.toArray(o),m=f.find(tM);if(m){const h=m.props.children,v=f.map(p=>p===m?x.Children.count(h)>1?x.Children.only(null):x.isValidElement(h)?h.props.children:null:p);return u.jsx(t,{...c,ref:s,children:x.isValidElement(h)?x.cloneElement(h,void 0,v):null})}return u.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var JD=hC("Slot");function WD(e){const t=x.forwardRef((n,a)=>{let{children:s,...o}=n;if(fC(s)&&typeof ef=="function"&&(s=ef(s._payload)),x.isValidElement(s)){const c=rM(s),f=nM(o,s.props);return s.type!==x.Fragment&&(f.ref=a?_i(a,c):c),x.cloneElement(s,f)}return x.Children.count(s)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eM=Symbol("radix.slottable");function tM(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eM}function nM(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function rM(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var aM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oa=aM.reduce((e,t)=>{const n=hC(`Primitive.${t}`),a=x.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),su='[cmdk-group=""]',Sp='[cmdk-group-items=""]',iM='[cmdk-group-heading=""]',mC='[cmdk-item=""]',ww=`${mC}:not([aria-disabled="true"])`,Mg="cmdk-item-select",pl="data-value",sM=(e,t,n)=>hO(e,t,n),pC=x.createContext(void 0),Xu=()=>x.useContext(pC),gC=x.createContext(void 0),Mv=()=>x.useContext(gC),vC=x.createContext(void 0),yC=x.forwardRef((e,t)=>{let n=gl(()=>{var B,T;return{search:"",value:(T=(B=e.value)!=null?B:e.defaultValue)!=null?T:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=gl(()=>new Set),s=gl(()=>new Map),o=gl(()=>new Map),c=gl(()=>new Set),f=bC(e),{label:m,children:h,value:v,onValueChange:p,filter:b,shouldFilter:w,loop:k,disablePointerSelection:j=!1,vimBindings:N=!0,...C}=e,A=Ta(),O=Ta(),M=Ta(),P=x.useRef(null),z=vM();ys(()=>{if(v!==void 0){let B=v.trim();n.current.value=B,$.emit()}},[v]),ys(()=>{z(6,xe)},[]);let $=x.useMemo(()=>({subscribe:B=>(c.current.add(B),()=>c.current.delete(B)),snapshot:()=>n.current,setState:(B,T,V)=>{var W,ce,be,ge;if(!Object.is(n.current[B],T)){if(n.current[B]=T,B==="search")ae(),D(),z(1,te);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let fe=document.getElementById(M);fe?fe.focus():(W=document.getElementById(A))==null||W.focus()}if(z(7,()=>{var fe;n.current.selectedItemId=(fe=G())==null?void 0:fe.id,$.emit()}),V||z(5,xe),((ce=f.current)==null?void 0:ce.value)!==void 0){let fe=T??"";(ge=(be=f.current).onValueChange)==null||ge.call(be,fe);return}}$.emit()}},emit:()=>{c.current.forEach(B=>B())}}),[]),I=x.useMemo(()=>({value:(B,T,V)=>{var W;T!==((W=o.current.get(B))==null?void 0:W.value)&&(o.current.set(B,{value:T,keywords:V}),n.current.filtered.items.set(B,Z(T,V)),z(2,()=>{D(),$.emit()}))},item:(B,T)=>(a.current.add(B),T&&(s.current.has(T)?s.current.get(T).add(B):s.current.set(T,new Set([B]))),z(3,()=>{ae(),D(),n.current.value||te(),$.emit()}),()=>{o.current.delete(B),a.current.delete(B),n.current.filtered.items.delete(B);let V=G();z(4,()=>{ae(),(V==null?void 0:V.getAttribute("id"))===B&&te(),$.emit()})}),group:B=>(s.current.has(B)||s.current.set(B,new Set),()=>{o.current.delete(B),s.current.delete(B)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:A,inputId:M,labelId:O,listInnerRef:P}),[]);function Z(B,T){var V,W;let ce=(W=(V=f.current)==null?void 0:V.filter)!=null?W:sM;return B?ce(B,n.current.search,T):0}function D(){if(!n.current.search||f.current.shouldFilter===!1)return;let B=n.current.filtered.items,T=[];n.current.filtered.groups.forEach(W=>{let ce=s.current.get(W),be=0;ce.forEach(ge=>{let fe=B.get(ge);be=Math.max(fe,be)}),T.push([W,be])});let V=P.current;X().sort((W,ce)=>{var be,ge;let fe=W.getAttribute("id"),Ge=ce.getAttribute("id");return((be=B.get(Ge))!=null?be:0)-((ge=B.get(fe))!=null?ge:0)}).forEach(W=>{let ce=W.closest(Sp);ce?ce.appendChild(W.parentElement===ce?W:W.closest(`${Sp} > *`)):V.appendChild(W.parentElement===V?W:W.closest(`${Sp} > *`))}),T.sort((W,ce)=>ce[1]-W[1]).forEach(W=>{var ce;let be=(ce=P.current)==null?void 0:ce.querySelector(`${su}[${pl}="${encodeURIComponent(W[0])}"]`);be==null||be.parentElement.appendChild(be)})}function te(){let B=X().find(V=>V.getAttribute("aria-disabled")!=="true"),T=B==null?void 0:B.getAttribute(pl);$.setState("value",T||void 0)}function ae(){var B,T,V,W;if(!n.current.search||f.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ce=0;for(let be of a.current){let ge=(T=(B=o.current.get(be))==null?void 0:B.value)!=null?T:"",fe=(W=(V=o.current.get(be))==null?void 0:V.keywords)!=null?W:[],Ge=Z(ge,fe);n.current.filtered.items.set(be,Ge),Ge>0&&ce++}for(let[be,ge]of s.current)for(let fe of ge)if(n.current.filtered.items.get(fe)>0){n.current.filtered.groups.add(be);break}n.current.filtered.count=ce}function xe(){var B,T,V;let W=G();W&&(((B=W.parentElement)==null?void 0:B.firstChild)===W&&((V=(T=W.closest(su))==null?void 0:T.querySelector(iM))==null||V.scrollIntoView({block:"nearest"})),W.scrollIntoView({block:"nearest"}))}function G(){var B;return(B=P.current)==null?void 0:B.querySelector(`${mC}[aria-selected="true"]`)}function X(){var B;return Array.from(((B=P.current)==null?void 0:B.querySelectorAll(ww))||[])}function q(B){let T=X()[B];T&&$.setState("value",T.getAttribute(pl))}function ee(B){var T;let V=G(),W=X(),ce=W.findIndex(ge=>ge===V),be=W[ce+B];(T=f.current)!=null&&T.loop&&(be=ce+B<0?W[W.length-1]:ce+B===W.length?W[0]:W[ce+B]),be&&$.setState("value",be.getAttribute(pl))}function ye(B){let T=G(),V=T==null?void 0:T.closest(su),W;for(;V&&!W;)V=B>0?pM(V,su):gM(V,su),W=V==null?void 0:V.querySelector(ww);W?$.setState("value",W.getAttribute(pl)):ee(B)}let Ae=()=>q(X().length-1),R=B=>{B.preventDefault(),B.metaKey?Ae():B.altKey?ye(1):ee(1)},U=B=>{B.preventDefault(),B.metaKey?q(0):B.altKey?ye(-1):ee(-1)};return x.createElement(Oa.div,{ref:t,tabIndex:-1,...C,"cmdk-root":"",onKeyDown:B=>{var T;(T=C.onKeyDown)==null||T.call(C,B);let V=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||V))switch(B.key){case"n":case"j":{N&&B.ctrlKey&&R(B);break}case"ArrowDown":{R(B);break}case"p":case"k":{N&&B.ctrlKey&&U(B);break}case"ArrowUp":{U(B);break}case"Home":{B.preventDefault(),q(0);break}case"End":{B.preventDefault(),Ae();break}case"Enter":{B.preventDefault();let W=G();if(W){let ce=new Event(Mg);W.dispatchEvent(ce)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:bM},m),Tf(e,B=>x.createElement(gC.Provider,{value:$},x.createElement(pC.Provider,{value:I},B))))}),lM=x.forwardRef((e,t)=>{var n,a;let s=Ta(),o=x.useRef(null),c=x.useContext(vC),f=Xu(),m=bC(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;ys(()=>{if(!h)return f.item(s,c==null?void 0:c.id)},[h]);let v=xC(s,o,[e.value,e.children,o],e.keywords),p=Mv(),b=Ti(z=>z.value&&z.value===v.current),w=Ti(z=>h||f.filter()===!1?!0:z.search?z.filtered.items.get(s)>0:!0);x.useEffect(()=>{let z=o.current;if(!(!z||e.disabled))return z.addEventListener(Mg,k),()=>z.removeEventListener(Mg,k)},[w,e.onSelect,e.disabled]);function k(){var z,$;j(),($=(z=m.current).onSelect)==null||$.call(z,v.current)}function j(){p.setState("value",v.current,!0)}if(!w)return null;let{disabled:N,value:C,onSelect:A,forceMount:O,keywords:M,...P}=e;return x.createElement(Oa.div,{ref:_i(o,t),...P,id:s,"cmdk-item":"",role:"option","aria-disabled":!!N,"aria-selected":!!b,"data-disabled":!!N,"data-selected":!!b,onPointerMove:N||f.getDisablePointerSelection()?void 0:j,onClick:N?void 0:k},e.children)}),oM=x.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,c=Ta(),f=x.useRef(null),m=x.useRef(null),h=Ta(),v=Xu(),p=Ti(w=>s||v.filter()===!1?!0:w.search?w.filtered.groups.has(c):!0);ys(()=>v.group(c),[]),xC(c,f,[e.value,e.heading,m]);let b=x.useMemo(()=>({id:c,forceMount:s}),[s]);return x.createElement(Oa.div,{ref:_i(f,t),...o,"cmdk-group":"",role:"presentation",hidden:p?void 0:!0},n&&x.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),Tf(e,w=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},x.createElement(vC.Provider,{value:b},w))))}),uM=x.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=x.useRef(null),o=Ti(c=>!c.search);return!n&&!o?null:x.createElement(Oa.div,{ref:_i(s,t),...a,"cmdk-separator":"",role:"separator"})}),cM=x.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Mv(),c=Ti(h=>h.search),f=Ti(h=>h.selectedItemId),m=Xu();return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.createElement(Oa.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":f,id:m.inputId,type:"text",value:s?e.value:c,onChange:h=>{s||o.setState("search",h.target.value),n==null||n(h.target.value)}})}),dM=x.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,o=x.useRef(null),c=x.useRef(null),f=Ti(h=>h.selectedItemId),m=Xu();return x.useEffect(()=>{if(c.current&&o.current){let h=c.current,v=o.current,p,b=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let w=h.offsetHeight;v.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return b.observe(h),()=>{cancelAnimationFrame(p),b.unobserve(h)}}},[]),x.createElement(Oa.div,{ref:_i(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},Tf(e,h=>x.createElement("div",{ref:_i(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),fM=x.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:c,...f}=e;return x.createElement(oC,{open:n,onOpenChange:a},x.createElement(uC,{container:c},x.createElement(cC,{"cmdk-overlay":"",className:s}),x.createElement(dC,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(yC,{ref:t,...f}))))}),hM=x.forwardRef((e,t)=>Ti(n=>n.filtered.count===0)?x.createElement(Oa.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),mM=x.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return x.createElement(Oa.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Tf(e,c=>x.createElement("div",{"aria-hidden":!0},c)))}),Wn=Object.assign(yC,{List:dM,Item:lM,Input:cM,Group:oM,Separator:uM,Dialog:fM,Empty:hM,Loading:mM});function pM(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function gM(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function bC(e){let t=x.useRef(e);return ys(()=>{t.current=e}),t}var ys=typeof window>"u"?x.useEffect:x.useLayoutEffect;function gl(e){let t=x.useRef();return t.current===void 0&&(t.current=e()),t}function Ti(e){let t=Mv(),n=()=>e(t.snapshot());return x.useSyncExternalStore(t.subscribe,n,n)}function xC(e,t,n,a=[]){let s=x.useRef(),o=Xu();return ys(()=>{var c;let f=(()=>{var h;for(let v of n){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(h=v.current.textContent)==null?void 0:h.trim():s.current}})(),m=a.map(h=>h.trim());o.value(e,f,m),(c=t.current)==null||c.setAttribute(pl,f),s.current=f}),s}var vM=()=>{let[e,t]=x.useState(),n=gl(()=>new Map);return ys(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function yM(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Tf({asChild:e,children:t},n){return e&&x.isValidElement(t)?x.cloneElement(yM(t),{ref:t.ref},n(t.props.children)):n(t)}var bM={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const ln=oC,xM=uC,wC=x.forwardRef(({className:e,...t},n)=>u.jsx(cC,{ref:n,className:Te("fixed inset-0 z-50 bg-overlay-scrim data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));wC.displayName="DialogOverlay";const en=x.forwardRef(({className:e,children:t,...n},a)=>u.jsxs(xM,{children:[u.jsx(wC,{}),u.jsxs(dC,{ref:a,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,u.jsxs(KD,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[u.jsx(Bl,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));en.displayName="DialogContent";function fn({className:e,...t}){return u.jsx("div",{className:Te("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Pn({className:e,...t}){return u.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const on=x.forwardRef(({className:e,...t},n)=>u.jsx(QD,{ref:n,className:Te("text-subtitle leading-none tracking-tight",e),...t}));on.displayName="DialogTitle";const Iv=x.forwardRef(({className:e,...t},n)=>u.jsx(GD,{ref:n,className:Te("text-body text-muted-foreground",e),...t}));Iv.displayName="DialogDescription";const SC=x.forwardRef(({className:e,...t},n)=>u.jsx(Wn,{ref:n,className:Te("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));SC.displayName=Wn.displayName;function wM({open:e,onOpenChange:t,children:n}){return u.jsx(ln,{open:e,onOpenChange:t,children:u.jsx(en,{className:"overflow-hidden p-0 shadow-lg",children:u.jsx(SC,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:n})})})}const kC=x.forwardRef(({className:e,...t},n)=>u.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[u.jsx(Ev,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),u.jsx(Wn.Input,{ref:n,className:Te("flex h-11 w-full rounded-md bg-transparent py-3 text-body outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));kC.displayName=Wn.Input.displayName;const jC=x.forwardRef(({className:e,...t},n)=>u.jsx(Wn.List,{ref:n,className:Te("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));jC.displayName=Wn.List.displayName;const CC=x.forwardRef((e,t)=>u.jsx(Wn.Empty,{ref:t,className:"py-6 text-center text-body",...e}));CC.displayName=Wn.Empty.displayName;const Vd=x.forwardRef(({className:e,...t},n)=>u.jsx(Wn.Group,{ref:n,className:Te("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-caption [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Vd.displayName=Wn.Group.displayName;const Ig=x.forwardRef(({className:e,...t},n)=>u.jsx(Wn.Separator,{ref:n,className:Te("-mx-1 h-px bg-border",e),...t}));Ig.displayName=Wn.Separator.displayName;const Qd=x.forwardRef(({className:e,...t},n)=>u.jsx(Wn.Item,{ref:n,className:Te("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-body outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));Qd.displayName=Wn.Item.displayName;function Ju(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.type&&t.set("type",e.type);const n=t.toString();return Se.get(hn(`/agents${n?`?${n}`:""}`))}function Lv(){return Se.get("/me/managed-agents")}function SM(e){return Se.get(`/agents/${encodeURIComponent(e)}`)}function kM(e){return Se.post(hn("/agents"),e)}function jM(e){return Se.get(hn(`/agents/names/${encodeURIComponent(e)}/availability`))}function Sw(e,t){return Se.patch(`/agents/${encodeURIComponent(e)}`,t)}function CM(e,t){return Se.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function NM(e){return Se.delete(`/agents/${encodeURIComponent(e)}`)}function EM(e){return Se.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function _M(e){return Se.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function TM(e){return Se.post(`/agents/${encodeURIComponent(e)}/test`,{})}function Rf(){const{data:e}=He({queryKey:["agents","name-map"],queryFn:()=>Ju({limit:100}),staleTime:3e4}),{data:t}=He({queryKey:["managed-agents","name-map"],queryFn:Lv,staleTime:3e4});return x.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,a.displayName);if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,a.displayName);return a=>a?n.get(a)??a:"—"},[e,t])}function Uv(){const{data:e}=He({queryKey:["agents","name-map"],queryFn:()=>Ju({limit:100}),staleTime:3e4}),{data:t}=He({queryKey:["managed-agents","name-map"],queryFn:Lv,staleTime:3e4});return x.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,{name:a.name,displayName:a.displayName});if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,{name:a.name,displayName:a.displayName});return a=>a?n.get(a)??null:null},[e,t])}const RM=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function AM({open:e,onOpenChange:t}){const n=jn(),a=Rf(),{data:s}=He({queryKey:["activity"],queryFn:Yu,enabled:e,staleTime:3e4}),o=(s==null?void 0:s.agents)??[],f=He({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const v of o)try{const p=await Tj(v.agentId);for(const b of p)h.push({agentId:v.agentId,session:b})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return u.jsxs(wM,{open:e,onOpenChange:t,children:[u.jsx(kC,{placeholder:"Jump to agent, chat, or page…"}),u.jsxs(jC,{children:[u.jsx(CC,{children:"No results"}),o.length>0&&u.jsx(Vd,{heading:"Agents",children:o.map(h=>{const v=a(h.agentId);return u.jsxs(Qd,{value:`agent ${v} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[u.jsx(xz,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),u.jsx("span",{className:"flex-1 truncate",children:v}),u.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),f.length>0&&u.jsxs(u.Fragment,{children:[u.jsx(Ig,{}),u.jsx(Vd,{heading:"Chats",children:f.map(({agentId:h,session:v})=>{const p=a(h);return u.jsxs(Qd,{value:`chat ${p} ${v.chatId}`,onSelect:()=>m(`/?a=${h}&c=${v.chatId}`),children:[u.jsx(Nv,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),u.jsx("span",{className:"flex-1 truncate",children:p}),u.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:v.chatId.slice(0,8)})]},`${h}-${v.chatId}`)})})]}),u.jsx(Ig,{}),u.jsx(Vd,{heading:"Pages",children:RM.map(h=>u.jsxs(Qd,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[u.jsx(Mz,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),u.jsx("span",{children:h.label})]},h.path))})]})]})}function zM(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function OM(){var a;const{user:e}=kt(),{data:t}=He({queryKey:["clients"],queryFn:Ei,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=zM(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const DM=160;function MM(){const e=jn(),{rows:t,firstHostname:n}=OM();if(t.length===0)return null;const a=t.length>1,s=a?`${t.length} computers disconnected. Click to manage.`:`${n??"Your computer"} is disconnected. Click to manage.`;return u.jsxs("button",{type:"button",onClick:()=>e("/settings/computers"),title:s,"aria-label":s,className:"inline-flex items-center cursor-pointer text-body font-medium",style:{gap:8,height:26,padding:"0 var(--sp-2_5) 0 var(--sp-2_25)",borderRadius:999,border:0,outline:"var(--hairline) solid color-mix(in oklch, var(--state-error) 38%, transparent)",outlineOffset:-1,background:"color-mix(in oklch, var(--state-error) 14%, transparent)",color:"color-mix(in oklch, var(--state-error) 80%, var(--fg))",minWidth:0},children:[u.jsx(IM,{}),a?u.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[u.jsx("span",{className:"font-semibold",children:t.length})," computers disconnected"]}):u.jsxs("span",{className:"inline-flex items-center",style:{gap:5,minWidth:0},children:[u.jsx("span",{className:"mono text-label font-medium",style:{maxWidth:DM,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"color-mix(in oklch, var(--state-error) 60%, var(--fg))"},children:n??"computer"}),u.jsx("span",{style:{flexShrink:0},children:"disconnected"})]})]})}function IM(){return u.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:8,height:8,flexShrink:0,display:"inline-block"},children:[u.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-error)"}}),u.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-error)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]})}function Wu(e){return u.jsxs("svg",{viewBox:"0 0 9 10",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",shapeRendering:"crispEdges","aria-hidden":"true",...e,children:[u.jsx("rect",{x:"4",y:"0",width:"1",height:"1"}),u.jsx("rect",{x:"3",y:"1",width:"3",height:"1"}),u.jsx("rect",{x:"2",y:"2",width:"5",height:"1"}),u.jsx("rect",{x:"3",y:"3",width:"3",height:"1"}),u.jsx("rect",{x:"2",y:"4",width:"5",height:"1"}),u.jsx("rect",{x:"1",y:"5",width:"7",height:"1"}),u.jsx("rect",{x:"2",y:"6",width:"5",height:"1"}),u.jsx("rect",{x:"1",y:"7",width:"7",height:"1"}),u.jsx("rect",{x:"0",y:"8",width:"9",height:"1"}),u.jsx("rect",{x:"3",y:"9",width:"3",height:"1"})]})}function kw(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.severity&&t.set("severity",e.severity),(e==null?void 0:e.read)!==void 0&&t.set("read",String(e.read)),e!=null&&e.agentId&&t.set("agentId",e.agentId);const n=t.toString();return Se.get(hn(`/notifications${n?`?${n}`:""}`))}function LM(e){return Se.post(hn(`/notifications/${e}/read`))}function UM(){return Se.post(hn("/notifications/read-all"))}const PM={agent_error:"Error",session_error:"Error",agent_blocked:"Blocked",agent_stale:"Stale",agent_disconnected:"Disconnected",agent_connected:"Connected",agent_needs_decision:"Decision",session_completed:"Completed"};function BM(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function $M({notification:e,onClick:t,clickable:n}){const a=(PM[e.type]??e.type).toString(),s=BM(e.severity),o=n??!0;return u.jsxs("button",{type:"button",onClick:t,className:Te("w-full text-left transition-colors text-body",o?"cursor-pointer":"cursor-default"),style:{padding:"var(--sp-1_5) var(--sp-2)",background:e.read?"transparent":"var(--bg-sunken)",borderLeft:`var(--hairline-bold) solid ${s}`,borderRadius:"0 var(--sp-0_75) var(--sp-0_75) 0"},onMouseEnter:c=>{o&&(c.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:c=>{c.currentTarget.style.background=e.read?"transparent":"var(--bg-sunken)"},children:[u.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:8},children:[u.jsx("span",{className:"mono uppercase text-label",style:{color:e.severity==="high"?"var(--state-error)":"var(--fg-3)"},children:a.replace("_"," ")}),u.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)",whiteSpace:"nowrap"},children:Eu(e.createdAt)})]}),u.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function FM(){var w;const[e,t]=x.useState(!1),[n,a]=x.useState(null),s=x.useRef(null),o=jn(),c=nn(),{data:f}=He({queryKey:["notifications","bell"],queryFn:()=>kw({limit:8}),refetchInterval:1e4}),{data:m}=He({queryKey:["notifications","unread-count"],queryFn:()=>kw({read:!1,limit:100}),refetchInterval:1e4}),h=((w=m==null?void 0:m.items)==null?void 0:w.length)??0,v=h>0,p=x.useCallback(async k=>{k.read||(LM(k.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),k.agentId&&k.chatId?o(`/?a=${k.agentId}&c=${k.chatId}`):k.agentId&&o(`/?a=${k.agentId}`)},[o,c]),b=x.useCallback(async()=>{a(null);try{await UM(),await c.invalidateQueries({queryKey:["notifications"]})}catch(k){a(k instanceof Error?k.message:"Failed to mark all as read")}},[c]);return u.jsxs("div",{className:"relative",children:[u.jsxs("button",{type:"button",onClick:()=>t(!e),className:"relative flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[u.jsx(yz,{className:"h-4 w-4"}),v&&u.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full px-1 font-medium text-label",style:{height:16,minWidth:16,background:"var(--state-error)",color:"var(--bg)"},children:h>99?"99+":h})]}),e&&u.jsxs(u.Fragment,{children:[u.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),u.jsxs("div",{ref:s,className:"absolute right-0 top-full mt-1 z-50",style:{width:320,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6,boxShadow:"var(--shadow-md)"},children:[u.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),v&&u.jsx("button",{type:"button",onClick:b,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&u.jsx("div",{className:"text-body",style:{padding:"var(--sp-1_5) var(--sp-3)",color:"var(--state-error)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:n}),u.jsx("div",{className:"flex flex-col overflow-y-auto",style:{maxHeight:360,padding:8,gap:4},children:!(f!=null&&f.items)||f.items.length===0?u.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):f.items.map(k=>u.jsx($M,{notification:k,clickable:!!k.agentId,onClick:()=>p(k)},k.id))})]})]})]})}function qM(){if(typeof window>"u")return"light";const e=window.localStorage.getItem("theme");return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function HM(){const[e,t]=x.useState(qM);return x.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),u.jsx("button",{type:"button",onClick:()=>t(e==="dark"?"light":"dark"),"aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-body text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:e==="dark"?u.jsx(e3,{className:"h-4 w-4"}):u.jsx(Hz,{className:"h-4 w-4"})})}function ZM(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function jw({src:e,name:t,size:n=28,className:a}){const s=`${n}px`;return e?u.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:s,height:s,borderRadius:"50%",objectFit:"cover",display:"block"}}):u.jsx("span",{className:a,role:"img","aria-label":t,style:{width:s,height:s,borderRadius:"50%",background:"var(--accent)",color:"var(--bg-raised)",display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,userSelect:"none"},children:u.jsx("span",{className:"text-subtitle font-semibold",children:ZM(t)})})}const Cw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Nw=hj,VM=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return Nw(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,c=Object.keys(s).map(h=>{const v=n==null?void 0:n[h],p=o==null?void 0:o[h];if(v===null)return null;const b=Cw(v)||Cw(p);return s[h][b]}),f=n&&Object.entries(n).reduce((h,v)=>{let[p,b]=v;return b===void 0||(h[p]=b),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,v)=>{let{class:p,className:b,...w}=v;return Object.entries(w).every(k=>{let[j,N]=k;return Array.isArray(N)?N.includes({...o,...f}[j]):{...o,...f}[j]===N})?[...h,p,b]:h},[]);return Nw(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},QM=VM("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-input)] text-body font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-label",xs:"h-7 rounded-[var(--radius-chip)] px-2.5 text-label gap-1.5",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),he=x.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},o)=>{const c=a?JD:"button";return u.jsx(c,{className:Te(QM({variant:t,size:n,className:e})),ref:o,...s})});he.displayName="Button";const zt=x.forwardRef(({className:e,type:t,...n},a)=>u.jsx("input",{type:t,className:Te("flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors file:border-0 file:bg-transparent file:text-body file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));zt.displayName="Input";function GM({action:e,onClose:t}){const n=e!==null;return u.jsx(ln,{open:n,onOpenChange:a=>!a&&t(),children:u.jsxs(en,{children:[u.jsxs(fn,{children:[u.jsx(on,{children:e==="join"?"Join a team":"Create a new team"}),u.jsx(Iv,{children:e==="join"?"Paste the invite token shared with you.":"You'll be the admin. You can rename or invite teammates afterward."})]}),e==="create"&&u.jsx(YM,{onDone:t}),e==="join"&&u.jsx(XM,{onDone:t})]})})}function KM(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function YM({onDone:e}){const{adoptTokens:t}=kt(),n=jn(),[a,s]=x.useState(""),[o,c]=x.useState(null),[f,m]=x.useState(!1);x.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async v=>{v.preventDefault();const p=a.trim();if(p){m(!0),c(null);try{const b=await Se.post("/me/organizations",{name:KM(p),displayName:p});await t(b.tokens),e(),n("/",{replace:!0})}catch(b){c(b instanceof Error?b.message:"Failed to create team")}finally{m(!1)}}};return u.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&u.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),u.jsx(zt,{id:"team-display-name","aria-label":"Team name",value:a,onChange:v=>s(v.target.value),placeholder:"Acme Robotics",autoFocus:!0}),u.jsx(he,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function XM({onDone:e}){const{adoptTokens:t}=kt(),n=jn(),[a,s]=x.useState(""),[o,c]=x.useState(null),[f,m]=x.useState(!1);x.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async v=>{if(v.preventDefault(),!!a.trim()){m(!0),c(null);try{const p=a.trim(),b=/\/invite\/([^/?#]+)/.exec(p),w=(b==null?void 0:b[1])??p,k=await Se.post("/me/organizations/join",{token:w});await t(k.tokens),e(),n("/",{replace:!0})}catch(p){c(p instanceof Error?p.message:"Failed to join team")}finally{m(!1)}}};return u.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&u.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),u.jsx(zt,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:v=>s(v.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),u.jsx(he,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function JM(){var P,z;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=kt(),o=jn(),[c,f]=x.useState([]),[m,h]=x.useState(!1),[v,p]=x.useState(null),b=x.useRef(null);x.useEffect(()=>{(async()=>{try{const $=await Se.get("/me/organizations");f($)}catch{}})()},[]),x.useEffect(()=>{const $=Z=>{m&&b.current&&!b.current.contains(Z.target)&&h(!1)},I=Z=>{m&&Z.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",$),window.addEventListener("keydown",I),()=>{window.removeEventListener("mousedown",$),window.removeEventListener("keydown",I)}},[m]);const w=(n==null?void 0:n.displayName)??"User",k=(n==null?void 0:n.username)??"",j=(n==null?void 0:n.avatarUrl)??null,N=c.find($=>$.id===e)??null,C=(N==null?void 0:N.role)??(t==="admin"||t==="member"?t:null),A=async $=>{if($===e){h(!1);return}try{await a($),h(!1),o("/",{replace:!0})}catch{}},O=()=>{h(!1),p("create")},M=()=>{h(!1),p("join")};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{ref:b,className:"relative","data-testid":"user-menu",children:[u.jsx("button",{type:"button","aria-label":`User menu, ${w}`,"aria-haspopup":"menu","aria-expanded":m,onClick:()=>h($=>!$),className:"inline-flex items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-ring transition-shadow",style:{background:"transparent",border:m?"var(--hairline) solid var(--border)":"var(--hairline) solid transparent",padding:1,cursor:"pointer"},children:u.jsx(jw,{src:j,name:w,size:28})}),m&&u.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[u.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[u.jsx(jw,{src:j,name:w,size:32}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:w}),k&&k!==w&&u.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",k]})]})]}),c.length>0&&u.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[u.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Current team"}),c.length===1?u.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[u.jsx("span",{style:{width:14,display:"inline-flex"},children:u.jsx(Un,{className:"h-3.5 w-3.5"})}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:(P=c[0])==null?void 0:P.displayName}),u.jsx(Ew,{role:((z=c[0])==null?void 0:z.role)??C})]}):u.jsx("div",{children:c.map($=>u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void A($.id),className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[u.jsx("span",{style:{width:14,display:"inline-flex"},children:$.id===e?u.jsx(Un,{className:"h-3.5 w-3.5"}):null}),u.jsx("span",{className:"min-w-0 flex-1 truncate",children:$.displayName}),u.jsx(Ew,{role:$.role})]},$.id))})]}),u.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[u.jsxs("button",{type:"button",role:"menuitem",onClick:O,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[u.jsx(qr,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Create new team"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:M,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[u.jsx(dj,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Join with invite link"})]})]}),u.jsx("div",{className:"py-1",children:u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),s()},className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[u.jsx($z,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Sign out"})]})})]})]}),u.jsx(GM,{action:v,onClose:()=>p(null)})]})}function Ew({role:e}){return e!=="admin"&&e!=="member"?null:u.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:e==="admin"?"var(--accent-dim)":"var(--fg-3)",border:"var(--hairline) solid var(--border)",background:e==="admin"?"var(--accent-bg)":"var(--bg-sunken)"},children:e})}const WM=[{to:"/",label:"Workspace",end:!0,kbd:"⌘1"},{to:"/context",label:"Context",end:!1,kbd:"⌘2"},{to:"/team",label:"Team",end:!1,kbd:"⌘3"},{to:"/settings",label:"Settings",end:!1,kbd:"⌘4"}];function e4(){const[e,t]=x.useState(!1),n=Jn(),a=n.pathname==="/"||n.search.includes("a=");return x.useEffect(()=>{const s=o=>{(o.metaKey||o.ctrlKey)&&o.key.toLowerCase()==="k"&&(o.preventDefault(),t(c=>!c))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[]),u.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[u.jsxs("header",{className:"relative shrink-0 grid items-center",style:{height:48,gridTemplateColumns:"1fr auto 1fr",gap:"var(--sp-3)",padding:"0 var(--sp-3)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)"},children:[u.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[u.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[u.jsx(Wu,{width:16,height:18,style:{color:"var(--fg)"}}),u.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),u.jsx(MM,{})]}),u.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:WM.map(s=>u.jsx(wf,{to:s.to,end:s.end,style:{pointerEvents:"auto"},className:({isActive:o})=>Te("inline-flex items-center transition-colors",o?"":"hover:text-[var(--fg)]"),children:({isActive:o})=>u.jsxs("span",{className:"inline-flex items-center text-subtitle font-medium",style:{padding:"var(--sp-1_5) var(--sp-3)",gap:6,borderRadius:5,color:o?"var(--fg)":"var(--fg-3)",background:o?"var(--bg-hover)":"transparent"},children:[s.label,o&&u.jsx("span",{className:"kbd",children:s.kbd})]})},s.to))}),u.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[u.jsxs("button",{type:"button",onClick:()=>t(!0),"aria-label":"Open command palette",className:"inline-flex items-center transition-colors text-body",style:{gap:8,padding:"var(--sp-1) var(--sp-2)",color:"var(--fg-3)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)"},onMouseEnter:s=>{s.currentTarget.style.color="var(--fg)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--fg-3)"},children:[u.jsx(Ev,{className:"h-4 w-4"}),u.jsx("span",{children:"Jump to…"}),u.jsx("span",{className:"kbd",children:"⌘K"})]}),u.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),u.jsx(FM,{}),u.jsx(HM,{}),u.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),u.jsx(JM,{})]})]}),u.jsx(AM,{open:e,onOpenChange:t}),a?u.jsx(Pl,{}):u.jsx("main",{className:"flex-1 overflow-auto",children:u.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:u.jsx(Pl,{})})})]})}const NC=x.createContext(null),t4=5e3;function n4({children:e}){const[t,n]=x.useState([]),a=x.useCallback(c=>{n(f=>f.filter(m=>m.id!==c))},[]),o={addToast:x.useCallback(c=>{const f=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...c,id:f}])},[])};return u.jsxs(NC.Provider,{value:o,children:[e,u.jsx(r4,{toasts:t,onDismiss:a})]})}function EC(){const e=x.useContext(NC);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function r4({toasts:e,onDismiss:t}){return e.length===0?null:u.jsx("div",{style:{position:"fixed",bottom:"var(--sp-4)",right:"var(--sp-4)",zIndex:100,display:"flex",flexDirection:"column",gap:"var(--sp-2)",pointerEvents:"none",maxWidth:380},"aria-live":"polite","aria-atomic":"false",children:e.map(n=>u.jsx(a4,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function a4({toast:e,onDismiss:t}){const n=x.useRef(t);return n.current=t,x.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??t4,s=setTimeout(()=>n.current(),a);return()=>clearTimeout(s)},[e.durationMs]),u.jsxs("div",{role:"status",style:{pointerEvents:"auto",display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"var(--sp-3) var(--sp-3_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",boxShadow:"var(--shadow-md)",animation:"toast-slide-in 180ms ease-out"},children:[u.jsxs("div",{className:"flex-1 min-w-0",style:{display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[u.jsx("p",{className:"text-body font-medium",style:{margin:0,color:"var(--fg)"},children:e.title}),e.description?u.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:e.description}):null,e.action?u.jsx("button",{type:"button",onClick:()=>{var a;(a=e.action)==null||a.onClick(),t()},className:"text-label font-medium hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{alignSelf:"flex-start",marginTop:"var(--sp-1)",padding:0,background:"transparent",border:"none",color:"var(--accent)",cursor:"pointer"},children:e.action.label}):null]}),u.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss",className:"hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-1)",background:"transparent",border:"none",borderRadius:"var(--radius-input)",cursor:"pointer",color:"var(--fg-4)",flexShrink:0},children:u.jsx(Bl,{className:"h-4 w-4"})})]})}function le(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:c,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=c.prototype,v=Object.keys(h);for(let p=0;p<v.length;p++){const b=v[p];b in f||(f[b]=h[b].bind(f))}}const s=(n==null?void 0:n.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function c(f){var m;const h=n!=null&&n.Parent?new o:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const v of h._zod.deferred)v();return h}return Object.defineProperty(c,"init",{value:a}),Object.defineProperty(c,Symbol.hasInstance,{value:f=>{var m,h;return n!=null&&n.Parent&&f instanceof n.Parent?!0:(h=(m=f==null?void 0:f._zod)==null?void 0:m.traits)==null?void 0:h.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class Sl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _C extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const TC={};function Ri(e){return TC}function RC(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,s])=>t.indexOf(+a)===-1).map(([a,s])=>s)}function Lg(e,t){return typeof t=="bigint"?t.toString():t}function Af(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Pv(e){return e==null}function Bv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function i4(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let s=(a.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m!=null&&m[1]&&(s=Number.parseInt(m[1]))}const o=n>s?n:s,c=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return c%f/10**o}const _w=Symbol("evaluating");function mt(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==_w)return a===void 0&&(a=_w,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function js(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Oi(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function Tw(e){return JSON.stringify(e)}function s4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const AC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ru(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const l4=Af(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function $l(e){if(Ru(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ru(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function zC(e){return $l(e)?{...e}:Array.isArray(e)?[...e]:e}const o4=new Set(["string","number","symbol"]);function Fl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Di(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(a._zod.parent=e),a}function Re(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new 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 u4(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const c4={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function d4(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=Oi(e._zod.def,{get shape(){const c={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(c[f]=n.shape[f])}return js(this,"shape",c),c},checks:[]});return Di(e,o)}function f4(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=Oi(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete c[f]}return js(this,"shape",c),c},checks:[]});return Di(e,o)}function h4(e,t){if(!$l(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(o,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Oi(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return js(this,"shape",o),o}});return Di(e,s)}function m4(e,t){if(!$l(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Oi(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return js(this,"shape",a),a}});return Di(e,n)}function p4(e,t){const n=Oi(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return js(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return Di(e,n)}function g4(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=Oi(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const h in n){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)m[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return js(this,"shape",m),m},checks:[]});return Di(t,c)}function v4(e,t,n){const a=Oi(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const c in n){if(!(c in o))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(o[c]=new e({type:"nonoptional",innerType:s[c]}))}else for(const c in s)o[c]=new e({type:"nonoptional",innerType:s[c]});return js(this,"shape",o),o}});return Di(t,a)}function yl(e,t=0){var n;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function bl(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function Ad(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ai(e,t,n){var s,o,c,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const v=Ad((c=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:c.call(o,e))??Ad((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??Ad((m=n.customError)==null?void 0:m.call(n,e))??Ad((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=v}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function $v(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Au(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const OC=(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,Lg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},DC=le("$ZodError",OC),MC=le("$ZodError",OC,{Parent:Error});function y4(e,t=n=>n.message){const n={},a=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:n}}function b4(e,t=n=>n.message){const n={_errors:[]},a=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(c=>a({issues:c}));else if(o.code==="invalid_key")a({issues:o.issues});else if(o.code==="invalid_element")a({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let c=n,f=0;for(;f<o.path.length;){const m=o.path[f];f===o.path.length-1?(c[m]=c[m]||{_errors:[]},c[m]._errors.push(t(o))):c[m]=c[m]||{_errors:[]},c=c[m],f++}}};return a(e),n}const Fv=e=>(t,n,a,s)=>{const o=a?Object.assign(a,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new Sl;if(c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>Ai(m,o,Ri())));throw AC(f,s==null?void 0:s.callee),f}return c.value},qv=e=>async(t,n,a,s)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>Ai(m,o,Ri())));throw AC(f,s==null?void 0:s.callee),f}return c.value},zf=e=>(t,n,a)=>{const s=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new Sl;return o.issues.length?{success:!1,error:new(e??DC)(o.issues.map(c=>Ai(c,s,Ri())))}:{success:!0,data:o.value}},x4=zf(MC),Of=e=>async(t,n,a)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(c=>Ai(c,s,Ri())))}:{success:!0,data:o.value}},w4=Of(MC),S4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Fv(e)(t,n,s)},k4=e=>(t,n,a)=>Fv(e)(t,n,a),j4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return qv(e)(t,n,s)},C4=e=>async(t,n,a)=>qv(e)(t,n,a),N4=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return zf(e)(t,n,s)},E4=e=>(t,n,a)=>zf(e)(t,n,a),_4=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Of(e)(t,n,s)},T4=e=>async(t,n,a)=>Of(e)(t,n,a),R4=/^[cC][^\s-]{8,}$/,A4=/^[0-9a-z]+$/,z4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,O4=/^[0-9a-vA-V]{20}$/,D4=/^[A-Za-z0-9]{27}$/,M4=/^[a-zA-Z0-9_-]{21}$/,I4=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,L4=/^([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})$/,Rw=e=>e?new 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)$/,U4=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,P4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function B4(){return new RegExp(P4,"u")}const $4=/^(?:(?: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])$/,F4=/^(([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}|:))$/,q4=/^((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])$/,H4=/^(([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])$/,Z4=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,IC=/^[A-Za-z0-9_-]*$/,V4=/^\+[1-9]\d{6,14}$/,LC="(?:(?:\\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])))",Q4=new RegExp(`^${LC}$`);function UC(e){const 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 G4(e){return new RegExp(`^${UC(e)}$`)}function K4(e){const t=UC({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${LC}T(?:${a})$`)}const Y4=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},X4=/^-?\d+$/,PC=/^-?\d+(?:\.\d+)?$/,J4=/^(?:true|false)$/i,W4=/^null$/i,e5=/^[^A-Z]*$/,t5=/^[^a-z]*$/,er=le("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),BC={number:"number",bigint:"bigint",object:"date"},$C=le("$ZodCheckLessThan",(e,t)=>{er.init(e,t);const n=BC[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),FC=le("$ZodCheckGreaterThan",(e,t)=>{er.init(e,t);const n=BC[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),n5=le("$ZodCheckMultipleOf",(e,t)=>{er.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):i4(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})}}),r5=le("$ZodCheckNumberFormat",(e,t)=>{var c;er.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),a=n?"int":"number",[s,o]=c4[t.format];e._zod.onattach.push(f=>{const m=f._zod.bag;m.format=t.format,m.minimum=s,m.maximum=o,n&&(m.pattern=X4)}),e._zod.check=f=>{const m=f.value;if(n){if(!Number.isInteger(m)){f.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?f.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):f.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}m<s&&f.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>o&&f.issues.push({origin:"number",input:m,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),a5=le("$ZodCheckMaxLength",(e,t)=>{var n;er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Pv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const s=a.value;if(s.length<=t.maximum)return;const c=$v(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),i5=le("$ZodCheckMinLength",(e,t)=>{var n;er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Pv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const s=a.value;if(s.length>=t.minimum)return;const c=$v(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),s5=le("$ZodCheckLengthEquals",(e,t)=>{var n;er.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Pv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=a=>{const s=a.value,o=s.length;if(o===t.length)return;const c=$v(s),f=o>t.length;a.issues.push({origin:c,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Df=le("$ZodCheckStringFormat",(e,t)=>{var n,a;er.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),l5=le("$ZodCheckRegex",(e,t)=>{Df.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})}}),o5=le("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=e5),Df.init(e,t)}),u5=le("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=t5),Df.init(e,t)}),c5=le("$ZodCheckIncludes",(e,t)=>{er.init(e,t);const n=Fl(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(a)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),d5=le("$ZodCheckStartsWith",(e,t)=>{er.init(e,t);const n=new RegExp(`^${Fl(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),f5=le("$ZodCheckEndsWith",(e,t)=>{er.init(e,t);const n=new RegExp(`.*${Fl(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),h5=le("$ZodCheckOverwrite",(e,t)=>{er.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class m5{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
320
+ `).filter(c=>c),s=Math.min(...a.map(c=>c.length-c.trimStart().length)),o=a.map(c=>c.slice(s)).map(c=>" ".repeat(this.indent*2)+c);for(const c of o)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...n,s.join(`
321
+ `))}}const p5={major:4,minor:3,patch:6},Mt=le("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=p5;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const c of o._zod.onattach)c(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const o=(f,m,h)=>{let v=yl(f),p;for(const b of m){if(b._zod.def.when){if(!b._zod.def.when(f))continue}else if(v)continue;const w=f.issues.length,k=b._zod.check(f);if(k instanceof Promise&&(h==null?void 0:h.async)===!1)throw new Sl;if(p||k instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await k,f.issues.length!==w&&(v||(v=yl(f,w)))});else{if(f.issues.length===w)continue;v||(v=yl(f,w))}}return p?p.then(()=>f):f},c=(f,m,h)=>{if(yl(f))return f.aborted=!0,f;const v=o(m,a,h);if(v instanceof Promise){if(h.async===!1)throw new Sl;return v.then(p=>e._zod.parse(p,h))}return e._zod.parse(v,h)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const v=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return v instanceof Promise?v.then(p=>c(p,f,m)):c(v,f,m)}const h=e._zod.parse(f,m);if(h instanceof Promise){if(m.async===!1)throw new Sl;return h.then(v=>o(v,a,m))}return o(h,a,m)}}mt(e,"~standard",()=>({validate:o=>{var c;try{const f=x4(e,o);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return w4(e,o).then(m=>{var h;return m.success?{value:m.data}:{issues:(h=m.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),Hv=le("$ZodString",(e,t)=>{var n;Mt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Y4(e._zod.bag),e._zod.parse=(a,s)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),It=le("$ZodStringFormat",(e,t)=>{Df.init(e,t),Hv.init(e,t)}),g5=le("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=L4),It.init(e,t)}),v5=le("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Rw(a))}else t.pattern??(t.pattern=Rw());It.init(e,t)}),y5=le("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=U4),It.init(e,t)}),b5=le("$ZodURL",(e,t)=>{It.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),s=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.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(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.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=s.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),x5=le("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=B4()),It.init(e,t)}),w5=le("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=M4),It.init(e,t)}),S5=le("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=R4),It.init(e,t)}),k5=le("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=A4),It.init(e,t)}),j5=le("$ZodULID",(e,t)=>{t.pattern??(t.pattern=z4),It.init(e,t)}),C5=le("$ZodXID",(e,t)=>{t.pattern??(t.pattern=O4),It.init(e,t)}),N5=le("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=D4),It.init(e,t)}),E5=le("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=K4(t)),It.init(e,t)}),_5=le("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Q4),It.init(e,t)}),T5=le("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=G4(t)),It.init(e,t)}),R5=le("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=I4),It.init(e,t)}),A5=le("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$4),It.init(e,t),e._zod.bag.format="ipv4"}),z5=le("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=F4),It.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})}}}),O5=le("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=q4),It.init(e,t)}),D5=le("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=H4),It.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[s,o]=a;if(!o)throw new Error;const c=Number(o);if(`${c}`!==o)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function qC(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const M5=le("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Z4),It.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{qC(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function I5(e){if(!IC.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return qC(n)}const L5=le("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=IC),It.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{I5(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),U5=le("$ZodE164",(e,t)=>{t.pattern??(t.pattern=V4),It.init(e,t)});function P5(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const s=JSON.parse(atob(a));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const B5=le("$ZodJWT",(e,t)=>{It.init(e,t),e._zod.check=n=>{P5(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),HC=le("$ZodNumber",(e,t)=>{Mt.init(e,t),e._zod.pattern=e._zod.bag.pattern??PC,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),$5=le("$ZodNumberFormat",(e,t)=>{r5.init(e,t),HC.init(e,t)}),F5=le("$ZodBoolean",(e,t)=>{Mt.init(e,t),e._zod.pattern=J4,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),q5=le("$ZodNull",(e,t)=>{Mt.init(e,t),e._zod.pattern=W4,e._zod.values=new Set([null]),e._zod.parse=(n,a)=>{const s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),n}}),H5=le("$ZodUnknown",(e,t)=>{Mt.init(e,t),e._zod.parse=n=>n}),Z5=le("$ZodNever",(e,t)=>{Mt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Aw(e,t,n){e.issues.length&&t.issues.push(...bl(n,e.issues)),t.value[n]=e.value}const V5=le("$ZodArray",(e,t)=>{Mt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let c=0;c<s.length;c++){const f=s[c],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?o.push(m.then(h=>Aw(h,n,c))):Aw(m,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function tf(e,t,n,a,s){if(e.issues.length){if(s&&!(n in a))return;t.issues.push(...bl(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function ZC(e){var a,s,o,c;const t=Object.keys(e.shape);for(const f of t)if(!((c=(o=(s=(a=e.shape)==null?void 0:a[f])==null?void 0:s._zod)==null?void 0:o.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);const n=u4(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function VC(e,t,n,a,s,o){const c=[],f=s.keySet,m=s.catchall._zod,h=m.def.type,v=m.optout==="optional";for(const p in t){if(f.has(p))continue;if(h==="never"){c.push(p);continue}const b=m.run({value:t[p],issues:[]},a);b instanceof Promise?e.push(b.then(w=>tf(w,n,p,t,v))):tf(b,n,p,t,v)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Q5=le("$ZodObject",(e,t)=>{Mt.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=Af(()=>ZC(t));mt(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const v=f[h]._zod;if(v.values){m[h]??(m[h]=new Set);for(const p of v.values)m[h].add(p)}}return m});const s=Ru,o=t.catchall;let c;e._zod.parse=(f,m)=>{c??(c=a.value);const h=f.value;if(!s(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const v=[],p=c.shape;for(const b of c.keys){const w=p[b],k=w._zod.optout==="optional",j=w._zod.run({value:h[b],issues:[]},m);j instanceof Promise?v.push(j.then(N=>tf(N,f,b,h,k))):tf(j,f,b,h,k)}return o?VC(v,h,f,m,a.value,e):v.length?Promise.all(v).then(()=>f):f}}),G5=le("$ZodObjectJIT",(e,t)=>{Q5.init(e,t);const n=e._zod.parse,a=Af(()=>ZC(t)),s=b=>{var O;const w=new m5(["shape","payload","ctx"]),k=a.value,j=M=>{const P=Tw(M);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};w.write("const input = payload.value;");const N=Object.create(null);let C=0;for(const M of k.keys)N[M]=`key_${C++}`;w.write("const newResult = {};");for(const M of k.keys){const P=N[M],z=Tw(M),$=b[M],I=((O=$==null?void 0:$._zod)==null?void 0:O.optout)==="optional";w.write(`const ${P} = ${j(M)};`),I?w.write(`
322
+ if (${P}.issues.length) {
323
+ if (${z} in input) {
324
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
325
+ ...iss,
326
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
327
+ })));
328
+ }
329
+ }
330
+
331
+ if (${P}.value === undefined) {
332
+ if (${z} in input) {
333
+ newResult[${z}] = undefined;
334
+ }
335
+ } else {
336
+ newResult[${z}] = ${P}.value;
337
+ }
338
+
339
+ `):w.write(`
340
+ if (${P}.issues.length) {
341
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
342
+ ...iss,
343
+ path: iss.path ? [${z}, ...iss.path] : [${z}]
344
+ })));
345
+ }
346
+
347
+ if (${P}.value === undefined) {
348
+ if (${z} in input) {
349
+ newResult[${z}] = undefined;
350
+ }
351
+ } else {
352
+ newResult[${z}] = ${P}.value;
353
+ }
354
+
355
+ `)}w.write("payload.value = newResult;"),w.write("return payload;");const A=w.compile();return(M,P)=>A(b,M,P)};let o;const c=Ru,f=!TC.jitless,h=f&&l4.value,v=t.catchall;let p;e._zod.parse=(b,w)=>{p??(p=a.value);const k=b.value;return c(k)?f&&h&&(w==null?void 0:w.async)===!1&&w.jitless!==!0?(o||(o=s(t.shape)),b=o(b,w),v?VC([],k,b,w,p,e):b):n(b,w):(b.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),b)}});function zw(e,t,n,a){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!yl(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(c=>Ai(c,a,Ri())))}),t)}const QC=le("$ZodUnion",(e,t)=>{Mt.init(e,t),mt(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),mt(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>Bv(o.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return a(s,o);let c=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:s.value,issues:[]},o);if(h instanceof Promise)f.push(h),c=!0;else{if(h.issues.length===0)return h;f.push(h)}}return c?Promise.all(f).then(m=>zw(m,s,e,o)):zw(f,s,e,o)}}),K5=le("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,QC.init(e,t);const n=e._zod.parse;mt(e._zod,"propValues",()=>{const s={};for(const o of t.options){const c=o._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[f,m]of Object.entries(c)){s[f]||(s[f]=new Set);for(const h of m)s[f].add(h)}}return s});const a=Af(()=>{var c;const s=t.options,o=new Map;for(const f of s){const m=(c=f._zod.propValues)==null?void 0:c[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(f)}"`);for(const h of m){if(o.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);o.set(h,f)}}return o});e._zod.parse=(s,o)=>{const c=s.value;if(!Ru(c))return s.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),s;const f=a.value.get(c==null?void 0:c[t.discriminator]);return f?f._zod.run(s,o):t.unionFallback?n(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),s)}}),Y5=le("$ZodIntersection",(e,t)=>{Mt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},a),c=t.right._zod.run({value:s,issues:[]},a);return o instanceof Promise||c instanceof Promise?Promise.all([o,c]).then(([m,h])=>Ow(n,m,h)):Ow(n,o,c)}});function Ug(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if($l(e)&&$l(t)){const n=Object.keys(t),a=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of a){const c=Ug(e[o],t[o]);if(!c.valid)return{valid:!1,mergeErrorPath:[o,...c.mergeErrorPath]};s[o]=c.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const s=e[a],o=t[a],c=Ug(s,o);if(!c.valid)return{valid:!1,mergeErrorPath:[a,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ow(e,t,n){const a=new Map;let s;for(const f of t.issues)if(f.code==="unrecognized_keys"){s??(s=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const o=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(o.length&&s&&e.issues.push({...s,keys:o}),yl(e))return e;const c=Ug(t.value,n.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const X5=le("$ZodRecord",(e,t)=>{Mt.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!$l(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const o=[],c=t.keyType._zod.values;if(c){n.value={};const f=new Set;for(const h of c)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const v=t.valueType._zod.run({value:s[h],issues:[]},a);v instanceof Promise?o.push(v.then(p=>{p.issues.length&&n.issues.push(...bl(h,p.issues)),n.value[h]=p.value})):(v.issues.length&&n.issues.push(...bl(h,v.issues)),n.value[h]=v.value)}let m;for(const h in s)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(s)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&PC.test(f)&&m.issues.length){const p=t.keyType._zod.run({value:Number(f),issues:[]},a);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(m=p)}if(m.issues.length){t.mode==="loose"?n.value[f]=s[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(p=>Ai(p,a,Ri())),input:f,path:[f],inst:e});continue}const v=t.valueType._zod.run({value:s[f],issues:[]},a);v instanceof Promise?o.push(v.then(p=>{p.issues.length&&n.issues.push(...bl(f,p.issues)),n.value[m.value]=p.value})):(v.issues.length&&n.issues.push(...bl(f,v.issues)),n.value[m.value]=v.value)}}return o.length?Promise.all(o).then(()=>n):n}}),J5=le("$ZodEnum",(e,t)=>{Mt.init(e,t);const n=RC(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>o4.has(typeof s)).map(s=>typeof s=="string"?Fl(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const c=s.value;return a.has(c)||s.issues.push({code:"invalid_value",values:n,input:c,inst:e}),s}}),W5=le("$ZodLiteral",(e,t)=>{if(Mt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?Fl(a):a?Fl(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,s)=>{const o=a.value;return n.has(o)||a.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),a}}),eI=le("$ZodTransform",(e,t)=>{Mt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new _C(e.constructor.name);const s=t.transform(n.value,n);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(c=>(n.value=c,n));if(s instanceof Promise)throw new Sl;return n.value=s,n}});function Dw(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const GC=le("$ZodOptional",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Bv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>Dw(o,n.value)):Dw(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),tI=le("$ZodExactOptional",(e,t)=>{GC.init(e,t),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),nI=le("$ZodNullable",(e,t)=>{Mt.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Bv(n.source)}|null)$`):void 0}),mt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),rI=le("$ZodDefault",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>Mw(o,t)):Mw(s,t)}});function Mw(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const aI=le("$ZodPrefault",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),iI=le("$ZodNonOptional",(e,t)=>{Mt.init(e,t),mt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>Iw(o,e)):Iw(s,e)}});function Iw(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const sI=le("$ZodCatch",(e,t)=>{Mt.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(c=>Ai(c,a,Ri()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>Ai(o,a,Ri()))},input:n.value}),n.issues=[]),n)}}),lI=le("$ZodPipe",(e,t)=>{Mt.init(e,t),mt(e._zod,"values",()=>t.in._zod.values),mt(e._zod,"optin",()=>t.in._zod.optin),mt(e._zod,"optout",()=>t.out._zod.optout),mt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const o=t.out._zod.run(n,a);return o instanceof Promise?o.then(c=>zd(c,t.in,a)):zd(o,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(o=>zd(o,t.out,a)):zd(s,t.out,a)}});function zd(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const oI=le("$ZodReadonly",(e,t)=>{Mt.init(e,t),mt(e._zod,"propValues",()=>t.innerType._zod.propValues),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),mt(e._zod,"optout",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optout}),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(Lw):Lw(s)}});function Lw(e){return e.value=Object.freeze(e.value),e}const uI=le("$ZodCustom",(e,t)=>{er.init(e,t),Mt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,s=t.fn(a);if(s instanceof Promise)return s.then(o=>Uw(o,n,a,e));Uw(s,n,a,e)}});function Uw(e,t,n,a){if(!e){const s={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(s.params=a._zod.def.params),t.issues.push(Au(s))}}var Pw;class cI{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const s={...a,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function dI(){return new cI}(Pw=globalThis).__zod_globalRegistry??(Pw.__zod_globalRegistry=dI());const hu=globalThis.__zod_globalRegistry;function fI(e,t){return new e({type:"string",...Re(t)})}function hI(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Re(t)})}function Bw(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Re(t)})}function mI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Re(t)})}function pI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Re(t)})}function gI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Re(t)})}function vI(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Re(t)})}function yI(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Re(t)})}function bI(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Re(t)})}function xI(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Re(t)})}function wI(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Re(t)})}function SI(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Re(t)})}function kI(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Re(t)})}function jI(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Re(t)})}function CI(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Re(t)})}function NI(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Re(t)})}function EI(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Re(t)})}function _I(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Re(t)})}function TI(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Re(t)})}function RI(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Re(t)})}function AI(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Re(t)})}function zI(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Re(t)})}function OI(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Re(t)})}function DI(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Re(t)})}function MI(e,t){return new e({type:"string",format:"date",check:"string_format",...Re(t)})}function II(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Re(t)})}function LI(e,t){return new e({type:"string",format:"duration",check:"string_format",...Re(t)})}function UI(e,t){return new e({type:"number",checks:[],...Re(t)})}function PI(e,t){return new e({type:"number",coerce:!0,checks:[],...Re(t)})}function BI(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Re(t)})}function $I(e,t){return new e({type:"boolean",...Re(t)})}function FI(e,t){return new e({type:"null",...Re(t)})}function qI(e){return new e({type:"unknown"})}function HI(e,t){return new e({type:"never",...Re(t)})}function $w(e,t){return new $C({check:"less_than",...Re(t),value:e,inclusive:!1})}function kp(e,t){return new $C({check:"less_than",...Re(t),value:e,inclusive:!0})}function Fw(e,t){return new FC({check:"greater_than",...Re(t),value:e,inclusive:!1})}function jp(e,t){return new FC({check:"greater_than",...Re(t),value:e,inclusive:!0})}function qw(e,t){return new n5({check:"multiple_of",...Re(t),value:e})}function KC(e,t){return new a5({check:"max_length",...Re(t),maximum:e})}function nf(e,t){return new i5({check:"min_length",...Re(t),minimum:e})}function YC(e,t){return new s5({check:"length_equals",...Re(t),length:e})}function ZI(e,t){return new l5({check:"string_format",format:"regex",...Re(t),pattern:e})}function VI(e){return new o5({check:"string_format",format:"lowercase",...Re(e)})}function QI(e){return new u5({check:"string_format",format:"uppercase",...Re(e)})}function GI(e,t){return new c5({check:"string_format",format:"includes",...Re(t),includes:e})}function KI(e,t){return new d5({check:"string_format",format:"starts_with",...Re(t),prefix:e})}function YI(e,t){return new f5({check:"string_format",format:"ends_with",...Re(t),suffix:e})}function Jl(e){return new h5({check:"overwrite",tx:e})}function XI(e){return Jl(t=>t.normalize(e))}function JI(){return Jl(e=>e.trim())}function WI(){return Jl(e=>e.toLowerCase())}function eL(){return Jl(e=>e.toUpperCase())}function tL(){return Jl(e=>s4(e))}function nL(e,t,n){return new e({type:"array",element:t,...Re(n)})}function rL(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Re(n)})}function aL(e){const t=iL(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(Au(a,n.value,t._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(Au(s))}},e(n.value,n)));return t}function iL(e,t){const n=new er({check:"custom",...Re(t)});return n._zod.check=e,n}function XC(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??hu,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Wt(e,t,n={path:[],schemaPath:[]}){var v,p;var a;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const f=(p=(v=e._zod).toJSONSchema)==null?void 0:p.call(v);if(f)c.schema=f;else{const b={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,b);else{const k=c.schema,j=t.processors[s.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);j(e,t,k,b)}const w=e._zod.parent;w&&(c.ref||(c.ref=w),Wt(w,t,b),t.seen.get(w).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&Mn(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((a=c.schema).default??(a.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function JC(e,t){var c,f,m,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const v of e.seen.entries()){const p=(c=e.metadataRegistry.get(v[0]))==null?void 0:c.id;if(p){const b=a.get(p);if(b&&b!==v[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(p,v[0])}}const s=v=>{var j;const p=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const N=(j=e.external.registry.get(v[0]))==null?void 0:j.id,C=e.external.uri??(O=>O);if(N)return{ref:C(N)};const A=v[1].defId??v[1].schema.id??`schema${e.counter++}`;return v[1].defId=A,{defId:A,ref:`${C("__shared")}#/${p}/${A}`}}if(v[1]===n)return{ref:"#"};const w=`#/${p}/`,k=v[1].schema.id??`__schema${e.counter++}`;return{defId:k,ref:w+k}},o=v=>{if(v[1].schema.$ref)return;const p=v[1],{ref:b,defId:w}=s(v);p.def={...p.schema},w&&(p.defId=w);const k=p.schema;for(const j in k)delete k[j];k.$ref=b};if(e.cycles==="throw")for(const v of e.seen.entries()){const p=v[1];if(p.cycle)throw new Error(`Cycle detected: #/${(f=p.cycle)==null?void 0:f.join("/")}/<root>
356
+
357
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const v of e.seen.entries()){const p=v[1];if(t===v[0]){o(v);continue}if(e.external){const w=(m=e.external.registry.get(v[0]))==null?void 0:m.id;if(t!==v[0]&&w){o(v);continue}}if((h=e.metadataRegistry.get(v[0]))==null?void 0:h.id){o(v);continue}if(p.cycle){o(v);continue}if(p.count>1&&e.reused==="ref"){o(v);continue}}}function WC(e,t){var c,f,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const v=e.seen.get(h);if(v.ref===null)return;const p=v.def??v.schema,b={...p},w=v.ref;if(v.ref=null,w){a(w);const j=e.seen.get(w),N=j.schema;if(N.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(N)):Object.assign(p,N),Object.assign(p,b),h._zod.parent===w)for(const A in p)A==="$ref"||A==="allOf"||A in b||delete p[A];if(N.$ref&&j.def)for(const A in p)A==="$ref"||A==="allOf"||A in j.def&&JSON.stringify(p[A])===JSON.stringify(j.def[A])&&delete p[A]}const k=h._zod.parent;if(k&&k!==w){a(k);const j=e.seen.get(k);if(j!=null&&j.schema.$ref&&(p.$ref=j.schema.$ref,j.def))for(const N in p)N==="$ref"||N==="allOf"||N in j.def&&JSON.stringify(p[N])===JSON.stringify(j.def[N])&&delete p[N]}e.override({zodSchema:h,jsonSchema:p,path:v.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(f=e.external.registry.get(t))==null?void 0:f.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(h)}Object.assign(s,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const v=h[1];v.def&&v.defId&&(o[v.defId]=v.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:rf(t,"input",e.processors),output:rf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function Mn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return Mn(a.element,n);if(a.type==="set")return Mn(a.valueType,n);if(a.type==="lazy")return Mn(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return Mn(a.innerType,n);if(a.type==="intersection")return Mn(a.left,n)||Mn(a.right,n);if(a.type==="record"||a.type==="map")return Mn(a.keyType,n)||Mn(a.valueType,n);if(a.type==="pipe")return Mn(a.in,n)||Mn(a.out,n);if(a.type==="object"){for(const s in a.shape)if(Mn(a.shape[s],n))return!0;return!1}if(a.type==="union"){for(const s of a.options)if(Mn(s,n))return!0;return!1}if(a.type==="tuple"){for(const s of a.items)if(Mn(s,n))return!0;return!!(a.rest&&Mn(a.rest,n))}return!1}const sL=(e,t={})=>n=>{const a=XC({...n,processors:t});return Wt(e,a),JC(a,e),WC(a,e)},rf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},c=XC({...s??{},target:o,io:t,processors:n});return Wt(e,c),JC(c,e),WC(c,e)},lL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oL=(e,t,n,a)=>{const s=n;s.type="string";const{minimum:o,maximum:c,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof c=="number"&&(s.maxLength=c),f&&(s.format=lL[f]??f,s.format===""&&delete s.format,f==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const v=[...m];v.length===1?s.pattern=v[0].source:v.length>1&&(s.allOf=[...v.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},uL=(e,t,n,a)=>{const s=n,{minimum:o,maximum:c,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:v}=e._zod.bag;typeof f=="string"&&f.includes("int")?s.type="integer":s.type="number",typeof v=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=v,s.exclusiveMinimum=!0):s.exclusiveMinimum=v),typeof o=="number"&&(s.minimum=o,typeof v=="number"&&t.target!=="draft-04"&&(v>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h),typeof c=="number"&&(s.maximum=c,typeof h=="number"&&t.target!=="draft-04"&&(h<=c?delete s.maximum:delete s.exclusiveMaximum)),typeof m=="number"&&(s.multipleOf=m)},cL=(e,t,n,a)=>{n.type="boolean"},dL=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},fL=(e,t,n,a)=>{n.not={}},hL=(e,t,n,a)=>{},mL=(e,t,n,a)=>{const s=e._zod.def,o=RC(s.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},pL=(e,t,n,a)=>{const s=e._zod.def,o=[];for(const c of s.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(c))}else o.push(c);if(o.length!==0)if(o.length===1){const c=o[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),o.every(c=>typeof c=="boolean")&&(n.type="boolean"),o.every(c=>c===null)&&(n.type="null"),n.enum=o},gL=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},vL=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},yL=(e,t,n,a)=>{const s=n,o=e._zod.def,{minimum:c,maximum:f}=e._zod.bag;typeof c=="number"&&(s.minItems=c),typeof f=="number"&&(s.maxItems=f),s.type="array",s.items=Wt(o.element,t,{...a,path:[...a.path,"items"]})},bL=(e,t,n,a)=>{var h;const s=n,o=e._zod.def;s.type="object",s.properties={};const c=o.shape;for(const v in c)s.properties[v]=Wt(c[v],t,{...a,path:[...a.path,"properties",v]});const f=new Set(Object.keys(c)),m=new Set([...f].filter(v=>{const p=o.shape[v]._zod;return t.io==="input"?p.optin===void 0:p.optout===void 0}));m.size>0&&(s.required=Array.from(m)),((h=o.catchall)==null?void 0:h._zod.def.type)==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=Wt(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},xL=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,c=s.options.map((f,m)=>Wt(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},wL=(e,t,n,a)=>{const s=e._zod.def,o=Wt(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=Wt(s.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(c)?c.allOf:[c]];n.allOf=m},SL=(e,t,n,a)=>{const s=n,o=e._zod.def;s.type="object";const c=o.keyType,f=c._zod.bag,m=f==null?void 0:f.patterns;if(o.mode==="loose"&&m&&m.size>0){const v=Wt(o.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const p of m)s.patternProperties[p.source]=v}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=Wt(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=Wt(o.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=c._zod.values;if(h){const v=[...h].filter(p=>typeof p=="string"||typeof p=="number");v.length>0&&(s.required=v)}},kL=(e,t,n,a)=>{const s=e._zod.def,o=Wt(s.innerType,t,a),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},jL=(e,t,n,a)=>{const s=e._zod.def;Wt(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},CL=(e,t,n,a)=>{const s=e._zod.def;Wt(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},NL=(e,t,n,a)=>{const s=e._zod.def;Wt(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},EL=(e,t,n,a)=>{const s=e._zod.def;Wt(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType;let c;try{c=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},_L=(e,t,n,a)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;Wt(o,t,a);const c=t.seen.get(e);c.ref=o},TL=(e,t,n,a)=>{const s=e._zod.def;Wt(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},eN=(e,t,n,a)=>{const s=e._zod.def;Wt(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},RL=le("ZodISODateTime",(e,t)=>{E5.init(e,t),Ut.init(e,t)});function AL(e){return DI(RL,e)}const zL=le("ZodISODate",(e,t)=>{_5.init(e,t),Ut.init(e,t)});function OL(e){return MI(zL,e)}const DL=le("ZodISOTime",(e,t)=>{T5.init(e,t),Ut.init(e,t)});function ML(e){return II(DL,e)}const IL=le("ZodISODuration",(e,t)=>{R5.init(e,t),Ut.init(e,t)});function LL(e){return LI(IL,e)}const UL=(e,t)=>{DC.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>b4(e,n)},flatten:{value:n=>y4(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Lg,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Lg,2)}},isEmpty:{get(){return e.issues.length===0}}})},zr=le("ZodError",UL,{Parent:Error}),PL=Fv(zr),BL=qv(zr),$L=zf(zr),FL=Of(zr),qL=S4(zr),HL=k4(zr),ZL=j4(zr),VL=C4(zr),QL=N4(zr),GL=E4(zr),KL=_4(zr),YL=T4(zr),Lt=le("ZodType",(e,t)=>(Mt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:rf(e,"input"),output:rf(e,"output")}}),e.toJSONSchema=sL(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Oi(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(n,a)=>Di(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>PL(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>$L(e,n,a),e.parseAsync=async(n,a)=>BL(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>FL(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>qL(e,n,a),e.decode=(n,a)=>HL(e,n,a),e.encodeAsync=async(n,a)=>ZL(e,n,a),e.decodeAsync=async(n,a)=>VL(e,n,a),e.safeEncode=(n,a)=>QL(e,n,a),e.safeDecode=(n,a)=>GL(e,n,a),e.safeEncodeAsync=async(n,a)=>KL(e,n,a),e.safeDecodeAsync=async(n,a)=>YL(e,n,a),e.refine=(n,a)=>e.check(H6(n,a)),e.superRefine=n=>e.check(Z6(n)),e.overwrite=n=>e.check(Jl(n)),e.optional=()=>Vw(e),e.exactOptional=()=>A6(e),e.nullable=()=>Qw(e),e.nullish=()=>Vw(Qw(e)),e.nonoptional=n=>L6(e,n),e.array=()=>pt(e),e.or=n=>Vv([e,n]),e.and=n=>N6(e,n),e.transform=n=>Bg(e,rN(n)),e.default=n=>D6(e,n),e.prefault=n=>I6(e,n),e.catch=n=>P6(e,n),e.pipe=n=>Bg(e,n),e.readonly=()=>F6(e),e.describe=n=>{const a=e.clone();return hu.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=hu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return hu.get(e);const a=e.clone();return hu.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),tN=le("_ZodString",(e,t)=>{Hv.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>oL(e,a,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(ZI(...a)),e.includes=(...a)=>e.check(GI(...a)),e.startsWith=(...a)=>e.check(KI(...a)),e.endsWith=(...a)=>e.check(YI(...a)),e.min=(...a)=>e.check(nf(...a)),e.max=(...a)=>e.check(KC(...a)),e.length=(...a)=>e.check(YC(...a)),e.nonempty=(...a)=>e.check(nf(1,...a)),e.lowercase=a=>e.check(VI(a)),e.uppercase=a=>e.check(QI(a)),e.trim=()=>e.check(JI()),e.normalize=(...a)=>e.check(XI(...a)),e.toLowerCase=()=>e.check(WI()),e.toUpperCase=()=>e.check(eL()),e.slugify=()=>e.check(tL())}),XL=le("ZodString",(e,t)=>{Hv.init(e,t),tN.init(e,t),e.email=n=>e.check(hI(JL,n)),e.url=n=>e.check(yI(WL,n)),e.jwt=n=>e.check(OI(m6,n)),e.emoji=n=>e.check(bI(e6,n)),e.guid=n=>e.check(Bw(Hw,n)),e.uuid=n=>e.check(mI(Od,n)),e.uuidv4=n=>e.check(pI(Od,n)),e.uuidv6=n=>e.check(gI(Od,n)),e.uuidv7=n=>e.check(vI(Od,n)),e.nanoid=n=>e.check(xI(t6,n)),e.guid=n=>e.check(Bw(Hw,n)),e.cuid=n=>e.check(wI(n6,n)),e.cuid2=n=>e.check(SI(r6,n)),e.ulid=n=>e.check(kI(a6,n)),e.base64=n=>e.check(RI(d6,n)),e.base64url=n=>e.check(AI(f6,n)),e.xid=n=>e.check(jI(i6,n)),e.ksuid=n=>e.check(CI(s6,n)),e.ipv4=n=>e.check(NI(l6,n)),e.ipv6=n=>e.check(EI(o6,n)),e.cidrv4=n=>e.check(_I(u6,n)),e.cidrv6=n=>e.check(TI(c6,n)),e.e164=n=>e.check(zI(h6,n)),e.datetime=n=>e.check(AL(n)),e.date=n=>e.check(OL(n)),e.time=n=>e.check(ML(n)),e.duration=n=>e.check(LL(n))});function E(e){return fI(XL,e)}const Ut=le("ZodStringFormat",(e,t)=>{It.init(e,t),tN.init(e,t)}),JL=le("ZodEmail",(e,t)=>{y5.init(e,t),Ut.init(e,t)}),Hw=le("ZodGUID",(e,t)=>{g5.init(e,t),Ut.init(e,t)}),Od=le("ZodUUID",(e,t)=>{v5.init(e,t),Ut.init(e,t)}),WL=le("ZodURL",(e,t)=>{b5.init(e,t),Ut.init(e,t)}),e6=le("ZodEmoji",(e,t)=>{x5.init(e,t),Ut.init(e,t)}),t6=le("ZodNanoID",(e,t)=>{w5.init(e,t),Ut.init(e,t)}),n6=le("ZodCUID",(e,t)=>{S5.init(e,t),Ut.init(e,t)}),r6=le("ZodCUID2",(e,t)=>{k5.init(e,t),Ut.init(e,t)}),a6=le("ZodULID",(e,t)=>{j5.init(e,t),Ut.init(e,t)}),i6=le("ZodXID",(e,t)=>{C5.init(e,t),Ut.init(e,t)}),s6=le("ZodKSUID",(e,t)=>{N5.init(e,t),Ut.init(e,t)}),l6=le("ZodIPv4",(e,t)=>{A5.init(e,t),Ut.init(e,t)}),o6=le("ZodIPv6",(e,t)=>{z5.init(e,t),Ut.init(e,t)}),u6=le("ZodCIDRv4",(e,t)=>{O5.init(e,t),Ut.init(e,t)}),c6=le("ZodCIDRv6",(e,t)=>{D5.init(e,t),Ut.init(e,t)}),d6=le("ZodBase64",(e,t)=>{M5.init(e,t),Ut.init(e,t)}),f6=le("ZodBase64URL",(e,t)=>{L5.init(e,t),Ut.init(e,t)}),h6=le("ZodE164",(e,t)=>{U5.init(e,t),Ut.init(e,t)}),m6=le("ZodJWT",(e,t)=>{B5.init(e,t),Ut.init(e,t)}),Zv=le("ZodNumber",(e,t)=>{HC.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>uL(e,a,s),e.gt=(a,s)=>e.check(Fw(a,s)),e.gte=(a,s)=>e.check(jp(a,s)),e.min=(a,s)=>e.check(jp(a,s)),e.lt=(a,s)=>e.check($w(a,s)),e.lte=(a,s)=>e.check(kp(a,s)),e.max=(a,s)=>e.check(kp(a,s)),e.int=a=>e.check(Zw(a)),e.safe=a=>e.check(Zw(a)),e.positive=a=>e.check(Fw(0,a)),e.nonnegative=a=>e.check(jp(0,a)),e.negative=a=>e.check($w(0,a)),e.nonpositive=a=>e.check(kp(0,a)),e.multipleOf=(a,s)=>e.check(qw(a,s)),e.step=(a,s)=>e.check(qw(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Be(e){return UI(Zv,e)}const p6=le("ZodNumberFormat",(e,t)=>{$5.init(e,t),Zv.init(e,t)});function Zw(e){return BI(p6,e)}const g6=le("ZodBoolean",(e,t)=>{F5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>cL(e,n,a)});function Xn(e){return $I(g6,e)}const v6=le("ZodNull",(e,t)=>{q5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>dL(e,n,a)});function y6(e){return FI(v6,e)}const b6=le("ZodUnknown",(e,t)=>{H5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>hL()});function _t(){return qI(b6)}const x6=le("ZodNever",(e,t)=>{Z5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>fL(e,n,a)});function w6(e){return HI(x6,e)}const S6=le("ZodArray",(e,t)=>{V5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>yL(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(nf(n,a)),e.nonempty=n=>e.check(nf(1,n)),e.max=(n,a)=>e.check(KC(n,a)),e.length=(n,a)=>e.check(YC(n,a)),e.unwrap=()=>e.element});function pt(e,t){return nL(S6,e,t)}const k6=le("ZodObject",(e,t)=>{G5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>bL(e,n,a,s),mt(e,"shape",()=>t.shape),e.keyof=()=>Me(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:_t()}),e.loose=()=>e.clone({...e._zod.def,catchall:_t()}),e.strict=()=>e.clone({...e._zod.def,catchall:w6()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>h4(e,n),e.safeExtend=n=>m4(e,n),e.merge=n=>p4(e,n),e.pick=n=>d4(e,n),e.omit=n=>f4(e,n),e.partial=(...n)=>g4(aN,e,n[0]),e.required=(...n)=>v4(iN,e,n[0])});function re(e,t){const n={type:"object",shape:e??{},...Re(t)};return new k6(n)}const nN=le("ZodUnion",(e,t)=>{QC.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>xL(e,n,a,s),e.options=t.options});function Vv(e,t){return new nN({type:"union",options:e,...Re(t)})}const j6=le("ZodDiscriminatedUnion",(e,t)=>{nN.init(e,t),K5.init(e,t)});function Qv(e,t,n){return new j6({type:"union",options:t,discriminator:e,...Re(n)})}const C6=le("ZodIntersection",(e,t)=>{Y5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>wL(e,n,a,s)});function N6(e,t){return new C6({type:"intersection",left:e,right:t})}const E6=le("ZodRecord",(e,t)=>{X5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>SL(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function qt(e,t,n){return new E6({type:"record",keyType:e,valueType:t,...Re(n)})}const Pg=le("ZodEnum",(e,t)=>{J5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(a,s,o)=>mL(e,a,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,s)=>{const o={};for(const c of a)if(n.has(c))o[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Pg({...t,checks:[],...Re(s),entries:o})},e.exclude=(a,s)=>{const o={...t.entries};for(const c of a)if(n.has(c))delete o[c];else throw new Error(`Key ${c} not found in enum`);return new Pg({...t,checks:[],...Re(s),entries:o})}});function Me(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Pg({type:"enum",entries:n,...Re(t)})}const _6=le("ZodLiteral",(e,t)=>{W5.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>pL(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Jt(e,t){return new _6({type:"literal",values:Array.isArray(e)?e:[e],...Re(t)})}const T6=le("ZodTransform",(e,t)=>{eI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>vL(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new _C(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(Au(o,n.value,t));else{const c=o;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(Au(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function rN(e){return new T6({type:"transform",transform:e})}const aN=le("ZodOptional",(e,t)=>{GC.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>eN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function Vw(e){return new aN({type:"optional",innerType:e})}const R6=le("ZodExactOptional",(e,t)=>{tI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>eN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function A6(e){return new R6({type:"optional",innerType:e})}const z6=le("ZodNullable",(e,t)=>{nI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>kL(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function Qw(e){return new z6({type:"nullable",innerType:e})}const O6=le("ZodDefault",(e,t)=>{rI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>CL(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function D6(e,t){return new O6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():zC(t)}})}const M6=le("ZodPrefault",(e,t)=>{aI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>NL(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function I6(e,t){return new M6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():zC(t)}})}const iN=le("ZodNonOptional",(e,t)=>{iI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>jL(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function L6(e,t){return new iN({type:"nonoptional",innerType:e,...Re(t)})}const U6=le("ZodCatch",(e,t)=>{sI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>EL(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function P6(e,t){return new U6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const B6=le("ZodPipe",(e,t)=>{lI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>_L(e,n,a,s),e.in=t.in,e.out=t.out});function Bg(e,t){return new B6({type:"pipe",in:e,out:t})}const $6=le("ZodReadonly",(e,t)=>{oI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>TL(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function F6(e){return new $6({type:"readonly",innerType:e})}const q6=le("ZodCustom",(e,t)=>{uI.init(e,t),Lt.init(e,t),e._zod.processJSONSchema=(n,a,s)=>gL(e,n)});function H6(e,t={}){return rL(q6,e,t)}function Z6(e){return aL(e)}function V6(e,t){return Bg(rN(e),t)}const Cp={custom:"custom"};function ec(e){return PI(Zv,e)}const Q6=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function G6(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function sN(e,t){const n=G6(e),a=new Map;for(const o of t)o.name&&a.set(o.name.toLowerCase(),o.agentId);if(a.size===0)return[];const s=new Set;for(const o of n.matchAll(Q6)){const c=o[1];if(!c)continue;const f=a.get(c.toLowerCase());f&&s.add(f)}return[...s]}const K6=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,Gw="/";function lN(e){return!e||typeof e!="string"||e.length>256||!K6.test(e)?"/":e}const Y6={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},oN=Me(["feishu","slack","kael"]),uN=Me(["active","inactive"]);re({platform:oN,agentId:E().min(1),credentials:qt(E(),_t()),status:uN.default("active")});re({agentId:E().min(1).optional(),credentials:qt(E(),_t()).optional(),status:uN.optional()});re({id:Be(),platform:E(),agentId:E(),hasCredentials:Xn(),status:E(),createdAt:E(),updatedAt:E()});const X6=Me(["code","reverse_token","oauth","manual"]);re({appId:E().min(1),appSecret:E().min(1)});re({platform:oN,externalUserId:E().min(1),agentId:E().min(1),boundVia:X6.default("manual"),displayName:E().max(200).optional()});re({id:Be(),platform:E(),externalUserId:E(),agentId:E(),boundVia:E().nullable(),displayName:E().nullable(),createdAt:E()});re({feishuUserId:E().min(1),displayName:E().max(200).optional()});re({configId:Be(),platform:E(),agentId:E(),appId:E(),connected:Xn(),lastActiveAt:E().nullable()});const J6=32e3,Gv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,W6=/^[A-Z][A-Z0-9_]*$/,cN=re({append:E().max(J6).default("")}),eU=re({name:E().regex(Gv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Jt("stdio"),command:E().min(1),args:pt(E()).optional()}),tU=re({name:E().regex(Gv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Jt("http"),url:E().url(),headers:qt(E(),E()).optional()}),nU=re({name:E().regex(Gv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Jt("sse"),url:E().url(),headers:qt(E(),E()).optional()}),dN=Qv("transport",[eU,tU,nU]),fN=re({key:E().regex(W6,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:E(),sensitive:Xn().default(!1)}),Kv=re({url:E().min(1),ref:E().min(1).optional(),localPath:E().min(1).optional()}),hN=re({prompt:cN.default({append:""}),model:E().default("opus"),mcpServers:pt(dN).default([]),env:pt(fN).default([]),gitRepos:pt(Kv).default([])}),rU=hN.extend({kind:Jt("claude-code")}),aU=hN.extend({kind:Jt("codex")}),iU=Qv("kind",[rU,aU]),sU=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,c)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:Cp.custom,path:["mcpServers",c,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(f)});const a=new Set;e.env.forEach((o,c)=>{a.has(o.key)&&t.addIssue({code:Cp.custom,path:["env",c,"key"],message:`Duplicate env key "${o.key}"`}),a.add(o.key)});const s=new Set;e.gitRepos.forEach((o,c)=>{const f=o.localPath??sf(o.url);f&&(s.has(f)&&t.addIssue({code:Cp.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${f}"`}),s.add(f))})},mN=V6(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,iU).superRefine((e,t)=>{sU(e,t)}),lU=re({agentId:E(),version:Be().int().positive(),payload:mN,updatedAt:E(),updatedBy:E()}),pN=re({prompt:cN,model:E(),mcpServers:pt(dN),env:pt(fN),gitRepos:pt(Kv)}).partial();re({expectedVersion:Be().int().positive(),payload:pN});re({payload:pN});re({current:lU,next:mN,diff:pt(re({path:E(),op:Me(["add","remove","replace"]),before:_t().optional(),after:_t().optional()}))});const af="***";function sf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const gN=Me(["online","offline"]),vN=Me(["idle","working","blocked","error"]);Me(["active","suspended","evicted"]);const oU=Me(["active","suspended"]);re({chatId:E().min(1),state:oU});re({runtimeState:vN});re({agentId:E().min(1),runtimeType:E().max(50),runtimeVersion:E().max(50).optional()});Me(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);re({agentId:E(),status:gN,connectedAt:E().nullable(),lastSeenAt:E(),clientId:E().nullable().optional(),runtimeType:E().nullable().optional(),runtimeVersion:E().nullable().optional(),runtimeState:vN.nullable().optional(),activeSessions:Be().int().nullable().optional(),totalSessions:Be().int().nullable().optional(),runtimeUpdatedAt:E().nullable().optional()});re({total:Be().int(),running:Be().int(),byState:re({idle:Be().int(),working:Be().int(),blocked:Be().int(),error:Be().int()}),clients:Be().int()});const lf={CLAUDE_CODE:"claude-code",CODEX:"codex"},Mf=Me(["claude-code","codex"]),If=Me(["human","personal_assistant","autonomous_agent"]),Kw={PRIVATE:"private",ORGANIZATION:"organization"},Yv=Me(["private","organization"]),uU=Me(["admin-api","portal"]);Me(["active","suspended"]);const $g=/^[a-z0-9][a-z0-9_-]{0,63}$/,xl=64,cU=["admin","agent","first-tree","hub","me","null","system","undefined"],dU=new Set(cU);function Fg(e){return dU.has(e)}re({name:E().min(1).max(64).regex($g,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Fg(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:If,displayName:E().min(1).max(200).optional(),delegateMention:E().max(100).optional(),organizationId:E().min(1).max(100).optional(),source:uU.optional(),visibility:Yv.optional(),metadata:qt(E(),_t()).optional(),managerId:E().optional(),clientId:E().min(1).max(100).optional(),runtimeProvider:Mf.optional(),gitRepos:pt(Kv).optional()});re({type:If.optional(),displayName:E().min(1).max(200).optional(),delegateMention:E().max(100).nullable().optional(),visibility:Yv.optional(),metadata:qt(E(),_t()).optional(),managerId:E().nullable().optional(),clientId:E().min(1).max(100).nullable().optional()});re({clientId:E().min(1).max(100),runtimeProvider:Mf,force:Xn().optional()});re({uuid:E(),name:E().nullable(),organizationId:E(),type:If,displayName:E(),delegateMention:E().nullable(),inboxId:E(),status:E(),source:E().nullable().optional(),visibility:Yv,metadata:qt(E(),_t()),managerId:E().nullable(),clientId:E().nullable(),runtimeProvider:Mf,presenceStatus:gN.optional(),createdAt:E(),updatedAt:E()});re({repo:E().nullable(),branch:E().nullable()});re({type:Jt("agent:pinned"),agentId:E(),name:E().nullable(),displayName:E(),agentType:If,runtimeProvider:Mf});re({username:E().min(1),password:E().min(1)});re({accessToken:E(),refreshToken:E()});re({refreshToken:E().min(1)});re({token:E().min(1)});re({token:E(),expiresIn:Be(),command:E()});const fU=Me(["direct","group","thread"]);re({type:fU,topic:E().max(500).optional(),participantIds:pt(E()).min(1),metadata:qt(E(),_t()).optional()});const yN=re({agentId:E(),role:E(),mode:E(),joinedAt:E()});yN.extend({name:E().nullable(),displayName:E(),type:E()});const hU=re({id:E(),organizationId:E(),type:E(),topic:E().nullable(),lifecyclePolicy:E().nullable().optional(),metadata:qt(E(),_t()),createdAt:E(),updatedAt:E()});hU.extend({participants:pt(yN),title:E(),firstMessagePreview:E().nullable()});re({topic:E().trim().max(500).nullable()});re({agentId:E().min(1),mode:Me(["full","mention_only"]).default("full")});re({agentId:E().min(1)});const mU=Me(["connected","disconnected"]),pU=Me(["ok","expired"]);re({id:E(),userId:E().nullable(),status:mU,authState:pU,sdkVersion:E().max(50).nullable(),hostname:E().max(100).nullable(),os:E().max(50).nullable(),agentCount:Be().int().min(0),connectedAt:E().nullable(),lastSeenAt:E(),metadata:qt(E(),_t()).nullable()});const gU=re({wsInboxDeliver:Xn().default(!1)}).partial();re({clientId:E().min(1).max(100),hostname:E().max(100).optional(),os:E().max(50).optional(),sdkVersion:E().max(50).optional(),wireCapabilities:gU.optional()});re({clientId:E(),previousUserId:E().nullable(),unpinnedAgentCount:Be().int().nonnegative()});const vU=Me(["ok","missing","unauthenticated","error"]),yU=Me(["api_key","oauth","auth_json","none"]),bU=re({state:vU,available:Xn(),authenticated:Xn(),sdkVersion:E().nullable().optional(),authMethod:yU,error:E().nullable().optional(),detectedAt:E()}),xU=qt(E(),bU);re({capabilities:xU});re({limit:ec().int().min(1).max(100).default(20),cursor:E().optional()});const wU=Me(["active","stale","unavailable"]),SU=Me(["ok","warning","error"]),kU=re({label:E(),detail:E().nullable(),severity:SU}),jU=Me(["root","domain","subdomain","leaf"]),Xv=Me(["added","edited","removed"]),CU=Me(["parent","soft_link","markdown_link"]),NU=Me(["low","medium","high"]),EU=re({id:E(),path:E(),sourcePath:E().nullable(),title:E(),kind:jU,owners:pt(E()),parentId:E().nullable(),preview:E().nullable(),relatedNodeIds:pt(E()),affectedContextArea:E(),changeType:Xv.nullable(),changedAtCommit:E().nullable()}),_U=re({source:E(),target:E(),kind:CU}),TU=re({path:E(),nodeId:E().nullable(),type:Xv,commit:E().nullable(),changedAt:E().nullable(),changedBy:E().nullable(),summary:E().nullable()}),RU=re({id:E(),nodeId:E().nullable(),path:E(),title:E(),changeType:Xv,affectedContextArea:E(),reason:E(),summary:E(),changedBy:E().nullable(),owners:pt(E()),relatedNodeIds:pt(E()),sourceCommit:E().nullable(),riskLevel:NU}),AU=re({addedCount:Be().int().nonnegative(),editedCount:Be().int().nonnegative(),removedCount:Be().int().nonnegative(),changedNodeCount:Be().int().nonnegative()});re({repo:E().nullable(),branch:E().nullable(),headCommit:E().nullable(),syncedAt:E().nullable(),snapshotStatus:wU,contextStatus:kU,summary:AU,updates:pt(RU),nodes:pt(EU),edges:pt(_U),changes:pt(TU)});const zU=["image/png","image/jpeg","image/gif","image/webp"],Jv=Me(zU);re({data:E().min(1),mimeType:Jv,filename:E().min(1),size:Be().int().nonnegative().optional(),imageId:E().uuid().optional()});re({imageId:E().uuid(),mimeType:Jv,filename:E().min(1),size:Be().int().nonnegative().optional()});re({type:Jt("image_payload"),imageId:E().uuid(),chatId:E(),base64:E().min(1),mimeType:Jv,filename:E().min(1),size:Be().int().nonnegative().optional()});const Wv=Me(["hub_ui","cli","feishu","github","api"]),bN=Me(["text","markdown","card","reference","file","task"]);re({format:bN.default("text"),content:_t(),metadata:qt(E(),_t()).optional(),inReplyTo:E().optional(),replyToInbox:E().optional(),replyToChat:E().optional(),source:Wv.optional()});re({format:bN.default("text"),content:_t(),metadata:qt(E(),_t()).optional(),replyToInbox:E().optional(),replyToChat:E().optional(),source:Wv.optional()});const OU=re({id:E(),chatId:E(),senderId:E(),format:E(),content:_t(),metadata:qt(E(),_t()),replyToInbox:E().nullable(),replyToChat:E().nullable(),inReplyTo:E().nullable(),source:Wv.nullable(),createdAt:E()}),DU=re({senderId:E(),chatId:E(),replyToChat:E().nullable()}).nullable(),MU=Me(["full","mention_only"]),IU=re({id:E(),senderId:E(),format:E(),content:_t(),metadata:qt(E(),_t()).default({}),createdAt:E()}),xN=OU.extend({configVersion:Be().int().positive(),recipientMode:MU.default("full"),inReplyToSnapshot:DU.default(null),precedingMessages:pt(IU).default([])});Me(["pending","delivered","acked","failed"]);const LU=re({id:Be(),inboxId:E(),messageId:E(),chatId:E().nullable(),status:E(),retryCount:Be(),createdAt:E(),deliveredAt:E().nullable(),ackedAt:E().nullable()});LU.extend({message:xN});re({limit:ec().int().min(1).max(50).default(10)});re({type:Jt("inbox:deliver"),entryId:Be().int().nonnegative(),inboxId:E().min(1),chatId:E().nullable(),message:xN}).passthrough();re({type:Jt("inbox:ack"),entryId:Be().int().nonnegative()});const UU=7;re({organizationId:E(),organizationName:E(),organizationDisplayName:E(),role:E(),expiresAt:E().nullable()});re({id:E(),organizationId:E(),token:E(),inviteUrl:E(),role:E(),createdAt:E(),expiresAt:E().nullable()});re({token:E().min(1)});re({}).optional();const PU=["all","unread","watching"],BU=Me(PU),wN=Me(["participant","watching"]);re({cursor:E().optional(),limit:ec().int().min(1).max(200).default(50),filter:BU.default("all")});const $U=re({agentId:E(),displayName:E(),type:E()}),FU=re({chatId:E(),type:E(),membershipKind:wN,title:E(),topic:E().nullable(),participants:pt($U),participantCount:Be().int(),lastMessageAt:E().nullable(),lastMessagePreview:E().nullable(),unreadMentionCount:Be().int(),canReply:Xn(),taskId:E().nullable(),taskStatus:E().nullable()});re({rows:pt(FU),nextCursor:E().nullable()});re({participantIds:pt(E().min(1)).min(1),topic:E().trim().max(500).optional().nullable()});re({participantIds:pt(E().min(1)).min(1)});re({chatId:E(),lastReadAt:E(),unreadMentionCount:Be().int()});re({chatId:E(),membershipKind:wN.nullable()});re({type:Jt("chat:message"),chatId:E()});Me(["connect","create_agent","completed"]);re({id:E(),name:E(),displayName:E(),role:Me(["admin","member"])});re({name:E().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:E().min(1).max(200)});re({dismissed:Xn().optional()});const qU=Me(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);re({event:qU,attrs:qt(E(),Vv([E(),Be(),Xn(),y6()])).optional()});re({id:E(),organizationId:E(),organizationName:E(),role:Me(["admin","member"]),agentId:E()});const HU={ADMIN:"admin",MEMBER:"member"},ey=Me(["admin","member"]),ZU=re({id:E(),userId:E(),organizationId:E(),agentId:E(),role:ey,createdAt:E()});re({username:E().min(1).max(100),displayName:E().min(1).max(200),role:ey.default("member")});re({role:ey.optional(),displayName:E().min(1).max(200).optional()});ZU.extend({username:E(),displayName:E(),password:E()});const VU=Me(["agent_error","session_error","agent_needs_decision","agent_blocked","agent_stale","agent_disconnected","agent_connected","session_completed"]),SN=Me(["high","medium","low"]);re({id:E(),organizationId:E(),type:VU,severity:SN,agentId:E().nullable(),chatId:E().nullable(),message:E(),read:Xn(),createdAt:E()});re({limit:ec().int().min(1).max(100).default(20),cursor:E().optional(),severity:SN.optional(),read:Me(["true","false"]).transform(e=>e==="true").optional(),agentId:E().optional()});re({next:E().max(256).optional()});re({code:E().min(1),state:E().min(1)});re({githubId:E().min(1),login:E().min(1),email:E().email().optional(),displayName:E().optional(),next:E().max(256).optional()});const kN=E().url().refine(e=>{try{return new URL(e).protocol==="https:"}catch{return!1}},{message:"Context Tree repo URL must use HTTPS."}).refine(e=>{try{const t=new URL(e);return t.username.length===0&&t.password.length===0}catch{return!1}},{message:"Context Tree repo URL must not include credentials."}),QU=re({repo:kN.optional(),branch:E().default("main")}),GU=re({repo:kN.nullish(),branch:E().min(1).nullish()}),KU=re({repo:E().optional(),branch:E().optional()}),YU=re({webhookSecretCipher:E().optional()}),XU=re({webhookSecret:E().min(1).nullish()}),JU=re({webhookSecretConfigured:Xn(),webhookUrl:E()}),WU={context_tree:{storage:QU,input:GU,output:KU},github_integration:{storage:YU,input:XU,output:JU}},eP=Object.keys(WU);Me(eP);const jN=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;re({name:E().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!jN.test(e),"Name must not be a UUID format"),displayName:E().min(1).max(200),maxAgents:Be().int().min(0).default(0),maxMessagesPerMinute:Be().int().min(0).default(0),features:qt(E(),_t()).default({})});re({name:E().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!jN.test(e),"Name must not be a UUID format").optional(),displayName:E().min(1).max(200).optional(),maxAgents:Be().int().min(0).optional(),maxMessagesPerMinute:Be().int().min(0).optional(),features:qt(E(),_t()).optional()});re({id:E(),name:E(),displayName:E(),maxAgents:Be(),maxMessagesPerMinute:Be(),features:qt(E(),_t()),createdAt:E(),updatedAt:E()});const tP=re({workingCount:Be().int().nonnegative(),errorMask:Xn()}),nP=re({type:Jt("pulse:tick"),organizationId:E(),agents:qt(E(),pt(tP).length(32))}),rP=Me(["tool_call","error","assistant_text","thinking","turn_end"]),CN=re({toolUseId:E(),name:E(),args:_t(),status:Me(["pending","ok","error"]),durationMs:Be().int().nonnegative().optional(),resultPreview:E().max(400).optional()}),NN=re({source:Me(["sdk","runtime","tool"]),message:E().max(2e3)}),EN=re({text:E().max(8e3)}),_N=re({}),TN=re({status:Me(["success","error"])}),aP=Qv("kind",[re({kind:Jt("tool_call"),payload:CN}),re({kind:Jt("error"),payload:NN}),re({kind:Jt("assistant_text"),payload:EN}),re({kind:Jt("thinking"),payload:_N}),re({kind:Jt("turn_end"),payload:TN})]);re({id:E(),agentId:E(),chatId:E(),seq:Be().int().positive(),kind:rP,payload:Vv([CN,NN,EN,_N,TN]),createdAt:E()});re({agentId:E(),chatId:E(),event:aP});re({agentId:E(),chatId:E()});re({type:Jt("session:reconcile"),agentId:E().min(1),chatIds:pt(E().min(1)).max(500)});re({type:Jt("session:reconcile:result"),agentId:E().min(1),staleChatIds:pt(E().min(1))});const iP=re({organizationId:E(),agentCount:Be(),chatCount:Be(),messageCount:Be()});re({totalAgents:Be(),totalChats:Be(),totalMessages:Be(),byOrganization:pt(iP)});const zu=Me(["pending","assigned","working","completed","failed","cancelled"]),Yw=Me(["agent","admin"]),sP=Me(["assigned","status_changed","cancelled"]);re({taskId:E(),event:sP,title:E(),body:E().default(""),status:zu,fromStatus:zu.optional(),originRef:E().nullable().optional()});const lP=re({title:E().min(1).max(500),body:E().optional(),assigneeAgentId:E().optional(),originRef:E().max(500).optional(),metadata:qt(E(),_t()).optional()});lP.extend({organizationId:E().optional()});re({status:Me(["working","completed","failed"]),result:E().optional()});re({assigneeAgentId:E().nullable().optional(),status:zu.optional(),result:E().optional()});re({chatId:E().min(1)});const oP=re({id:E(),organizationId:E(),title:E(),body:E(),status:zu,assigneeAgentId:E().nullable(),createdByType:Yw,createdById:E(),originRef:E().nullable(),result:E().nullable(),metadata:qt(E(),_t()),createdAt:E(),updatedAt:E(),cancelledAt:E().nullable(),cancelledByType:Yw.nullable(),cancelledById:E().nullable()}),uP=re({taskId:E(),chatId:E(),linkedByAgentId:E().nullable(),linkedAt:E()});oP.extend({chats:pt(uP)});re({status:zu.optional(),assigneeAgentId:E().optional(),originRef:E().optional(),limit:ec().int().min(1).max(100).default(20),cursor:E().optional()});const cP=Me(["normal","idle_island","awaiting_reply","no_chat","not_applicable"]);re({taskId:E(),signal:cP,reason:E()});const dP=Me(["active","suspended"]);re({id:E(),username:E(),displayName:E(),avatarUrl:E().nullable(),status:dP,createdAt:E(),updatedAt:E()});re({username:E().min(1).max(100),displayName:E().min(1).max(200),password:E().min(8).max(200)});re({displayName:E().min(1).max(200).optional(),password:E().min(8).max(200).optional()});re({type:Jt("auth"),token:E().min(1)});const fP=re({wsInboxDeliver:Xn().default(!1)}).partial();re({type:Jt("server:welcome"),serverCommandVersion:E().min(1),serverTimeMs:Be().int().nonnegative(),capabilities:fP.optional()}).passthrough();const RN=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function hP(e){const t=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));for(const n of Object.values(e))for(let a=0;a<32&&a<n.length;a++){const s=n[a],o=t[a];!s||!o||(o.workingCount+=s.workingCount,o.errorMask=o.errorMask||s.errorMask)}return t}const mP=2e3,pP=3e4;let mi=null,Ou=!1,of=0,pu=null;const qg=new Set;let hi=null,ss=0;function gP(e){for(const t of qg)try{t(e)}catch{}if(hi){if(e.type==="notification")hi.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")hi.invalidateQueries({queryKey:["activity"]}),hi.invalidateQueries({queryKey:["sessions"]});else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;hi.invalidateQueries({queryKey:["me","chats"]}),t&&(hi.invalidateQueries({queryKey:["chat-messages",t]}),hi.invalidateQueries({queryKey:["chat-detail",t]}))}}}function ty(){const e=kf();if(!(e!=null&&e.accessToken))return;let t=null;try{t=localStorage.getItem("first-tree-hub:selectedOrganizationId")}catch{t=null}if(!t)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/orgs/${encodeURIComponent(t)}/ws/?token=${e.accessToken}`,s=new WebSocket(a);mi=s,s.onmessage=o=>{if(s===mi)try{const c=JSON.parse(o.data);gP(c)}catch{}},s.onopen=()=>{s===mi&&(of=0)},s.onclose=o=>{if(s===mi&&(mi=null,!(Ou||ss===0))){if(o.code===4001){$A().then(c=>{Ou||ss===0||(c?(of=0,ty()):Xw())});return}Xw()}}}function Xw(){of++;const e=Math.min(mP*2**(of-1),pP);pu=setTimeout(()=>{pu=null,!Ou&&ss>0&&ty()},e)}function vP(){Ou=!0,pu&&(clearTimeout(pu),pu=null),mi&&(mi.close(1e3,"unmount"),mi=null)}function AN(e){const{onMessage:t,enabled:n=!0}=e??{},a=nn(),s=x.useRef(t);s.current=t,x.useEffect(()=>{hi=a},[a]),x.useEffect(()=>{if(!n)return;const o=c=>{var f;return(f=s.current)==null?void 0:f.call(s,c)};return qg.add(o),ss++,ss===1&&(Ou=!1,ty()),()=>{qg.delete(o),ss--,ss===0&&vP()}},[n])}const yP=x.createContext({aggregated:RN,agents:{},receivedAtMs:null,stale:!0});function bP({children:e}){const[t,n]=x.useState({aggregated:RN,agents:{},receivedAtMs:null}),[a,s]=x.useState(()=>Date.now());AN({onMessage:c=>{const f=nP.safeParse(c);f.success&&n({aggregated:hP(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),x.useEffect(()=>{const c=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(c)},[]);const o=x.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return u.jsx(yP.Provider,{value:o,children:e})}function zN(e){return Se.get(`/agents/${e}/config`)}function ON(e,t){return Se.patch(`/agents/${e}/config`,t)}function xP(e,t){return Se.post(`/agents/${e}/config/dry-run`,{payload:t})}function wP(e){return Se.get(`/agents/${e}/client-status`)}function SP({className:e,style:t,...n}){return u.jsx("div",{className:Te("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function kP({onClick:e,children:t}){return u.jsx("button",{type:"button",onClick:e,className:"bg-transparent border-0 p-0 cursor-pointer",style:{color:"var(--fg-3)",textDecoration:"none",font:"inherit"},onMouseEnter:n=>{n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--fg-3)"},children:t})}function jP(){return u.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function CP({children:e,mono:t}){return u.jsx("span",{className:Te("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const NP={neutral:{bg:"var(--bg-sunken)",fg:"var(--fg-2)",bd:"var(--border)"},accent:{bg:"var(--accent-bg)",fg:"var(--accent-dim)",bd:"color-mix(in oklch, var(--accent) 30%, transparent)"},warn:{bg:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},error:{bg:"color-mix(in oklch, var(--state-error) 14%, transparent)",fg:"var(--state-error)",bd:"color-mix(in oklch, var(--state-error) 30%, transparent)"},outline:{bg:"transparent",fg:"var(--fg-3)",bd:"var(--border)"},idle:{bg:"color-mix(in oklch, var(--state-idle) 14%, transparent)",fg:"var(--state-idle)",bd:"color-mix(in oklch, var(--state-idle) 30%, transparent)"},working:{bg:"color-mix(in oklch, var(--state-working) 14%, transparent)",fg:"var(--state-working)",bd:"color-mix(in oklch, var(--state-working) 30%, transparent)"},blocked:{bg:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},offline:{bg:"color-mix(in oklch, var(--state-offline) 14%, transparent)",fg:"var(--state-offline)",bd:"color-mix(in oklch, var(--state-offline) 30%, transparent)"}};function Br({tone:e="neutral",className:t,style:n,...a}){const s=NP[e],o={background:s.bg,color:s.fg,border:`var(--hairline) solid ${s.bd}`,...n};return u.jsx("span",{className:Te("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...o},...a})}function Hg({children:e,right:t,className:n,style:a,...s}){return u.jsxs("div",{className:Te("mono flex items-center justify-between uppercase text-eyebrow",n),style:{padding:"var(--sp-1_75) var(--sp-3_5)",color:"var(--fg-4)",background:"var(--bg-raised)",borderBottom:"var(--hairline) solid var(--border-faint)",...a},...s,children:[u.jsx("span",{children:e}),t]})}function ny({className:e,style:t,...n}){return u.jsx("span",{className:Te("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function gu({state:e,size:t=8,className:n}){const a={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?u.jsxs("span",{className:Te("shrink-0",n),style:a,role:"img","aria-label":"working",children:[u.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),u.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-working)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]}):e==="blocked"?u.jsx("span",{className:Te("shrink-0",n),style:{...a,border:"var(--hairline-bold) dashed var(--state-blocked)",borderRadius:"50%",animation:"dash-spin 4s linear infinite"},role:"img","aria-label":"blocked",children:u.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?u.jsx("span",{className:Te("shrink-0",n),style:{...a,background:"var(--state-error)",clipPath:"polygon(50% 0%, 100% 100%, 0% 100%)",borderRadius:1},role:"img","aria-label":"error"}):e==="idle"?u.jsx("span",{className:Te("shrink-0",n),style:{...a,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):u.jsx("span",{className:Te("shrink-0",n),style:{...a,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function EP(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function Du({state:e,className:t}){const n=e!==null&&EP(e)?e:"offline",a=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return u.jsxs("span",{className:Te("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:a},children:[u.jsx(gu,{state:n,size:7}),n]})}function Dd({label:e,value:t,accent:n}){return u.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",cursor:"default"},children:[u.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),u.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:"var(--sp-px)"},children:t})]})}function _P({runtimeLabel:e,computerLabel:t,visible:n=!0}){return n?u.jsx("div",{className:"sticky z-20 flex items-center justify-between gap-3 backdrop-blur",style:{top:0,padding:"var(--sp-1_75) var(--sp-5)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:u.jsxs("div",{className:"mono text-caption flex items-center gap-2",style:{color:"var(--fg-3)"},children:[u.jsxs("span",{children:["Runs on ",u.jsx("span",{style:{color:"var(--fg-2)"},children:e})]}),t&&u.jsxs(u.Fragment,{children:[u.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"@"}),u.jsx("span",{style:{color:"var(--fg-2)"},children:t})]})]})}):null}function TP(e){const{agent:t}=e,[n,a]=x.useState(!1),[s,o]=x.useState(!1),c=t.displayName||t.name||t.uuid;return u.jsxs("section",{id:"ad-danger",style:{background:"color-mix(in oklch, var(--state-error) 6%, var(--bg-raised))",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-panel)"},children:[u.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[u.jsx(ws,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),u.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),u.jsxs("div",{children:[t.status==="active"?u.jsx(Np,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:u.jsx(he,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):u.jsx(Np,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:u.jsx(he,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),u.jsx(Np,{title:"Delete agent",body:"Permanent. Configuration, bindings, tokens, and session history are all dropped.",action:u.jsxs(he,{variant:"destructive",size:"xs",onClick:()=>a(!0),disabled:e.deletePending,children:[u.jsx(Nu,{className:"h-3 w-3"}),"Delete"]})})]}),u.jsx(RP,{open:s,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),u.jsx(AP,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function Np(e){return u.jsxs("div",{className:"flex items-start justify-between gap-4 text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)"},children:[u.jsxs("div",{children:[u.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),u.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),u.jsx("div",{children:e.action})]})}function RP({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return u.jsx(ln,{open:e,onOpenChange:t,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsxs(on,{children:['Suspend "',n,'"?']})}),u.jsx("div",{className:"space-y-3",children:u.jsx("p",{className:"text-body",style:{color:"var(--fg-2)"},children:"Runtime binds and HTTP calls will be refused while the agent is suspended. Active sessions end on their next message. You can reactivate later from this same page."})}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),u.jsx(he,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function AP({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[o,c]=x.useState("");function f(m){m.preventDefault(),o===n&&a()}return u.jsx(ln,{open:e,onOpenChange:m=>{t(m),m||c("")},children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsxs(on,{children:['Delete "',n,'"?']})}),u.jsxs("form",{onSubmit:f,className:"space-y-4",children:[u.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",u.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),u.jsx(zt,{value:o,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),u.jsx(he,{type:"submit",variant:"destructive",disabled:o!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}var zP="Label",DN=x.forwardRef((e,t)=>u.jsx(Oa.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));DN.displayName=zP;var OP=DN;const dt=x.forwardRef(({className:e,...t},n)=>u.jsx(OP,{ref:n,className:Te("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));dt.displayName="Label";const tn=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("div",{ref:a,className:Te("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));tn.displayName="Panel";const Or=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("div",{ref:a,className:Te("flex items-center justify-between gap-3",e),style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Or.displayName="PanelHeader";const Dr=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("div",{ref:a,className:Te("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));Dr.displayName="PanelTitle";const Rn=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("div",{ref:a,className:Te(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));Rn.displayName="PanelBody";const DP={unchanged:{label:"",tone:""},added:{label:"new",tone:"bg-success-soft text-success"},modified:{label:"changed",tone:"bg-warn-soft text-warn"},deleted:{label:"will be removed on save",tone:"bg-error-soft text-error"}};function ry({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const c=DP[e],f=e==="deleted";return u.jsxs("div",{className:Te("flex items-center gap-2 rounded border px-3 py-2 text-body",f?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[u.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),c.label&&u.jsx("span",{className:Te("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!o&&(f?u.jsxs(he,{size:"sm",variant:"ghost",onClick:a,children:[u.jsx(a3,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):u.jsxs("div",{className:"flex gap-1 shrink-0",children:[u.jsxs(he,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[u.jsx(Cf,{className:"h-3.5 w-3.5"}),u.jsx("span",{className:"sr-only",children:"Edit"})]}),u.jsxs(he,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[u.jsx(Nu,{className:"h-3.5 w-3.5"}),u.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function MP(e){const[t,n]=x.useState(null),[a,s]=x.useState(()=>new Set),o=f=>s(m=>{const h=new Set(m);return h.has(f)?h.delete(f):h.add(f),h}),c=e.items.filter(f=>f.status!=="deleted").length;return u.jsxs(tn,{children:[u.jsxs(Or,{children:[u.jsxs(Dr,{children:["Environment variables (",c,")"]}),!e.disabled&&u.jsxs(he,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[u.jsx(qr,{className:"h-3 w-3"})," Add"]})]}),u.jsx(Rn,{className:"space-y-2",children:e.items.length===0?u.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(f=>{const m=f.value.sensitive,h=f.value.value===af,v=m&&!h&&!!f.value.value,p=a.has(f.key);let b;return m?v&&p?b=f.value.value:b="••••••":b=f.value.value||u.jsx("em",{children:"(empty)"}),u.jsxs(ry,{status:f.status,onEdit:()=>n({mode:"edit",key:f.key,initial:f.value}),onDelete:()=>e.onDelete(f.key),onUndo:()=>e.onUndoDelete(f.key),disabled:e.disabled,children:[u.jsx("span",{className:"font-mono font-medium",children:f.value.key}),u.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:b}),m&&u.jsx(uj,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),m&&u.jsx("button",{type:"button",onClick:()=>v&&o(f.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:v?p?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":p?"Hide value":"Reveal value",disabled:!v,style:{padding:0,opacity:v?1:.4},children:p?u.jsx(Tz,{className:"h-3.5 w-3.5"}):u.jsx(lj,{className:"h-3.5 w-3.5"})})]},f.key)})}),t&&u.jsx(IP,{open:!!t,onOpenChange:f=>!f&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:f=>{t.mode==="edit"?e.onUpdate(t.key,f):e.onAdd(f),n(null)}})]})}function IP({open:e,onOpenChange:t,initial:n,forbiddenKeys:a,onSubmit:s}){const[o,c]=x.useState((n==null?void 0:n.key)??""),[f,m]=x.useState(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),[h,v]=x.useState((n==null?void 0:n.sensitive)??!1),[p,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.key)??""),m(n!=null&&n.sensitive?"":(n==null?void 0:n.value)??""),v((n==null?void 0:n.sensitive)??!1),b(null))},[e,n]);function w(k){if(k.preventDefault(),!o.match(/^[A-Z][A-Z0-9_]*$/)){b("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(a.has(o)){b(`Another entry already uses key "${o}".`);return}let j=f;if(h&&(n!=null&&n.sensitive)&&!f&&(j=af),!h&&!n&&!f){b("Value is required for non-sensitive entries.");return}s({key:o,value:j,sensitive:h})}return u.jsx(ln,{open:e,onOpenChange:t,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:n?"Edit environment variable":"Add environment variable"})}),u.jsxs("form",{onSubmit:w,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"env-key",children:"Key"}),u.jsx(zt,{id:"env-key",value:o,onChange:k=>c(k.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&u.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"env-value",children:"Value"}),u.jsx(zt,{id:"env-value",type:h?"password":"text",autoComplete:"new-password",value:f,onChange:k=>m(k.target.value),placeholder:n!=null&&n.sensitive?"Leave empty to keep existing value":h?"new secret":"value",className:"font-mono"})]}),u.jsxs("label",{className:"flex items-center gap-2 text-body",children:[u.jsx("input",{type:"checkbox",checked:h,onChange:k=>v(k.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),p&&u.jsx("p",{className:"text-body text-destructive",children:p}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),u.jsx(he,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function LP(e){const[t,n]=x.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return u.jsxs(tn,{children:[u.jsxs(Or,{children:[u.jsxs(Dr,{children:["Git repositories (",a,")"]}),!e.disabled&&u.jsxs(he,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[u.jsx(qr,{className:"h-3 w-3"})," Add"]})]}),u.jsx(Rn,{className:"space-y-2",children:e.items.length===0?u.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(s=>{const o=s.value.localPath??sf(s.value.url);return u.jsxs(ry,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[u.jsx("span",{className:"font-mono text-caption",children:s.value.url}),s.value.ref&&u.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",s.value.ref]}),u.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",o||"./"]})]},s.key)})}),t&&u.jsx(UP,{open:!!t,onOpenChange:s=>!s&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenPaths:e.otherPaths(t.mode==="edit"?t.key:null),onSubmit:s=>{t.mode==="edit"?e.onUpdate(t.key,s):e.onAdd(s),n(null)}})]})}function UP({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[o,c]=x.useState((n==null?void 0:n.url)??""),[f,m]=x.useState((n==null?void 0:n.ref)??""),[h,v]=x.useState((n==null?void 0:n.localPath)??""),[p,b]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),v((n==null?void 0:n.localPath)??""),b(null))},[e,n]);function w(k){k.preventDefault();const j=o.trim();if(!j){b("URL is required.");return}const N=h.trim()||sf(j);if(N&&a.has(N)){b(`Another repo already occupies local path "${N}".`);return}const C={url:j,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(C)}return u.jsx(ln,{open:e,onOpenChange:t,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:n?"Edit Git repository":"Add Git repository"})}),u.jsxs("form",{onSubmit:w,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"git-url",children:"URL"}),u.jsx(zt,{id:"git-url",value:o,onChange:k=>c(k.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),u.jsx(zt,{id:"git-ref",value:f,onChange:k=>m(k.target.value),placeholder:"main",className:"font-mono"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"git-path",children:"Local path (optional)"}),u.jsx(zt,{id:"git-path",value:h,onChange:k=>v(k.target.value),placeholder:sf(o)||"repo-name",className:"font-mono"}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),p&&u.jsx("p",{className:"text-body text-destructive",children:p}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),u.jsx(he,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function PP({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:s="—",className:o,style:c,title:f}){const m=typeof e=="string"&&e.length>0,h=typeof t=="string"&&t.length>0;if(!m&&!h)return u.jsx("span",{className:Te("mono text-label",o),style:{color:"var(--fg-4)",...c},title:f,children:s});const v=f??(m&&h?`${t} (@${e})`:h?t:`@${e}`),p=a==="accent"?"var(--accent-dim)":void 0,b=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?u.jsxs("span",{className:Te("inline-flex flex-col leading-tight",o),style:{gap:1,...c},title:v??void 0,children:[h&&u.jsx("span",{className:"text-body",style:{color:p},children:t}),m&&u.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]}):u.jsxs("span",{className:Te("inline-flex items-baseline gap-1.5",o),style:c,title:v??void 0,children:[h&&u.jsx("span",{style:{color:p},children:t}),m&&u.jsxs("span",{className:"mono text-caption",style:{color:b},children:["@",e]})]})}function ay(){return Se.get(hn("/members"))}function BP(e,t){return Se.patch(hn(`/members/${encodeURIComponent(e)}`),t)}function $P(e){return Se.delete(hn(`/members/${encodeURIComponent(e)}`))}function MN(){const{data:e}=He({queryKey:["members","name-map"],queryFn:ay,staleTime:3e4});return x.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.id,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}function FP({agent:e,onSave:t}){const[n,a]=x.useState(!1),s=Uv(),o=MN(),c=e.metadata,f=c==null?void 0:c.tree,m=typeof(f==null?void 0:f.role)=="string"?f.role:null,h=Array.isArray(f==null?void 0:f.domains)?(f==null?void 0:f.domains).filter(b=>typeof b=="string"):[],v=e.managerId?o(e.managerId):null,p=e.delegateMention?s(e.delegateMention):null;return u.jsxs(tn,{children:[u.jsxs(Or,{children:[u.jsx(Dr,{children:"Profile"}),e.status==="active"&&u.jsxs(he,{size:"xs",variant:"outline",onClick:()=>a(!0),children:[u.jsx(Cf,{className:"h-3 w-3"})," Edit"]})]}),u.jsxs(Rn,{className:"text-body space-y-1",children:[u.jsxs("div",{children:[u.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&u.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),p&&u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),u.jsxs("span",{className:"text-muted-foreground",children:["delegate ",u.jsx(PP,{name:p.name,displayName:p.displayName})]})]})]}),u.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[u.jsxs("span",{children:["owner ",u.jsx("span",{className:"text-foreground",children:v??"—"})]}),m&&u.jsxs("span",{children:["role ",u.jsx("span",{className:"text-foreground",children:m})]}),u.jsxs("span",{children:["type ",u.jsx(Br,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),u.jsxs("span",{children:["visibility"," ",u.jsx(Br,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),h.length>0&&u.jsxs("span",{children:["domains"," ",u.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:h.map(b=>u.jsx(Br,{tone:"outline",children:b},b))})]})]})]}),u.jsx(qP,{agent:e,open:n,onOpenChange:a,onSave:t})]})}function qP({agent:e,open:t,onOpenChange:n,onSave:a}){var M;const{memberId:s,role:o}=kt(),[c,f]=x.useState(e.displayName),[m,h]=x.useState(e.delegateMention??""),[v,p]=x.useState(e.visibility),[b,w]=x.useState(!1),[k,j]=x.useState(null);x.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),p(e.visibility),j(null))},[t,e]);const N=e.type==="human",C=o==="admin"||e.managerId===s,A=He({queryKey:["agents-for-delegate"],queryFn:async()=>(await Ju({limit:100})).items.filter(z=>z.type==="personal_assistant"&&z.status==="active"),enabled:t&&N});async function O(P){P.preventDefault(),j(null);const z=c.trim();if(!z){j("Display name is required.");return}w(!0);try{const $={displayName:z,delegateMention:m||null};v!==e.visibility&&($.visibility=v),await a($),n(!1)}catch($){j($ instanceof Error?$.message:String($))}finally{w(!1)}}return u.jsx(ln,{open:t,onOpenChange:n,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:"Edit Identity"})}),u.jsxs("form",{onSubmit:O,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{children:"Agent name"}),u.jsx(zt,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"id-display",children:"Display Name"}),u.jsx(zt,{id:"id-display",value:c,onChange:P=>f(P.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"id-visibility",children:"Visibility"}),u.jsxs("select",{id:"id-visibility",value:v,onChange:P=>p(P.target.value),disabled:!C,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[u.jsx("option",{value:Kw.PRIVATE,children:"Private — only the manager"}),u.jsx("option",{value:Kw.ORGANIZATION,children:"Organization — all members"})]}),u.jsx("p",{className:"text-caption text-muted-foreground",children:C?"Private agents are only visible to their manager; organization agents appear in every member's list.":"Only the manager or an admin can change this agent's visibility."})]}),N&&u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"id-delegate",children:"Delegate Mention"}),u.jsxs("select",{id:"id-delegate",value:m,onChange:P=>h(P.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[u.jsx("option",{value:"",children:"None"}),(M=A.data)==null?void 0:M.map(P=>u.jsx("option",{value:P.uuid,children:P.displayName?`${P.displayName} (@${P.name??P.uuid})`:P.name?`@${P.name}`:P.uuid},P.uuid))]}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),k&&u.jsx("p",{className:"text-body text-destructive",children:k}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:b,children:"Cancel"}),u.jsx(he,{type:"submit",disabled:b,children:b?"Saving…":"Save"})]})]})]})})}function HP(e){return e==="working"?"accent":e==="error"?"error":"outline"}function ZP(e){const[t,n]=x.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return u.jsxs(tn,{children:[u.jsxs(Or,{children:[u.jsxs(Dr,{children:["MCP servers (",a,")"]}),!e.disabled&&u.jsxs(he,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[u.jsx(qr,{className:"h-3 w-3"})," Add"]})]}),u.jsx(Rn,{className:"space-y-2",children:e.items.length===0?u.jsx("p",{className:"text-body text-muted-foreground",children:"No MCP servers. Add one to extend the agent's tools."}):e.items.map(s=>{const o=s.status==="deleted"||!e.toolHealth?"unknown":e.toolHealth(s.value.name);return u.jsxs(ry,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[u.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:s.value.transport}),u.jsx("span",{className:"font-medium font-mono",children:s.value.name}),u.jsx(Br,{tone:HP(o),children:o}),u.jsx("span",{className:"text-caption text-muted-foreground truncate",children:VP(s.value)})]},s.key)})}),t&&u.jsx(QP,{open:!!t,onOpenChange:s=>!s&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenNames:e.otherNames(t.mode==="edit"?t.key:null),onSubmit:s=>{t.mode==="edit"?e.onUpdate(t.key,s):e.onAdd(s),n(null)}})]})}function VP(e){var t;if(e.transport==="stdio"){const n=(t=e.args)!=null&&t.length?` ${e.args.join(" ")}`:"";return`${e.command}${n}`}return e.url}function QP({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[o,c]=x.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=x.useState((n==null?void 0:n.name)??""),[h,v]=x.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[p,b]=x.useState((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),[w,k]=x.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[j,N]=x.useState(null);x.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),v((n==null?void 0:n.transport)==="stdio"?n.command:""),b((n==null?void 0:n.transport)==="stdio"&&n.args?n.args.join(" "):""),k(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),N(null))},[e,n]);function C(A){if(A.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){N("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){N(`Another MCP server is already named "${f}".`);return}let O;if(o==="stdio"){if(!h.trim()){N("stdio transport requires a command.");return}const M=p.trim().split(/\s+/).filter(P=>P.length>0);O={name:f,transport:"stdio",command:h.trim(),...M.length?{args:M}:{}}}else{const M=w.trim();try{new URL(M)}catch{N("URL is not valid.");return}O={name:f,transport:o,url:M}}s(O)}return u.jsx(ln,{open:e,onOpenChange:t,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:n?"Edit MCP server":"Add MCP server"})}),u.jsxs("form",{onSubmit:C,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"mcp-transport",children:"Transport"}),u.jsxs("select",{id:"mcp-transport",value:o,onChange:A=>c(A.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[u.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),u.jsx("option",{value:"http",children:"http"}),u.jsx("option",{value:"sse",children:"sse"})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"mcp-name",children:"Name"}),u.jsx(zt,{id:"mcp-name",value:f,onChange:A=>m(A.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"mcp-command",children:"Command"}),u.jsx(zt,{id:"mcp-command",value:h,onChange:A=>v(A.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"mcp-args",children:"Args (space-separated, optional)"}),u.jsx(zt,{id:"mcp-args",value:p,onChange:A=>b(A.target.value),placeholder:"--port 3000",className:"font-mono"})]})]}):u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"mcp-url",children:"URL"}),u.jsx(zt,{id:"mcp-url",value:w,onChange:A=>k(A.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),j&&u.jsx("p",{className:"text-body text-destructive",children:j}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),u.jsx(he,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const GP=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],KP=[{value:"gpt-5.5",label:"gpt-5.5",hint:"latest"},{value:"gpt-5.4",label:"gpt-5.4"},{value:"gpt-5.4-mini",label:"gpt-5.4-mini",hint:"fastest"},{value:"gpt-5.3-codex",label:"gpt-5.3-codex",hint:"coding-specialized"},{value:"gpt-5.2",label:"gpt-5.2"}],YP={"claude-code":GP,codex:KP},XP={"claude-code":"Choose which Claude model powers this agent. Aliases (opus / sonnet / haiku) follow the CLI's latest-in-family mapping and may shift across releases. Applies to new sessions immediately; active sessions switch on their next message. Unset falls back to the operator's local ~/.claude/settings.json model preference, then the CLI default.",codex:"Pick a Codex model. Slugs come from the Codex CLI bundled with @openai/codex-sdk; ChatGPT-account auth currently only accepts gpt-5.5, while API-key auth accepts the wider set. Applies to new sessions immediately; active sessions switch on their next message. Unset lets the codex CLI choose a model that matches the user's auth mode."},JP={value:"",label:"(unset — inherits local)"};function WP({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const c=e!==t,f=YP[o],m=x.useMemo(()=>{const h=[JP,...f];return e!==""&&!f.some(v=>v.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return u.jsxs(tn,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[u.jsxs(Or,{children:[u.jsxs(Dr,{children:["Model",c&&u.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})]}),c&&u.jsx(he,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),u.jsxs(Rn,{className:"space-y-2",children:[u.jsx(e9,{items:m,value:e,onChange:n,disabled:s}),u.jsx("p",{className:"text-caption text-muted-foreground",children:XP[o]})]})]})}function e9({items:e,value:t,onChange:n,disabled:a}){const[s,o]=x.useState(!1),[c,f]=x.useState(null),m=x.useRef(null),h=x.useRef(null),v=e.find(b=>b.value===t)??e[0],p=x.useCallback(()=>{const b=m.current;if(!b)return;const w=b.getBoundingClientRect();f({top:w.bottom+4,left:w.left,width:w.width})},[]);return x.useLayoutEffect(()=>{s&&p()},[s,p]),x.useEffect(()=>{if(!s)return;const b=j=>{var C,A;const N=j.target;(C=m.current)!=null&&C.contains(N)||(A=h.current)!=null&&A.contains(N)||o(!1)},w=j=>{var N;j.key==="Escape"&&(o(!1),(N=m.current)==null||N.focus())},k=()=>p();return document.addEventListener("pointerdown",b),document.addEventListener("keydown",w),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",w),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[s,p]),u.jsxs("div",{className:"max-w-md",children:[u.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(b=>!b),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":s,children:[u.jsx("span",{className:"truncate",style:{color:(v==null?void 0:v.value)===""?"var(--fg-3)":void 0},children:(v==null?void 0:v.label)??t}),u.jsx(Cv,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&Av.createPortal(u.jsx("div",{ref:h,className:"fixed z-50 overflow-hidden rounded-[var(--radius-input)] py-1",style:{top:c.top,left:c.left,width:c.width,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",boxShadow:"var(--shadow-md)",maxHeight:280,overflowY:"auto"},children:e.map(b=>{const w=b.value===t;return u.jsxs("button",{type:"button",onClick:()=>{n(b.value),o(!1)},className:"mono flex w-full items-center gap-2 cursor-pointer px-3 py-1.5 text-body text-left hover:bg-accent/40 transition-colors focus-visible:outline-none focus-visible:bg-accent/40",style:{background:w?"var(--bg-hover)":void 0,color:b.value===""?"var(--fg-3)":void 0},children:[u.jsx(Un,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:w?"visible":"hidden",color:"var(--state-idle)"}}),u.jsx("span",{className:"flex-1 truncate",children:b.label}),b.hint&&u.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:b.hint})]},b.value||"__unset")})}),document.body)]})}function t9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const n9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,r9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,a9={};function Jw(e,t){return(a9.jsx?r9:n9).test(e)}const i9=/[ \t\n\f\r]/g;function s9(e){return typeof e=="object"?e.type==="text"?Ww(e.value):!1:Ww(e)}function Ww(e){return e.replace(i9,"")===""}class tc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}tc.prototype.normal={};tc.prototype.property={};tc.prototype.space=void 0;function IN(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new tc(n,a,t)}function Zg(e){return e.toLowerCase()}class tr{constructor(t,n){this.attribute=n,this.property=t}}tr.prototype.attribute="";tr.prototype.booleanish=!1;tr.prototype.boolean=!1;tr.prototype.commaOrSpaceSeparated=!1;tr.prototype.commaSeparated=!1;tr.prototype.defined=!1;tr.prototype.mustUseProperty=!1;tr.prototype.number=!1;tr.prototype.overloadedBoolean=!1;tr.prototype.property="";tr.prototype.spaceSeparated=!1;tr.prototype.space=void 0;let l9=0;const Ve=Cs(),Xt=Cs(),Vg=Cs(),me=Cs(),Et=Cs(),kl=Cs(),ur=Cs();function Cs(){return 2**++l9}const Qg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Xt,commaOrSpaceSeparated:ur,commaSeparated:kl,number:me,overloadedBoolean:Vg,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),Ep=Object.keys(Qg);class iy extends tr{constructor(t,n,a,s){let o=-1;if(super(t,n),eS(this,"space",s),typeof a=="number")for(;++o<Ep.length;){const c=Ep[o];eS(this,Ep[o],(a&Qg[c])===Qg[c])}}}iy.prototype.defined=!0;function eS(e,t,n){n&&(e[t]=n)}function Wl(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new iy(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[Zg(a)]=a,n[Zg(o.attribute)]=a}return new tc(t,n,e.space)}const LN=Wl({properties:{ariaActiveDescendant:null,ariaAtomic:Xt,ariaAutoComplete:null,ariaBusy:Xt,ariaChecked:Xt,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:Xt,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:Xt,ariaFlowTo:Et,ariaGrabbed:Xt,ariaHasPopup:null,ariaHidden:Xt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:me,ariaLive:null,ariaModal:Xt,ariaMultiLine:Xt,ariaMultiSelectable:Xt,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:Xt,ariaReadOnly:Xt,ariaRelevant:null,ariaRequired:Xt,ariaRoleDescription:Et,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:Xt,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function UN(e,t){return t in e?e[t]:t}function PN(e,t){return UN(e,t.toLowerCase())}const o9=Wl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kl,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:Et,autoFocus:Ve,autoPlay:Ve,blocking:Et,capture:null,charSet:null,checked:Ve,cite:null,className:Et,cols:me,colSpan:null,content:null,contentEditable:Xt,controls:Ve,controlsList:Et,coords:me|kl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:Vg,draggable:Xt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:Et,height:me,hidden:Vg,high:me,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:Et,itemRef:Et,itemScope:Ve,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ve,optimum:me,pattern:null,ping:Et,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:Et,required:Ve,reversed:Ve,rows:me,rowSpan:me,sandbox:Et,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:Xt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Xt,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:Xt,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ve,disableRemotePlayback:Ve,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:PN}),u9=Wl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ur,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:Et,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kl,g2:kl,glyphName:kl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:ur,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ur,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ur,rev:ur,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ur,requiredFeatures:ur,requiredFonts:ur,requiredFormats:ur,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:ur,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ur,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ur,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:UN}),BN=Wl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),$N=Wl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:PN}),FN=Wl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),c9={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},d9=/[A-Z]/g,tS=/-[a-z]/g,f9=/^data[-\w.:]+$/i;function h9(e,t){const n=Zg(t);let a=t,s=tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&f9.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(tS,p9);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!tS.test(o)){let c=o.replace(d9,m9);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=iy}return new s(a,t)}function m9(e){return"-"+e.toLowerCase()}function p9(e){return e.charAt(1).toUpperCase()}const g9=IN([LN,o9,BN,$N,FN],"html"),sy=IN([LN,u9,BN,$N,FN],"svg");function v9(e){return e.join(" ").trim()}var hl={},_p,nS;function y9(){if(nS)return _p;nS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
358
+ `,h="/",v="*",p="",b="comment",w="declaration";function k(N,C){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];C=C||{};var A=1,O=1;function M(G){var X=G.match(t);X&&(A+=X.length);var q=G.lastIndexOf(m);O=~q?G.length-q:O+G.length}function P(){var G={line:A,column:O};return function(X){return X.position=new z(G),Z(),X}}function z(G){this.start=G,this.end={line:A,column:O},this.source=C.source}z.prototype.content=N;function $(G){var X=new Error(C.source+":"+A+":"+O+": "+G);if(X.reason=G,X.filename=C.source,X.line=A,X.column=O,X.source=N,!C.silent)throw X}function I(G){var X=G.exec(N);if(X){var q=X[0];return M(q),N=N.slice(q.length),X}}function Z(){I(n)}function D(G){var X;for(G=G||[];X=te();)X!==!1&&G.push(X);return G}function te(){var G=P();if(!(h!=N.charAt(0)||v!=N.charAt(1))){for(var X=2;p!=N.charAt(X)&&(v!=N.charAt(X)||h!=N.charAt(X+1));)++X;if(X+=2,p===N.charAt(X-1))return $("End of comment missing");var q=N.slice(2,X-2);return O+=2,M(q),N=N.slice(X),O+=2,G({type:b,comment:q})}}function ae(){var G=P(),X=I(a);if(X){if(te(),!I(s))return $("property missing ':'");var q=I(o),ee=G({type:w,property:j(X[0].replace(e,p)),value:q?j(q[0].replace(e,p)):p});return I(c),ee}}function xe(){var G=[];D(G);for(var X;X=ae();)X!==!1&&(G.push(X),D(G));return G}return Z(),xe()}function j(N){return N?N.replace(f,p):p}return _p=k,_p}var rS;function b9(){if(rS)return hl;rS=1;var e=hl&&hl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(hl,"__esModule",{value:!0}),hl.default=n;const t=e(y9());function n(a,s){let o=null;if(!a||typeof a!="string")return o;const c=(0,t.default)(a),f=typeof s=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:v}=m;f?s(h,v,m):v&&(o=o||{},o[h]=v)}),o}return hl}var lu={},aS;function x9(){if(aS)return lu;aS=1,Object.defineProperty(lu,"__esModule",{value:!0}),lu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,v){return v.toUpperCase()},f=function(h,v){return"".concat(v,"-")},m=function(h,v){return v===void 0&&(v={}),o(h)?h:(h=h.toLowerCase(),v.reactCompat?h=h.replace(s,f):h=h.replace(a,f),h.replace(t,c))};return lu.camelCase=m,lu}var ou,iS;function w9(){if(iS)return ou;iS=1;var e=ou&&ou.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(b9()),n=x9();function a(s,o){var c={};return!s||typeof s!="string"||(0,t.default)(s,function(f,m){f&&m&&(c[(0,n.camelCase)(f,o)]=m)}),c}return a.default=a,ou=a,ou}var S9=w9();const k9=vf(S9),qN=HN("end"),ly=HN("start");function HN(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function j9(e){const t=ly(e),n=qN(e);if(t&&n)return{start:t,end:n}}function vu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?sS(e.position):"start"in e||"end"in e?sS(e):"line"in e||"column"in e?Gg(e):""}function Gg(e){return lS(e&&e.line)+":"+lS(e&&e.column)}function sS(e){return Gg(e&&e.start)+"-"+Gg(e&&e.end)}function lS(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(c=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=f?f.line:void 0,this.name=vu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const oy={}.hasOwnProperty,C9=new Map,N9=/[A-Z]/g,E9=new Set(["table","tbody","thead","tfoot","tr"]),_9=new Set(["td","th"]),ZN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function T9(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=L9(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=I9(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?sy:g9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=VN(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function VN(e,t,n){if(t.type==="element")return R9(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return A9(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return O9(e,t,n);if(t.type==="mdxjsEsm")return z9(e,t);if(t.type==="root")return D9(e,t,n);if(t.type==="text")return M9(e,t)}function R9(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=sy,e.schema=s),e.ancestors.push(t);const o=GN(e,t.tagName,!1),c=U9(e,t);let f=cy(e,t);return E9.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!s9(m):!0})),QN(e,c,o,t),uy(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function A9(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}Mu(e,t.position)}function z9(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Mu(e,t.position)}function O9(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=sy,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:GN(e,t.name,!0),c=P9(e,t),f=cy(e,t);return QN(e,c,o,t),uy(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function D9(e,t,n){const a={};return uy(a,cy(e,t)),e.create(t,e.Fragment,a,n)}function M9(e,t){return t.value}function QN(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function uy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function I9(e,t,n){return a;function a(s,o,c,f){const h=Array.isArray(c.children)?n:t;return f?h(o,c,f):h(o,c)}}function L9(e,t){return n;function n(a,s,o,c){const f=Array.isArray(o.children),m=ly(a);return t(s,o,c,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function U9(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&oy.call(t.properties,s)){const o=B9(e,s,t.properties[s]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&_9.has(t.tagName)?a=f:n[c]=f}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function P9(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const c=o.expression;c.type;const f=c.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else Mu(e,t.position);else{const s=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else Mu(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function cy(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:C9;for(;++a<t.children.length;){const o=t.children[a];let c;if(e.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const h=s.get(m)||0;c=m+"-"+h,s.set(m,h+1)}}const f=VN(e,o,c);f!==void 0&&n.push(f)}return n}function B9(e,t,n){const a=h9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?t9(n):v9(n)),a.property==="style"){let s=typeof n=="object"?n:$9(e,String(n));return e.stylePropertyNameCase==="css"&&(s=F9(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?c9[a.property]||a.property:a.attribute,n]}}function $9(e,t){try{return k9(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=ZN+"#cannot-parse-style-attribute",s}}function GN(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,c;for(;++o<s.length;){const f=Jw(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};c=c?{type:"MemberExpression",object:c,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}a=c}else a=Jw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return oy.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);Mu(e)}function Mu(e,t){const n=new An("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ZN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function F9(e){const t={};let n;for(n in e)oy.call(e,n)&&(t[q9(n)]=e[n]);return t}function q9(e){let t=e.replace(N9,H9);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function H9(e){return"-"+e.toLowerCase()}const Tp={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Z9={};function dy(e,t){const n=Z9,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return KN(e,a,s)}function KN(e,t,n){if(V9(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return oS(e.children,t,n)}return Array.isArray(e)?oS(e,t,n):""}function oS(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=KN(e[s],t,n);return a.join("")}function V9(e){return!!(e&&typeof e=="object")}const uS=document.createElement("i");function fy(e){const t="&"+e+";";uS.innerHTML=t;const n=uS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function hr(e,t,n,a){const s=e.length;let o=0,c;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)c=Array.from(a),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<a.length;)c=a.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function Tr(e,t){return e.length>0?(hr(e,e.length,0,t),e):t}const cS={}.hasOwnProperty;function YN(e){const t={};let n=-1;for(;++n<e.length;)Q9(t,e[n]);return t}function Q9(e,t){let n;for(n in t){const s=(cS.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){cS.call(s,c)||(s[c]=[]);const f=o[c];G9(s[c],Array.isArray(f)?f:f?[f]:[])}}}function G9(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);hr(e,0,0,a)}function XN(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Fr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ln=Mi(/[A-Za-z]/),Tn=Mi(/[\dA-Za-z]/),K9=Mi(/[#-'*+\--9=?A-Z^-~]/);function uf(e){return e!==null&&(e<32||e===127)}const Kg=Mi(/\d/),Y9=Mi(/[\dA-Fa-f]/),X9=Mi(/[!-/:-@[-`{-~]/);function Ie(e){return e!==null&&e<-2}function Nt(e){return e!==null&&(e<0||e===32)}function et(e){return e===-2||e===-1||e===32}const Lf=Mi(new RegExp("\\p{P}|\\p{S}","u")),bs=Mi(/\s/);function Mi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function eo(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&Tn(e.charCodeAt(n+1))&&Tn(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(c=String.fromCharCode(o,f),s=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(a,n),encodeURIComponent(c)),a=n+s+1,c=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function ot(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return et(m)?(e.enter(n),f(m)):t(m)}function f(m){return et(m)&&o++<s?(e.consume(m),f):(e.exit(n),t(m))}}const J9={tokenize:W9};function W9(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ot(e,t,"linePrefix")}function s(f){return e.enter("paragraph"),o(f)}function o(f){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,c(f)}function c(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Ie(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const eB={tokenize:tB},dS={tokenize:nB};function tB(e){const t=this,n=[];let a=0,s,o,c;return f;function f(O){if(a<n.length){const M=n[a];return t.containerState=M[1],e.attempt(M[0].continuation,m,h)(O)}return h(O)}function m(O){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&A();const M=t.events.length;let P=M,z;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){z=t.events[P][1].end;break}C(a);let $=M;for(;$<t.events.length;)t.events[$][1].end={...z},$++;return hr(t.events,P+1,0,t.events.slice(M)),t.events.length=$,h(O)}return f(O)}function h(O){if(a===n.length){if(!s)return b(O);if(s.currentConstruct&&s.currentConstruct.concrete)return k(O);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(dS,v,p)(O)}function v(O){return s&&A(),C(a),b(O)}function p(O){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,k(O)}function b(O){return t.containerState={},e.attempt(dS,w,k)(O)}function w(O){return a++,n.push([t.currentConstruct,t.containerState]),b(O)}function k(O){if(O===null){s&&A(),C(0),e.consume(O);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),j(O)}function j(O){if(O===null){N(e.exit("chunkFlow"),!0),C(0),e.consume(O);return}return Ie(O)?(e.consume(O),N(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(O),j)}function N(O,M){const P=t.sliceStream(O);if(M&&P.push(null),O.previous=o,o&&(o.next=O),o=O,s.defineSkip(O.start),s.write(P),t.parser.lazy[O.start.line]){let z=s.events.length;for(;z--;)if(s.events[z][1].start.offset<c&&(!s.events[z][1].end||s.events[z][1].end.offset>c))return;const $=t.events.length;let I=$,Z,D;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(Z){D=t.events[I][1].end;break}Z=!0}for(C(a),z=$;z<t.events.length;)t.events[z][1].end={...D},z++;hr(t.events,I+1,0,t.events.slice($)),t.events.length=z}}function C(O){let M=n.length;for(;M-- >O;){const P=n[M];t.containerState=P[1],P[0].exit.call(t,e)}n.length=O}function A(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function nB(e,t,n){return ot(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ql(e){if(e===null||Nt(e)||bs(e))return 1;if(Lf(e))return 2}function Uf(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!a.includes(o)&&(t=o(t,n),a.push(o))}return t}const Yg={name:"attention",resolveAll:rB,tokenize:aB};function rB(e,t){let n=-1,a,s,o,c,f,m,h,v;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[a][1].end},b={...e[n][1].start};fS(p,-m),fS(b,m),c={type:m>1?"strongSequence":"emphasisSequence",start:p,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...c.start},end:{...f.end}},e[a][1].end={...c.start},e[n][1].start={...f.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=Tr(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=Tr(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=Tr(h,Uf(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=Tr(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(v=2,h=Tr(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):v=0,hr(e,a-1,n-a+3,h),n=a+h.length-v-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function aB(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=ql(a);let o;return c;function c(m){return o=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===o)return e.consume(m),f;const h=e.exit("attentionSequence"),v=ql(m),p=!v||v===2&&s||n.includes(m),b=!s||s===2&&v||n.includes(a);return h._open=!!(o===42?p:p&&(s||!b)),h._close=!!(o===42?b:b&&(v||!p)),t(m)}}function fS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const iB={name:"autolink",tokenize:sB};function sB(e,t,n){let a=0;return s;function s(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(w){return Ln(w)?(e.consume(w),c):w===64?n(w):h(w)}function c(w){return w===43||w===45||w===46||Tn(w)?(a=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),a=0,m):(w===43||w===45||w===46||Tn(w))&&a++<32?(e.consume(w),f):(a=0,h(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||uf(w)?n(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),v):K9(w)?(e.consume(w),h):n(w)}function v(w){return Tn(w)?p(w):n(w)}function p(w){return w===46?(e.consume(w),a=0,v):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):b(w)}function b(w){if((w===45||Tn(w))&&a++<63){const k=w===45?b:p;return e.consume(w),k}return n(w)}}const nc={partial:!0,tokenize:lB};function lB(e,t,n){return a;function a(o){return et(o)?ot(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Ie(o)?t(o):n(o)}}const JN={continuation:{tokenize:uB},exit:cB,name:"blockQuote",tokenize:oB};function oB(e,t,n){const a=this;return s;function s(c){if(c===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return et(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function uB(e,t,n){const a=this;return s;function s(c){return et(c)?ot(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(JN,t,n)(c)}}function cB(e){e.exit("blockQuote")}const WN={name:"characterEscape",tokenize:dB};function dB(e,t,n){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return X9(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const eE={name:"characterReference",tokenize:fB};function fB(e,t,n){const a=this;let s=0,o,c;return f;function f(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),m}function m(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=Tn,v(p))}function h(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=Y9,v):(e.enter("characterReferenceValue"),o=7,c=Kg,v(p))}function v(p){if(p===59&&s){const b=e.exit("characterReferenceValue");return c===Tn&&!fy(a.sliceSerialize(b))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(p)&&s++<o?(e.consume(p),v):n(p)}}const hS={partial:!0,tokenize:mB},mS={concrete:!0,name:"codeFenced",tokenize:hB};function hB(e,t,n){const a=this,s={partial:!0,tokenize:P};let o=0,c=0,f;return m;function m(z){return h(z)}function h(z){const $=a.events[a.events.length-1];return o=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),v(z)}function v(z){return z===f?(c++,e.consume(z),v):c<3?n(z):(e.exit("codeFencedFenceSequence"),et(z)?ot(e,p,"whitespace")(z):p(z))}function p(z){return z===null||Ie(z)?(e.exit("codeFencedFence"),a.interrupt?t(z):e.check(hS,j,M)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||Ie(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(z)):et(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ot(e,w,"whitespace")(z)):z===96&&z===f?n(z):(e.consume(z),b)}function w(z){return z===null||Ie(z)?p(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(z))}function k(z){return z===null||Ie(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(z)):z===96&&z===f?n(z):(e.consume(z),k)}function j(z){return e.attempt(s,M,N)(z)}function N(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),C}function C(z){return o>0&&et(z)?ot(e,A,"linePrefix",o+1)(z):A(z)}function A(z){return z===null||Ie(z)?e.check(hS,j,M)(z):(e.enter("codeFlowValue"),O(z))}function O(z){return z===null||Ie(z)?(e.exit("codeFlowValue"),A(z)):(e.consume(z),O)}function M(z){return e.exit("codeFenced"),t(z)}function P(z,$,I){let Z=0;return D;function D(X){return z.enter("lineEnding"),z.consume(X),z.exit("lineEnding"),te}function te(X){return z.enter("codeFencedFence"),et(X)?ot(z,ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):ae(X)}function ae(X){return X===f?(z.enter("codeFencedFenceSequence"),xe(X)):I(X)}function xe(X){return X===f?(Z++,z.consume(X),xe):Z>=c?(z.exit("codeFencedFenceSequence"),et(X)?ot(z,G,"whitespace")(X):G(X)):I(X)}function G(X){return X===null||Ie(X)?(z.exit("codeFencedFence"),$(X)):I(X)}}}function mB(e,t,n){const a=this;return s;function s(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}const Rp={name:"codeIndented",tokenize:gB},pB={partial:!0,tokenize:vB};function gB(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),ot(e,o,"linePrefix",5)(h)}function o(h){const v=a.events[a.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):Ie(h)?e.attempt(pB,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Ie(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function vB(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):Ie(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):ot(e,o,"linePrefix",5)(c)}function o(c){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):Ie(c)?s(c):n(c)}}const yB={name:"codeText",previous:xB,resolve:bB,tokenize:wB};function bB(e){let t=e.length-4,n=3,a,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function xB(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function wB(e,t,n){let a=0,s,o;return c;function c(p){return e.enter("codeText"),e.enter("codeTextSequence"),f(p)}function f(p){return p===96?(e.consume(p),a++,f):(e.exit("codeTextSequence"),m(p))}function m(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),m):p===96?(o=e.enter("codeTextSequence"),s=0,v(p)):Ie(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(p))}function h(p){return p===null||p===32||p===96||Ie(p)?(e.exit("codeTextData"),m(p)):(e.consume(p),h)}function v(p){return p===96?(e.consume(p),s++,v):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",h(p))}}class SB{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&uu(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),uu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),uu(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);uu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);uu(this.left,n.reverse())}}}function uu(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function tE(e){const t={};let n=-1,a,s,o,c,f,m,h;const v=new SB(e);for(;++n<v.length;){for(;n in t;)n=t[n];if(a=v.get(n),n&&a[1].type==="chunkFlow"&&v.get(n-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,kB(v,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(c=v.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(v.get(s)[1].type="lineEndingBlank"),c[1].type="lineEnding",s=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;s&&(a[1].end={...v.get(s)[1].start},f=v.slice(s,n),f.unshift(a),v.splice(s,n-s+1,f))}}return hr(e,0,Number.POSITIVE_INFINITY,v.slice(0)),!h}function kB(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const o=[];let c=n._tokenizer;c||(c=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const f=c.events,m=[],h={};let v,p,b=-1,w=n,k=0,j=0;const N=[j];for(;w;){for(;e.get(++s)[1]!==w;);o.push(s),w._tokenizer||(v=a.sliceStream(w),w.next||v.push(null),p&&c.defineSkip(w.start),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(v),w._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),p=w,w=w.next}for(w=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(j=b+1,N.push(j),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(c.events=[],w?(w._tokenizer=void 0,w.previous=void 0):N.pop(),b=N.length;b--;){const C=f.slice(N[b],N[b+1]),A=o.pop();m.push([A,A+C.length-1]),e.splice(A,2,C)}for(m.reverse(),b=-1;++b<m.length;)h[k+m[b][0]]=k+m[b][1],k+=m[b][1]-m[b][0]-1;return h}const jB={resolve:NB,tokenize:EB},CB={partial:!0,tokenize:_B};function NB(e){return tE(e),e}function EB(e,t){let n;return a;function a(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(f)}function s(f){return f===null?o(f):Ie(f)?e.check(CB,c,o)(f):(e.consume(f),s)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function c(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function _B(e,t,n){const a=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),ot(e,o,"linePrefix")}function o(c){if(c===null||Ie(c))return n(c);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(c):e.interrupt(a.parser.constructs.flow,n,t)(c)}}function nE(e,t,n,a,s,o,c,f,m){const h=m||Number.POSITIVE_INFINITY;let v=0;return p;function p(C){return C===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(C),e.exit(o),b):C===null||C===32||C===41||uf(C)?n(C):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(C))}function b(C){return C===62?(e.enter(o),e.consume(C),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(C))}function w(C){return C===62?(e.exit("chunkString"),e.exit(f),b(C)):C===null||C===60||Ie(C)?n(C):(e.consume(C),C===92?k:w)}function k(C){return C===60||C===62||C===92?(e.consume(C),w):w(C)}function j(C){return!v&&(C===null||C===41||Nt(C))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),t(C)):v<h&&C===40?(e.consume(C),v++,j):C===41?(e.consume(C),v--,j):C===null||C===32||C===40||uf(C)?n(C):(e.consume(C),C===92?N:j)}function N(C){return C===40||C===41||C===92?(e.consume(C),j):j(C)}}function rE(e,t,n,a,s,o){const c=this;let f=0,m;return h;function h(w){return e.enter(a),e.enter(s),e.consume(w),e.exit(s),e.enter(o),v}function v(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(w):w===93?(e.exit(o),e.enter(s),e.consume(w),e.exit(s),e.exit(a),t):Ie(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===null||w===91||w===93||Ie(w)||f++>999?(e.exit("chunkString"),v(w)):(e.consume(w),m||(m=!et(w)),w===92?b:p)}function b(w){return w===91||w===92||w===93?(e.consume(w),f++,p):p(w)}}function aE(e,t,n,a,s,o){let c;return f;function f(b){return b===34||b===39||b===40?(e.enter(a),e.enter(s),e.consume(b),e.exit(s),c=b===40?41:b,m):n(b)}function m(b){return b===c?(e.enter(s),e.consume(b),e.exit(s),e.exit(a),t):(e.enter(o),h(b))}function h(b){return b===c?(e.exit(o),m(c)):b===null?n(b):Ie(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),ot(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(b))}function v(b){return b===c||b===null||Ie(b)?(e.exit("chunkString"),h(b)):(e.consume(b),b===92?p:v)}function p(b){return b===c||b===92?(e.consume(b),v):v(b)}}function yu(e,t){let n;return a;function a(s){return Ie(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):et(s)?ot(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const TB={name:"definition",tokenize:AB},RB={partial:!0,tokenize:zB};function AB(e,t,n){const a=this;let s;return o;function o(w){return e.enter("definition"),c(w)}function c(w){return rE.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return s=Fr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):n(w)}function m(w){return Nt(w)?yu(e,h)(w):h(w)}function h(w){return nE(e,v,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function v(w){return e.attempt(RB,p,p)(w)}function p(w){return et(w)?ot(e,b,"whitespace")(w):b(w)}function b(w){return w===null||Ie(w)?(e.exit("definition"),a.parser.defined.push(s),t(w)):n(w)}}function zB(e,t,n){return a;function a(f){return Nt(f)?yu(e,s)(f):n(f)}function s(f){return aE(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return et(f)?ot(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Ie(f)?t(f):n(f)}}const OB={name:"hardBreakEscape",tokenize:DB};function DB(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Ie(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const MB={name:"headingAtx",resolve:IB,tokenize:LB};function IB(e,t){let n=e.length-2,a=3,s,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},hr(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function LB(e,t,n){let a=0;return s;function s(v){return e.enter("atxHeading"),o(v)}function o(v){return e.enter("atxHeadingSequence"),c(v)}function c(v){return v===35&&a++<6?(e.consume(v),c):v===null||Nt(v)?(e.exit("atxHeadingSequence"),f(v)):n(v)}function f(v){return v===35?(e.enter("atxHeadingSequence"),m(v)):v===null||Ie(v)?(e.exit("atxHeading"),t(v)):et(v)?ot(e,f,"whitespace")(v):(e.enter("atxHeadingText"),h(v))}function m(v){return v===35?(e.consume(v),m):(e.exit("atxHeadingSequence"),f(v))}function h(v){return v===null||v===35||Nt(v)?(e.exit("atxHeadingText"),f(v)):(e.consume(v),h)}}const UB=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],pS=["pre","script","style","textarea"],PB={concrete:!0,name:"htmlFlow",resolveTo:FB,tokenize:qB},BB={partial:!0,tokenize:ZB},$B={partial:!0,tokenize:HB};function FB(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function qB(e,t,n){const a=this;let s,o,c,f,m;return h;function h(T){return v(T)}function v(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),p}function p(T){return T===33?(e.consume(T),b):T===47?(e.consume(T),o=!0,j):T===63?(e.consume(T),s=3,a.interrupt?t:R):Ln(T)?(e.consume(T),c=String.fromCharCode(T),N):n(T)}function b(T){return T===45?(e.consume(T),s=2,w):T===91?(e.consume(T),s=5,f=0,k):Ln(T)?(e.consume(T),s=4,a.interrupt?t:R):n(T)}function w(T){return T===45?(e.consume(T),a.interrupt?t:R):n(T)}function k(T){const V="CDATA[";return T===V.charCodeAt(f++)?(e.consume(T),f===V.length?a.interrupt?t:ae:k):n(T)}function j(T){return Ln(T)?(e.consume(T),c=String.fromCharCode(T),N):n(T)}function N(T){if(T===null||T===47||T===62||Nt(T)){const V=T===47,W=c.toLowerCase();return!V&&!o&&pS.includes(W)?(s=1,a.interrupt?t(T):ae(T)):UB.includes(c.toLowerCase())?(s=6,V?(e.consume(T),C):a.interrupt?t(T):ae(T)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(T):o?A(T):O(T))}return T===45||Tn(T)?(e.consume(T),c+=String.fromCharCode(T),N):n(T)}function C(T){return T===62?(e.consume(T),a.interrupt?t:ae):n(T)}function A(T){return et(T)?(e.consume(T),A):D(T)}function O(T){return T===47?(e.consume(T),D):T===58||T===95||Ln(T)?(e.consume(T),M):et(T)?(e.consume(T),O):D(T)}function M(T){return T===45||T===46||T===58||T===95||Tn(T)?(e.consume(T),M):P(T)}function P(T){return T===61?(e.consume(T),z):et(T)?(e.consume(T),P):O(T)}function z(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),m=T,$):et(T)?(e.consume(T),z):I(T)}function $(T){return T===m?(e.consume(T),m=null,Z):T===null||Ie(T)?n(T):(e.consume(T),$)}function I(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Nt(T)?P(T):(e.consume(T),I)}function Z(T){return T===47||T===62||et(T)?O(T):n(T)}function D(T){return T===62?(e.consume(T),te):n(T)}function te(T){return T===null||Ie(T)?ae(T):et(T)?(e.consume(T),te):n(T)}function ae(T){return T===45&&s===2?(e.consume(T),q):T===60&&s===1?(e.consume(T),ee):T===62&&s===4?(e.consume(T),U):T===63&&s===3?(e.consume(T),R):T===93&&s===5?(e.consume(T),Ae):Ie(T)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(BB,B,xe)(T)):T===null||Ie(T)?(e.exit("htmlFlowData"),xe(T)):(e.consume(T),ae)}function xe(T){return e.check($B,G,B)(T)}function G(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),X}function X(T){return T===null||Ie(T)?xe(T):(e.enter("htmlFlowData"),ae(T))}function q(T){return T===45?(e.consume(T),R):ae(T)}function ee(T){return T===47?(e.consume(T),c="",ye):ae(T)}function ye(T){if(T===62){const V=c.toLowerCase();return pS.includes(V)?(e.consume(T),U):ae(T)}return Ln(T)&&c.length<8?(e.consume(T),c+=String.fromCharCode(T),ye):ae(T)}function Ae(T){return T===93?(e.consume(T),R):ae(T)}function R(T){return T===62?(e.consume(T),U):T===45&&s===2?(e.consume(T),R):ae(T)}function U(T){return T===null||Ie(T)?(e.exit("htmlFlowData"),B(T)):(e.consume(T),U)}function B(T){return e.exit("htmlFlow"),t(T)}}function HB(e,t,n){const a=this;return s;function s(c){return Ie(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return a.parser.lazy[a.now().line]?n(c):t(c)}}function ZB(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(nc,t,n)}}const VB={name:"htmlText",tokenize:QB};function QB(e,t,n){const a=this;let s,o,c;return f;function f(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),m}function m(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),P):R===63?(e.consume(R),O):Ln(R)?(e.consume(R),I):n(R)}function h(R){return R===45?(e.consume(R),v):R===91?(e.consume(R),o=0,k):Ln(R)?(e.consume(R),A):n(R)}function v(R){return R===45?(e.consume(R),w):n(R)}function p(R){return R===null?n(R):R===45?(e.consume(R),b):Ie(R)?(c=p,ee(R)):(e.consume(R),p)}function b(R){return R===45?(e.consume(R),w):p(R)}function w(R){return R===62?q(R):R===45?b(R):p(R)}function k(R){const U="CDATA[";return R===U.charCodeAt(o++)?(e.consume(R),o===U.length?j:k):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),N):Ie(R)?(c=j,ee(R)):(e.consume(R),j)}function N(R){return R===93?(e.consume(R),C):j(R)}function C(R){return R===62?q(R):R===93?(e.consume(R),C):j(R)}function A(R){return R===null||R===62?q(R):Ie(R)?(c=A,ee(R)):(e.consume(R),A)}function O(R){return R===null?n(R):R===63?(e.consume(R),M):Ie(R)?(c=O,ee(R)):(e.consume(R),O)}function M(R){return R===62?q(R):O(R)}function P(R){return Ln(R)?(e.consume(R),z):n(R)}function z(R){return R===45||Tn(R)?(e.consume(R),z):$(R)}function $(R){return Ie(R)?(c=$,ee(R)):et(R)?(e.consume(R),$):q(R)}function I(R){return R===45||Tn(R)?(e.consume(R),I):R===47||R===62||Nt(R)?Z(R):n(R)}function Z(R){return R===47?(e.consume(R),q):R===58||R===95||Ln(R)?(e.consume(R),D):Ie(R)?(c=Z,ee(R)):et(R)?(e.consume(R),Z):q(R)}function D(R){return R===45||R===46||R===58||R===95||Tn(R)?(e.consume(R),D):te(R)}function te(R){return R===61?(e.consume(R),ae):Ie(R)?(c=te,ee(R)):et(R)?(e.consume(R),te):Z(R)}function ae(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),s=R,xe):Ie(R)?(c=ae,ee(R)):et(R)?(e.consume(R),ae):(e.consume(R),G)}function xe(R){return R===s?(e.consume(R),s=void 0,X):R===null?n(R):Ie(R)?(c=xe,ee(R)):(e.consume(R),xe)}function G(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Nt(R)?Z(R):(e.consume(R),G)}function X(R){return R===47||R===62||Nt(R)?Z(R):n(R)}function q(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function ee(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),ye}function ye(R){return et(R)?ot(e,Ae,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):Ae(R)}function Ae(R){return e.enter("htmlTextData"),c(R)}}const hy={name:"labelEnd",resolveAll:XB,resolveTo:JB,tokenize:WB},GB={tokenize:e8},KB={tokenize:t8},YB={tokenize:n8};function XB(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==n.length&&hr(e,0,e.length,n),e}function JB(e,t){let n=e.length,a=0,s,o,c,f;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(c=n);const m={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},v={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=Tr(f,e.slice(o+1,o+a+3)),f=Tr(f,[["enter",v,t]]),f=Tr(f,Uf(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),f=Tr(f,[["exit",v,t],e[c-2],e[c-1],["exit",h,t]]),f=Tr(f,e.slice(c+1)),f=Tr(f,[["exit",m,t]]),hr(e,o,e.length,f),e}function WB(e,t,n){const a=this;let s=a.events.length,o,c;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){o=a.events[s][1];break}return f;function f(b){return o?o._inactive?p(b):(c=a.parser.defined.includes(Fr(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),m):n(b)}function m(b){return b===40?e.attempt(GB,v,c?v:p)(b):b===91?e.attempt(KB,v,c?h:p)(b):c?v(b):p(b)}function h(b){return e.attempt(YB,v,p)(b)}function v(b){return t(b)}function p(b){return o._balanced=!0,n(b)}}function e8(e,t,n){return a;function a(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return Nt(p)?yu(e,o)(p):o(p)}function o(p){return p===41?v(p):nE(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function c(p){return Nt(p)?yu(e,m)(p):v(p)}function f(p){return n(p)}function m(p){return p===34||p===39||p===40?aE(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):v(p)}function h(p){return Nt(p)?yu(e,v)(p):v(p)}function v(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function t8(e,t,n){const a=this;return s;function s(f){return rE.call(a,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(Fr(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function n8(e,t,n){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const r8={name:"labelStartImage",resolveAll:hy.resolveAll,tokenize:a8};function a8(e,t,n){const a=this;return s;function s(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),c):n(f)}function c(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):t(f)}}const i8={name:"labelStartLink",resolveAll:hy.resolveAll,tokenize:s8};function s8(e,t,n){const a=this;return s;function s(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(c):t(c)}}const Ap={name:"lineEnding",tokenize:l8};function l8(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),ot(e,t,"linePrefix")}}const Gd={name:"thematicBreak",tokenize:o8};function o8(e,t,n){let a=0,s;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return s=h,f(h)}function f(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||Ie(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),et(h)?ot(e,f,"whitespace")(h):f(h))}}const Gn={continuation:{tokenize:f8},exit:m8,name:"list",tokenize:d8},u8={partial:!0,tokenize:p8},c8={partial:!0,tokenize:h8};function d8(e,t,n){const a=this,s=a.events[a.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,c=0;return f;function f(w){const k=a.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||w===a.containerState.marker:Kg(w)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Gd,n,h)(w):h(w);if(!a.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return n(w)}function m(w){return Kg(w)&&++c<10?(e.consume(w),m):(!a.interrupt||c<2)&&(a.containerState.marker?w===a.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):n(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||w,e.check(nc,a.interrupt?n:v,e.attempt(u8,b,p))}function v(w){return a.containerState.initialBlankLine=!0,o++,b(w)}function p(w){return et(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),b):n(w)}function b(w){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function f8(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(nc,s,o);function s(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,ot(e,t,"listItemIndent",a.containerState.size+1)(f)}function o(f){return a.containerState.furtherBlankLines||!et(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,c(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(c8,t,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,ot(e,e.attempt(Gn,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function h8(e,t,n){const a=this;return ot(e,s,"listItemIndent",a.containerState.size+1);function s(o){const c=a.events[a.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===a.containerState.size?t(o):n(o)}}function m8(e){e.exit(this.containerState.type)}function p8(e,t,n){const a=this;return ot(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const c=a.events[a.events.length-1];return!et(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const gS={name:"setextUnderline",resolveTo:g8,tokenize:v8};function g8(e,t){let n=e.length,a,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",c,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=c,e.push(["exit",c,t]),e}function v8(e,t,n){const a=this;let s;return o;function o(h){let v=a.events.length,p;for(;v--;)if(a.events[v][1].type!=="lineEnding"&&a.events[v][1].type!=="linePrefix"&&a.events[v][1].type!=="content"){p=a.events[v][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||p)?(e.enter("setextHeadingLine"),s=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===s?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),et(h)?ot(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Ie(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const y8={tokenize:b8};function b8(e){const t=this,n=e.attempt(nc,a,e.attempt(this.parser.constructs.flowInitial,s,ot(e,e.attempt(this.parser.constructs.flow,s,e.attempt(jB,s)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const x8={resolveAll:sE()},w8=iE("string"),S8=iE("text");function iE(e){return{resolveAll:sE(e==="text"?k8:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],o=n.attempt(s,c,f);return c;function c(v){return h(v)?o(v):f(v)}function f(v){if(v===null){n.consume(v);return}return n.enter("data"),n.consume(v),m}function m(v){return h(v)?(n.exit("data"),o(v)):(n.consume(v),m)}function h(v){if(v===null)return!0;const p=s[v];let b=-1;if(p)for(;++b<p.length;){const w=p[b];if(!w.previous||w.previous.call(a,a.previous))return!0}return!1}}}function sE(e){return t;function t(n,a){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,a):n}}function k8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let o=s.length,c=-1,f=0,m;for(;o--;){const h=s[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)f++,c--;if(c)break;c=-1}else if(h===-2)m=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:a.start._bufferIndex+c,_index:a.start._index+o,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const j8={42:Gn,43:Gn,45:Gn,48:Gn,49:Gn,50:Gn,51:Gn,52:Gn,53:Gn,54:Gn,55:Gn,56:Gn,57:Gn,62:JN},C8={91:TB},N8={[-2]:Rp,[-1]:Rp,32:Rp},E8={35:MB,42:Gd,45:[gS,Gd],60:PB,61:gS,95:Gd,96:mS,126:mS},_8={38:eE,92:WN},T8={[-5]:Ap,[-4]:Ap,[-3]:Ap,33:r8,38:eE,42:Yg,60:[iB,VB],91:i8,92:[OB,WN],93:hy,95:Yg,96:yB},R8={null:[Yg,x8]},A8={null:[42,95]},z8={null:[]},O8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:A8,contentInitial:C8,disable:z8,document:j8,flow:E8,flowInitial:N8,insideSpan:R8,string:_8,text:T8},Symbol.toStringTag,{value:"Module"}));function D8(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let c=[],f=[];const m={attempt:$(P),check:$(z),consume:A,enter:O,exit:M,interrupt:$(z,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:b,sliceStream:w,write:p};let v=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function p(te){return c=Tr(c,te),N(),c[c.length-1]!==null?[]:(I(t,0),h.events=Uf(o,h.events,h),h.events)}function b(te,ae){return I8(w(te),ae)}function w(te){return M8(c,te)}function k(){const{_bufferIndex:te,_index:ae,line:xe,column:G,offset:X}=a;return{_bufferIndex:te,_index:ae,line:xe,column:G,offset:X}}function j(te){s[te.line]=te.column,D()}function N(){let te;for(;a._index<c.length;){const ae=c[a._index];if(typeof ae=="string")for(te=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===te&&a._bufferIndex<ae.length;)C(ae.charCodeAt(a._bufferIndex));else C(ae)}}function C(te){v=v(te)}function A(te){Ie(te)?(a.line++,a.column=1,a.offset+=te===-3?2:1,D()):te!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===c[a._index].length&&(a._bufferIndex=-1,a._index++)),h.previous=te}function O(te,ae){const xe=ae||{};return xe.type=te,xe.start=k(),h.events.push(["enter",xe,h]),f.push(xe),xe}function M(te){const ae=f.pop();return ae.end=k(),h.events.push(["exit",ae,h]),ae}function P(te,ae){I(te,ae.from)}function z(te,ae){ae.restore()}function $(te,ae){return xe;function xe(G,X,q){let ee,ye,Ae,R;return Array.isArray(G)?B(G):"tokenize"in G?B([G]):U(G);function U(ce){return be;function be(ge){const fe=ge!==null&&ce[ge],Ge=ge!==null&&ce.null,Oe=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(Ge)?Ge:Ge?[Ge]:[]];return B(Oe)(ge)}}function B(ce){return ee=ce,ye=0,ce.length===0?q:T(ce[ye])}function T(ce){return be;function be(ge){return R=Z(),Ae=ce,ce.partial||(h.currentConstruct=ce),ce.name&&h.parser.constructs.disable.null.includes(ce.name)?W():ce.tokenize.call(ae?Object.assign(Object.create(h),ae):h,m,V,W)(ge)}}function V(ce){return te(Ae,R),X}function W(ce){return R.restore(),++ye<ee.length?T(ee[ye]):q}}}function I(te,ae){te.resolveAll&&!o.includes(te)&&o.push(te),te.resolve&&hr(h.events,ae,h.events.length-ae,te.resolve(h.events.slice(ae),h)),te.resolveTo&&(h.events=te.resolveTo(h.events,h))}function Z(){const te=k(),ae=h.previous,xe=h.currentConstruct,G=h.events.length,X=Array.from(f);return{from:G,restore:q};function q(){a=te,h.previous=ae,h.currentConstruct=xe,h.events.length=G,f=X,D()}}function D(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function M8(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let c;if(n===s)c=[e[n].slice(a,o)];else{if(c=e.slice(n,s),a>-1){const f=c[0];typeof f=="string"?c[0]=f.slice(a):c.shift()}o>0&&c.push(e[s].slice(0,o))}return c}function I8(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
359
+ `;break}case-3:{c=`\r
360
+ `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&s)continue;c=" ";break}default:c=String.fromCharCode(o)}s=o===-2,a.push(c)}return a.join("")}function L8(e){const a={constructs:YN([O8,...(e||{}).extensions||[]]),content:s(J9),defined:[],document:s(eB),flow:s(y8),lazy:{},string:s(w8),text:s(S8)};return a;function s(o){return c;function c(f){return D8(a,o,f)}}}function U8(e){for(;!tE(e););return e}const vS=/[\0\t\n\r]/g;function P8(){let e=1,t="",n=!0,a;return s;function s(o,c,f){const m=[];let h,v,p,b,w;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(vS.lastIndex=p,h=vS.exec(o),b=h&&h.index!==void 0?h.index:o.length,w=o.charCodeAt(b),!h){t=o.slice(p);break}if(w===10&&p===b&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),p<b&&(m.push(o.slice(p,b)),e+=b-p),w){case 0:{m.push(65533),e++;break}case 9:{for(v=Math.ceil(e/4)*4,m.push(-2);e++<v;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}p=b+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const B8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $8(e){return e.replace(B8,F8)}function F8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return XN(n.slice(o?2:1),o?16:10)}return fy(n)||e}const lE={}.hasOwnProperty;function q8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),H8(n)(U8(L8(n).document().write(P8()(e,t,!0))))}function H8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Ma),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:o(De),blockQuote:o(Ge),characterEscape:Z,characterReference:Z,codeFenced:o(Oe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Oe,c),codeText:o(jt,c),codeTextData:Z,data:Z,codeFlowValue:Z,definition:o(ie),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(ke),hardBreakEscape:o(Ke),hardBreakTrailing:o(Ke),htmlFlow:o(zn,c),htmlFlowData:Z,htmlText:o(zn,c),htmlTextData:Z,image:o(On),label:c,link:o(Ma),listItem:o(ra),listItemValue:b,listOrdered:o(Ia,p),listUnordered:o(Ia),paragraph:o(io),reference:T,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(De),strong:o(so),thematicBreak:o(lo)},exit:{atxHeading:m(),atxHeadingSequence:P,autolink:m(),autolinkEmail:fe,autolinkProtocol:ge,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:ce,characterReference:be,codeFenced:m(N),codeFencedFence:j,codeFencedFenceInfo:w,codeFencedFenceMeta:k,codeFlowValue:D,codeIndented:m(C),codeText:m(X),codeTextData:D,data:D,definition:m(),definitionDestinationString:M,definitionLabelString:A,definitionTitleString:O,emphasis:m(),hardBreakEscape:m(ae),hardBreakTrailing:m(ae),htmlFlow:m(xe),htmlFlowData:D,htmlText:m(G),htmlTextData:D,image:m(ee),label:Ae,labelText:ye,lineEnding:te,link:m(q),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:V,resourceDestinationString:R,resourceTitleString:U,resource:B,setextHeading:m(I),setextHeadingLineSequence:$,setextHeadingText:z,strong:m(),thematicBreak:m()}};oE(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(oe){let ve={type:"root",children:[]};const Pe={stack:[ve],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:v,data:n},$e=[];let rt=-1;for(;++rt<oe.length;)if(oe[rt][1].type==="listOrdered"||oe[rt][1].type==="listUnordered")if(oe[rt][0]==="enter")$e.push(rt);else{const pn=$e.pop();rt=s(oe,pn,rt)}for(rt=-1;++rt<oe.length;){const pn=t[oe[rt][0]];lE.call(pn,oe[rt][1].type)&&pn[oe[rt][1].type].call(Object.assign({sliceSerialize:oe[rt][2].sliceSerialize},Pe),oe[rt][1])}if(Pe.tokenStack.length>0){const pn=Pe.tokenStack[Pe.tokenStack.length-1];(pn[1]||yS).call(Pe,void 0,pn[0])}for(ve.position={start:ci(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:ci(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},rt=-1;++rt<t.transforms.length;)ve=t.transforms[rt](ve)||ve;return ve}function s(oe,ve,Pe){let $e=ve-1,rt=-1,pn=!1,pr,rn,Ht,gn;for(;++$e<=Pe;){const ht=oe[$e];switch(ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ht[0]==="enter"?rt++:rt--,gn=void 0;break}case"lineEndingBlank":{ht[0]==="enter"&&(pr&&!gn&&!rt&&!Ht&&(Ht=$e),gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gn=void 0}if(!rt&&ht[0]==="enter"&&ht[1].type==="listItemPrefix"||rt===-1&&ht[0]==="exit"&&(ht[1].type==="listUnordered"||ht[1].type==="listOrdered")){if(pr){let Mr=$e;for(rn=void 0;Mr--;){const Bn=oe[Mr];if(Bn[1].type==="lineEnding"||Bn[1].type==="lineEndingBlank"){if(Bn[0]==="exit")continue;rn&&(oe[rn][1].type="lineEndingBlank",pn=!0),Bn[1].type="lineEnding",rn=Mr}else if(!(Bn[1].type==="linePrefix"||Bn[1].type==="blockQuotePrefix"||Bn[1].type==="blockQuotePrefixWhitespace"||Bn[1].type==="blockQuoteMarker"||Bn[1].type==="listItemIndent"))break}Ht&&(!rn||Ht<rn)&&(pr._spread=!0),pr.end=Object.assign({},rn?oe[rn][1].start:ht[1].end),oe.splice(rn||$e,0,["exit",pr,ht[2]]),$e++,Pe++}if(ht[1].type==="listItemPrefix"){const Mr={type:"listItem",_spread:!1,start:Object.assign({},ht[1].start),end:void 0};pr=Mr,oe.splice($e,0,["enter",Mr,ht[2]]),$e++,Pe++,Ht=void 0,gn=!0}}}return oe[ve][1]._spread=pn,Pe}function o(oe,ve){return Pe;function Pe($e){f.call(this,oe($e),$e),ve&&ve.call(this,$e)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(oe,ve,Pe){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([ve,Pe||void 0]),oe.position={start:ci(ve.start),end:void 0}}function m(oe){return ve;function ve(Pe){oe&&oe.call(this,Pe),h.call(this,Pe)}}function h(oe,ve){const Pe=this.stack.pop(),$e=this.tokenStack.pop();if($e)$e[0].type!==oe.type&&(ve?ve.call(this,oe,$e[0]):($e[1]||yS).call(this,oe,$e[0]));else throw new Error("Cannot close `"+oe.type+"` ("+vu({start:oe.start,end:oe.end})+"): it’s not open");Pe.position.end=ci(oe.end)}function v(){return dy(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function b(oe){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=oe}function k(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=oe}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function C(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe.replace(/(\r?\n|\r)$/g,"")}function A(oe){const ve=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=ve,Pe.identifier=Fr(this.sliceSerialize(oe)).toLowerCase()}function O(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.title=oe}function M(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.url=oe}function P(oe){const ve=this.stack[this.stack.length-1];if(!ve.depth){const Pe=this.sliceSerialize(oe).length;ve.depth=Pe}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function $(oe){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(oe){const Pe=this.stack[this.stack.length-1].children;let $e=Pe[Pe.length-1];(!$e||$e.type!=="text")&&($e=mn(),$e.position={start:ci(oe.start),end:void 0},Pe.push($e)),this.stack.push($e)}function D(oe){const ve=this.stack.pop();ve.value+=this.sliceSerialize(oe),ve.position.end=ci(oe.end)}function te(oe){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Pe=ve.children[ve.children.length-1];Pe.position.end=ci(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(Z.call(this,oe),D.call(this,oe))}function ae(){this.data.atHardBreak=!0}function xe(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe}function G(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe}function X(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.value=oe}function q(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ve,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ee(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=ve,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function ye(oe){const ve=this.sliceSerialize(oe),Pe=this.stack[this.stack.length-2];Pe.label=$8(ve),Pe.identifier=Fr(ve).toLowerCase()}function Ae(){const oe=this.stack[this.stack.length-1],ve=this.resume(),Pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Pe.type==="link"){const $e=oe.children;Pe.children=$e}else Pe.alt=ve}function R(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.url=oe}function U(){const oe=this.resume(),ve=this.stack[this.stack.length-1];ve.title=oe}function B(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function V(oe){const ve=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=ve,Pe.identifier=Fr(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function W(oe){this.data.characterReferenceType=oe.type}function ce(oe){const ve=this.sliceSerialize(oe),Pe=this.data.characterReferenceType;let $e;Pe?($e=XN(ve,Pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):$e=fy(ve);const rt=this.stack[this.stack.length-1];rt.value+=$e}function be(oe){const ve=this.stack.pop();ve.position.end=ci(oe.end)}function ge(oe){D.call(this,oe);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(oe)}function fe(oe){D.call(this,oe);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(oe)}function Ge(){return{type:"blockquote",children:[]}}function Oe(){return{type:"code",lang:null,meta:null,value:""}}function jt(){return{type:"inlineCode",value:""}}function ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ke(){return{type:"emphasis",children:[]}}function De(){return{type:"heading",depth:0,children:[]}}function Ke(){return{type:"break"}}function zn(){return{type:"html",value:""}}function On(){return{type:"image",title:null,url:"",alt:null}}function Ma(){return{type:"link",title:null,url:"",children:[]}}function Ia(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function ra(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function io(){return{type:"paragraph",children:[]}}function so(){return{type:"strong",children:[]}}function mn(){return{type:"text",value:""}}function lo(){return{type:"thematicBreak"}}}function ci(e){return{line:e.line,column:e.column,offset:e.offset}}function oE(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?oE(e,a):Z8(e,a)}}function Z8(e,t){let n;for(n in t)if(lE.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function yS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+vu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+vu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+vu({start:t.start,end:t.end})+") is still open")}function V8(e){const t=this;t.parser=n;function n(a){return q8(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Q8(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function G8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
361
+ `}]}function K8(e,t){const n=t.value?t.value+`
362
+ `:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function Y8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function X8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function J8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=eo(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let c,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),c=e.footnoteOrder.length):c=o+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,h),e.applyData(t,h)}function W8(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function e$(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function uE(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const c=s[s.length-1];return c&&c.type==="text"?c.value+=a:s.push({type:"text",value:a}),s}function t$(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return uE(e,t);const s={src:eo(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function n$(e,t){const n={src:eo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function r$(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function a$(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return uE(e,t);const s={href:eo(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function i$(e,t){const n={href:eo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function s$(e,t,n){const a=e.all(t),s=n?l$(n):cE(t),o={},c=[];if(typeof t.checked=="boolean"){const v=a[0];let p;v&&v.type==="element"&&v.tagName==="p"?p=v:(p={type:"element",tagName:"p",properties:{},children:[]},a.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const v=a[f];(s||f!==0||v.type!=="element"||v.tagName!=="p")&&c.push({type:"text",value:`
363
+ `}),v.type==="element"&&v.tagName==="p"&&!s?c.push(...v.children):c.push(v)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
364
+ `});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function l$(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let a=-1;for(;!t&&++a<n.length;)t=cE(n[a])}return t}function cE(e){const t=e.spread;return t??e.children.length>1}function o$(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const c=a[s];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function u$(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function c$(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function d$(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function f$(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],c),s.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=ly(t.children[1]),m=qN(t.children[t.children.length-1]);f&&m&&(c.position={start:f,end:m}),s.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function h$(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,f=c?c.length:t.children.length;let m=-1;const h=[];for(;++m<f;){const p=t.children[m],b={},w=c?c[m]:void 0;w&&(b.align=w);let k={type:"element",tagName:o,properties:b,children:[]};p&&(k.children=e.all(p),e.patch(p,k),k=e.applyData(p,k)),h.push(k)}const v={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,v),e.applyData(t,v)}function m$(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const bS=9,xS=32;function p$(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(wS(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(wS(t.slice(s),s>0,!1)),o.join("")}function wS(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===bS||o===xS;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===bS||o===xS;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function g$(e,t){const n={type:"text",value:p$(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function v$(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const y$={blockquote:Q8,break:G8,code:K8,delete:Y8,emphasis:X8,footnoteReference:J8,heading:W8,html:e$,imageReference:t$,image:n$,inlineCode:r$,linkReference:a$,link:i$,listItem:s$,list:o$,paragraph:u$,root:c$,strong:d$,table:f$,tableCell:m$,tableRow:h$,text:g$,thematicBreak:v$,toml:Md,yaml:Md,definition:Md,footnoteDefinition:Md};function Md(){}const dE=-1,Pf=0,bu=1,cf=2,my=3,py=4,gy=5,vy=6,fE=7,hE=8,SS=typeof self=="object"?self:globalThis,b$=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),a=s=>{if(e.has(s))return e.get(s);const[o,c]=t[s];switch(o){case Pf:case dE:return n(c,s);case bu:{const f=n([],s);for(const m of c)f.push(a(m));return f}case cf:{const f=n({},s);for(const[m,h]of c)f[a(m)]=a(h);return f}case my:return n(new Date(c),s);case py:{const{source:f,flags:m}=c;return n(new RegExp(f,m),s)}case gy:{const f=n(new Map,s);for(const[m,h]of c)f.set(a(m),a(h));return f}case vy:{const f=n(new Set,s);for(const m of c)f.add(a(m));return f}case fE:{const{name:f,message:m}=c;return n(new SS[f](m),s)}case hE:return n(BigInt(c),s);case"BigInt":return n(Object(BigInt(c)),s);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:f}=new Uint8Array(c);return n(new DataView(f),c)}}return n(new SS[o](c),s)};return a},kS=e=>b$(new Map,e)(0),ml="",{toString:x$}={},{keys:w$}=Object,cu=e=>{const t=typeof e;if(t!=="object"||!e)return[Pf,t];const n=x$.call(e).slice(8,-1);switch(n){case"Array":return[bu,ml];case"Object":return[cf,ml];case"Date":return[my,ml];case"RegExp":return[py,ml];case"Map":return[gy,ml];case"Set":return[vy,ml];case"DataView":return[bu,n]}return n.includes("Array")?[bu,n]:n.includes("Error")?[fE,n]:[cf,n]},Id=([e,t])=>e===Pf&&(t==="function"||t==="symbol"),S$=(e,t,n,a)=>{const s=(c,f)=>{const m=a.push(c)-1;return n.set(f,m),m},o=c=>{if(n.has(c))return n.get(c);let[f,m]=cu(c);switch(f){case Pf:{let v=c;switch(m){case"bigint":f=hE,v=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);v=null;break;case"undefined":return s([dE],c)}return s([f,v],c)}case bu:{if(m){let b=c;return m==="DataView"?b=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(b=new Uint8Array(c)),s([m,[...b]],c)}const v=[],p=s([f,v],c);for(const b of c)v.push(o(b));return p}case cf:{if(m)switch(m){case"BigInt":return s([m,c.toString()],c);case"Boolean":case"Number":case"String":return s([m,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const v=[],p=s([f,v],c);for(const b of w$(c))(e||!Id(cu(c[b])))&&v.push([o(b),o(c[b])]);return p}case my:return s([f,c.toISOString()],c);case py:{const{source:v,flags:p}=c;return s([f,{source:v,flags:p}],c)}case gy:{const v=[],p=s([f,v],c);for(const[b,w]of c)(e||!(Id(cu(b))||Id(cu(w))))&&v.push([o(b),o(w)]);return p}case vy:{const v=[],p=s([f,v],c);for(const b of c)(e||!Id(cu(b)))&&v.push(o(b));return p}}const{message:h}=c;return s([f,{name:m,message:h}],c)};return o},jS=(e,{json:t,lossy:n}={})=>{const a=[];return S$(!(t||n),!!t,new Map,a)(e),a},df=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?kS(jS(e,t)):structuredClone(e):(e,t)=>kS(jS(e,t));function k$(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function j$(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function C$(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||k$,a=e.options.footnoteBackLabel||j$,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const v=e.all(h),p=String(h.identifier).toUpperCase(),b=eo(p.toLowerCase());let w=0;const k=[],j=e.footnoteCounts.get(p);for(;j!==void 0&&++w<=j;){k.length>0&&k.push({type:"text",value:" "});let A=typeof n=="string"?n:n(m,w);typeof A=="string"&&(A={type:"text",value:A}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,w),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const N=v[v.length-1];if(N&&N.type==="element"&&N.tagName==="p"){const A=N.children[N.children.length-1];A&&A.type==="text"?A.value+=" ":N.children.push({type:"text",value:" "}),N.children.push(...k)}else v.push(...k);const C={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(v,!0)};e.patch(h,C),f.push(C)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...df(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
365
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
366
+ `}]}}const Bf=(function(e){if(e==null)return T$;if(typeof e=="function")return $f(e);if(typeof e=="object")return Array.isArray(e)?N$(e):E$(e);if(typeof e=="string")return _$(e);throw new Error("Expected function, string, or object as test")});function N$(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Bf(e[n]);return $f(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function E$(e){const t=e;return $f(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function _$(e){return $f(t);function t(n){return n&&n.type===e}}function $f(e){return t;function t(n,a,s){return!!(R$(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function T$(){return!0}function R$(e){return e!==null&&typeof e=="object"&&"type"in e}const mE=[],A$=!0,Xg=!1,z$="skip";function pE(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Bf(s),c=a?-1:1;f(e,void 0,[])();function f(m,h,v){const p=m&&typeof m=="object"?m:{};if(typeof p.type=="string"){const w=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return b;function b(){let w=mE,k,j,N;if((!t||o(m,h,v[v.length-1]||void 0))&&(w=O$(n(m,v)),w[0]===Xg))return w;if("children"in m&&m.children){const C=m;if(C.children&&w[0]!==z$)for(j=(a?C.children.length:-1)+c,N=v.concat(C);j>-1&&j<C.children.length;){const A=C.children[j];if(k=f(A,j,N)(),k[0]===Xg)return k;j=typeof k[1]=="number"?k[1]:j+c}}return w}}}function O$(e){return Array.isArray(e)?e:typeof e=="number"?[A$,e]:e==null?mE:[e]}function yy(e,t,n,a){let s,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,s=n):(o=t,c=n,s=a),pE(e,o,f,s);function f(m,h){const v=h[h.length-1],p=v?v.children.indexOf(m):void 0;return c(m,p,v)}}const Jg={}.hasOwnProperty,D$={};function M$(e,t){const n=t||D$,a=new Map,s=new Map,o=new Map,c={...y$,...n.handlers},f={all:h,applyData:L$,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:I$,wrap:P$};return yy(e,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const p=v.type==="definition"?a:s,b=String(v.identifier).toUpperCase();p.has(b)||p.set(b,v)}}),f;function m(v,p){const b=v.type,w=f.handlers[b];if(Jg.call(f.handlers,b)&&w)return w(f,v,p);if(f.options.passThrough&&f.options.passThrough.includes(b)){if("children"in v){const{children:j,...N}=v,C=df(N);return C.children=f.all(v),C}return df(v)}return(f.options.unknownHandler||U$)(f,v,p)}function h(v){const p=[];if("children"in v){const b=v.children;let w=-1;for(;++w<b.length;){const k=f.one(b[w],v);if(k){if(w&&b[w-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=CS(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=CS(j.value))}Array.isArray(k)?p.push(...k):p.push(k)}}}return p}}function I$(e,t){e.position&&(t.position=j9(e))}function L$(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const c="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,df(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function U$(e,t){const n=t.data||{},a="value"in t&&!(Jg.call(n,"hProperties")||Jg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function P$(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
367
+ `});++a<e.length;)a&&n.push({type:"text",value:`
368
+ `}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
369
+ `}),n}function CS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function NS(e,t){const n=M$(e,t),a=n.one(e,void 0),s=C$(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
370
+ `},s),o}function B$(e,t){return e&&"run"in e?async function(n,a){const s=NS(n,{file:a,...t});await e.run(s,a)}:function(n,a){return NS(n,{file:a,...e||t})}}function ES(e){if(e)throw e}var zp,_S;function $$(){if(_S)return zp;_S=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var v=e.call(h,"constructor"),p=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!v&&!p)return!1;var b;for(b in h);return typeof b>"u"||e.call(h,b)},c=function(h,v){n&&v.name==="__proto__"?n(h,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):h[v.name]=v.newValue},f=function(h,v){if(v==="__proto__")if(e.call(h,v)){if(a)return a(h,v).value}else return;return h[v]};return zp=function m(){var h,v,p,b,w,k,j=arguments[0],N=1,C=arguments.length,A=!1;for(typeof j=="boolean"&&(A=j,j=arguments[1]||{},N=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});N<C;++N)if(h=arguments[N],h!=null)for(v in h)p=f(j,v),b=f(h,v),j!==b&&(A&&b&&(o(b)||(w=s(b)))?(w?(w=!1,k=p&&s(p)?p:[]):k=p&&o(p)?p:{},c(j,{name:v,newValue:m(A,k,b)})):typeof b<"u"&&c(j,{name:v,newValue:b}));return j},zp}var F$=$$();const Op=vf(F$);function Wg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function q$(){const e=[],t={run:n,use:a};return t;function n(...s){let o=-1;const c=s.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);f(null,...s);function f(m,...h){const v=e[++o];let p=-1;if(m){c(m);return}for(;++p<s.length;)(h[p]===null||h[p]===void 0)&&(h[p]=s[p]);s=h,v?H$(v,f)(...h):c(null,...h)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function H$(e,t){let n;return a;function a(...c){const f=e.length>c.length;let m;f&&c.push(s);try{m=e.apply(this,c)}catch(h){const v=h;if(f&&n)throw v;return s(v)}f||(m&&m.then&&typeof m.then=="function"?m.then(o,s):m instanceof Error?s(m):o(m))}function s(c,...f){n||(n=!0,t(c,...f))}function o(c){s(null,c)}}const Yr={basename:Z$,dirname:V$,extname:Q$,join:G$,sep:"/"};function Z$(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');rc(e);let n=0,a=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else a<0&&(o=!0,a=s+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let c=-1,f=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else c<0&&(o=!0,c=s+1),f>-1&&(e.codePointAt(s)===t.codePointAt(f--)?f<0&&(a=s):(f=-1,a=c));return n===a?a=c:a<0&&(a=e.length),e.slice(n,a)}function V$(e){if(rc(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Q$(e){rc(e);let t=e.length,n=-1,a=0,s=-1,o=0,c;for(;t--;){const f=e.codePointAt(t);if(f===47){if(c){a=t+1;break}continue}n<0&&(c=!0,n=t+1),f===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function G$(...e){let t=-1,n;for(;++t<e.length;)rc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":K$(n)}function K$(e){rc(e);const t=e.codePointAt(0)===47;let n=Y$(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Y$(e,t){let n="",a=0,s=-1,o=0,c=-1,f,m;for(;++c<=e.length;){if(c<e.length)f=e.codePointAt(c);else{if(f===47)break;f=47}if(f===47){if(!(s===c-1||o===1))if(s!==c-1&&o===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),s=c,o=0;continue}}else if(n.length>0){n="",a=0,s=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,c):n=e.slice(s+1,c),a=c-s-1;s=c,o=0}else f===46&&o>-1?o++:o=-1}return n}function rc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const X$={cwd:J$};function J$(){return"/"}function ev(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function W$(e){if(typeof e=="string")e=new URL(e);else if(!ev(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return eF(e)}function eF(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Dp=["history","path","basename","stem","extname","dirname"];class gE{constructor(t){let n;t?ev(t)?n={path:t}:typeof t=="string"||tF(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":X$.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Dp.length;){const o=Dp[a];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)Dp.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Yr.basename(this.path):void 0}set basename(t){Ip(t,"basename"),Mp(t,"basename"),this.path=Yr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Yr.dirname(this.path):void 0}set dirname(t){TS(this.basename,"dirname"),this.path=Yr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Yr.extname(this.path):void 0}set extname(t){if(Mp(t,"extname"),TS(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Yr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ev(t)&&(t=W$(t)),Ip(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Yr.basename(this.path,this.extname):void 0}set stem(t){Ip(t,"stem"),Mp(t,"stem"),this.path=Yr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new An(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Mp(e,t){if(e&&e.includes(Yr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Yr.sep+"`")}function Ip(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function TS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function tF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const nF=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),rF={}.hasOwnProperty;class by extends nF{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=q$()}copy(){const t=new by;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(Op(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Pp("data",this.frozen),this.namespace[t]=n,this):rF.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Pp("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Ld(t),a=this.parser||this.Parser;return Lp("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Lp("process",this.parser||this.Parser),Up("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,c){const f=Ld(t),m=a.parse(f);a.run(m,f,function(v,p,b){if(v||!p||!b)return h(v);const w=p,k=a.stringify(w,b);sF(k)?b.value=k:b.result=k,h(v,b)});function h(v,p){v||!p?c(v):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,a;return this.freeze(),Lp("processSync",this.parser||this.Parser),Up("processSync",this.compiler||this.Compiler),this.process(t,s),AS("processSync","process",n),a;function s(o,c){n=!0,ES(o),a=c}}run(t,n,a){RS(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?o(void 0,a):new Promise(o);function o(c,f){const m=Ld(n);s.run(t,m,h);function h(v,p,b){const w=p||t;v?f(v):c?c(w):a(void 0,w,b)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),AS("runSync","run",a),s;function o(c,f){ES(c),s=f,a=!0}}stringify(t,n){this.freeze();const a=Ld(n),s=this.compiler||this.Compiler;return Up("stringify",s),RS(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(Pp("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[v,...p]=h;m(v,p)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(s.settings=Op(!0,s.settings,h.settings))}function f(h){let v=-1;if(h!=null)if(Array.isArray(h))for(;++v<h.length;){const p=h[v];o(p)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,v){let p=-1,b=-1;for(;++p<a.length;)if(a[p][0]===h){b=p;break}if(b===-1)a.push([h,...v]);else if(v.length>0){let[w,...k]=v;const j=a[b][1];Wg(j)&&Wg(w)&&(w=Op(!0,j,w)),a[b]=[h,w,...k]}}}}const aF=new by().freeze();function Lp(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Up(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Pp(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function RS(e){if(!Wg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function AS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Ld(e){return iF(e)?e:new gE(e)}function iF(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function sF(e){return typeof e=="string"||lF(e)}function lF(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const oF="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zS=[],OS={allowDangerousHtml:!0},uF=/^(https?|ircs?|mailto|xmpp)$/i,cF=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function dF(e){const t=fF(e),n=hF(e);return mF(t.runSync(t.parse(n),n),e)}function fF(e){const t=e.rehypePlugins||zS,n=e.remarkPlugins||zS,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...OS}:OS;return aF().use(V8).use(n).use(B$,a).use(t)}function hF(e){const t=e.children||"",n=new gE;return typeof t=="string"&&(n.value=t),n}function mF(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||pF;for(const v of cF)Object.hasOwn(t,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+oF+v.id,void 0);return yy(e,h),T9(e,{Fragment:u.Fragment,components:s,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function h(v,p,b){if(v.type==="raw"&&b&&typeof p=="number")return c?b.children.splice(p,1):b.children[p]={type:"text",value:v.value},p;if(v.type==="element"){let w;for(w in Tp)if(Object.hasOwn(Tp,w)&&Object.hasOwn(v.properties,w)){const k=v.properties[w],j=Tp[w];(j===null||j.includes(v.tagName))&&(v.properties[w]=m(String(k||""),w,v))}}if(v.type==="element"){let w=n?!n.includes(v.tagName):o?o.includes(v.tagName):!1;if(!w&&a&&typeof p=="number"&&(w=!a(v,p,b)),w&&b&&typeof p=="number")return f&&v.children?b.children.splice(p,1,...v.children):b.children.splice(p,1),p}}}function pF(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||a!==-1&&t>a||uF.test(e.slice(0,t))?e:""}function gF(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function vE(e,t,n){const s=Bf((n||{}).ignore||[]),o=vF(t);let c=-1;for(;++c<o.length;)pE(e,"text",f);function f(h,v){let p=-1,b;for(;++p<v.length;){const w=v[p],k=b?b.children:void 0;if(s(w,k?k.indexOf(w):void 0,b))return;b=w}if(b)return m(h,v)}function m(h,v){const p=v[v.length-1],b=o[c][0],w=o[c][1];let k=0;const N=p.children.indexOf(h);let C=!1,A=[];b.lastIndex=0;let O=b.exec(h.value);for(;O;){const M=O.index,P={index:O.index,input:O.input,stack:[...v,h]};let z=w(...O,P);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1?b.lastIndex=M+1:(k!==M&&A.push({type:"text",value:h.value.slice(k,M)}),Array.isArray(z)?A.push(...z):z&&A.push(z),k=M+O[0].length,C=!0),!b.global)break;O=b.exec(h.value)}return C?(k<h.value.length&&A.push({type:"text",value:h.value.slice(k)}),p.children.splice(N,1,...A)):A=[h],N+A.length}}function vF(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<n.length;){const s=n[a];t.push([yF(s[0]),bF(s[1])])}return t}function yF(e){return typeof e=="string"?new RegExp(gF(e),"g"):e}function bF(e){return typeof e=="function"?e:function(){return e}}function xF(e){vE(e,[/\r?\n|\r/g,wF])}function wF(){return{type:"break"}}function SF(){return function(e){xF(e)}}function DS(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}const Bp="phrasing",$p=["autolink","link","image","label"];function kF(){return{transforms:[RF],enter:{literalAutolink:CF,literalAutolinkEmail:Fp,literalAutolinkHttp:Fp,literalAutolinkWww:Fp},exit:{literalAutolink:TF,literalAutolinkEmail:_F,literalAutolinkHttp:NF,literalAutolinkWww:EF}}}function jF(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bp,notInConstruct:$p},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bp,notInConstruct:$p},{character:":",before:"[ps]",after:"\\/",inConstruct:Bp,notInConstruct:$p}]}}function CF(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Fp(e){this.config.enter.autolinkProtocol.call(this,e)}function NF(e){this.config.exit.autolinkProtocol.call(this,e)}function EF(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function _F(e){this.config.exit.autolinkEmail.call(this,e)}function TF(e){this.exit(e)}function RF(e){vE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,AF],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),zF]],{ignore:["link","linkReference"]})}function AF(e,t,n,a,s){let o="";if(!yE(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!OF(n)))return!1;const c=DF(n+a);if(!c[0])return!1;const f={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[f,{type:"text",value:c[1]}]:f}function zF(e,t,n,a){return!yE(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function OF(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function DF(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=DS(e,"(");let o=DS(e,")");for(;a!==-1&&s>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function yE(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||bs(n)||Lf(n))&&(!t||n!==47)}bE.peek=qF;function MF(){this.buffer()}function IF(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function LF(){this.buffer()}function UF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function PF(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Fr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function BF(e){this.exit(e)}function $F(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Fr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function FF(e){this.exit(e)}function qF(){return"["}function bE(e,t,n,a){const s=n.createTracker(a);let o=s.move("[^");const c=n.enter("footnoteReference"),f=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),c(),o+=s.move("]"),o}function HF(){return{enter:{gfmFootnoteCallString:MF,gfmFootnoteCall:IF,gfmFootnoteDefinitionLabelString:LF,gfmFootnoteDefinition:UF},exit:{gfmFootnoteCallString:PF,gfmFootnoteCall:BF,gfmFootnoteDefinitionLabelString:$F,gfmFootnoteDefinition:FF}}}function ZF(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:bE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,o,c){const f=o.createTracker(c);let m=f.move("[^");const h=o.enter("footnoteDefinition"),v=o.enter("label");return m+=f.move(o.safe(o.associationId(a),{before:m,after:"]"})),v(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((t?`
371
+ `:" ")+o.indentLines(o.containerFlow(a,f.current()),t?xE:VF))),h(),m}}function VF(e,t,n){return t===0?e:xE(e,t,n)}function xE(e,t,n){return(n?"":" ")+e}const QF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];wE.peek=JF;function GF(){return{canContainEols:["delete"],enter:{strikethrough:YF},exit:{strikethrough:XF}}}function KF(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:QF}],handlers:{delete:wE}}}function YF(e){this.enter({type:"delete",children:[]},e)}function XF(e){this.exit(e)}function wE(e,t,n,a){const s=n.createTracker(a),o=n.enter("strikethrough");let c=s.move("~~");return c+=n.containerPhrasing(e,{...s.current(),before:c,after:"~"}),c+=s.move("~~"),o(),c}function JF(){return"~"}function WF(e){return e.length}function eq(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||WF,o=[],c=[],f=[],m=[];let h=0,v=-1;for(;++v<e.length;){const j=[],N=[];let C=-1;for(e[v].length>h&&(h=e[v].length);++C<e[v].length;){const A=tq(e[v][C]);if(n.alignDelimiters!==!1){const O=s(A);N[C]=O,(m[C]===void 0||O>m[C])&&(m[C]=O)}j.push(A)}c[v]=j,f[v]=N}let p=-1;if(typeof a=="object"&&"length"in a)for(;++p<h;)o[p]=MS(a[p]);else{const j=MS(a);for(;++p<h;)o[p]=j}p=-1;const b=[],w=[];for(;++p<h;){const j=o[p];let N="",C="";j===99?(N=":",C=":"):j===108?N=":":j===114&&(C=":");let A=n.alignDelimiters===!1?1:Math.max(1,m[p]-N.length-C.length);const O=N+"-".repeat(A)+C;n.alignDelimiters!==!1&&(A=N.length+A+C.length,A>m[p]&&(m[p]=A),w[p]=A),b[p]=O}c.splice(1,0,b),f.splice(1,0,w),v=-1;const k=[];for(;++v<c.length;){const j=c[v],N=f[v];p=-1;const C=[];for(;++p<h;){const A=j[p]||"";let O="",M="";if(n.alignDelimiters!==!1){const P=m[p]-(N[p]||0),z=o[p];z===114?O=" ".repeat(P):z===99?P%2?(O=" ".repeat(P/2+.5),M=" ".repeat(P/2-.5)):(O=" ".repeat(P/2),M=O):M=" ".repeat(P)}n.delimiterStart!==!1&&!p&&C.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&A==="")&&(n.delimiterStart!==!1||p)&&C.push(" "),n.alignDelimiters!==!1&&C.push(O),C.push(A),n.alignDelimiters!==!1&&C.push(M),n.padding!==!1&&C.push(" "),(n.delimiterEnd!==!1||p!==h-1)&&C.push("|")}k.push(n.delimiterEnd===!1?C.join("").replace(/ +$/,""):C.join(""))}return k.join(`
372
+ `)}function tq(e){return e==null?"":String(e)}function MS(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function nq(e,t,n,a){const s=n.enter("blockquote"),o=n.createTracker(a);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),rq);return s(),c}function rq(e,t,n){return">"+(n?"":" ")+e}function aq(e,t){return IS(e,t.inConstruct,!0)&&!IS(e,t.notInConstruct,!1)}function IS(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function LS(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
373
+ `&&aq(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
374
+ `}function iq(e,t){const n=String(e);let a=n.indexOf(t),s=a,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++o>c&&(c=o):o=1,s=a+t.length,a=n.indexOf(t,s);return c}function sq(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function lq(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function oq(e,t,n,a){const s=lq(n),o=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(sq(e,n)){const p=n.enter("codeIndented"),b=n.indentLines(o,uq);return p(),b}const f=n.createTracker(a),m=s.repeat(Math.max(iq(o,s)+1,3)),h=n.enter("codeFenced");let v=f.move(m);if(e.lang){const p=n.enter(`codeFencedLang${c}`);v+=f.move(n.safe(e.lang,{before:v,after:" ",encode:["`"],...f.current()})),p()}if(e.lang&&e.meta){const p=n.enter(`codeFencedMeta${c}`);v+=f.move(" "),v+=f.move(n.safe(e.meta,{before:v,after:`
375
+ `,encode:["`"],...f.current()})),p()}return v+=f.move(`
376
+ `),o&&(v+=f.move(o+`
377
+ `)),v+=f.move(m),h(),v}function uq(e,t,n){return(n?"":" ")+e}function xy(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function cq(e,t,n,a){const s=xy(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("definition");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("[");return h+=m.move(n.safe(n.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":`
378
+ `,...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),c(),h}function dq(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Iu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ff(e,t,n){const a=ql(e),s=ql(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}SE.peek=fq;function SE(e,t,n,a){const s=dq(n),o=n.enter("emphasis"),c=n.createTracker(a),f=c.move(s);let m=c.move(n.containerPhrasing(e,{after:s,before:f,...c.current()}));const h=m.charCodeAt(0),v=ff(a.before.charCodeAt(a.before.length-1),h,s);v.inside&&(m=Iu(h)+m.slice(1));const p=m.charCodeAt(m.length-1),b=ff(a.after.charCodeAt(0),p,s);b.inside&&(m=m.slice(0,-1)+Iu(p));const w=c.move(s);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:v.outside},f+m+w}function fq(e,t,n){return n.options.emphasis||"*"}function hq(e,t){let n=!1;return yy(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Xg}),!!((!e.depth||e.depth<3)&&dy(e)&&(t.options.setext||n))}function mq(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(hq(e,n)){const v=n.enter("headingSetext"),p=n.enter("phrasing"),b=n.containerPhrasing(e,{...o.current(),before:`
379
+ `,after:`
380
+ `});return p(),v(),b+`
381
+ `+(s===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
382
+ `))+1))}const c="#".repeat(s),f=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
383
+ `,...o.current()});return/^[\t ]/.test(h)&&(h=Iu(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),f(),h}kE.peek=pq;function kE(e){return e.value||""}function pq(){return"<"}jE.peek=gq;function jE(e,t,n,a){const s=xy(n),o=s==='"'?"Quote":"Apostrophe",c=n.enter("image");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("![");return h+=m.move(n.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),h+=m.move(")"),c(),h}function gq(){return"!"}CE.peek=vq;function CE(e,t,n,a){const s=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("![");const h=n.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const v=n.stack;n.stack=[],c=n.enter("reference");const p=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=v,o(),s==="full"||!h||h!==p?m+=f.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function vq(){return"!"}NE.peek=yq;function NE(e,t,n){let a=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<n.unsafe.length;){const c=n.unsafe[o],f=n.compilePattern(c);let m;if(c.atBreak)for(;m=f.exec(a);){let h=m.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(m.index+1)}}return s+a+s}function yq(){return"`"}function EE(e,t){const n=dy(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}_E.peek=bq;function _E(e,t,n,a){const s=xy(n),o=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(EE(e,n)){const v=n.stack;n.stack=[],f=n.enter("autolink");let p=c.move("<");return p+=c.move(n.containerPhrasing(e,{before:p,after:">",...c.current()})),p+=c.move(">"),f(),n.stack=v,p}f=n.enter("link"),m=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(m=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=n.enter(`title${o}`),h+=c.move(" "+s),h+=c.move(n.safe(e.title,{before:h,after:s,...c.current()})),h+=c.move(s),m()),h+=c.move(")"),f(),h}function bq(e,t,n){return EE(e,n)?"<":"["}TE.peek=xq;function TE(e,t,n,a){const s=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const f=n.createTracker(a);let m=f.move("[");const h=n.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),c();const v=n.stack;n.stack=[],c=n.enter("reference");const p=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=v,o(),s==="full"||!h||h!==p?m+=f.move(p+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function xq(){return"["}function wy(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function wq(e){const t=wy(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Sq(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function RE(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function kq(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?Sq(n):wy(n);const f=e.ordered?c==="."?")":".":wq(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&v&&(!v.children||!v.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),RE(n)===c&&v){let p=-1;for(;++p<e.children.length;){const b=e.children[p];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=f),n.bulletCurrent=c;const h=n.containerFlow(e,a);return n.bulletLastUsed=c,n.bulletCurrent=o,s(),h}function jq(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Cq(e,t,n,a){const s=jq(n);let o=n.bulletCurrent||wy(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const f=n.createTracker(a);f.move(o+" ".repeat(c-o.length)),f.shift(c);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),v);return m(),h;function v(p,b,w){return b?(w?"":" ".repeat(c))+p:(w?o:o+" ".repeat(c-o.length))+p}}function Nq(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),s(),c}const Eq=Bf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function _q(e,t,n,a){return(e.children.some(function(c){return Eq(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function Tq(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}AE.peek=Rq;function AE(e,t,n,a){const s=Tq(n),o=n.enter("strong"),c=n.createTracker(a),f=c.move(s+s);let m=c.move(n.containerPhrasing(e,{after:s,before:f,...c.current()}));const h=m.charCodeAt(0),v=ff(a.before.charCodeAt(a.before.length-1),h,s);v.inside&&(m=Iu(h)+m.slice(1));const p=m.charCodeAt(m.length-1),b=ff(a.after.charCodeAt(0),p,s);b.inside&&(m=m.slice(0,-1)+Iu(p));const w=c.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:b.outside,before:v.outside},f+m+w}function Rq(e,t,n){return n.options.strong||"*"}function Aq(e,t,n,a){return n.safe(e.value,a)}function zq(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Oq(e,t,n){const a=(RE(n)+(n.options.ruleSpaces?" ":"")).repeat(zq(n));return n.options.ruleSpaces?a.slice(0,-1):a}const zE={blockquote:nq,break:LS,code:oq,definition:cq,emphasis:SE,hardBreak:LS,heading:mq,html:kE,image:jE,imageReference:CE,inlineCode:NE,link:_E,linkReference:TE,list:kq,listItem:Cq,paragraph:Nq,root:_q,strong:AE,text:Aq,thematicBreak:Oq};function Dq(){return{enter:{table:Mq,tableData:US,tableHeader:US,tableRow:Lq},exit:{codeText:Uq,table:Iq,tableData:qp,tableHeader:qp,tableRow:qp}}}function Mq(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Iq(e){this.exit(e),this.data.inTable=void 0}function Lq(e){this.enter({type:"tableRow",children:[]},e)}function qp(e){this.exit(e)}function US(e){this.enter({type:"tableCell",children:[]},e)}function Uq(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Pq));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Pq(e,t){return t==="|"?t:e}function Bq(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
384
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:c,tableCell:m,tableRow:f}};function c(w,k,j,N){return h(v(w,j,N),w.align)}function f(w,k,j,N){const C=p(w,j,N),A=h([C]);return A.slice(0,A.indexOf(`
385
+ `))}function m(w,k,j,N){const C=j.enter("tableCell"),A=j.enter("phrasing"),O=j.containerPhrasing(w,{...N,before:o,after:o});return A(),C(),O}function h(w,k){return eq(w,{align:k,alignDelimiters:a,padding:n,stringLength:s})}function v(w,k,j){const N=w.children;let C=-1;const A=[],O=k.enter("table");for(;++C<N.length;)A[C]=p(N[C],k,j);return O(),A}function p(w,k,j){const N=w.children;let C=-1;const A=[],O=k.enter("tableRow");for(;++C<N.length;)A[C]=m(N[C],w,k,j);return O(),A}function b(w,k,j){let N=zE.inlineCode(w,k,j);return j.stack.includes("tableCell")&&(N=N.replace(/\|/g,"\\$&")),N}}function $q(){return{exit:{taskListCheckValueChecked:PS,taskListCheckValueUnchecked:PS,paragraph:qq}}}function Fq(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Hq}}}function PS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function qq(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let o=-1,c;for(;++o<s.length;){const f=s[o];if(f.type==="paragraph"){c=f;break}}c===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function Hq(e,t,n,a){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",f=n.createTracker(a);o&&f.move(c);let m=zE.listItem(e,t,n,{...a,...f.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(v){return v+c}}function Zq(){return[kF(),HF(),GF(),Dq(),$q()]}function Vq(e){return{extensions:[jF(),ZF(e),KF(),Bq(e),Fq()]}}const Qq={tokenize:Wq,partial:!0},OE={tokenize:e7,partial:!0},DE={tokenize:t7,partial:!0},ME={tokenize:n7,partial:!0},Gq={tokenize:r7,partial:!0},IE={name:"wwwAutolink",tokenize:Xq,previous:UE},LE={name:"protocolAutolink",tokenize:Jq,previous:PE},Da={name:"emailAutolink",tokenize:Yq,previous:BE},na={};function Kq(){return{text:na}}let as=48;for(;as<123;)na[as]=Da,as++,as===58?as=65:as===91&&(as=97);na[43]=Da;na[45]=Da;na[46]=Da;na[95]=Da;na[72]=[Da,LE];na[104]=[Da,LE];na[87]=[Da,IE];na[119]=[Da,IE];function Yq(e,t,n){const a=this;let s,o;return c;function c(p){return!tv(p)||!BE.call(a,a.previous)||Sy(a.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(p))}function f(p){return tv(p)?(e.consume(p),f):p===64?(e.consume(p),m):n(p)}function m(p){return p===46?e.check(Gq,v,h)(p):p===45||p===95||Tn(p)?(o=!0,e.consume(p),m):v(p)}function h(p){return e.consume(p),s=!0,m}function v(p){return o&&s&&Ln(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function Xq(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!UE.call(a,a.previous)||Sy(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Qq,e.attempt(OE,e.attempt(DE,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function Jq(e,t,n){const a=this;let s="",o=!1;return c;function c(p){return(p===72||p===104)&&PE.call(a,a.previous)&&!Sy(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(p),e.consume(p),f):n(p)}function f(p){if(Ln(p)&&s.length<5)return s+=String.fromCodePoint(p),e.consume(p),f;if(p===58){const b=s.toLowerCase();if(b==="http"||b==="https")return e.consume(p),m}return n(p)}function m(p){return p===47?(e.consume(p),o?h:(o=!0,m)):n(p)}function h(p){return p===null||uf(p)||Nt(p)||bs(p)||Lf(p)?n(p):e.attempt(OE,e.attempt(DE,v),n)(p)}function v(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function Wq(e,t,n){let a=0;return s;function s(c){return(c===87||c===119)&&a<3?(a++,e.consume(c),s):c===46&&a===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function e7(e,t,n){let a,s,o;return c;function c(h){return h===46||h===95?e.check(ME,m,f)(h):h===null||Nt(h)||bs(h)||h!==45&&Lf(h)?m(h):(o=!0,e.consume(h),c)}function f(h){return h===95?a=!0:(s=a,a=void 0),e.consume(h),c}function m(h){return s||a||!o?n(h):t(h)}}function t7(e,t){let n=0,a=0;return s;function s(c){return c===40?(n++,e.consume(c),s):c===41&&a<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(ME,t,o)(c):c===null||Nt(c)||bs(c)?t(c):(e.consume(c),s)}function o(c){return c===41&&a++,e.consume(c),s}}function n7(e,t,n){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),o):f===93?(e.consume(f),s):f===60||f===null||Nt(f)||bs(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||Nt(f)||bs(f)?t(f):a(f)}function o(f){return Ln(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),a):Ln(f)?(e.consume(f),c):n(f)}}function r7(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return Tn(o)?n(o):t(o)}}function UE(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Nt(e)}function PE(e){return!Ln(e)}function BE(e){return!(e===47||tv(e))}function tv(e){return e===43||e===45||e===46||e===95||Tn(e)}function Sy(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const a7={tokenize:f7,partial:!0};function i7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:u7,continuation:{tokenize:c7},exit:d7}},text:{91:{name:"gfmFootnoteCall",tokenize:o7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:s7,resolveTo:l7}}}}function s7(e,t,n){const a=this;let s=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let c;for(;s--;){const m=a.events[s][1];if(m.type==="labelImage"){c=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!c||!c._balanced)return n(m);const h=Fr(a.sliceSerialize({start:c.end,end:a.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function l7(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...f),e}function o7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return f;function f(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),m}function m(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(p){if(o>999||p===93&&!c||p===null||p===91||Nt(p))return n(p);if(p===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return s.includes(Fr(a.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Nt(p)||(c=!0),o++,e.consume(p),p===92?v:h}function v(p){return p===91||p===92||p===93?(e.consume(p),o++,h):h(p)}}function u7(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,c=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):n(k)}function v(k){if(c>999||k===93&&!f||k===null||k===91||Nt(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=Fr(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return Nt(k)||(f=!0),c++,e.consume(k),k===92?p:v}function p(k){return k===91||k===92||k===93?(e.consume(k),c++,v):v(k)}function b(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(o)||s.push(o),ot(e,w,"gfmFootnoteDefinitionWhitespace")):n(k)}function w(k){return t(k)}}function c7(e,t,n){return e.check(nc,t,e.attempt(a7,t,n))}function d7(e){e.exit("gfmFootnoteDefinition")}function f7(e,t,n){const a=this;return ot(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const c=a.events[a.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function h7(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(c,f){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let h=m;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[m][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},p={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},b=[["enter",v,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",p,f]],w=f.parser.constructs.insideSpan.null;w&&hr(b,b.length,0,Uf(w,c.slice(h+1,m),f)),hr(b,b.length,0,[["exit",p,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",v,f]]),hr(c,h-1,m-h+3,b),m=h+b.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function o(c,f,m){const h=this.previous,v=this.events;let p=0;return b;function b(k){return h===126&&v[v.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),w(k))}function w(k){const j=ql(h);if(k===126)return p>1?m(k):(c.consume(k),p++,w);if(p<2&&!n)return m(k);const N=c.exit("strikethroughSequenceTemporary"),C=ql(k);return N._open=!C||C===2&&!!j,N._close=!j||j===2&&!!C,f(k)}}}class m7{constructor(){this.map=[]}add(t,n,a){p7(this,t,n,a)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const o of s)t.push(o);s=a.pop()}this.map.length=0}}function p7(e,t,n,a){let s=0;if(!(n===0&&a.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...a);return}s+=1}e.map.push([t,n,a])}}function g7(e,t){let n=!1;const a=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=a.length-1;a[o]=a[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function v7(){return{flow:{null:{name:"table",tokenize:y7,resolveAll:b7}}}}function y7(e,t,n){const a=this;let s=0,o=0,c;return f;function f(D){let te=a.events.length-1;for(;te>-1;){const G=a.events[te][1].type;if(G==="lineEnding"||G==="linePrefix")te--;else break}const ae=te>-1?a.events[te][1].type:null,xe=ae==="tableHead"||ae==="tableRow"?z:m;return xe===z&&a.parser.lazy[a.now().line]?n(D):xe(D)}function m(D){return e.enter("tableHead"),e.enter("tableRow"),h(D)}function h(D){return D===124||(c=!0,o+=1),v(D)}function v(D){return D===null?n(D):Ie(D)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),w):n(D):et(D)?ot(e,v,"whitespace")(D):(o+=1,c&&(c=!1,s+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),c=!0,v):(e.enter("data"),p(D)))}function p(D){return D===null||D===124||Nt(D)?(e.exit("data"),v(D)):(e.consume(D),D===92?b:p)}function b(D){return D===92||D===124?(e.consume(D),p):p(D)}function w(D){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(D):(e.enter("tableDelimiterRow"),c=!1,et(D)?ot(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):k(D))}function k(D){return D===45||D===58?N(D):D===124?(c=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),j):P(D)}function j(D){return et(D)?ot(e,N,"whitespace")(D):N(D)}function N(D){return D===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),C):D===45?(o+=1,C(D)):D===null||Ie(D)?M(D):P(D)}function C(D){return D===45?(e.enter("tableDelimiterFiller"),A(D)):P(D)}function A(D){return D===45?(e.consume(D),A):D===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),O):(e.exit("tableDelimiterFiller"),O(D))}function O(D){return et(D)?ot(e,M,"whitespace")(D):M(D)}function M(D){return D===124?k(D):D===null||Ie(D)?!c||s!==o?P(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(D)):P(D)}function P(D){return n(D)}function z(D){return e.enter("tableRow"),$(D)}function $(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),$):D===null||Ie(D)?(e.exit("tableRow"),t(D)):et(D)?ot(e,$,"whitespace")(D):(e.enter("data"),I(D))}function I(D){return D===null||D===124||Nt(D)?(e.exit("data"),$(D)):(e.consume(D),D===92?Z:I)}function Z(D){return D===92||D===124?(e.consume(D),I):I(D)}}function b7(e,t){let n=-1,a=!0,s=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,v,p;const b=new m7;for(;++n<e.length;){const w=e[n],k=w[1];w[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(BS(b,t,m,h,v),v=void 0,m=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,p=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,v={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},b.add(n,0,[["enter",v,t]])),s=k.type==="tableDelimiterRow"?2:v?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],p=Ud(b,t,o,s,void 0,p),o=[0,0,0,0]),c[2]=n)):k.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],p=Ud(b,t,o,s,void 0,p)),o=c,c=[o[1],n,0,0])):k.type==="tableHead"?(f=!0,m=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=n,o[1]!==0?(c[0]=c[1],p=Ud(b,t,o,s,n,p)):c[1]!==0&&(p=Ud(b,t,c,s,n,p)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&BS(b,t,m,h,v),b.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=g7(t.events,n))}return e}function Ud(e,t,n,a,s,o){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},vl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const m=vl(t.events,n[1]);if(o={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=vl(t.events,n[2]),v=vl(t.events,n[3]),p={type:f,start:Object.assign({},h),end:Object.assign({},v)};if(e.add(n[2],0,[["enter",p,t]]),a!==2){const b=t.events[n[2]],w=t.events[n[3]];if(b[1].end=Object.assign({},w[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,j=n[3]-n[2]-1;e.add(k,j,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return s!==void 0&&(o.end=Object.assign({},vl(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function BS(e,t,n,a,s){const o=[],c=vl(t.events,n);s&&(s.end=Object.assign({},c),o.push(["exit",s,t])),a.end=Object.assign({},c),o.push(["exit",a,t]),e.add(n+1,0,o)}function vl(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const x7={name:"tasklistCheck",tokenize:S7};function w7(){return{text:{91:x7}}}function S7(e,t,n){const a=this;return s;function s(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return Nt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):n(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(m)}function f(m){return Ie(m)?t(m):et(m)?e.check({tokenize:k7},t,n)(m):n(m)}}function k7(e,t,n){return ot(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function j7(e){return YN([Kq(),i7(),h7(e),v7(),w7()])}const C7={};function N7(e){const t=this,n=e||C7,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(j7(n)),o.push(Zq()),c.push(Vq(n))}function ky({children:e,className:t}){return u.jsx("div",{className:Te("prose prose-sm max-w-none leading-[1.55] text-[color:inherit]","prose-headings:text-current prose-p:text-current prose-li:text-current prose-strong:text-current prose-em:text-current prose-blockquote:text-current","prose-p:my-2 prose-headings:mt-3 prose-headings:mb-1.5 prose-ul:my-2 prose-ol:my-2 prose-li:my-0.5 prose-pre:my-2 prose-blockquote:my-2 prose-hr:my-3","prose-a:text-[color:var(--accent)] prose-a:no-underline hover:prose-a:underline","prose-code:text-current prose-code:bg-[color:var(--bg-sunken)] prose-code:rounded prose-code:px-1 prose-code:py-0.5 prose-code:text-[0.9em] prose-code:before:content-none prose-code:after:content-none","prose-pre:bg-[color:var(--bg-sunken)] prose-pre:text-current prose-pre:border prose-pre:border-[color:var(--border)]","prose-hr:border-[color:var(--border)]","prose-blockquote:border-l-[color:var(--border-strong)] prose-blockquote:text-[color:var(--fg-2)]","prose-th:border-[color:var(--border)] prose-td:border-[color:var(--border)]",t),children:u.jsx(dF,{remarkPlugins:[N7,SF],children:e})})}function E7({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[o,c]=x.useState(!1),f=x.useRef(null),m=e!==t;return x.useEffect(()=>{var h;o&&((h=f.current)==null||h.focus())},[o]),u.jsxs(tn,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[u.jsxs(Or,{children:[u.jsxs(Dr,{children:["System prompt append",m&&u.jsx(_7,{})]}),!o&&!s&&u.jsxs(he,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[u.jsx(Cf,{className:"h-3 w-3"})," Edit"]})]}),u.jsx(Rn,{children:o?u.jsxs("div",{className:"space-y-2",children:[u.jsx("textarea",{ref:f,value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),c(!1))},rows:10,className:"w-full rounded border bg-transparent p-2 font-mono text-body shadow-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Appended to Claude Code's default system prompt.",maxLength:32e3,spellCheck:!1}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(he,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),u.jsx(he,{size:"xs",onClick:()=>c(!1),children:"Done"})]}),u.jsx("p",{className:"text-caption text-muted-foreground",children:"`Done` collapses this editor. The change is saved only when you click Save in the bar at the bottom of the page."})]}):u.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?u.jsx(ky,{children:e}):u.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function _7(){return u.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})}const $E={"claude-code":"Claude Code",codex:"Codex"},T7=[lf.CLAUDE_CODE,lf.CODEX];function R7({open:e,onOpenChange:t,agent:n}){const a=nn(),s=n.clientId,o=n.runtimeProvider,[c,f]=x.useState(s),[m,h]=x.useState(o),[v,p]=x.useState(!1),w=He({queryKey:["clients-rebind"],queryFn:Ei,enabled:e}).data??[],k=iR({queries:w.map(I=>({queryKey:["client-capabilities",I.id],queryFn:()=>Rv(I.id),enabled:e}))}),j=x.useMemo(()=>{const I=new Map;return k.forEach((Z,D)=>{const te=w[D];if(!te)return;const ae=Z.data;ae!=null&&ae.capabilities&&I.set(te.id,ae.capabilities)}),I},[k,w]);x.useEffect(()=>{e||(f(s),h(o),p(!1))},[e,s,o]);const N=c?j.get(c)??null:null,C=(N==null?void 0:N[m])??null,A=!C||C.state==="missing"||C.state==="error",O=!!c&&(c!==s||m!==o)&&(!A||v),M=m!==o,P=c!==s,z=St({mutationFn:()=>{if(!c)throw new Error("clientId required");return CM(n.uuid,{clientId:c,runtimeProvider:m,force:A&&v?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),$=z.error instanceof Ku||z.error instanceof Error?z.error.message:null;return u.jsx(ln,{open:e,onOpenChange:t,children:u.jsxs(en,{className:"max-w-lg",children:[u.jsx(fn,{children:u.jsx(on,{children:"Re-bind agent"})}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",u.jsx("span",{className:"mono",children:z7(s,w,o)})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{children:"Computer"}),u.jsx("select",{value:c??"",onChange:I=>f(I.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:w.map(I=>u.jsx("option",{value:I.id,children:A7(I)},I.id))})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{children:"Runtime"}),u.jsx("div",{className:"space-y-2",children:T7.map(I=>{const Z=(N==null?void 0:N[I])??null,D=!!Z&&Z.state!=="missing",te=m===I;return u.jsxs("label",{className:te?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":D?"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30":"flex items-start gap-3 rounded-md border border-border p-3 opacity-60",children:[u.jsx("input",{type:"radio",name:"rebind-runtime",checked:te,onChange:()=>h(I),className:"mt-1"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",children:$E[I]}),u.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:D7(Z,I)})]})]},I)})})]}),(P||M)&&u.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[u.jsxs("p",{children:[u.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),M&&u.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),A&&u.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[u.jsx("input",{type:"checkbox",checked:v,onChange:I=>p(I.target.checked),className:"mt-0.5"}),u.jsx("span",{children:"Override capability check — pick this if the destination computer is offline or the SDK was just installed and capabilities haven't refreshed yet."})]}),$&&u.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:$})]}),u.jsxs(Pn,{children:[u.jsx(he,{variant:"outline",onClick:()=>t(!1),disabled:z.isPending,children:"Cancel"}),u.jsx(he,{onClick:()=>z.mutate(),disabled:!O||z.isPending,children:z.isPending?"Re-binding…":"Re-bind"})]})]})})}function A7(e){return`${e.hostname??e.id} · ${e.status}`}function z7(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${$E[n]}`}const O7={"claude-code":"Run `claude login` (or set ANTHROPIC_API_KEY) on the computer.",codex:"Run `codex login` (or set CODEX_API_KEY) on the computer."};function D7(e,t){if(!e)return"Not reported on this computer.";switch(e.state){case"ok":return`Installed${e.sdkVersion?` v${e.sdkVersion}`:""}, authenticated.`;case"unauthenticated":return`Installed${e.sdkVersion?` v${e.sdkVersion}`:""}, not authenticated. ${O7[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const M7={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function I7(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length;return u.jsx("div",{className:"sticky bottom-0 z-30 -mx-6 backdrop-blur",style:{padding:"var(--sp-3) var(--sp-6)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderTop:"var(--hairline) solid var(--border)"},children:u.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[u.jsxs("div",{className:"flex flex-col gap-1 text-body min-w-0",children:[e.summary.anyDirty&&u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsx(gu,{state:"blocked",size:8}),u.jsxs("span",{className:"font-medium",children:[t," section",t===1?"":"s"," with unsaved changes"]}),u.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"·"}),u.jsx("span",{className:"flex flex-wrap gap-1",children:e.summary.dirtySections.map(n=>u.jsx("button",{type:"button",onClick:()=>e.onJumpTo(n),className:"text-caption transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",color:"var(--fg-2)",cursor:"pointer"},children:M7[n]},n))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&u.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[u.jsx(Un,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&u.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&u.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&u.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),u.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&u.jsx(he,{variant:"outline",size:"sm",onClick:e.onReloadRemote,children:"Discard mine, load latest"}),u.jsx(he,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),u.jsx(he,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?u.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[u.jsx(Uz,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})})}function xu(e){return`agent-cfg-${e}`}function du({anchorId:e,title:t,caption:n,right:a,children:s,className:o,sectionProps:c}){return u.jsxs("section",{id:e,className:Te("space-y-3",o),...c,children:[u.jsxs("div",{className:"flex items-end justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"text-subtitle",style:{color:"var(--fg)"},children:t}),n&&u.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:n})]}),a]}),u.jsx("div",{className:"space-y-3",children:s})]})}function L7(){return u.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const U7={"claude-code":{name:"Claude Code",caption:"Anthropic's Claude Code runtime. Re-bind via the agent's settings to switch computer or runtime."},codex:{name:"Codex",caption:"OpenAI's Codex CLI runtime. Re-bind via the agent's settings to switch computer or runtime."}};function P7(e){const t=U7[e.runtimeProvider];return u.jsxs("div",{className:"space-y-3",children:[u.jsx(B7,{name:t.name,caption:t.caption,locked:!0}),u.jsx($7,{computerLabel:e.computerLabel,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function B7({name:e,caption:t,locked:n}){return u.jsxs(tn,{children:[u.jsx(Or,{children:u.jsxs(Dr,{children:["Where it runs",n&&u.jsxs("span",{className:"mono uppercase text-caption inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[u.jsx(uj,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),u.jsxs(Rn,{className:"space-y-1 text-body",children:[u.jsxs("div",{className:"inline-flex items-center gap-2",children:[u.jsx(cj,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--accent)"}}),u.jsx("span",{className:"font-medium",children:e})]}),u.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:t})]})]})}function $7(e){const t=!!e.computerLabel;return u.jsxs(tn,{children:[u.jsxs(Or,{children:[u.jsx(Dr,{children:"Bound computer"}),e.canBindComputer&&e.onBindComputer&&!t&&u.jsxs(he,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,children:[u.jsx(Rg,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),t&&e.onRebind&&u.jsxs(he,{size:"xs",variant:"outline",onClick:e.onRebind,children:[u.jsx(Rg,{className:"h-3 w-3"}),"Re-bind"]})]}),u.jsx(Rn,{className:"text-body",children:t?u.jsx("div",{className:"mono",style:{color:"var(--fg-2)"},children:e.computerLabel}):u.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"No computer bound. A computer claims this agent on its first WebSocket connect, or you can pick one manually via the button above."})})]})}function F7(e){return e.isUnclaimed?"Saving: configuration stored; will apply when a computer claims this agent.":e.isOffline?"Saving: configuration stored; will apply when the computer reconnects.":e.activeSessions>0?`Saving: new chats use this immediately; ${e.activeSessions} active chat${e.activeSessions===1?"":"s"} switch on their next message.`:"Saving: new chats use this immediately."}function q7(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function H7(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Hp(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function $S(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:H7(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Zp(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],c=new Set(o.map(h=>h.key)),f=q7(n,c),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:$S(m)}}),update:(a,s)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:$S(f)}}),remove:a=>t(s=>{const c=s[e].map(f=>f.key!==a?f:f.baseline==null?null:{...f,status:"deleted"}).filter(f=>f!==null);return{...s,[e]:c}}),undo:a=>t(s=>{const c=s[e].map(f=>f.key!==a||f.baseline==null?f:{...f,value:f.baseline,status:"unchanged"});return{...s,[e]:c}})}}function Z7(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:Hp(e.payload.mcpServers,"mcp"),env:Hp(e.payload.env,"env"),git:Hp(e.payload.gitRepos,"git")}}function V7(e){const[t,n]=x.useState(null);x.useEffect(()=>{e&&t===null&&n(Z7(e))},[e,t]);const a=t??{promptAppend:"",model:"",mcp:[],env:[],git:[]},s=(e==null?void 0:e.payload.prompt.append)??"",o=(e==null?void 0:e.payload.model)??"",c=a.promptAppend!==s,f=a.model!==o,m=x.useMemo(()=>{const O=[],M=I=>I.reduce((Z,D)=>D.status==="unchanged"?Z:Z+1,0),P=M(a.mcp),z=M(a.env),$=M(a.git);return c&&O.push("prompt"),f&&O.push("model"),P>0&&O.push("mcp"),z>0&&O.push("env"),$>0&&O.push("git"),{anyDirty:O.length>0,dirtySections:O,counts:{prompt:c?1:0,model:f?1:0,mcp:P,env:z,git:$}}},[a,c,f]),h=x.useCallback(O=>{n(M=>M&&O(M))},[]),v=x.useCallback(O=>h(M=>({...M,promptAppend:O})),[h]),p=x.useCallback(()=>h(O=>({...O,promptAppend:s})),[h,s]),b=x.useCallback(O=>h(M=>({...M,model:O})),[h]),w=x.useCallback(()=>h(O=>({...O,model:o})),[h,o]),k=x.useMemo(()=>Zp("mcp",h),[h]),j=x.useMemo(()=>Zp("env",h),[h]),N=x.useMemo(()=>Zp("git",h),[h]),C=x.useCallback(()=>{n(null)},[]),A=x.useCallback(()=>{if(!t||!e)return{};const O={};c&&(O.prompt={append:t.promptAppend}),f&&(O.model=t.model);const M=m.counts.mcp>0,P=m.counts.env>0,z=m.counts.git>0;return M&&(O.mcpServers=t.mcp.filter($=>$.status!=="deleted").map($=>$.value)),P&&(O.env=t.env.filter($=>$.status!=="deleted").map($=>{const I=$.value;return I.sensitive&&I.value===af?{key:I.key,value:af,sensitive:!0}:I})),z&&(O.gitRepos=t.git.filter($=>$.status!=="deleted").map($=>$.value)),O},[t,e,c,f,m]);return{draft:a,summary:m,promptDirty:c,modelDirty:f,setPromptAppend:v,revertPrompt:p,setModel:b,revertModel:w,addMcp:k.add,updateMcp:k.update,deleteMcp:k.remove,undoDeleteMcp:k.undo,addEnv:j.add,updateEnv:j.update,deleteEnv:j.remove,undoDeleteEnv:j.undo,addGit:N.add,updateGit:N.update,deleteGit:N.remove,undoDeleteGit:N.undo,resetAll:C,buildPayloadPatch:A}}const En={overview:"ad-overview",setup:"ad-setup",prompt:xu("prompt"),tools:xu("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function Q7(e){const t=[{key:"overview",label:"Profile",anchor:En.overview}];return e||t.push({key:"setup",label:"Setup",anchor:En.setup},{key:"prompt",label:"Prompt",anchor:En.prompt},{key:"tools",label:"Tools",anchor:En.tools},{key:"advanced",label:"Advanced",anchor:En.advanced}),t.push({key:"danger",label:"Danger zone",anchor:En.danger,divider:!0,danger:!0}),t}function G7(){var gn,ht,Mr,Bn,sc,Ii,Li,Ui,Zr,Pi,La,lc;const t=Hk().uuid??"",n=jn(),a=nn(),s=He({queryKey:["agent",t],queryFn:()=>SM(t),enabled:!!t}),o=He({queryKey:["agent-config",t],queryFn:()=>zN(t),enabled:!!t&&((gn=s.data)==null?void 0:gn.type)!=="human"}),c=He({queryKey:["agent-client-status",t],queryFn:()=>wP(t),enabled:!!t&&((ht=s.data)==null?void 0:ht.type)!=="human"}),f=He({queryKey:["agent-sessions-active",t],queryFn:()=>Tj(t,{state:"active"}),enabled:!!t&&((Mr=s.data)==null?void 0:Mr.type)!=="human"}),m=He({queryKey:["clients"],queryFn:Ei,enabled:!!t&&((Bn=s.data)==null?void 0:Bn.type)!=="human",refetchInterval:3e4}),h=V7(o.data),[v,p]=x.useState(null),[b,w]=x.useState(null),[k,j]=x.useState(!1),N=St({mutationFn:async()=>{if(!o.data)throw new Error("config not loaded");const we=h.buildPayloadPatch();return ON(t,{expectedVersion:o.data.version,payload:we})},onSuccess:we=>{a.setQueryData(["agent-config",t],we),p(null),w(null),j(!0)},onError:we=>{if(j(!1),we instanceof Ku&&we.status===409){w("Someone else saved a newer version while you were editing."),p(null);return}p(we instanceof Error?we.message:String(we))}});x.useEffect(()=>{if(!k)return;const we=setTimeout(()=>j(!1),2500);return()=>clearTimeout(we)},[k]),x.useEffect(()=>{h.summary.anyDirty&&j(!1)},[h.summary.anyDirty]);const C=x.useCallback(()=>{w(null),p(null),a.invalidateQueries({queryKey:["agent-config",t]}),h.resetAll()},[a,t,h]),A=x.useCallback(we=>{const Ye=document.getElementById(we);Ye&&Ye.scrollIntoView({behavior:"smooth",block:"start"})},[]),O=St({mutationFn:we=>Sw(t,we),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),M=St({mutationFn:()=>EM(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),P=St({mutationFn:()=>_M(t),onSuccess:()=>a.invalidateQueries({queryKey:["agent",t]})}),z=St({mutationFn:()=>NM(t),onSuccess:()=>n("/team")}),$=St({mutationFn:()=>TM(t)}),[I,Z]=x.useState(!1),[D,te]=x.useState(""),[ae,xe]=x.useState(null),[G,X]=x.useState(!1),q=He({queryKey:["clients"],queryFn:Ei,enabled:I}),ee=St({mutationFn:we=>Sw(t,{clientId:we}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),Z(!1),te(""),xe(null)},onError:we=>xe(we instanceof Error?we.message:String(we))}),[ye,Ae]=x.useState(!1),[R,U]=x.useState(null),B=St({mutationFn:()=>xP(t,h.buildPayloadPatch()),onSuccess:we=>{const Ye=we.diff.length?we.diff.map(vn=>`${vn.op} ${vn.path}`).join(`
386
+ `):"(no changes)";U(Ye)},onError:we=>U(`Dry run failed: ${we instanceof Error?we.message:String(we)}`)});x.useEffect(()=>{if(!h.summary.anyDirty)return;const we=Ye=>{Ye.preventDefault(),Ye.returnValue=""};return window.addEventListener("beforeunload",we),()=>window.removeEventListener("beforeunload",we)},[h.summary.anyDirty]);const T=((sc=s.data)==null?void 0:sc.type)==="human",V=x.useMemo(()=>Q7(T),[T]),W=x.useRef(null),[ce,be]=x.useState(!1);x.useEffect(()=>{if(T)return;const we=W.current;if(!we||typeof IntersectionObserver>"u")return;const Ye=new IntersectionObserver(vn=>{const aa=vn[0];aa&&be(!aa.isIntersecting&&aa.boundingClientRect.top<0)},{threshold:0});return Ye.observe(we),()=>Ye.disconnect()},[T]);const[ge,fe]=x.useState(En.overview);x.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const we=[];for(const Ye of V){const vn=document.getElementById(Ye.anchor);if(!vn)continue;const aa=new IntersectionObserver(oo=>{for(const oc of oo)oc.isIntersecting&&fe(Ye.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});aa.observe(vn),we.push(aa)}return()=>{for(const Ye of we)Ye.disconnect()}},[V]);const Ge=x.useMemo(()=>{const we=new Set;for(const Ye of h.summary.dirtySections)Ye==="prompt"&&we.add(En.prompt),Ye==="model"&&we.add(En.setup),Ye==="mcp"&&we.add(En.tools),(Ye==="env"||Ye==="git")&&we.add(En.advanced);return we},[h.summary.dirtySections]);if(s.isLoading)return u.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:u.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(s.error)return u.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",s.error instanceof Error?s.error.message:"Unknown error"]});const Oe=s.data;if(!Oe)return u.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const jt=Oe.type==="human",ie=c.data,ke=((Ii=f.data)==null?void 0:Ii.length)??0,De=!jt&&!(ie!=null&&ie.clientId),Ke=!jt&&ie?!ie.online&&!!ie.clientId:!1,zn=Oe,On=zn.runtimeState??null,Ma=zn.runtimeType??null,Ia=zn.totalSessions??null,ra=Oe.uuid.slice(0,8),io=F7({activeSessions:ke,isUnclaimed:De,isOffline:Ke}),so=h.draft.mcp.filter(we=>we.status!=="deleted"),mn=h.draft.env.filter(we=>we.status!=="deleted"),lo=h.draft.git.filter(we=>we.status!=="deleted"),oe=we=>new Set(so.filter(Ye=>Ye.key!==we).map(Ye=>Ye.value.name.toLowerCase())),ve=we=>new Set(mn.filter(Ye=>Ye.key!==we).map(Ye=>Ye.value.key)),Pe=we=>new Set(lo.filter(Ye=>Ye.key!==we).map(Ye=>{const{value:vn}=Ye;return vn.localPath?vn.localPath:((vn.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),$e={sessions:Ia??"—",active:ke,runtime:Ma??(jt?"human":"—"),model:((Ui=(Li=o.data)==null?void 0:Li.payload.model)==null?void 0:Ui.trim())||"—"},rt=(ie==null?void 0:ie.clientId)??null,pn=rt?((Zr=m.data)==null?void 0:Zr.find(we=>we.id===rt))??null:null,pr=rt?(pn==null?void 0:pn.hostname)??rt:null,rn=Oe.runtimeProvider??"claude-code",Ht=rn==="codex"?"Codex":"Claude Code";return u.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[u.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:220,borderRight:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",padding:"var(--sp-3) 0"},children:[u.jsx(ny,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),V.map(we=>u.jsxs("div",{children:[we.divider&&u.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),u.jsx(K7,{label:we.label,active:ge===we.anchor,danger:we.danger??!1,dirty:Ge.has(we.anchor),onClick:()=>A(we.anchor)})]},we.key))]}),u.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",style:{background:"var(--bg)"},children:[u.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)"},children:[u.jsxs(SP,{style:{marginBottom:"var(--sp-2)"},children:[u.jsx(kP,{onClick:()=>n("/team"),children:"Agents"}),u.jsx(jP,{}),u.jsx(CP,{mono:!0,children:Oe.name??ra})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"inline-flex items-center justify-center",style:{width:36,height:36,borderRadius:"var(--radius-panel)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)"},children:u.jsx(Wu,{width:18,height:20,style:{color:"var(--accent)"}})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-baseline gap-2",children:[u.jsx("span",{className:"text-title",title:`agt_${ra}`,children:Oe.displayName}),u.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Oe.name??ra]})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[u.jsx(Br,{tone:Oe.type==="autonomous_agent"?"accent":"neutral",children:Oe.type}),Oe.visibility&&u.jsx(Br,{tone:Oe.visibility==="organization"?"accent":"outline",children:Oe.visibility}),(ie==null?void 0:ie.offlineSince)&&u.jsxs("span",{className:"mono",children:["offline since ",Eu(ie.offlineSince)]})]})]}),u.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u.jsx(Du,{state:On}),u.jsxs(he,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Oe.uuid}`),children:[u.jsx(Nv,{className:"h-3 w-3"})," Open chat"]}),!jt&&Oe.status==="active"&&u.jsxs(he,{variant:"outline",size:"xs",onClick:()=>{$.reset(),$.mutate()},disabled:$.isPending,children:[u.jsx(cj,{className:"h-3 w-3"}),$.isPending?"Testing…":"Test"]})]})]}),u.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[u.jsx(Dd,{label:"sessions",value:$e.sessions}),u.jsx(Dd,{label:"active",value:$e.active,accent:typeof $e.active=="number"&&$e.active>0?"var(--accent)":void 0}),u.jsx(Dd,{label:"runtime",value:$e.runtime}),u.jsx(Dd,{label:"model",value:$e.model})]})]}),u.jsx("div",{ref:W,"aria-hidden":!0,style:{height:0}}),!jt&&u.jsx(_P,{runtimeLabel:Ht,computerLabel:pr,visible:ce}),u.jsxs("div",{className:"mx-auto",style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)",maxWidth:960,display:"flex",flexDirection:"column",gap:20},children:[($.data||$.error)&&u.jsx(tH,{result:$.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>$.reset()}),u.jsx(du,{anchorId:En.overview,title:"Profile",right:u.jsxs(he,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${Oe.uuid}`),title:"Manage platform bindings in Integrations",children:[u.jsx(Rg,{className:"h-3 w-3"}),"Manage bindings"]}),children:u.jsx(FP,{agent:Oe,onSave:async we=>{await O.mutateAsync(we)}})}),!jt&&u.jsxs(u.Fragment,{children:[u.jsxs(du,{anchorId:En.setup,title:"Setup",caption:((Pi=o.data)==null?void 0:Pi.version)!=null?u.jsxs("span",{className:"mono",children:["config v",o.data.version,h.summary.anyDirty&&u.jsxs(u.Fragment,{children:[" · ",u.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[o.isLoading&&u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),o.error&&u.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(o.error)]}),o.data&&u.jsx(P7,{runtimeProvider:rn,computerLabel:pr,canBindComputer:De&&Oe.status==="active",bindComputerPending:ee.isPending,onBindComputer:()=>Z(!0),onRebind:Oe.clientId?()=>X(!0):void 0,modelSlot:u.jsx(WP,{value:h.draft.model,baseline:((La=o.data)==null?void 0:La.payload.model)??"",onChange:h.setModel,onRevert:h.revertModel,disabled:Oe.status!=="active",provider:rn})})]}),u.jsx(du,{anchorId:En.prompt,title:"Prompt",children:o.data?u.jsx(E7,{value:h.draft.promptAppend,baseline:((lc=o.data)==null?void 0:lc.payload.prompt.append)??"",onChange:h.setPromptAppend,onRevert:h.revertPrompt,disabled:Oe.status!=="active"}):null}),u.jsx(du,{anchorId:En.tools,title:"Tools",caption:"MCP servers available to this agent",children:o.data?u.jsx(ZP,{items:h.draft.mcp,otherNames:oe,onAdd:h.addMcp,onUpdate:h.updateMcp,onDelete:h.deleteMcp,onUndoDelete:h.undoDeleteMcp,disabled:Oe.status!=="active"}):null}),u.jsx(du,{anchorId:En.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:o.data&&u.jsxs("div",{className:"space-y-4",children:[u.jsx("div",{id:xu("env"),children:u.jsx(MP,{items:h.draft.env,otherKeys:ve,onAdd:h.addEnv,onUpdate:h.updateEnv,onDelete:h.deleteEnv,onUndoDelete:h.undoDeleteEnv,disabled:Oe.status!=="active"})}),u.jsx("div",{id:xu("git"),children:u.jsx(LP,{items:h.draft.git,otherPaths:Pe,onAdd:h.addGit,onUpdate:h.updateGit,onDelete:h.deleteGit,onUndoDelete:h.undoDeleteGit,disabled:Oe.status!=="active"})}),R&&u.jsx("pre",{className:"whitespace-pre-wrap mono text-label",style:{padding:"var(--sp-2)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:R}),h.summary.anyDirty&&u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:u.jsx("button",{type:"button",onClick:()=>B.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:B.isPending,children:B.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),u.jsx(L7,{}),u.jsx(TP,{agent:Oe,suspendPending:M.isPending,reactivatePending:P.isPending,deletePending:z.isPending,onSuspend:()=>M.mutate(),onReactivate:()=>P.mutate(),onDelete:()=>z.mutate()})]}),!jt&&u.jsx(I7,{summary:h.summary,saveHint:io,conflictMessage:b,errorMessage:v,saving:N.isPending,justSaved:k,onSave:()=>N.mutate(),onDiscard:()=>{h.summary.anyDirty&&Ae(!0)},onReloadRemote:C,onJumpTo:we=>A(xu(we))})]}),u.jsx(Y7,{open:ye,onOpenChange:Ae,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{h.resetAll(),p(null),w(null),Ae(!1)}}),u.jsx(ln,{open:I,onOpenChange:we=>{Z(we),we||(te(""),xe(null),ee.reset())},children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:"Bind computer"})}),u.jsxs("div",{className:"space-y-4",children:[u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick a computer you own to pin this agent to. The bind is one-shot — once set, moving the agent requires deleting and re-creating it on the target computer."}),q.isLoading?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):q.error?u.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",q.error instanceof Error?q.error.message:"Unknown"]}):u.jsx(X7,{clients:q.data??[],selected:D,onSelect:te}),ae&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:ae})]}),u.jsxs(Pn,{children:[u.jsx(he,{variant:"outline",onClick:()=>Z(!1),children:"Cancel"}),u.jsx(he,{disabled:!D||ee.isPending,onClick:()=>{xe(null),ee.mutate(D)},children:ee.isPending?"Binding…":"Bind"})]})]})}),u.jsx(R7,{open:G,onOpenChange:X,agent:Oe})]})}function K7({label:e,active:t,danger:n,dirty:a,onClick:s}){return u.jsx("button",{type:"button",onClick:s,className:Te("block w-full text-left bg-transparent text-body transition-colors cursor-pointer","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",t?"":"hover:bg-accent"),style:{padding:"var(--sp-1_25) var(--sp-4) var(--sp-1_25) var(--sp-3_5)",border:"none",borderLeft:`var(--hairline-bold) solid ${t?"var(--accent)":"transparent"}`,background:t?"var(--bg-active)":"transparent",color:t?"var(--fg)":"var(--fg-3)",fontWeight:t?500:400},children:u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"flex-1 truncate",children:e}),a&&u.jsx("span",{role:"img","aria-label":"unsaved changes",style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-blocked)",flexShrink:0}}),n&&!a&&u.jsx("span",{"aria-hidden":!0,style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-error)",flexShrink:0}})]})})}function Y7(e){return u.jsx(ln,{open:e.open,onOpenChange:e.onOpenChange,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:e.title})}),u.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),u.jsx(he,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function X7({clients:e,selected:t,onSelect:n}){const a=e.filter(s=>s.status==="connected");return a.length===0?u.jsxs("div",{className:"text-body",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:"var(--sp-2_5) var(--sp-3)",color:"var(--fg-3)"},children:["No connected computers available. Run"," ",u.jsx("code",{className:"mono text-label",children:"first-tree-hub client connect <url>"})," on the computer that should run this agent, then reopen this dialog."]}):u.jsx("ul",{className:"max-h-64 overflow-y-auto",style:{border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",margin:0,padding:0,listStyle:"none"},children:a.map(s=>{const o=s.id===t,c=s.status==="online"||s.status==="active";return u.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:u.jsxs("button",{type:"button",onClick:()=>n(s.id),className:Te("w-full text-left flex items-center gap-3"),style:{padding:"var(--sp-2) var(--sp-3)",background:o?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer"},children:[u.jsx("span",{className:Te("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:c?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),u.jsxs("span",{className:"flex-1 min-w-0",children:[u.jsx("span",{className:"block text-body truncate font-medium",children:s.hostname??s.id}),u.jsxs("span",{className:"block mono truncate text-caption",style:{color:"var(--fg-4)"},children:[s.id,s.os?` · ${s.os}`:"",s.sdkVersion?` · SDK ${s.sdkVersion}`:""]})]}),u.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:s.status})]})},s.id)})})}const J7={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},W7={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},eH={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function tH({result:e,onDismiss:t}){const n=W7[e.status],a=eH[e.status],s=e.connection;return u.jsx("div",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderLeft:`var(--sp-0_75) solid ${n}`,borderRadius:"var(--radius-panel)",padding:"var(--sp-3) var(--sp-3_5)"},children:u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Br,{tone:a,children:J7[e.status]}),e.responseTime!=null&&u.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),s&&u.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[u.jsx("div",{children:s.runtimeState&&u.jsxs("span",{className:"mono",children:["runtime: ",s.runtimeState]})}),s.client?u.jsxs("div",{children:["Computer: ",s.client.hostname??s.client.id,s.client.os&&` (${s.client.os})`,s.client.sdkVersion&&` · SDK ${s.client.sdkVersion}`]}):u.jsx("div",{children:"No computer bound"}),s.lastSeenAt&&u.jsxs("div",{children:["Last seen: ",new Date(s.lastSeenAt).toLocaleString()]})]}),e.responseContent&&u.jsx("p",{className:"mono whitespace-pre-wrap text-label",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:8,maxHeight:160,overflow:"auto"},children:e.responseContent})]}),u.jsx(he,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function nH(e){var t=0,n=e.children,a=n&&n.length;if(!a)t=1;else for(;--a>=0;)t+=n[a].value;e.value=t}function rH(){return this.eachAfter(nH)}function aH(e,t){let n=-1;for(const a of this)e.call(t,a,++n,this);return this}function iH(e,t){for(var n=this,a=[n],s,o,c=-1;n=a.pop();)if(e.call(t,n,++c,this),s=n.children)for(o=s.length-1;o>=0;--o)a.push(s[o]);return this}function sH(e,t){for(var n=this,a=[n],s=[],o,c,f,m=-1;n=a.pop();)if(s.push(n),o=n.children)for(c=0,f=o.length;c<f;++c)a.push(o[c]);for(;n=s.pop();)e.call(t,n,++m,this);return this}function lH(e,t){let n=-1;for(const a of this)if(e.call(t,a,++n,this))return a}function oH(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,a=t.children,s=a&&a.length;--s>=0;)n+=a[s].value;t.value=n})}function uH(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function cH(e){for(var t=this,n=dH(t,e),a=[t];t!==n;)t=t.parent,a.push(t);for(var s=a.length;e!==n;)a.splice(s,0,e),e=e.parent;return a}function dH(e,t){if(e===t)return e;var n=e.ancestors(),a=t.ancestors(),s=null;for(e=n.pop(),t=a.pop();e===t;)s=e,e=n.pop(),t=a.pop();return s}function fH(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function hH(){return Array.from(this)}function mH(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function pH(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*gH(){var e=this,t,n=[e],a,s,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,a=e.children)for(s=0,o=a.length;s<o;++s)n.push(a[s]);while(n.length)}function FE(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=bH)):t===void 0&&(t=yH);for(var n=new Hl(e),a,s=[n],o,c,f,m;a=s.pop();)if((c=t(a.data))&&(m=(c=Array.from(c)).length))for(a.children=c,f=m-1;f>=0;--f)s.push(o=c[f]=new Hl(c[f])),o.parent=a,o.depth=a.depth+1;return n.eachBefore(qE)}function vH(){return FE(this).eachBefore(xH)}function yH(e){return e.children}function bH(e){return Array.isArray(e)?e[1]:null}function xH(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function qE(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Hl(e){this.data=e,this.depth=this.height=0,this.parent=null}Hl.prototype=FE.prototype={constructor:Hl,count:rH,each:aH,eachAfter:sH,eachBefore:iH,find:lH,sum:oH,sort:uH,path:cH,ancestors:fH,descendants:hH,leaves:mH,links:pH,copy:vH,[Symbol.iterator]:gH};function Vp(e){return e==null?null:wH(e)}function wH(e){if(typeof e!="function")throw new Error;return e}var SH={depth:-1},FS={},Qp={};function kH(e){return e.id}function jH(e){return e.parentId}function CH(){var e=kH,t=jH,n;function a(s){var o=Array.from(s),c=e,f=t,m,h,v,p,b,w,k,j,N=new Map;if(n!=null){const C=o.map((M,P)=>NH(n(M,P,s))),A=C.map(qS),O=new Set(C).add("");for(const M of A)O.has(M)||(O.add(M),C.push(M),A.push(qS(M)),o.push(Qp));c=(M,P)=>C[P],f=(M,P)=>A[P]}for(v=0,m=o.length;v<m;++v)h=o[v],w=o[v]=new Hl(h),(k=c(h,v,s))!=null&&(k+="")&&(j=w.id=k,N.set(j,N.has(j)?FS:w)),(k=f(h,v,s))!=null&&(k+="")&&(w.parent=k);for(v=0;v<m;++v)if(w=o[v],k=w.parent){if(b=N.get(k),!b)throw new Error("missing: "+k);if(b===FS)throw new Error("ambiguous: "+k);b.children?b.children.push(w):b.children=[w],w.parent=b}else{if(p)throw new Error("multiple roots");p=w}if(!p)throw new Error("no root");if(n!=null){for(;p.data===Qp&&p.children.length===1;)p=p.children[0],--m;for(let C=o.length-1;C>=0&&(w=o[C],w.data===Qp);--C)w.data=null}if(p.parent=SH,p.eachBefore(function(C){C.depth=C.parent.depth+1,--m}).eachBefore(qE),p.parent=null,m>0)throw new Error("cycle");return p}return a.id=function(s){return arguments.length?(e=Vp(s),a):e},a.parentId=function(s){return arguments.length?(t=Vp(s),a):t},a.path=function(s){return arguments.length?(n=Vp(s),a):n},a}function NH(e){e=`${e}`;let t=e.length;return nv(e,t-1)&&!nv(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function qS(e){let t=e.length;if(t<2)return"";for(;--t>1&&!nv(e,t););return e.slice(0,t)}function nv(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((n&1)===0)return!0}return!1}function EH(e,t){return e.parent===t.parent?1:2}function Gp(e){var t=e.children;return t?t[0]:e.t}function Kp(e){var t=e.children;return t?t[t.length-1]:e.t}function _H(e,t,n){var a=n/(t.i-e.i);t.c-=a,t.s+=n,e.c+=a,t.z+=n,t.m+=n}function TH(e){for(var t=0,n=0,a=e.children,s=a.length,o;--s>=0;)o=a[s],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function RH(e,t,n){return e.a.parent===t.parent?e.a:n}function Kd(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Kd.prototype=Object.create(Hl.prototype);function AH(e){for(var t=new Kd(e,0),n,a=[t],s,o,c,f;n=a.pop();)if(o=n._.children)for(n.children=new Array(f=o.length),c=f-1;c>=0;--c)a.push(s=n.children[c]=new Kd(o[c],c)),s.parent=n;return(t.parent=new Kd(null,0)).children=[t],t}function zH(){var e=EH,t=1,n=1,a=null;function s(h){var v=AH(h);if(v.eachAfter(o),v.parent.m=-v.z,v.eachBefore(c),a)h.eachBefore(m);else{var p=h,b=h,w=h;h.eachBefore(function(A){A.x<p.x&&(p=A),A.x>b.x&&(b=A),A.depth>w.depth&&(w=A)});var k=p===b?1:e(p,b)/2,j=k-p.x,N=t/(b.x+k+j),C=n/(w.depth||1);h.eachBefore(function(A){A.x=(A.x+j)*N,A.y=A.depth*C})}return h}function o(h){var v=h.children,p=h.parent.children,b=h.i?p[h.i-1]:null;if(v){TH(h);var w=(v[0].z+v[v.length-1].z)/2;b?(h.z=b.z+e(h._,b._),h.m=h.z-w):h.z=w}else b&&(h.z=b.z+e(h._,b._));h.parent.A=f(h,b,h.parent.A||p[0])}function c(h){h._.x=h.z+h.parent.m,h.m+=h.parent.m}function f(h,v,p){if(v){for(var b=h,w=h,k=v,j=b.parent.children[0],N=b.m,C=w.m,A=k.m,O=j.m,M;k=Kp(k),b=Gp(b),k&&b;)j=Gp(j),w=Kp(w),w.a=h,M=k.z+A-b.z-N+e(k._,b._),M>0&&(_H(RH(k,h,p),h,M),N+=M,C+=M),A+=k.m,N+=b.m,O+=j.m,C+=w.m;k&&!Kp(w)&&(w.t=k,w.m+=A-C),b&&!Gp(j)&&(j.t=b,j.m+=N-O,p=h)}return p}function m(h){h.x*=t,h.y=h.depth*n}return s.separation=function(h){return arguments.length?(e=h,s):e},s.size=function(h){return arguments.length?(a=!1,t=+h[0],n=+h[1],s):a?null:[t,n]},s.nodeSize=function(h){return arguments.length?(a=!0,t=+h[0],n=+h[1],s):a?[t,n]:null},s}function OH(e){const t=`?window=${encodeURIComponent(e)}`;return Se.get(`/context-tree/snapshot${t}`)}function to({title:e,subtitle:t,right:n,className:a,style:s,...o}){return u.jsxs("div",{className:Te("flex items-baseline gap-3 shrink-0",a),style:{padding:"var(--sp-4) var(--sp-5) var(--sp-3)",...s},...o,children:[u.jsx("h1",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t&&u.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),u.jsx("div",{style:{flex:1}}),n]})}const HE=[{value:"1d",label:"1 day",summary:"last 1 day"},{value:"7d",label:"7 days",summary:"last 7 days"},{value:"30d",label:"30 days",summary:"last 30 days"}];function DH(){const[e,t]=x.useState("7d"),[n,a]=x.useState(null),[s,o]=x.useState(null),c=He({queryKey:["context-tree-snapshot",e],queryFn:()=>OH(e)}),f=c.data,m=x.useMemo(()=>f?f.updates.find(p=>p.id===n)??f.updates[0]??null:null,[n,f]),h=x.useMemo(()=>f&&m!=null&&m.nodeId?f.nodes.find(p=>p.id===m.nodeId)??null:null,[m,f]),v=s??(m==null?void 0:m.nodeId)??(h==null?void 0:h.id)??null;return x.useEffect(()=>{var p;f&&(n&&f.updates.some(b=>b.id===n)||a(((p=f.updates[0])==null?void 0:p.id)??null))},[n,f]),u.jsxs("div",{className:"-m-6",children:[u.jsx(to,{title:"Context",subtitle:"Team context available to agents, and how it is changing"}),u.jsxs("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:[c.isLoading?u.jsx(BH,{}):null,c.error?u.jsx($H,{message:c.error instanceof Error?c.error.message:"Failed to load"}):null,f&&!c.isLoading?u.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:f.snapshotStatus==="unavailable"?u.jsx(VE,{snapshot:f}):u.jsxs(u.Fragment,{children:[u.jsx(MH,{snapshot:f,window:e,onWindowChange:t}),u.jsx(IH,{snapshot:f,selectedUpdate:m,selectedUpdateNode:h,selectedOverviewNodeId:v,onSelectUpdate:p=>{a(p.id),o(p.nodeId)},onSelectOverviewNode:o})]})}):null]})]})}function MH({snapshot:e,window:t,onWindowChange:n}){const a=e.contextStatus.severity==="ok"?u.jsx(Nz,{size:18}):u.jsx(ws,{size:18}),s=ZH(t);return u.jsx(tn,{children:u.jsx(Rn,{children:u.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-3)"},children:[u.jsxs("div",{className:"flex flex-wrap items-start justify-between",style:{gap:"var(--sp-3)"},children:[u.jsxs("div",{className:"flex items-start",style:{gap:"var(--sp-2)"},children:[u.jsx("span",{style:{color:VH(e.contextStatus.severity),paddingTop:"var(--sp-0_5)"},children:a}),u.jsxs("div",{children:[u.jsx("div",{className:"text-title font-semibold",style:{color:"var(--fg)"},children:e.contextStatus.label}),u.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)",marginTop:"var(--sp-1)"},children:[e.contextStatus.detail??"Agents have a synced team context snapshot available.",e.branch||e.headCommit?u.jsxs(u.Fragment,{children:[" ",u.jsx("span",{style:{color:"var(--fg-3)"},children:"·"})," ",u.jsx("span",{className:"font-medium",children:e.branch??"unknown"}),e.headCommit?`@${e.headCommit.slice(0,7)}`:""]}):null]})]})]}),u.jsxs("fieldset",{className:"flex flex-wrap",style:{gap:"var(--sp-1)"},children:[u.jsx("legend",{className:"sr-only",children:"Context update window"}),HE.map(o=>u.jsx(he,{variant:o.value===t?"default":"outline",size:"sm",onClick:()=>n(o.value),children:o.label},o.value))]})]}),u.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[u.jsx(mu,{label:`${e.summary.changedNodeCount} context updates in the ${s}`,strong:!0}),u.jsx(mu,{label:`Added ${e.summary.addedCount}`,tone:"added"}),u.jsx(mu,{label:`Edited ${e.summary.editedCount}`,tone:"edited"}),u.jsx(mu,{label:`Removed ${e.summary.removedCount}`,tone:"removed"})]})]})})})}function IH({snapshot:e,selectedUpdate:t,selectedUpdateNode:n,selectedOverviewNodeId:a,onSelectUpdate:s,onSelectOverviewNode:o}){const c=f=>{o(f);const m=e.updates.find(h=>h.nodeId===f);m&&s(m)};return u.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:[u.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-[minmax(22rem,0.78fr)_minmax(0,1.22fr)]",style:{gap:"var(--sp-4)",alignItems:"start"},children:[u.jsxs(tn,{children:[u.jsx(Or,{children:u.jsxs("div",{className:"flex flex-col",children:[u.jsx(Dr,{children:"Context Updates"}),u.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:[e.updates.length," team context changes agents may use"]})]})}),u.jsx(Rn,{children:e.updates.length===0?u.jsx(QE,{}):u.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-2)",maxHeight:"min(64vh, 38rem)",overflow:"auto",paddingRight:"var(--sp-0_5)"},children:e.updates.map(f=>u.jsx(LH,{update:f,selected:f.id===(t==null?void 0:t.id),onClick:()=>s(f)},f.id))})})]}),u.jsx(UH,{update:t,node:n,snapshot:e},(t==null?void 0:t.id)??"empty")]}),u.jsx(PH,{snapshot:e,selectedNodeId:a,onSelectNode:c})]})}function LH({update:e,selected:t,onClick:n}){return u.jsxs("button",{type:"button",onClick:n,className:"w-full text-left transition-colors",style:{border:"var(--hairline) solid var(--border)",borderColor:t?"var(--accent)":"var(--border)",borderRadius:"var(--radius-panel)",background:t?"var(--bg-sunken)":"var(--bg)",padding:"var(--sp-3)"},children:[u.jsx("div",{className:"flex items-start justify-between",style:{gap:"var(--sp-2)"},children:u.jsxs("div",{style:{minWidth:0},children:[u.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[u.jsx(ZE,{type:e.changeType}),u.jsx("span",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:YH(e)})]}),u.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["In ",rv(e.path)]})]})}),u.jsxs("div",{className:"flex flex-wrap text-label",style:{color:"var(--fg-3)",gap:"var(--sp-2)",marginTop:"var(--sp-2)"},children:[u.jsx("span",{children:tZ(e.owners)}),e.relatedNodeIds.length>0?u.jsx("span",{children:nZ(e.relatedNodeIds.length)}):null]})]})}function UH({update:e,node:t,snapshot:n}){const[a,s]=x.useState(!1),o=t==null?void 0:t.relatedNodeIds.map(h=>n.nodes.find(v=>v.id===h)).filter(h=>!!h),c=(t==null?void 0:t.sourcePath)??(e==null?void 0:e.path)??null,f=e!=null&&e.sourceCommit?e.sourceCommit.slice(0,7):"no commit",m=e?eZ(e.owners):"No owner";return u.jsxs(tn,{children:[u.jsxs(Or,{children:[u.jsxs("div",{children:[u.jsx(Dr,{children:"Selected Change"}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"What changed, and what agents can use from it"})]}),e?u.jsx(ZE,{type:e.changeType}):null]}),u.jsx(Rn,{children:e?u.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-title font-semibold",style:{color:"var(--fg)"},children:e.title}),u.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["In ",rv(e.path)]})]}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2",style:{gap:"var(--sp-3)"},children:[u.jsx(HS,{label:"What changed",value:XH(e)}),u.jsx(HS,{label:"What agents can use",value:KH(e)})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3",style:{gap:"var(--sp-3)"},children:[u.jsx(Yp,{label:"Change",value:GH(e.changeType)}),u.jsx(Yp,{label:"Context area",value:rZ(e.path)||rv(e.path)}),u.jsx(Yp,{label:e.owners.length>1?"Owners":"Owner",value:m})]}),u.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[minmax(0,1fr)_minmax(16rem,0.7fr)]",style:{gap:"var(--sp-4)"},children:[u.jsx(ZS,{title:"Linked context",items:o&&o.length>0?o.map(h=>h.title||h.path||"root"):["none"]}),u.jsxs("div",{children:[u.jsx(ZS,{title:"Source",items:[c??e.path,f]}),c?u.jsxs("div",{className:"flex flex-wrap",style:{gap:"var(--sp-1)",marginTop:"var(--sp-2)"},children:[u.jsx(he,{variant:"outline",size:"xs",onClick:()=>{s(h=>!h)},children:"Preview source"}),u.jsxs(he,{variant:"ghost",size:"xs",onClick:()=>void navigator.clipboard.writeText(c),children:[u.jsx(jf,{size:14}),"Copy path"]})]}):null]})]}),a?u.jsx("div",{style:{borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:"var(--sp-3)"},children:t!=null&&t.preview?u.jsx(ky,{children:t.preview}):u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No source preview available."})}):null]}):u.jsx(QE,{})})]})}function PH({snapshot:e,selectedNodeId:t,onSelectNode:n}){const a=x.useMemo(()=>qH(e.nodes),[e.nodes]),s=x.useMemo(()=>HH(e.nodes),[e.nodes]),o=Math.max(920,...a.map(f=>f.x+300)),c=Math.max(340,a.length*34);return u.jsxs(tn,{children:[u.jsx(Or,{children:u.jsxs("div",{children:[u.jsxs(Dr,{children:[u.jsx(zz,{size:17}),"Context Tree Overview"]}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"Shows where recent context updates are concentrated across the team tree"})]})}),u.jsx(Rn,{children:a.length===0?u.jsx(VE,{snapshot:e}):u.jsx("div",{style:{overflow:"auto",maxHeight:"min(72vh, 52rem)"},children:u.jsxs("svg",{viewBox:`0 0 ${o} ${c}`,role:"img","aria-label":"Context Tree overview",style:{width:"100%",minWidth:"44rem"},children:[a.map(f=>f.parent?u.jsx("line",{x1:f.parent.x,y1:f.parent.y,x2:f.x,y2:f.y,stroke:"var(--border)",strokeWidth:1},`edge:${f.id}`):null),a.map(f=>{const m=f.id===t,h=s.get(f.id)??0;return u.jsx("foreignObject",{x:f.x-8,y:f.y-12,width:o-f.x+8,height:24,children:u.jsxs("button",{type:"button",onClick:()=>n(f.id),className:"flex w-full items-center text-left text-label",style:{color:"var(--fg)",gap:"var(--sp-2)"},children:[u.jsx("span",{"aria-hidden":"true",style:{width:m?"var(--sp-4)":"var(--sp-3)",height:m?"var(--sp-4)":"var(--sp-3)",borderRadius:"50%",background:iZ(f.changeType,m),border:`${m?"var(--hairline-bold)":"var(--hairline)"} solid ${m?"var(--accent)":"var(--border-strong)"}`,flex:"0 0 auto"}}),u.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.title}),h>0?u.jsx("span",{style:{color:"var(--fg-3)",marginLeft:"auto",paddingRight:"var(--sp-2)"},children:h}):null]})},f.id)})]})})})]})}function mu({label:e,tone:t,strong:n}){return u.jsx("span",{className:`text-label ${n?"font-semibold":"font-medium"}`,style:{color:t?aZ(t):"var(--fg)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",padding:"var(--sp-1) var(--sp-2)"},children:e})}function ZE({type:e}){return u.jsx(mu,{label:QH(e),tone:e})}function Yp({label:e,value:t}){return u.jsxs("div",{children:[u.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:e}),u.jsx("div",{className:"text-body font-semibold",style:{color:"var(--fg)"},children:t})]})}function HS({label:e,value:t}){return u.jsxs("div",{style:{color:"var(--fg-2)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:"var(--sp-3)"},children:[u.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:e}),u.jsx("div",{className:"text-body",children:t})]})}function ZS({title:e,items:t}){return u.jsxs("div",{children:[u.jsx("div",{className:"text-label font-semibold",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:e}),u.jsx("div",{className:"flex flex-wrap",style:{gap:"var(--sp-1)"},children:t.map(n=>u.jsx("span",{className:"text-label",style:{color:"var(--fg-2)",background:"var(--bg-sunken)",borderRadius:"var(--radius-chip)",padding:"var(--sp-1) var(--sp-2)"},children:n},n))})]})}function BH(){return u.jsx(tn,{children:u.jsx(Rn,{children:u.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[u.jsx(Xz,{size:17}),"Loading team context..."]})})})}function $H({message:e}){return u.jsx(tn,{children:u.jsx(Rn,{children:u.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--danger)",gap:"var(--sp-2)"},children:[u.jsx(ws,{size:17}),e]})})})}function VE({snapshot:e}){const t=e.repo?"Context Tree sync unavailable":"Connect Context Tree",n=e.repo?"Hub cannot read the team Context Tree yet. Agents and users will see context here after the server can sync the configured repo.":"Connect a Context Tree repo to show the team knowledge agents can use.",a=e.repo?FH(e.repo):null;return u.jsx(tn,{children:u.jsx(Rn,{children:u.jsxs("div",{className:"flex items-start text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[u.jsx(ws,{size:18,style:{color:"var(--warn)"}}),u.jsxs("div",{children:[u.jsx("div",{className:"font-semibold",style:{color:"var(--fg)"},children:t}),u.jsx("div",{style:{marginTop:"var(--sp-1)"},children:n}),e.repo||e.branch?u.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[a?`Repo: ${a}`:null,e.repo&&e.branch?" · ":null,e.branch?`Branch: ${e.branch}`:null]}):null]})]})})})}function FH(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function QE(){return u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in this time window."})}function qH(e){const t=new Map(e.map(m=>[m.id,m])),n=e.filter(m=>!m.parentId||t.has(m.parentId)).sort((m,h)=>m.path.localeCompare(h.path));if(n.length===0)return[];const a=CH().id(m=>m.id).parentId(m=>m.parentId)(n).sort((m,h)=>m.data.path.localeCompare(h.data.path)),o=zH().nodeSize([34,96])(a).descendants(),c=Math.min(...o.map(m=>m.x));return o.map(m=>({...m.data,x:24+m.y,y:24+m.x-c,parent:null})).map((m,h,v)=>({...m,parent:m.parentId?v.find(p=>p.id===m.parentId)??null:null}))}function HH(e){const t=new Map(e.map(a=>[a.id,a])),n=new Map;for(const a of e){if(!a.changeType)continue;let s=a;for(;s;)n.set(s.id,(n.get(s.id)??0)+1),s=s.parentId?t.get(s.parentId):void 0}return n}function ZH(e){var t;return((t=HE.find(n=>n.value===e))==null?void 0:t.summary)??"last 7 days"}function VH(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function QH(e){return e==="added"?"New":e==="removed"?"Removed":"Updated"}function GH(e){return e==="added"?"New knowledge":e==="removed"?"Removed knowledge":"Updated knowledge"}function KH(e){return e.changeType==="added"?`Agents can use new team knowledge when working on ${e.affectedContextArea}.`:e.changeType==="removed"?`Agents should stop using the old team knowledge for ${e.affectedContextArea}.`:`Agents can use updated team knowledge when working on ${e.affectedContextArea}.`}function YH(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated";return`${t} ${n} ${e.title}`}function XH(e){const t=e.changedBy??"Someone",n=e.changeType==="added"?"added":e.changeType==="removed"?"removed":"updated",a=WH(e);return a?`${t} ${n} ${e.title}: ${a}`:`${t} ${n} ${e.title}.`}function JH(e){return e.summary.replace(/^updated:\s*/i,"")}function WH(e){const t=JH(e);return new Set(["updated this team knowledge","added this team knowledge","removed this team knowledge"]).has(t.toLowerCase())||t.length<12||/[,;:]$/.test(t)?null:t}function eZ(e){return e.length===0?"No owner":e.length===1?e[0]??"No owner":e.join(", ")}function tZ(e){return e.length===0?"Owner not set":e.length===1?`Owner: ${e[0]??"Unknown"}`:`Owners: ${e.join(", ")}`}function nZ(e){return`${e} linked context${e===1?"":"s"}`}function rZ(e){const t=e.split("/").filter(Boolean);return t.length<=1?null:t.slice(0,-1).map(GE).join(" / ")}function rv(e){return e.split("/").filter(Boolean).map(GE).join(" / ")||"root"}function GE(e){return e.replace(/[-_]+/g," ").replace(/\b\w/g,t=>t.toUpperCase()).trim()}function aZ(e){return e==="added"?"var(--ok)":e==="edited"?"var(--warn)":"var(--danger)"}function iZ(e,t){return t?"var(--accent)":e==="added"?"var(--ok)":e==="edited"?"var(--warn)":e==="removed"?"var(--danger)":"var(--bg-raised)"}const no=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Te("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));no.displayName="Card";const ro=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Te("flex flex-col space-y-1.5 p-6",e),...t}));ro.displayName="CardHeader";const ac=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Te("text-subtitle leading-none",e),...t}));ac.displayName="CardTitle";const KE=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Te("text-body text-muted-foreground",e),...t}));KE.displayName="CardDescription";const ao=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Te("p-6 pt-0",e),...t}));ao.displayName="CardContent";const sZ=x.forwardRef(({className:e,...t},n)=>u.jsx("div",{ref:n,className:Te("flex items-center p-6 pt-0",e),...t}));sZ.displayName="CardFooter";function lZ(){const{token:e}=Hk(),t=jn(),{isAuthenticated:n,adoptTokens:a}=kt(),[s,o]=x.useState(null),[c,f]=x.useState(null),[m,h]=x.useState(!1),[v,p]=x.useState(null);if(x.useEffect(()=>{e&&(async()=>{try{const N=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!N.ok){f("This invitation is no longer valid");return}o(await N.json())}catch{f("Network error while loading invitation")}})()},[e]),x.useEffect(()=>{n&&(async()=>{try{const N=await Se.get("/me/organizations"),C=await Se.get("/me"),A=N.find(O=>O.id===C.member.organizationId);p((A==null?void 0:A.displayName)??null)}catch{}})()},[n]),!e)return u.jsx(VS,{message:"Bad invitation URL"});if(c)return u.jsx(VS,{message:"This invitation is no longer valid"});if(!s)return u.jsx(oZ,{});const b=async()=>{h(!0);try{const N=await Se.post("/me/organizations/join",{token:e});await a(N.tokens),nj("invite"),t("/",{replace:!0})}catch(N){f(N instanceof Error?N.message:"Failed to join team")}finally{h(!1)}},w=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,k=n&&v&&v!==s.organizationDisplayName,j=uZ(s.expiresAt);return u.jsx(jy,{children:u.jsxs(no,{className:"w-full max-w-sm",children:[u.jsx(ro,{className:"text-center",children:u.jsxs(ac,{className:"text-title",children:["You're invited to join",u.jsx("br",{}),s.organizationDisplayName]})}),u.jsxs(ao,{className:"space-y-4",children:[k&&u.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[u.jsx(ws,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),u.jsxs("span",{children:["You'll switch from ",u.jsx("span",{className:"font-medium",children:v})," to"," ",u.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?u.jsx(he,{className:"w-full",disabled:m,onClick:b,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):u.jsx(he,{asChild:!0,className:"w-full",children:u.jsxs("a",{href:w,children:[u.jsx(oj,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),j&&u.jsx("p",{className:"text-center text-label",style:{color:j.urgent?"var(--destructive)":"var(--fg-3)"},children:j.text}),u.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",u.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",u.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function jy({children:e}){return u.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[u.jsx("header",{className:"px-4 py-3",children:u.jsxs(Gu,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[u.jsx(jv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),u.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function oZ(){return u.jsx(jy,{children:u.jsxs(no,{className:"w-full max-w-sm",children:[u.jsxs(ro,{className:"text-center",children:[u.jsx("div",{className:"mx-auto h-5 w-2/3 rounded-md",style:{background:"var(--bg-sunken)"}}),u.jsx("div",{className:"mx-auto mt-2 h-5 w-1/2 rounded-md",style:{background:"var(--bg-sunken)"}})]}),u.jsxs(ao,{className:"space-y-4",children:[u.jsx("div",{className:"h-9 w-full rounded-md",style:{background:"var(--bg-sunken)"}}),u.jsx("div",{className:"mx-auto h-3 w-1/3 rounded-md",style:{background:"var(--bg-sunken)"}})]})]})})}function VS({message:e}){return u.jsx(jy,{children:u.jsxs(no,{className:"w-full max-w-sm",children:[u.jsxs(ro,{className:"text-center",children:[u.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:u.jsx(ws,{className:"h-6 w-6"})}),u.jsx(ac,{className:"text-title",children:e})]}),u.jsxs(ao,{className:"space-y-4",children:[u.jsx("p",{className:"text-center text-body text-muted-foreground",children:"It may have expired or been revoked. Ask the team admin for a fresh link."}),u.jsx(he,{asChild:!0,variant:"outline",className:"w-full",children:u.jsxs(Gu,{to:"/",children:[u.jsx(jv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function uZ(e){if(!e)return null;const t=new Date(e).getTime();if(!Number.isFinite(t))return null;const n=t-Date.now();if(n<=0)return null;const a=Math.floor(n/6e4),s=Math.floor(a/60),o=Math.floor(s/24);return o>7?null:o>=1?{text:`Expires in ${o} ${o===1?"day":"days"}`,urgent:!1}:s>=1?{text:`Expires in ${s} ${s===1?"hour":"hours"}`,urgent:!0}:{text:`Expires in ${Math.max(1,a)} ${a===1?"minute":"minutes"}`,urgent:!0}}function cZ(e){if(typeof e!="object"||e===null||!("from"in e))return null;const t=e.from;if(typeof t!="object"||t===null||!("pathname"in t)||typeof t.pathname!="string"||t.pathname==="/login")return null;const n="search"in t&&typeof t.search=="string"?t.search:"",a="hash"in t&&typeof t.hash=="string"?t.hash:"",s=`${t.pathname}${n}${a}`,o=lN(s);return o===Gw&&s!==Gw?null:o}function dZ(){const{isAuthenticated:e}=kt(),t=Jn(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=cZ(t.state)??"/",s=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,o="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?u.jsx(dr,{to:a,replace:!0}):u.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[u.jsx("header",{className:"px-4 py-3",children:u.jsxs(Gu,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[u.jsx(jv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),u.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:u.jsxs(no,{className:"w-full max-w-sm",children:[u.jsxs(ro,{className:"text-center",children:[u.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:u.jsx(Wu,{width:28,height:32})}),u.jsxs(ac,{className:"text-title",children:["First Tree ",u.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),u.jsxs(ao,{className:"space-y-4",children:[u.jsx(he,{asChild:!0,className:"w-full",children:u.jsxs("a",{href:s,children:[u.jsx(oj,{className:"h-4 w-4"}),"Continue with GitHub"]})}),u.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",u.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",u.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[u.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),u.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),u.jsx(he,{asChild:!0,variant:"outline",className:"w-full",children:u.jsxs("a",{href:o,children:[u.jsx(o3,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function fZ(){const e=jn(),{adoptTokens:t}=kt(),[n,a]=x.useState(null);return x.useEffect(()=>{const s=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,o=new URLSearchParams(s),c=o.get("access"),f=o.get("refresh"),m=lN(o.get("next")),h=o.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&nj(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:f}),e(m,{replace:!0})))()},[t,e]),u.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}const Zl=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("table",{ref:a,className:Te("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));Zl.displayName="DenseTable";const Vl=x.forwardRef(({className:e,...t},n)=>u.jsx("thead",{ref:n,className:e,...t}));Vl.displayName="DenseTableHeader";const Ql=x.forwardRef(({className:e,...t},n)=>u.jsx("tbody",{ref:n,className:e,...t}));Ql.displayName="DenseTableBody";const $r=x.forwardRef(({className:e,interactive:t,selected:n,style:a,...s},o)=>u.jsx("tr",{ref:o,className:Te("transition-colors",e),"data-interactive":t?"":void 0,"data-selected":n?"":void 0,style:{background:n?"var(--bg-active)":void 0,cursor:t?"pointer":void 0,...a},...s}));$r.displayName="DenseTableRow";const st=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("th",{ref:a,className:Te("text-left text-label whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3_5)",color:"var(--fg-3)",fontWeight:500,borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));st.displayName="DenseTableHead";const We=x.forwardRef(({className:e,style:t,...n},a)=>u.jsx("td",{ref:a,className:Te("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));We.displayName="DenseTableCell";const hZ=1500;function mZ({command:e,expiresInSeconds:t,phase:n,copyLabel:a={idle:"Copy",done:"Copied"},waitingText:s="Waiting for your computer to connect…",successContent:o,errorContent:c,caption:f="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,v]=x.useState(!1),p=async()=>{e&&(await navigator.clipboard.writeText(e),v(!0),setTimeout(()=>v(!1),hZ))},b=t!==void 0?Math.max(1,Math.round(t/60)):null,w=u.jsx("pre",{className:"mono text-label",style:{margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",minWidth:0,flex:m==="right"?1:void 0},title:e??"",children:e?u.jsxs(u.Fragment,{children:[e,b!==null&&u.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",b,"m"]})]}):"Generating token…"}),k=u.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:p,disabled:!e,style:{alignSelf:"flex-start"},children:[h?u.jsx(Un,{className:"h-3.5 w-3.5"}):u.jsx(jf,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return u.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?u.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[w,k]}):u.jsxs(u.Fragment,{children:[w,k]}),f&&u.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&u.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-blocked) 35%, var(--fg))"},children:[u.jsx(pZ,{}),s]}),n==="success"&&o&&u.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-idle) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-idle) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-idle) 45%, var(--fg))"},children:[u.jsx(Un,{className:"h-3.5 w-3.5",style:{flexShrink:0}}),u.jsx("span",{style:{minWidth:0},children:o})]}),n==="error"&&c&&u.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:c})]})}function pZ(){return u.jsx("span",{"aria-hidden":"true",style:{width:12,height:12,flexShrink:0,borderRadius:"50%",border:"var(--hairline-bold) solid color-mix(in oklch, var(--state-blocked) 30%, transparent)",borderTopColor:"var(--state-blocked)",animation:"spin 0.85s linear infinite"}})}const gZ=3e3,vZ=1200;function yZ({open:e,onOpenChange:t}){const n=nn(),{user:a}=kt(),[s,o]=x.useState("loading"),[c,f]=x.useState(null),[m,h]=x.useState(null),[v,p]=x.useState(null),b=x.useRef(new Set);return x.useEffect(()=>{if(!e){o("loading"),f(null),h(null),p(null),b.current=new Set;return}let w=!1;const k=(n.getQueryData(["clients"])??[]).map(j=>j.id);return b.current=new Set(k),(async()=>{try{const j=await eO();if(w)return;f(j),o("waiting")}catch(j){if(w)return;h(j instanceof Error?j.message:"Failed to generate connect token"),o("error")}})(),()=>{w=!0}},[e,n]),x.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const k=setInterval(async()=>{try{const j=await n.fetchQuery({queryKey:["clients"],queryFn:Ei}),N=b.current,C=j.find(A=>!N.has(A.id)&&A.status==="connected"&&A.userId===a.id);C&&(p(C.hostname??null),o("success"))}catch{}},gZ);return()=>clearInterval(k)},[e,s,n,a]),x.useEffect(()=>{if(s!=="success")return;const w=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},vZ);return()=>clearTimeout(w)},[s,t,n]),u.jsx(ln,{open:e,onOpenChange:t,children:u.jsxs(en,{children:[u.jsxs(fn,{children:[u.jsx(on,{children:"Connect computer"}),u.jsx(Iv,{children:"Run this command on the machine you want to pair with this Hub."})]}),u.jsx(mZ,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:s,successContent:u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"font-semibold",children:v??"Computer"})," connected. Closing…"]}),errorContent:m}),u.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:u.jsx(he,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function bZ({embedded:e=!1}={}){const t=nn(),n=Rf(),[a,s]=x.useState(()=>new Set),[o,c]=x.useState(null),[f,m]=x.useState(null),[h,v]=x.useState(null),[p,b]=x.useState(!1),{data:w}=He({queryKey:["clients"],queryFn:Ei,refetchInterval:1e4}),{data:k}=He({queryKey:["activity"],queryFn:Yu,refetchInterval:1e4}),j=St({mutationFn:W3,onSuccess:()=>{c(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),N=St({mutationFn:J3,onSuccess:()=>{m(null),v(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:z=>{z instanceof Ku?v(z.message):v(z instanceof Error?z.message:String(z))}}),C=x.useMemo(()=>{const z=new Map;for(const $ of(k==null?void 0:k.agents)??[]){if(!$.clientId)continue;const I=z.get($.clientId)??[];I.push($),z.set($.clientId,I)}return z},[k==null?void 0:k.agents]),A=z=>C.get(z)??[],O=(w??[]).filter(z=>z.status==="connected").length,M=(w??[]).reduce((z,$)=>z+$.agentCount,0),P=(w??[]).filter(z=>z.authState!=="ok").length;return u.jsxs("div",{className:e?"":"-m-6",children:[u.jsx(to,{title:"Computers",subtitle:w&&w.length>0?u.jsxs(u.Fragment,{children:[w.length," total · ",O," connected · ",M," agents bound",P>0&&u.jsxs(u.Fragment,{children:[" · ",u.jsxs("span",{style:{color:"var(--state-error)"},children:[P," need re-auth"]})]})]}):null,right:u.jsx("div",{className:"flex items-center gap-1.5",children:u.jsxs(he,{size:"xs",onClick:()=>b(!0),children:[u.jsx(qr,{className:"h-3 w-3"}),"Connect computer"]})})}),u.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[u.jsx(yZ,{open:p,onOpenChange:b}),f&&u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:u.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[u.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),u.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",u.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:f.hostname??f.id.slice(0,8)}),". Retire refuses if any agent is still pinned to this computer — you must delete those agents first (reassign is not available in this milestone)."]}),A(f.id).length>0&&u.jsxs("div",{className:"mb-3 p-2 rounded",style:{background:"color-mix(in oklch, var(--state-blocked) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 28%, transparent)"},children:[u.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),u.jsx("ul",{className:"text-body space-y-0.5",children:A(f.id).map(z=>u.jsx("li",{className:"font-medium",children:n(z.agentId)},z.agentId))})]}),h&&u.jsx("div",{className:"mb-3 p-2 rounded text-body",style:{background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",color:"var(--state-error)"},children:h}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(he,{variant:"outline",size:"sm",onClick:()=>{m(null),v(null)},children:"Cancel"}),u.jsx(he,{variant:"destructive",size:"sm",onClick:()=>N.mutate(f.id),disabled:N.isPending,children:N.isPending?"Retiring…":"Retire"})]})]})}),o&&u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:u.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[u.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),u.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",u.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:o.hostname??o.id.slice(0,8)})," ","and affect all bound agents:"]}),u.jsx("ul",{className:"mb-4 space-y-1",children:A(o.id).length===0?u.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):A(o.id).map(z=>u.jsxs("li",{className:"text-body flex items-center gap-2",children:[u.jsx("span",{className:"font-medium",children:n(z.agentId)}),u.jsx(Du,{state:z.runtimeState})]},z.agentId))}),u.jsxs("div",{className:"flex justify-end gap-2",children:[u.jsx(he,{variant:"outline",size:"sm",onClick:()=>c(null),children:"Cancel"}),u.jsx(he,{variant:"destructive",size:"sm",onClick:()=>j.mutate(o.id),disabled:j.isPending,children:j.isPending?"Disconnecting…":"Disconnect"})]})]})}),!w||w.length===0?u.jsx(tn,{children:u.jsx("div",{className:"text-center py-10 text-body",style:{color:"var(--fg-3)"},children:"No computers connected. Use the button above to generate a connect command."})}):u.jsxs(tn,{children:[u.jsxs(Hg,{children:["Registered · ",w.length]}),u.jsxs(Zl,{children:[u.jsx(Vl,{children:u.jsxs($r,{children:[u.jsx(st,{style:{width:16}}),u.jsx(st,{children:"Hostname"}),u.jsx(st,{children:"OS"}),u.jsx(st,{children:"SDK"}),u.jsx(st,{children:"Agents"}),u.jsx(st,{children:"Connected"}),u.jsx(st,{children:"Status"}),u.jsx(st,{"aria-hidden":!0})]})}),u.jsx(Ql,{children:w.map(z=>{const $=!a.has(z.id),I=A(z.id);return u.jsx(NZ,{client:z,boundAgents:I,isExpanded:$,agentName:n,onToggle:()=>s(Z=>{const D=new Set(Z);return D.has(z.id)?D.delete(z.id):D.add(z.id),D}),onDisconnect:()=>c(z),onRetire:()=>{v(null),m(z)},onReconnect:()=>b(!0)},z.id)})})]})]})]})]})}const xZ={"claude-code":"Claude Code",codex:"Codex"},wZ=[lf.CLAUDE_CODE,lf.CODEX],QS={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},SZ={"claude-code":"Run `claude login` (or set ANTHROPIC_API_KEY) on the computer.",codex:"Run `codex login` (or set CODEX_API_KEY) on the computer."};function kZ({clientId:e,enabled:t}){const{data:n,isLoading:a}=He({queryKey:["client-capabilities",e],queryFn:()=>Rv(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return u.jsxs(u.Fragment,{children:[u.jsx(ny,{style:{display:"block",marginBottom:6},children:"Runtimes"}),a&&!s?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):s&&Object.keys(s).length===0?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Capabilities not yet reported. Reconnect this computer to refresh."}):u.jsx("div",{className:"flex flex-col gap-1",children:wZ.map(o=>u.jsx(jZ,{provider:o,entry:s?s[o]??null:null},o))})]})}function jZ({provider:e,entry:t}){const n=xZ[e];if(!t)return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[u.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",QS[e]]})]});switch(t.state){case"ok":return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[u.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[u.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",SZ[e]]})]});case"missing":return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[u.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",QS[e]]})]});case"error":return u.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[u.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),u.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function CZ(){return u.jsxs("span",{className:"mono inline-flex items-center gap-1.5 uppercase text-caption",style:{color:"var(--state-error)"},children:[u.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--state-error)",display:"inline-block"}}),"AUTH EXPIRED"]})}function NZ({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:o,onRetire:c,onReconnect:f}){const h=e.status!=="connected",v=e.authState!=="ok",p=e.status==="connected"?"idle":"offline";return u.jsxs(u.Fragment,{children:[u.jsxs($r,{interactive:!0,selected:n,onClick:s,children:[u.jsx(We,{style:{width:16},children:u.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:n?u.jsx(Cv,{className:"h-3.5 w-3.5"}):u.jsx(jz,{className:"h-3.5 w-3.5"})})}),u.jsx(We,{className:"font-medium",children:e.hostname??"—"}),u.jsx(We,{style:{color:"var(--fg-3)"},children:e.os??"—"}),u.jsx(We,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),u.jsx(We,{children:u.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),u.jsx(We,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?Eu(e.connectedAt):"—"}),u.jsx(We,{children:v?u.jsx(CZ,{}):u.jsx(Du,{state:p})}),u.jsx(We,{style:{width:1,whiteSpace:"nowrap"},children:u.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[h&&u.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:v?"var(--state-error)":"var(--fg-2)"},onClick:b=>{b.stopPropagation(),f()},children:"Reconnect"}),u.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-2)"},onClick:b=>{b.stopPropagation(),o()},children:"Disconnect"}),u.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-4)"},onClick:b=>{b.stopPropagation(),c()},children:"Retire"})]})})]}),n&&u.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[u.jsx(We,{}),u.jsxs(We,{colSpan:7,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[u.jsx(kZ,{clientId:e.id,enabled:n}),t.length>0&&u.jsxs(u.Fragment,{children:[u.jsxs(ny,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),u.jsx("div",{className:"flex flex-col gap-1",children:t.map(b=>u.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[u.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(b.agentId)}),u.jsx(Du,{state:b.runtimeState}),b.activeSessions!==null&&u.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[b.activeSessions," / ",b.totalSessions??0," sessions"]})]},b.agentId))})]})]})]})]})}function EZ(){return u.jsx(bZ,{embedded:!0})}function _Z(){return Se.get(hn("/adapter-mappings"))}function TZ(e){return Se.post(hn("/adapter-mappings"),e)}function RZ(e){return Se.delete(`/adapter-mappings/${e}`)}function AZ(){return Se.get(hn("/adapters/status"))}function zZ(){return Se.get(hn("/adapters"))}function OZ(e){return Se.post(hn("/adapters"),e)}function DZ(e,t){return Se.patch(`/adapters/${e}`,t)}function MZ(e){return Se.delete(`/adapters/${e}`)}const IZ=Object.values(Y6),GS={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function KS(e){const[t,n]=x.useState(GS),[a,s]=x.useState("");x.useEffect(()=>{e.open&&(n({...GS,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function o(f){if(f.preventDefault(),s(""),e.kind==="user"){if(!t.externalUserId)return;e.onSubmit({kind:"user-create",draft:{platform:t.platform,externalUserId:t.externalUserId,displayName:t.displayName||null}});return}if(t.platform==="feishu"){if(!e.editingId&&(!t.feishuAppId||!t.feishuAppSecret)){s("App ID and App Secret are required");return}}else if(t.platform==="kael"){if(!e.editingId&&(!t.kaelUserId||!t.kaelProjectId)){s("User ID and Project ID are required");return}}else{const h=t.credentialsJson.trim();if(!e.editingId&&!h){s("Credentials are required");return}if(h)try{JSON.parse(h)}catch{s("Invalid JSON");return}}const m=LZ(t);if(!e.editingId&&!m){s("Credentials are required");return}if(e.editingId)e.onSubmit({kind:"bot-update",status:t.status,...m?{credentials:m}:{}});else{if(!m)return;e.onSubmit({kind:"bot-create",draft:{platform:t.platform,status:t.status,credentials:m}})}}const c=e.kind==="user"?`Bind external user → ${e.agentLabel}`:e.editingId?`Edit bot binding · ${e.agentLabel}`:`Bind bot → ${e.agentLabel}`;return u.jsx(ln,{open:e.open,onOpenChange:e.onOpenChange,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:c})}),u.jsxs("form",{onSubmit:o,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"binding-platform",children:"Platform"}),u.jsx("select",{id:"binding-platform",value:t.platform,onChange:f=>n({...t,platform:f.target.value}),disabled:!!e.editingId,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:IZ.map(f=>u.jsx("option",{value:f,children:f},f))})]}),e.kind==="user"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"binding-ext-id",children:"External user ID"}),u.jsx(zt,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"binding-name",children:"Display name (optional)"}),u.jsx(zt,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):u.jsxs(u.Fragment,{children:[t.platform==="feishu"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs(dt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),u.jsx(zt,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs(dt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),u.jsx(zt,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs(dt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),u.jsx(zt,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs(dt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),u.jsx(zt,{id:"kael-project-id",value:t.kaelProjectId,onChange:f=>n({...t,kaelProjectId:f.target.value}),placeholder:"proj_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),!e.editingId&&u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):u.jsxs("div",{className:"space-y-2",children:[u.jsxs(dt,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),u.jsx("textarea",{id:"binding-creds",value:t.credentialsJson,onChange:f=>n({...t,credentialsJson:f.target.value}),rows:4,className:"flex w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body shadow-sm font-mono focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",placeholder:'{"bot_token": "xoxb-...", "signing_secret": "..."}'})]}),a&&u.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"binding-status",children:"Status"}),u.jsxs("select",{id:"binding-status",value:t.status,onChange:f=>n({...t,status:f.target.value}),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[u.jsx("option",{value:"active",children:"active"}),u.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),u.jsx(he,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function LZ(e){if(e.platform==="feishu")return!e.feishuAppId&&!e.feishuAppSecret||!e.feishuAppId||!e.feishuAppSecret?null:{app_id:e.feishuAppId,app_secret:e.feishuAppSecret};if(e.platform==="kael")return!e.kaelUserId&&!e.kaelProjectId||!e.kaelUserId||!e.kaelProjectId?null:{kaelUserId:e.kaelUserId,kaelProjectId:e.kaelProjectId};const t=e.credentialsJson.trim();return t?JSON.parse(t):null}function UZ(){var T;const e=jn(),t=nn(),[n,a]=Sf(),s=n.get("agent"),o=Rf(),c=He({queryKey:["adapters"],queryFn:zZ}),f=He({queryKey:["adapter-mappings"],queryFn:_Z}),m=He({queryKey:["adapter-statuses"],queryFn:AZ,refetchInterval:15e3}),v=((T=He({queryKey:["agents","name-map"],queryFn:()=>Ju({limit:100}),staleTime:3e4}).data)==null?void 0:T.items)??[],p=x.useMemo(()=>{const V=new Map;for(const W of m.data??[])V.set(W.configId,W);return V},[m.data]),b=x.useMemo(()=>{const V=c.data??[];return s?V.filter(W=>W.agentId===s):V},[c.data,s]),w=x.useMemo(()=>{const V=f.data??[];return s?V.filter(W=>W.agentId===s):V},[f.data,s]),k=b.reduce((V,W)=>{var ce;return V+((ce=p.get(W.id))!=null&&ce.connected?1:0)},0),j=b.length-k,N=c.isLoading||f.isLoading,[C,A]=x.useState(null),[O,M]=x.useState(""),[P,z]=x.useState(null),[$,I]=x.useState(null),[Z,D]=x.useState(null),[te,ae]=x.useState(null),xe=St({mutationFn:V=>OZ({platform:V.platform,agentId:V.agentId,credentials:V.credentials,status:V.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),z(null)}}),G=St({mutationFn:V=>{const W={status:V.status};return V.credentials&&(W.credentials=V.credentials),DZ(V.id,W)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),z(null)}}),X=St({mutationFn:MZ,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),q=St({mutationFn:V=>TZ({platform:V.platform,externalUserId:V.externalUserId,agentId:V.agentId,boundVia:"manual",displayName:V.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),I(null)}}),ee=St({mutationFn:RZ,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function ye(V){if(s){V==="bot"?z({agentId:s,editingId:null}):I({agentId:s});return}M(""),A({kind:V})}function Ae(){!C||!O||(C.kind==="bot"?z({agentId:O,editingId:null}):I({agentId:O}),A(null))}function R(V){if(P){if(V.kind==="bot-create")xe.mutate({agentId:P.agentId,platform:V.draft.platform,status:V.draft.status,credentials:V.draft.credentials});else if(V.kind==="bot-update"){if(!P.editingId)return;G.mutate({id:P.editingId,status:V.status,credentials:V.credentials})}}}function U(V){!$||V.kind!=="user-create"||q.mutate({agentId:$.agentId,platform:V.draft.platform,externalUserId:V.draft.externalUserId,displayName:V.draft.displayName})}const B=s?v.find(V=>V.uuid===s):null;return u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",padding:"0 var(--sp-0_5) var(--sp-3)"},children:"Manage how external platforms (Feishu, Slack, Kael) reach your agents. Bot bindings hold encrypted credentials; user bindings map an external user to a human agent in this organization."}),s&&u.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 var(--sp-0_5) var(--sp-3)"},children:[u.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Filtered to"}),u.jsxs("span",{className:"inline-flex items-center gap-1.5 mono text-caption",style:{padding:"var(--sp-0_5) var(--sp-2)",borderRadius:"var(--radius-chip)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border)"},children:[(B==null?void 0:B.displayName)??s,u.jsx("button",{type:"button",onClick:()=>{const V=new URLSearchParams(n);V.delete("agent"),a(V,{replace:!0})},"aria-label":"Clear filter",className:"inline-flex items-center justify-center hover:bg-accent rounded-full",style:{width:14,height:14,border:"none",background:"transparent",cursor:"pointer"},children:u.jsx(Bl,{className:"h-3 w-3"})})]})]}),u.jsxs(tn,{className:"mb-3.5",children:[u.jsxs(Hg,{right:u.jsxs("span",{className:"inline-flex items-center gap-2",children:[u.jsxs("span",{className:"inline-flex items-center gap-3 text-caption",children:[u.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--state-idle)"},children:[u.jsx(gu,{state:"idle",size:6})," ",k," online"]}),u.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[u.jsx(gu,{state:"offline",size:6})," ",j," offline"]})]}),u.jsxs(he,{size:"xs",variant:"outline",onClick:()=>ye("bot"),children:[u.jsx(qr,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",b.length]}),N?u.jsx(Pd,{children:"Loading…"}):b.length?u.jsxs(Zl,{children:[u.jsx(Vl,{children:u.jsxs($r,{children:[u.jsx(st,{children:"Agent"}),u.jsx(st,{children:"Platform"}),u.jsx(st,{children:"Status"}),u.jsx(st,{children:"Connection"}),u.jsx(st,{children:"Created"}),u.jsx(st,{style:{width:96,textAlign:"right"}})]})}),u.jsx(Ql,{children:b.map(V=>{var ce;const W=((ce=p.get(V.id))==null?void 0:ce.connected)??!1;return u.jsxs($r,{interactive:!0,onClick:()=>e(`/agents/${V.agentId}`),children:[u.jsx(We,{children:u.jsx("span",{className:"mono font-medium",children:o(V.agentId)})}),u.jsx(We,{children:u.jsx(Br,{children:V.platform})}),u.jsx(We,{children:u.jsx(Br,{tone:V.status==="active"?"accent":"outline",children:V.status})}),u.jsx(We,{children:u.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[u.jsx(gu,{state:W?"idle":"offline",size:7}),u.jsx("span",{style:{color:"var(--fg-3)"},children:W?"Online":"Offline"})]})}),u.jsx(We,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Eu(V.createdAt)}),u.jsxs(We,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:be=>be.stopPropagation(),children:[u.jsx(he,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>z({agentId:V.agentId,editingId:V.id,initialPlatform:PZ(V.platform),initialStatus:BZ(V.status)}),children:"Edit"}),u.jsx(he,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(V.id),disabled:X.isPending,title:"Delete",children:u.jsx(Nu,{className:"h-3.5 w-3.5"})})]})]},V.id)})})]}):u.jsx(Pd,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),u.jsxs(tn,{children:[u.jsxs(Hg,{right:u.jsxs(he,{size:"xs",variant:"outline",onClick:()=>ye("user"),children:[u.jsx(qr,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",w.length]}),N?u.jsx(Pd,{children:"Loading…"}):w.length?u.jsxs(Zl,{children:[u.jsx(Vl,{children:u.jsxs($r,{children:[u.jsx(st,{children:"Agent"}),u.jsx(st,{children:"Platform"}),u.jsx(st,{children:"External user ID"}),u.jsx(st,{children:"Display name"}),u.jsx(st,{children:"Bound via"}),u.jsx(st,{children:"Created"}),u.jsx(st,{style:{width:32}})]})}),u.jsx(Ql,{children:w.map(V=>u.jsxs($r,{interactive:!0,onClick:()=>e(`/agents/${V.agentId}`),children:[u.jsx(We,{children:u.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(V.agentId)})}),u.jsx(We,{children:u.jsx(Br,{children:V.platform})}),u.jsx(We,{children:u.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:V.externalUserId})}),u.jsx(We,{style:{color:"var(--fg-2)"},children:V.displayName??"—"}),u.jsx(We,{children:u.jsx(Br,{tone:"outline",children:V.boundVia??"—"})}),u.jsx(We,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Eu(V.createdAt)}),u.jsx(We,{onClick:W=>W.stopPropagation(),children:u.jsx(he,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ae(V.id),disabled:ee.isPending,title:"Delete",children:u.jsx(Nu,{className:"h-3.5 w-3.5"})})})]},V.id))})]}):u.jsx(Pd,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),u.jsx($Z,{open:C!=null,kind:(C==null?void 0:C.kind)??"bot",agents:v,agentId:O,onAgentChange:M,onCancel:()=>A(null),onConfirm:Ae}),u.jsx(KS,{open:P!=null,kind:"bot",editingId:(P==null?void 0:P.editingId)??null,initialPlatform:P==null?void 0:P.initialPlatform,initialStatus:P==null?void 0:P.initialStatus,agentLabel:P?o(P.agentId):"",pending:xe.isPending||G.isPending,errorMessage:(xe.error??G.error)instanceof Error?(xe.error??G.error).message:null,onOpenChange:V=>{V||(z(null),xe.reset(),G.reset())},onSubmit:R}),u.jsx(KS,{open:$!=null,kind:"user",editingId:null,agentLabel:$?o($.agentId):"",pending:q.isPending,errorMessage:q.error instanceof Error?q.error.message:null,onOpenChange:V=>{V||(I(null),q.reset())},onSubmit:U}),u.jsx(YS,{open:Z!=null,onOpenChange:V=>!V&&D(null),title:"Remove this bot binding?",description:"The bot will stop routing to this agent and any platform credentials stored here will be dropped.",confirmLabel:"Remove binding",pending:X.isPending,onConfirm:()=>{Z!=null&&(X.mutate(Z),D(null))}}),u.jsx(YS,{open:te!=null,onOpenChange:V=>!V&&ae(null),title:"Remove this binding?",description:"The external user will stop routing to this agent. You can add the mapping again later.",confirmLabel:"Remove binding",pending:ee.isPending,onConfirm:()=>{te!=null&&(ee.mutate(te),ae(null))}})]})}function PZ(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function BZ(e){return e==="inactive"?"inactive":"active"}function Pd({children:e}){return u.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function $Z(e){const t=e.kind==="user"?e.agents.filter(n=>n.type==="human"&&n.status==="active"):e.agents.filter(n=>n.type!=="human"&&n.status==="active");return u.jsx(ln,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),u.jsxs("select",{value:e.agentId,onChange:n=>e.onAgentChange(n.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[u.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>u.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),u.jsxs(Pn,{children:[u.jsx(he,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),u.jsx(he,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function YS(e){return u.jsx(ln,{open:e.open,onOpenChange:e.onOpenChange,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:e.title})}),u.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),u.jsx(he,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function FZ({embedded:e=!1}={}){return u.jsxs("div",{className:e?"":"-m-6",children:[u.jsx(to,{title:"Integrations",subtitle:"External platform bindings"}),u.jsx("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:u.jsx(UZ,{})})]})}function qZ(){return u.jsx(FZ,{embedded:!0})}function HZ(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n,restoreOnboarding:a}=kt(),s=!!t,o=e==="completed";return u.jsxs("div",{children:[u.jsx(to,{title:"Setup",subtitle:"Onboarding guide controls"}),u.jsx("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)",maxWidth:640},children:u.jsxs("div",{style:{padding:"var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)"},children:[u.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",marginBottom:"var(--sp-1)"},children:[u.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Setup guide"}),s?null:u.jsxs("span",{className:"text-label",style:{color:"color-mix(in oklch, var(--accent) 30%, var(--fg))",display:"inline-flex",alignItems:"center",gap:"var(--sp-1)"},children:[u.jsx(Un,{className:"h-3 w-3"}),"Active"]})]}),u.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:s?"The onboarding stepper is hidden. Bring it back if you want to walk through Step 3 (build your context-tree).":"The onboarding stepper is shown above your workspace. You can hide it any time once your agent is set up."}),u.jsx("div",{style:{marginTop:"var(--sp-4)"},children:s?u.jsx(he,{type:"button",onClick:()=>void a(),children:"Resume setup"}):u.jsx(he,{type:"button",variant:"outline",onClick:()=>void n(),disabled:!o,title:o?void 0:"Finish setting up your agent first",children:"Hide setup guide"})})]})})]})}function ZZ(){return u.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[u.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:200,padding:"var(--sp-4) var(--sp-2)"},children:[u.jsx(Xp,{to:"/settings/computers",label:"Computers"}),u.jsx(Xp,{to:"/settings/integrations",label:"Integrations"}),u.jsx(Xp,{to:"/settings/setup",label:"Setup"})]}),u.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:u.jsx(Pl,{})})]})}function Xp({to:e,label:t}){return u.jsx(wf,{to:e,className:({isActive:n})=>Te("block w-full text-left bg-transparent text-body transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",!n&&"hover:bg-accent"),style:{borderRadius:"var(--radius-input)"},children:({isActive:n})=>u.jsx("span",{className:"flex items-center",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:n?"var(--bg-active)":"transparent",color:n?"var(--fg)":"var(--fg-3)",fontWeight:n?500:400,borderRadius:"var(--radius-input)"},children:u.jsx("span",{className:"flex-1 truncate",children:t})})})}function av(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,xl)}const Jp=200;function VZ(e){if(!e||e.length===0)return{};const t={},n=["name","displayName","clientId"];for(const a of e){const s=a.path[0];if(typeof s=="string"&&n.includes(s)){const o=s;t[o]||(t[o]=a.message)}else t._root=a.message}return t}function QZ(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,xl)}function GZ(e){switch(e){case"taken":return"That agent name is already in use in this organization. Pick a different one.";case"reserved":return"That agent name is reserved — pick a different one.";case"invalid":return"Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_)."}}function KZ({open:e,onOpenChange:t,onCreated:n}){const a=nn(),{refreshMe:s,organizationId:o}=kt(),[c,f]=x.useState(""),[m,h]=x.useState(""),[v,p]=x.useState(!1),[b,w]=x.useState("claude-code"),[k,j]=x.useState("form"),[N,C]=x.useState([]),[A,O]=x.useState(null),[M,P]=x.useState(!1),[z,$]=x.useState({}),[I,Z]=x.useState({status:"idle"});x.useEffect(()=>{e&&(f(""),h(""),p(!1),w("claude-code"),j("form"),C([]),O(null),P(!1),$({}),Z({status:"idle"}))},[e]),x.useEffect(()=>{v||h(av(c))},[c,v]);const D=x.useRef(0);x.useEffect(()=>{if(!e||!m){Z({status:"idle"});return}if(!$g.test(m)){Z({status:"bad",reason:"invalid"});return}if(Fg(m)){Z({status:"bad",reason:"reserved"});return}const R=++D.current;Z({status:"checking"});const U=window.setTimeout(()=>{jM(m).then(B=>{R===D.current&&(B.available?Z({status:"ok"}):Z({status:"bad",reason:B.reason}))}).catch(()=>{R===D.current&&Z({status:"idle"})})},300);return()=>window.clearTimeout(U)},[m,e]);const te=St({mutationFn:async R=>{const U=c.trim()||m.trim()||"Untitled assistant";return kM({name:m||void 0,type:"personal_assistant",displayName:U,clientId:R.clientId,runtimeProvider:b,...o?{organizationId:o}:{}})},onSuccess:R=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(R,b)}}),ae=x.useMemo(()=>{const R=te.error;if(!R)return{};if(R instanceof Ku){const U=VZ(R.issues);return Object.keys(U).length>0?U:R.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:R.message}}return R instanceof Error?{_root:R.message}:{}},[te.error]),xe=I.status==="bad"?GZ(I.reason):void 0,G={...xe?{name:xe}:{},...ae,...z};function X(){const R={};return m?m.length>xl?R.name=`Agent name must be at most ${xl} characters (got ${m.length}).`:$g.test(m)?Fg(m)&&(R.name="That agent name is reserved — pick a different one."):R.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(R.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Jp&&(R.displayName=`Display name must be at most ${Jp} characters (got ${c.length}).`),R}async function q(R){var B,T;R.preventDefault();const U=X();if($(U),!(Object.keys(U).length>0)&&I.status!=="bad"){P(!0);try{const W=(await Ei()).filter(be=>be.status==="connected");if(W.length===0){te.mutate({clientId:void 0});return}if(W.length===1){te.mutate({clientId:(B=W[0])==null?void 0:B.id});return}const ce=[...W].sort((be,ge)=>ge.lastSeenAt.localeCompare(be.lastSeenAt));C(ce),O(((T=ce[0])==null?void 0:T.id)??null),j("pick-computer")}catch{te.mutate({clientId:void 0})}finally{P(!1)}}}function ee(){A&&te.mutate({clientId:A})}const ye=I.status==="bad",Ae=c.trim().length>0&&!ye&&!te.isPending&&!M;return k==="pick-computer"?u.jsx(ln,{open:e,onOpenChange:t,children:u.jsxs(en,{className:"max-w-lg",children:[u.jsx(fn,{children:u.jsx(on,{children:"Choose a computer"})}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("p",{className:"text-body text-muted-foreground",children:["Multiple computers are online. Pick where ",u.jsx("span",{className:"font-medium",children:c||m})," ","should run:"]}),u.jsx("div",{className:"space-y-2",children:N.map(R=>{const U=A===R.id;return u.jsxs("label",{className:U?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[u.jsx("input",{type:"radio",name:"target-computer",checked:U,onChange:()=>O(R.id),className:"mt-1"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body font-medium truncate",children:R.hostname??R.id}),u.jsxs("div",{className:"text-caption text-muted-foreground",children:[R.os??"unknown OS"," · last seen ",new Date(R.lastSeenAt).toLocaleString()]})]})]},R.id)})}),G.clientId&&u.jsx("p",{className:"text-body text-destructive",children:G.clientId}),G._root&&u.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:G._root})]}),u.jsxs(Pn,{children:[u.jsx(he,{variant:"outline",onClick:()=>j("form"),disabled:te.isPending,children:"Back"}),u.jsx(he,{onClick:ee,disabled:!A||te.isPending,children:te.isPending?"Creating…":"Create"})]})]})}):u.jsx(ln,{open:e,onOpenChange:t,children:u.jsxs(en,{className:"max-w-lg",children:[u.jsx(fn,{children:u.jsx(on,{children:"New Agent"})}),u.jsxs("form",{onSubmit:q,className:"space-y-5",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"new-agent-display-name",children:"Display name"}),u.jsx(zt,{id:"new-agent-display-name",value:c,onChange:R=>{f(R.target.value),z.displayName&&$(U=>({...U,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Jp,"aria-invalid":G.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),u.jsx("p",{id:"new-agent-display-name-help",className:"text-caption text-muted-foreground",children:"How teammates see this agent in chats and lists. Can be changed anytime."}),G.displayName&&u.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:G.displayName})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"new-agent-name",children:"Agent name"}),u.jsxs("div",{className:"flex items-stretch",children:[u.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center px-2 font-mono text-body text-muted-foreground border border-r-0 border-input rounded-l-[var(--radius-input)] bg-muted/40",children:"@"}),u.jsx(zt,{id:"new-agent-name",value:m,onChange:R=>{const U=QZ(R.target.value);h(U),p(!0),z.name&&$(B=>({...B,name:void 0}))},onBlur:R=>{const U=av(R.target.value);U!==m&&h(U)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:xl,"aria-invalid":G.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),u.jsxs("p",{id:"new-agent-name-help",className:"text-caption text-muted-foreground",children:["Used in @mentions and CLI commands. Lowercase letters, digits, hyphens (-), and underscores (_). Up to"," ",xl," characters. Permanent after creation."]}),m&&!G.name&&I.status!=="idle"&&u.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:I.status==="ok"?"var(--state-idle)":I.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[I.status==="checking"&&"Checking availability…",I.status==="ok"&&"Available."]}),G.name&&u.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:G.name})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{children:"Where it runs"}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("label",{className:b==="claude-code"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[u.jsx("input",{type:"radio",name:"runtime",checked:b==="claude-code",onChange:()=>w("claude-code"),className:"mt-1"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",children:"Claude Code"}),u.jsx("div",{className:"text-caption text-muted-foreground",children:"Anthropic's Claude Code on the bound computer. (default)"})]})]}),u.jsxs("label",{className:b==="codex"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[u.jsx("input",{type:"radio",name:"runtime",checked:b==="codex",onChange:()=>w("codex"),className:"mt-1"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",children:"Codex"}),u.jsxs("div",{className:"text-caption text-muted-foreground",children:["OpenAI Codex CLI on the bound computer. Run ",u.jsx("code",{children:"codex login"})," on the host once."]})]})]})]})]}),G._root&&u.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:G._root}),u.jsx(Pn,{children:u.jsx(he,{type:"submit",disabled:!Ae,children:M?"Checking computers…":te.isPending?"Creating…":"Create"})})]})]})})}function ic({children:e,count:t,right:n}){return u.jsxs("div",{className:"flex items-baseline justify-between",style:{padding:"var(--sp-1) var(--sp-1) var(--sp-2)"},children:[u.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[u.jsx("h2",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t!==void 0&&u.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:t})]}),n]})}function YZ(e){const t=new Date(e),n=Date.now(),a=t.getTime()-n;if(a<=0)return`expired ${t.toLocaleDateString()}`;const s=Math.ceil(a/(1440*60*1e3));return`expires ${s===1?"in less than a day":`in ${s} days`} · ${t.toLocaleDateString()}`}function XZ(){const{organizationId:e}=kt(),[t,n]=x.useState(null),[a,s]=x.useState(null),[o,c]=x.useState(!1),[f,m]=x.useState(!1);x.useEffect(()=>{e&&(async()=>{try{const v=await Se.get(K1(e,"/invitations"));n(v)}catch(v){s(v instanceof Error?v.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),s(null);try{const v=await Se.post(K1(e,"/invitations/rotate"));n(v)}catch(v){s(v instanceof Error?v.message:"Failed to rotate invite link")}finally{c(!1)}}};return u.jsxs(no,{children:[u.jsxs(ro,{children:[u.jsx(ac,{children:"Invite link"}),u.jsxs(KE,{children:["Anyone with this link can join your team as a member. Links expire after ",UU," days; rotating revokes the old link instantly and resets the timer."]})]}),u.jsxs(ao,{className:"space-y-3",children:[a&&u.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:a}),t?u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{readOnly:!0,className:"flex-1 rounded-md border bg-muted px-2 py-1 text-label font-mono",value:t.inviteUrl}),u.jsx(he,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),u.jsx(he,{size:"sm",onClick:h,disabled:o,children:o?"Rotating…":"Rotate"})]}),u.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${YZ(t.expiresAt)}`:" · no expiry"]})]}):u.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}const JZ=Object.values(HU);function WZ(){const e=nn(),{memberId:t,role:n}=kt(),a=n==="admin",[s,o]=x.useState(null),{data:c,isLoading:f,error:m}=He({queryKey:["members"],queryFn:ay}),h=St({mutationFn:$P,onSuccess:()=>e.invalidateQueries({queryKey:["members"]})});function v(p){window.confirm("Delete this member? Their human agent will also be deactivated.")&&h.mutate(p)}return u.jsxs(u.Fragment,{children:[u.jsx("section",{children:f?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):m?u.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load members: ",m instanceof Error?m.message:"Unknown error"]}):(c==null?void 0:c.length)===0?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:a?"No members yet — share the Invite link to add teammates.":"No members yet."}):u.jsxs(Zl,{className:"table-fixed",children:[u.jsx(Vl,{children:u.jsxs($r,{children:[u.jsx(st,{style:{width:160},children:"Display name"}),u.jsx(st,{style:{width:140},children:"Username"}),u.jsx(st,{style:{width:120},children:"Role"}),u.jsx(st,{style:{width:150},children:"Created"}),u.jsx(st,{"aria-hidden":!0}),a&&u.jsx(st,{style:{width:80,textAlign:"right"}})]})}),u.jsx(Ql,{children:c==null?void 0:c.map(p=>{const b=t===p.id;return u.jsxs($r,{children:[u.jsxs(We,{children:[u.jsx("span",{className:"font-medium",children:p.displayName}),b&&u.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),u.jsx(We,{children:u.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-3)"},children:["@",p.username]})}),u.jsx(We,{className:"text-label",style:{color:"var(--fg-3)"},children:p.role==="admin"?"Admin":"Member"}),u.jsx(We,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:_j(p.createdAt)}),u.jsx(We,{"aria-hidden":!0}),a&&u.jsx(We,{style:{whiteSpace:"nowrap"},children:u.jsxs("div",{className:"flex gap-0.5 justify-end",children:[u.jsx(he,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>o({id:p.id,username:p.username,displayName:p.displayName,role:p.role}),title:"Edit",children:u.jsx(Cf,{className:"h-3.5 w-3.5"})}),!b&&u.jsx(he,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>v(p.id),disabled:h.isPending,title:"Delete",style:{color:"var(--fg-4)"},children:u.jsx(Nu,{className:"h-3.5 w-3.5"})})]})})]},p.id)})})]})}),u.jsx(eV,{target:s,onClose:()=>o(null),onSaved:()=>{o(null),e.invalidateQueries({queryKey:["members"]})}})]})}function eV({target:e,onClose:t,onSaved:n}){const[a,s]=x.useState(""),[o,c]=x.useState("member"),[f,m]=x.useState(null);x.useEffect(()=>{e&&(s(e.displayName),c(e.role),m(null))},[e]);const h=St({mutationFn:async()=>{if(!e)throw new Error("No target");const b={};return a.trim()&&a!==e.displayName&&(b.displayName=a.trim()),o!==e.role&&(b.role=o),Object.keys(b).length===0?e:BP(e.id,b)},onSuccess:()=>{m(null),n()},onError:b=>{m(b instanceof Error?b.message:String(b))}});function v(b){b.preventDefault(),h.mutate()}const p=e!==null;return u.jsx(ln,{open:p,onOpenChange:b=>b?void 0:t(),children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:"Edit Member"})}),e&&u.jsxs("form",{onSubmit:v,className:"space-y-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{children:"Username"}),u.jsx(zt,{value:e.username,disabled:!0,className:"font-mono"}),u.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"edit-member-display",children:"Display Name"}),u.jsx(zt,{id:"edit-member-display",value:a,onChange:b=>s(b.target.value),required:!0,maxLength:200})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx(dt,{htmlFor:"edit-member-role",children:"Role"}),u.jsx("select",{id:"edit-member-role",value:o,onChange:b=>c(b.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:JZ.map(b=>u.jsx("option",{value:b,children:b},b))}),u.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Demoting the last admin is blocked — every org needs at least one admin to manage members."})]}),f&&u.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),u.jsxs(Pn,{children:[u.jsx(he,{type:"button",variant:"ghost",onClick:t,disabled:h.isPending,children:"Cancel"}),u.jsx(he,{type:"submit",disabled:h.isPending,children:h.isPending?"Saving…":"Save"})]})]})]})})}function tV(){var m;const{role:e}=kt(),t=e==="admin",[n,a]=x.useState(!1),{data:s}=He({queryKey:["members"],queryFn:ay}),o=He({queryKey:["agents","team-page"],queryFn:()=>Ju({limit:100})}),c=(s==null?void 0:s.length)??0,f=(((m=o.data)==null?void 0:m.items)??[]).filter(h=>h.type!=="human").length;return u.jsxs(u.Fragment,{children:[u.jsx(to,{title:"Team",subtitle:`${c} ${c===1?"human":"humans"} and ${f} ${f===1?"agent":"agents"} working together`,right:t&&u.jsxs(he,{size:"xs",variant:"ghost",onClick:()=>a(!0),children:[u.jsx(dj,{className:"h-3 w-3"}),"Invite link"]})}),u.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-5)"},children:[u.jsx(nV,{}),u.jsx(rV,{data:o.data,isLoading:o.isLoading,error:o.error})]}),u.jsx(ln,{open:n,onOpenChange:a,children:u.jsxs(en,{children:[u.jsx(fn,{children:u.jsx(on,{children:"Invite link"})}),u.jsx(XZ,{})]})})]})}function nV(){return u.jsxs("section",{children:[u.jsx(ic,{children:"Humans"}),u.jsx(WZ,{})]})}function rV({data:e,isLoading:t,error:n}){const a=jn(),s=nn(),o=MN(),{memberId:c}=kt(),[f,m]=x.useState(!1),{data:h}=He({queryKey:["activity"],queryFn:Yu,refetchInterval:1e4}),v=x.useMemo(()=>{const w=new Map;for(const k of(h==null?void 0:h.agents)??[])w.set(k.agentId,k);return w},[h==null?void 0:h.agents]),p=x.useMemo(()=>{const w=((e==null?void 0:e.items)??[]).filter(N=>N.type!=="human");if(!c)return w;const k=[],j=[];for(const N of w)(N.managerId===c?k:j).push(N);return[...k,...j]},[e==null?void 0:e.items,c]);function b(w,k){m(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}return u.jsxs(u.Fragment,{children:[u.jsxs("section",{children:[u.jsx(ic,{right:u.jsxs(he,{size:"xs",variant:"ghost",className:"normal-case tracking-normal",onClick:()=>m(!0),children:[u.jsx(qr,{className:"h-3 w-3"}),"New agent"]}),children:"Agents"}),t?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):n?u.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load agents: ",n instanceof Error?n.message:"Unknown error"]}):p.length===0?u.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"No agents yet — create one with “New agent”."}):u.jsxs(Zl,{className:"table-fixed",children:[u.jsx(Vl,{children:u.jsxs($r,{children:[u.jsx(st,{style:{width:160},children:"Display name"}),u.jsx(st,{style:{width:140},children:"Agent name"}),u.jsx(st,{style:{width:150},children:"Type"}),u.jsx(st,{style:{width:160},children:"Managed by"}),u.jsx(st,{style:{width:100},children:"Visibility"}),u.jsx(st,{style:{width:110},children:"Status"}),u.jsx(st,{style:{width:150},children:"Created"})]})}),u.jsx(Ql,{children:p.map(w=>{const k=v.get(w.uuid);return u.jsxs($r,{interactive:!0,onClick:()=>a(`/agents/${encodeURIComponent(w.uuid)}`),children:[u.jsx(We,{children:u.jsx("span",{className:"font-medium",children:w.displayName})}),u.jsx(We,{children:w.name?u.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-3)"},children:["@",w.name]}):u.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:"—"})}),u.jsx(We,{className:"text-label",style:{color:"var(--fg-3)"},children:aV(w.type)}),u.jsxs(We,{className:"text-label",style:{color:"var(--fg-2)"},children:[w.managerId?o(w.managerId):"—",w.managerId&&w.managerId===c&&u.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}),u.jsx(We,{className:"text-label",style:{color:"var(--fg-3)"},children:iV(w.visibility)}),u.jsx(We,{children:u.jsx(Du,{state:(k==null?void 0:k.runtimeState)??null})}),u.jsx(We,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:_j(w.createdAt)})]},w.uuid)})})]})]}),u.jsx(KZ,{open:f,onOpenChange:m,onCreated:b})]})}function aV(e){return e==="autonomous_agent"?"Autonomous agent":e==="personal_assistant"?"Personal assistant":e}function iV(e){return e==="organization"?"Shared":e==="private"?"Private":e}function Ff(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function YE(e){return Se.get(Ff(e,"context_tree"))}function XE(e,t){return Se.put(Ff(e,"context_tree"),t)}function sV(e){return Se.get(Ff(e,"github_integration"))}function lV(e,t){return Se.put(Ff(e,"github_integration"),t)}function oV(){const{organizationId:e}=kt(),t=nn(),n=He({queryKey:["org-setting",e,"context_tree"],queryFn:()=>e?YE(e):Promise.reject(new Error("no org")),enabled:!!e}),[a,s]=x.useState(""),[o,c]=x.useState(""),[f,m]=x.useState(!1);x.useEffect(()=>{n.data&&(s(n.data.repo??""),c(n.data.branch??"main"))},[n.data]);const h=St({mutationFn:()=>{if(!e)throw new Error("organization not loaded");return XE(e,{repo:a.trim()?a.trim():null,branch:o.trim()?o.trim():null})},onSuccess:p=>{t.setQueryData(["org-setting",e,"context_tree"],p),m(!0),setTimeout(()=>m(!1),2e3)}}),v=p=>{p.preventDefault(),h.mutate()};return u.jsxs("section",{children:[u.jsx(ic,{right:u.jsxs("div",{className:"flex items-center gap-1.5",children:[f&&u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent-dim)"},children:"saved"}),u.jsxs(he,{type:"submit",form:"context-tree-form",size:"xs",variant:"outline",disabled:h.isPending||!n.data,children:[u.jsx(Un,{className:"h-3 w-3"}),h.isPending?"Saving…":"Save"]})]}),children:"Context Tree"}),n.isLoading?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-1)"},children:"Loading…"}):n.error?u.jsx("div",{className:"text-body",style:{color:"var(--state-error)",padding:"var(--sp-3) var(--sp-1)"},children:n.error instanceof Error?n.error.message:"Failed to load setting"}):u.jsxs("form",{id:"context-tree-form",onSubmit:v,children:[u.jsx(XS,{label:"Repo URL",hint:"HTTPS URL of the Context Tree git repository for this team.",value:a,onChange:s,mono:!0,placeholder:"https://github.com/your-org/first-tree-context"}),u.jsx(XS,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:o,onChange:c,mono:!0,placeholder:"main"}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",padding:"var(--sp-2) var(--sp-1) 0"},children:"Changes apply to new agent sessions. Members should restart agents to pick up updated tree contents."}),h.error instanceof Error&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:h.error.message})]})]})}function XS({label:e,hint:t,value:n,onChange:a,mono:s,placeholder:o}){return u.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"var(--sp-45) 1fr",padding:"var(--sp-3_5) var(--sp-1)",borderTop:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:t})]}),u.jsx("input",{value:n,onChange:c=>a(c.target.value),placeholder:o,className:`w-full outline-none text-body ${s?"mono":""}`,style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}})]})}function uV(){var N,C;const{organizationId:e}=kt(),t=nn(),n=He({queryKey:["org-setting",e,"github_integration"],queryFn:()=>e?sV(e):Promise.reject(new Error("no org")),enabled:!!e}),[a,s]=x.useState(""),[o,c]=x.useState(!1),[f,m]=x.useState(!1),[h,v]=x.useState(!1);x.useEffect(()=>{n.data},[n.data]);const p=((N=n.data)==null?void 0:N.webhookUrl)??"",b=St({mutationFn:()=>{if(!e)throw new Error("organization not loaded");const A=a.trim();return A.length===0&&!o?Promise.resolve(n.data):lV(e,{webhookSecret:A.length>0?A:null})},onSuccess:A=>{A&&(t.setQueryData(["org-setting",e,"github_integration"],A),s(""),c(!1),m(!0),setTimeout(()=>m(!1),2e3))}}),w=A=>{A.preventDefault(),b.mutate()},k=async()=>{p&&(await navigator.clipboard.writeText(p),v(!0),setTimeout(()=>v(!1),2e3))},j=((C=n.data)==null?void 0:C.webhookSecretConfigured)??!1;return u.jsxs("section",{children:[u.jsx(ic,{right:u.jsxs("div",{className:"flex items-center gap-1.5",children:[f&&u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent-dim)"},children:"saved"}),u.jsxs(he,{type:"submit",form:"github-integration-form",size:"xs",variant:"outline",disabled:b.isPending||!n.data,children:[u.jsx(Un,{className:"h-3 w-3"}),b.isPending?"Saving…":"Save"]})]}),children:"GitHub integration"}),n.isLoading?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-1)"},children:"Loading…"}):n.error?u.jsx("div",{className:"text-body",style:{color:"var(--state-error)",padding:"var(--sp-3) var(--sp-1)"},children:n.error instanceof Error?n.error.message:"Failed to load setting"}):u.jsxs("form",{id:"github-integration-form",onSubmit:w,children:[p?u.jsx(dV,{label:"Webhook URL",hint:"Configure this URL in GitHub repo / org Settings → Webhooks. Never changes.",value:p,rightSlot:u.jsxs(he,{type:"button",size:"xs",variant:"ghost",onClick:k,children:[u.jsx(jf,{className:"h-3 w-3"}),h?"Copied":"Copy"]})}):u.jsx(fV,{label:"Webhook URL",message:"The Hub's public URL is not configured. Please contact your site administrator to enable the GitHub webhook."}),j&&!o?u.jsx(hV,{onReplace:()=>{c(!0),s("")}}):u.jsx(cV,{label:"Webhook secret",hint:"Paste the value you used when configuring the GitHub webhook. Stored encrypted; never echoed back.",value:a,onChange:s,mono:!0,placeholder:o?"Enter new secret":"(none)",type:"password"}),b.error instanceof Error&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:b.error.message})]})]})}function cV({label:e,hint:t,value:n,onChange:a,mono:s,placeholder:o,type:c}){return u.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"var(--sp-45) 1fr",padding:"var(--sp-3_5) var(--sp-1)",borderTop:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:t})]}),u.jsx("input",{value:n,onChange:f=>a(f.target.value),type:c??"text",placeholder:o,className:`w-full outline-none text-body ${s?"mono":""}`,style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}})]})}function dV({label:e,hint:t,value:n,rightSlot:a}){return u.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"var(--sp-45) 1fr",padding:"var(--sp-3_5) var(--sp-1)",borderTop:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:t})]}),u.jsxs("div",{className:"mono text-body flex items-center justify-between gap-2",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg-3)",overflow:"hidden"},children:[u.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n}),a]})]})}function fV({label:e,message:t}){return u.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"var(--sp-45) 1fr",padding:"var(--sp-3_5) var(--sp-1)",borderTop:"var(--hairline) solid var(--border-faint)"},children:[u.jsx("div",{children:u.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e})}),u.jsxs("div",{className:"flex items-start gap-2 text-body",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--state-warning, var(--fg-3))"},children:[u.jsx(ws,{className:"h-4 w-4 shrink-0",style:{marginTop:2}}),u.jsx("span",{children:t})]})]})}function hV({onReplace:e}){return u.jsxs("div",{className:"grid items-center gap-5",style:{gridTemplateColumns:"var(--sp-45) 1fr",padding:"var(--sp-3_5) var(--sp-1)",borderTop:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:"Webhook secret"}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:"Configured. Replace to rotate; webhook signature verification will fail until GitHub is also updated."})]}),u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsx("span",{className:"mono text-body",style:{color:"var(--accent-dim)"},children:"••••••••"}),u.jsx(he,{type:"button",size:"xs",variant:"ghost",onClick:e,children:"Replace"})]})]})}function mV(e){return Se.get(`/orgs/${encodeURIComponent(e)}`)}function pV(e,t){return Se.patch(`/orgs/${encodeURIComponent(e)}`,t)}function gV(){const{organizationId:e}=kt(),t=nn(),n=He({queryKey:["organization",e],queryFn:()=>e?mV(e):Promise.reject(new Error("no org")),enabled:!!e}),[a,s]=x.useState(""),[o,c]=x.useState(!1);x.useEffect(()=>{n.data&&s(n.data.displayName)},[n.data]);const f=St({mutationFn:()=>{if(!e||!n.data)throw new Error("organization not loaded");const h=a.trim();return!h||h===n.data.displayName?Promise.resolve(n.data):pV(e,{displayName:h})},onSuccess:h=>{t.setQueryData(["organization",e],h),t.invalidateQueries({queryKey:["me-organizations"]}),c(!0),setTimeout(()=>c(!1),2e3)}}),m=h=>{h.preventDefault(),f.mutate()};return u.jsxs("section",{children:[u.jsx(ic,{right:u.jsxs("div",{className:"flex items-center gap-1.5",children:[o&&u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent-dim)"},children:"saved"}),u.jsxs(he,{type:"submit",form:"team-identity-form",size:"xs",variant:"outline",disabled:f.isPending||!n.data,children:[u.jsx(Un,{className:"h-3 w-3"}),f.isPending?"Saving…":"Save"]})]}),children:"Team identity"}),n.isLoading?u.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-1)"},children:"Loading…"}):n.error?u.jsx("div",{className:"text-body",style:{color:"var(--state-error)",padding:"var(--sp-3) var(--sp-1)"},children:n.error instanceof Error?n.error.message:"Failed to load team"}):u.jsxs("form",{id:"team-identity-form",onSubmit:m,children:[u.jsx(vV,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:a,onChange:s}),f.error instanceof Error&&u.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:f.error.message})]})]})}function vV({label:e,hint:t,value:n,onChange:a,mono:s,pattern:o}){return u.jsxs("div",{className:"grid items-start gap-5",style:{gridTemplateColumns:"var(--sp-45) 1fr",padding:"var(--sp-3_5) var(--sp-1)",borderTop:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("div",{children:[u.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),u.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:2},children:t})]}),u.jsx("input",{value:n,onChange:c=>a(c.target.value),pattern:o,className:`w-full outline-none text-body ${s?"mono":""}`,style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)"}})]})}function yV(){return u.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[u.jsx(gV,{}),u.jsx(oV,{}),u.jsx(uV,{})]})}function bV(){const{role:e}=kt();return e===null?u.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."}):e!=="admin"?u.jsx(dr,{to:"/team",replace:!0}):u.jsxs(u.Fragment,{children:[u.jsx(to,{title:"Team settings",subtitle:"Identity, Context Tree, GitHub integration"}),u.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:u.jsx(yV,{})})]})}function xV(){const{role:e}=kt();return e!=="admin"?u.jsx(Pl,{}):u.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[u.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:200,padding:"var(--sp-4) var(--sp-2)"},children:[u.jsx(JS,{to:"/team",end:!0,label:"Members"}),u.jsx(JS,{to:"/team/settings",label:"Team settings"})]}),u.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:u.jsx(Pl,{})})]})}function JS({to:e,label:t,end:n}){return u.jsx(wf,{to:e,end:n,className:({isActive:a})=>Te("block w-full text-left bg-transparent text-body transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",!a&&"hover:bg-accent"),style:{borderRadius:"var(--radius-input)"},children:({isActive:a})=>u.jsx("span",{className:"flex items-center",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:a?"var(--bg-active)":"transparent",color:a?"var(--fg)":"var(--fg-3)",fontWeight:a?500:400,borderRadius:"var(--radius-input)"},children:u.jsx("span",{className:"flex-1 truncate",children:t})})})}function hf(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.filter&&t.set("filter",e.filter);const n=t.toString();return Se.get(hn(`/chats${n?`?${n}`:""}`))}function wV(e){return Se.post(hn("/chats"),e)}function SV(e){return Se.post(`/chats/${encodeURIComponent(e)}/read`)}function JE(e,t){return Se.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function kV(e){return Se.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}function jV({active:e,count:t,warn:n,className:a,children:s,style:o,...c}){return u.jsxs("button",{type:"button",className:Te("mono inline-flex items-center gap-1 text-caption leading-[1.6]",a),style:{padding:"var(--sp-0_5) var(--sp-1_75)",borderRadius:3,border:`var(--hairline) solid ${e?"var(--border-strong)":"var(--border)"}`,background:e?"var(--bg-active)":"transparent",color:e?"var(--fg)":"var(--fg-3)",cursor:"pointer",...o},...c,children:[s,t!==void 0&&u.jsx("span",{className:"mono",style:{color:n&&typeof t=="number"&&t>0?"var(--state-error)":"var(--fg-4)"},children:t})]})}const mf="draft";function CV(e){if(!e)return"";const t=new Date(e),a=Date.now()-t.getTime();if(a<6e4)return"now";if(a<60*6e4)return`${Math.round(a/6e4)}m`;if(a<1440*6e4)return`${Math.round(a/36e5)}h`;const s=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),o=c=>{var f;return((f=s.find(m=>m.type===c))==null?void 0:f.value)??""};return`${o("month")}/${o("day")} ${o("hour")}:${o("minute")}`}function NV(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function EV({selectedChatId:e,onSelectChat:t,onNewChat:n}){const[a,s]=x.useState("all"),[o,c]=x.useState(""),[f,m]=x.useState([]),[h,v]=x.useState(!1),[p,b]=x.useState(null),{data:w,isLoading:k}=He({queryKey:["me","chats",a],queryFn:()=>hf({filter:a}),refetchInterval:15e3}),j=()=>{f.length>0&&m([]),b(null)},N=(w==null?void 0:w.rows)??[],C=x.useMemo(()=>[...N,...f],[N,f]),A=x.useMemo(()=>{const I=o.trim().toLowerCase();return I?C.filter(Z=>Z.title.toLowerCase().includes(I)||(Z.lastMessagePreview??"").toLowerCase().includes(I)?!0:Z.participants.map(xe=>xe.displayName.toLowerCase()).join(" ").includes(I)):C},[C,o]),O=async()=>{if(h)return;const I=w==null?void 0:w.nextCursor;if(I){v(!0),b(null);try{const Z=await hf({filter:a,cursor:I});m(D=>[...D,...Z.rows]),P(Z.nextCursor)}catch(Z){b(Z instanceof Error?Z.message:"Failed to load more")}finally{v(!1)}}},[M,P]=x.useState(null),z=(w==null?void 0:w.nextCursor)??null;x.useEffect(()=>{P(z)},[z]);const $=x.useMemo(()=>C.reduce((I,Z)=>I+(Z.unreadMentionCount>0?1:0),0),[C]);return u.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[u.jsxs("div",{className:"shrink-0 flex flex-col",style:{gap:6,padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[u.jsxs("button",{type:"button",onClick:n,className:"w-full inline-flex items-center transition-colors text-body hover:bg-[var(--bg-hover)]",style:{gap:6,padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:e===mf?"var(--bg-active)":"transparent",color:e===mf?"var(--accent)":"var(--fg)",cursor:"pointer",fontWeight:500},title:"New chat",children:[u.jsx(qr,{className:"h-3.5 w-3.5",strokeWidth:2}),"New chat"]}),u.jsxs("div",{className:"flex items-center",style:{gap:8},children:[u.jsx("div",{className:"flex gap-1 shrink-0",children:$>0&&u.jsx(jV,{active:a==="unread",count:$,onClick:()=>{s(a==="unread"?"all":"unread"),j()},children:"unread"})}),u.jsxs("div",{className:"relative",style:{flex:1,minWidth:0},children:[u.jsx(Ev,{className:"h-3 w-3 absolute pointer-events-none",style:{left:4,top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),u.jsx("input",{value:o,onChange:I=>c(I.target.value),placeholder:"Search…",className:"w-full outline-none text-caption",style:{padding:"var(--sp-0_5) var(--sp-1) var(--sp-0_5) var(--sp-5)",background:"transparent",border:"none",color:"var(--fg-2)"}})]})]})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto",children:[k&&A.length===0&&u.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!k&&A.length===0&&u.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:o?"No matches":u.jsxs(u.Fragment,{children:[u.jsx("p",{style:{margin:0},children:"No conversations yet."}),u.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Start with New chat."})]})}),A.map(I=>{const Z=e===I.chatId,D=NV(I),te=D&&D!==I.title?D:"",ae=I.unreadMentionCount>0;return u.jsx("div",{style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:u.jsxs("button",{type:"button",onClick:()=>t(I.chatId),className:Te("w-full text-left transition-colors flex flex-col","hover:bg-[var(--bg-hover)]"),style:{padding:"var(--sp-2) var(--sp-3)",background:Z?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${Z?"var(--accent)":"transparent"}`},children:[u.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[ae&&u.jsx("span",{"aria-label":`${I.unreadMentionCount} unread mentions`,role:"status",style:{width:6,height:6,borderRadius:"50%",background:"var(--state-error)",flexShrink:0,alignSelf:"center"}}),u.jsx("span",{className:"truncate text-subtitle",style:{color:ae?"var(--fg)":"var(--fg-2)",fontWeight:ae?700:500,flex:1,minWidth:0},children:I.title}),I.lastMessageAt&&u.jsx("span",{className:"mono text-caption shrink-0",style:{color:"var(--fg-4)"},children:CV(I.lastMessageAt)})]}),u.jsx("div",{className:"truncate text-body",style:{color:ae?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:te||"—"})]})},I.chatId)}),M&&A.length>0&&u.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[u.jsx("button",{type:"button",onClick:O,disabled:h,className:"w-full text-body mono",style:{padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",color:"var(--fg-2)",cursor:h?"default":"pointer",opacity:h?.6:1},children:h?"Loading…":"Load more"}),p&&u.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:p})]})]})]})}function WE(e){return Se.get(`/chats/${encodeURIComponent(e)}`)}function _V(e,t){return Se.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function pf(e,t){return Se.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function TV(e,t){return Se.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t})}function RV(e){return new Promise((t,n)=>{const a=new FileReader;a.onload=()=>{const s=a.result;if(typeof s!="string"){n(new Error("Unexpected FileReader result"));return}const o=s.indexOf(",");t(o>=0?s.slice(o+1):s)},a.onerror=()=>n(a.error??new Error("FileReader error")),a.readAsDataURL(e)})}function AV(e){return Se.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function zV(e,t){const n=new URLSearchParams;n.set("limit",String(t.limit)),t!=null&&t.cursor&&n.set("cursor",t.cursor);const a=n.toString();return Se.get(`/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}function Cy(e){const t=new Map;for(const a of e)a.displayName&&t.set(a.displayName,(t.get(a.displayName)??0)+1);const n=new Set;for(const[a,s]of t)s>1&&n.add(a);return n}function OV(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function Ny({candidate:e,ambiguous:t}){const n=e.name?`@${e.name}`:"—";return u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"font-medium",children:e.displayName??n}),OV(e,t)&&u.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function DV(e,t){if(t<=0||t>e.length)return null;let n=t-1;for(;n>=0;){const s=e[n];if(s===void 0)return null;if(s==="@")break;if(!/[A-Za-z0-9_-]/.test(s))return null;n--}if(n<0||e[n]!=="@")return null;if(n>0){const s=e[n-1];if(s!==void 0&&/[A-Za-z0-9_.@-]/.test(s))return null}const a=e.slice(n+1,t).toLowerCase();return{triggerIndex:n,query:a}}function MV(e,t){if(!t)return[...e].sort((a,s)=>(a.displayName??a.name??"").localeCompare(s.displayName??s.name??"")).slice(0,8);const n=[];for(const a of e){const s=(a.name??"").toLowerCase(),o=(a.displayName??"").toLowerCase();let c=1/0;s.startsWith(t)?c=0:o.startsWith(t)?c=1:o.includes(t)&&(c=2),c!==1/0&&n.push({c:a,score:c})}return n.sort((a,s)=>a.score-s.score||(a.c.displayName??"").localeCompare(s.c.displayName??"")),n.slice(0,8).map(a=>a.c)}function IV(e,t,n,a){if(!a.name)return null;const s=e.slice(0,t.triggerIndex),o=e.slice(n),c=`@${a.name}`,f=o.length===0||!/\s/.test(o[0]??""),m=f?` ${o}`:o,h=`${s}${c}${m}`,v=s.length+c.length+(f?1:0);return{text:h,cursor:v}}function e_({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[o,c]=x.useState(0),[f,m]=x.useState(null),h=x.useMemo(()=>s?null:DV(e,t),[e,t,s]),v=x.useMemo(()=>h?MV(n,h.query):[],[h,n]),p=h?`${h.triggerIndex}:${h.query}`:"";x.useEffect(()=>{c(0)},[p]),x.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const b=f!==null&&h!==null&&f===h.triggerIndex,w=h!==null&&v.length>0&&!b;function k(){m((h==null?void 0:h.triggerIndex)??null)}function j(C){if(!h)return;const A=IV(e,h,t,C);A&&a(A)}return{trigger:w?h:null,results:w?v:[],highlightIndex:o,handleKey:C=>{if(!w||!h)return!1;if(C.key==="ArrowDown")return C.preventDefault(),c(A=>v.length===0?0:(A+1)%v.length),!0;if(C.key==="ArrowUp")return C.preventDefault(),c(A=>v.length===0?0:(A-1+v.length)%v.length),!0;if(C.key==="Enter"||C.key==="Tab"){const A=v[o]??v[0];return A?(C.preventDefault(),j(A),!0):!1}return C.key==="Escape"?(C.preventDefault(),k(),!0):!1},pick:j,dismiss:k}}function t_({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const o=x.useRef(null);return x.useEffect(()=>{var m;const f=(m=o.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);f==null||f.scrollIntoView({block:"nearest"})},[n]),!e||t.length===0||!s.current?null:u.jsx("div",{ref:o,role:"listbox","aria-label":"Mention suggestions",className:Te("absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg"),style:{bottom:"calc(100% + var(--sp-1))",left:0,minWidth:240,maxWidth:360,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const f=Cy(t);return t.map((m,h)=>{const v=h===n;return u.jsx("button",{type:"button",role:"option","aria-selected":v,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:p=>{p.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:v?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:u.jsx(Ny,{candidate:m,ambiguous:f})},m.agentId)})})()})}function LV({onCreated:e}){const t=nn(),{agentId:n}=kt(),a=Uv(),[s,o]=x.useState([]),[c,f]=x.useState(""),[m,h]=x.useState(0),[v,p]=x.useState(null),[b,w]=x.useState(!1),[k,j]=x.useState(!1),N=x.useRef(null),C=x.useRef(!1),A=x.useRef(null),{data:O}=He({queryKey:["activity"],queryFn:Yu,refetchInterval:15e3}),M=x.useMemo(()=>{const G=(O==null?void 0:O.agents)??[],X=[];for(const q of G){if(n&&q.agentId===n)continue;const ee=a(q.agentId);!ee||!ee.name||X.push({agentId:q.agentId,name:ee.name,displayName:ee.displayName})}return X},[O,a,n]);x.useEffect(()=>{if(C.current||s.length>0||M.length===0)return;const G=PV(M,(O==null?void 0:O.agents)??[]);G&&(o([G]),C.current=!0)},[M,O,s.length]);const P=x.useMemo(()=>{const G=M.map(X=>({agentId:X.agentId,name:X.name}));return sN(c,G)},[c,M]),z=e_({value:c,cursor:m,candidates:M,disabled:b,onSelect:G=>{f(G.text),h(G.cursor),requestAnimationFrame(()=>{const X=N.current;X&&(X.focus(),X.setSelectionRange(G.cursor,G.cursor))})}});x.useEffect(()=>{P.length!==0&&o(G=>{const X=new Set(G);let q=!1;for(const ee of P)X.has(ee)||(X.add(ee),q=!0);return q?[...X]:G})},[P]),x.useEffect(()=>{if(!k)return;const G=X=>{A.current&&(A.current.contains(X.target)||j(!1))};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[k]);const $=St({mutationFn:async({participantIds:G,text:X})=>{const q=await wV({participantIds:G}),ee=X.trim();return ee.length>0&&await pf(q.chatId,ee),q.chatId},onSuccess:G=>{f(""),o([]),C.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(G)},onError:G=>{p(G instanceof Error?G.message:"Failed to create chat")}}),I=x.useMemo(()=>!(b||$.isPending||s.length===0||c.trim().length===0||s.length>=2&&P.length===0),[b,$.isPending,s.length,c,P.length]),Z=x.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&P.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,P.length]),D=async()=>{if(!I)return;const G=Array.from(new Set([...s,...P]));p(null),w(!0);try{await $.mutateAsync({participantIds:G,text:c})}finally{w(!1)}},te=G=>{o(X=>X.filter(q=>q!==G))},ae=G=>{o(X=>X.includes(G)?X:[...X,G]),j(!1)},xe=x.useMemo(()=>M.filter(G=>!s.includes(G.agentId)),[M,s]);return u.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:u.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:u.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[u.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),u.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[u.jsx(UV,{chips:s,candidates:M,chipCandidates:xe,pickerOpen:k,setPickerOpen:j,pickerContainerRef:A,onAdd:ae,onRemove:te}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx(t_,{trigger:z.trigger,results:z.results,highlightIndex:z.highlightIndex,anchorRef:N,onPick:z.pick}),u.jsx("textarea",{ref:N,value:c,onChange:G=>{f(G.target.value),h(G.target.selectionStart??G.target.value.length)},onSelect:G=>{h(G.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:G=>{z.handleKey(G)||G.key==="Enter"&&!G.shiftKey&&(G.preventDefault(),D())},disabled:b||$.isPending,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2) var(--sp-3)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}}),s.length>=2&&P.length===0&&c.trim().length>0&&u.jsxs("div",{"aria-hidden":"true",className:"text-subtitle font-normal",style:{position:"absolute",inset:0,padding:"var(--sp-2) var(--sp-3)",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"none",color:"transparent",overflow:"hidden"},children:[c,u.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),u.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:u.jsx("button",{type:"button",onClick:()=>void D(),disabled:!I,title:Z??"Send (Enter)","aria-label":"Send",className:Te("inline-flex items-center justify-center transition-opacity",!I&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:u.jsx(sj,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),v&&u.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:v})]})})})}function UV({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:o,onAdd:c,onRemove:f}){return u.jsxs("div",{className:"flex items-center flex-wrap",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) var(--sp-1)"},children:[e.map(m=>{const h=t.find(p=>p.agentId===m),v=(h==null?void 0:h.displayName)??(h==null?void 0:h.name)??m;return u.jsxs("span",{className:"group inline-flex items-center text-label",style:{gap:2,padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg)"},children:[u.jsx("span",{children:v}),u.jsx("button",{type:"button",onClick:()=>f(m),title:"Remove participant",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{background:"none",border:"none",padding:0,marginLeft:2,cursor:"pointer",color:"var(--fg-3)",display:"inline-flex",alignItems:"center"},children:u.jsx(Bl,{className:"h-3 w-3"})})]},m)}),u.jsxs("div",{ref:o,style:{position:"relative"},children:[u.jsx("button",{type:"button",onClick:()=>s(!a),title:"Add participant","aria-label":"Add participant",disabled:n.length===0,className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:n.length===0?"var(--fg-4)":"var(--fg-3)",cursor:n.length===0?"not-allowed":"pointer"},children:u.jsx(qr,{className:"h-3 w-3"})}),a&&n.length>0&&u.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",left:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const m=Cy(n);return n.map(h=>u.jsx("button",{type:"button",role:"option","aria-selected":"false",title:h.name?`@${h.name}`:void 0,onClick:()=>c(h.agentId),className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:u.jsx(Ny,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function PV(e,t){var o;const n=new Set(e.map(c=>c.agentId)),a=[...t].filter(c=>n.has(c.agentId)&&c.runtimeUpdatedAt).sort((c,f)=>(f.runtimeUpdatedAt??"").localeCompare(c.runtimeUpdatedAt??""))[0];if(a)return a.agentId;const s=t.find(c=>n.has(c.agentId)&&c.type==="personal_assistant");return s?s.agentId:((o=e[0])==null?void 0:o.agentId)??null}const BV="first-tree-hub-images",$V=1,Gl="images";let Bd=null;function n_(){return Bd||(Bd=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(BV,$V);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(Gl)||n.createObjectStore(Gl,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Bd)}async function FV(e){const t=await n_();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(Gl,"readwrite"),o=s.objectStore(Gl),c={imageId:e.imageId,base64:e.base64,mimeType:e.mimeType,createdAt:Date.now()};o.put(c),s.oncomplete=()=>n(),s.onerror=()=>a(s.error??new Error("Image storage write failed")),s.onabort=()=>a(s.error??new Error("Image storage write aborted"))})}async function qV(e){const t=await n_();return t?new Promise(n=>{const o=t.transaction(Gl,"readonly").objectStore(Gl).get(e);o.onsuccess=()=>{const c=o.result;if(!c){n(null);return}n({base64:c.base64,mimeType:c.mimeType})},o.onerror=()=>n(null)}):null}function HV(e){let t=-1;for(const s of e)s.kind==="turn_end"&&s.seq>t&&(t=s.seq);const n=e.filter(s=>s.kind==="turn_end"?!1:s.kind==="error"?!0:s.seq>t),a=new Map;for(const s of n){if(s.kind!=="tool_call")continue;const o=WS(s.payload);if(!o)continue;const c=a.get(o)??-1;s.seq>c&&a.set(o,s.seq)}return n.filter(s=>{if(s.kind!=="tool_call")return!0;const o=WS(s.payload);return o?a.get(o)===s.seq:!0})}function WS(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function qf(e){const t=new Date(e),n=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),a=s=>{var o;return((o=n.find(c=>c.type===s))==null?void 0:o.value)??""};return`${a("month")}/${a("day")} ${a("hour")}:${a("minute")}`}function ZV(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function ek(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function VV({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function QV({event:e}){const t=tO(e.payload);if(!t)return null;const n=t.status==="error",a=t.status==="pending",s=n?"var(--state-error)":a?"var(--state-blocked)":"var(--fg-3)",o=n?"failed":a?"using":"used";return u.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[a?u.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:s,animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0,marginTop:5}}):u.jsx("span",{"aria-hidden":!0,style:{color:s,flexShrink:0},children:n?"⚠":"↳"}),u.jsxs("span",{className:"flex items-baseline",style:{color:"var(--fg-3)",minWidth:0,flex:1},title:t.args!==void 0&&t.args!==null?ek(t.args):void 0,children:[u.jsxs("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:[o," ",u.jsx("span",{style:{color:"var(--fg-2)"},children:t.name})]}),t.args!==void 0&&t.args!==null?u.jsxs("span",{className:"truncate",style:{color:"var(--fg-4)",minWidth:0,flex:1},children:["(",ek(t.args),")"]}):null,t.durationMs!==void 0&&!a?u.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:["· ",ZV(t.durationMs)]}):null]})]})}function GV({event:e,agentNameFn:t,agentId:n}){const a=rO(e.payload);if(!a||a.text.length===0)return null;const s=t(n);return u.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[u.jsx(r_,{name:s,isSelf:!1}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[u.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:s}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:qf(e.createdAt)}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"· streaming"})]}),u.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",whiteSpace:"pre-wrap",marginTop:2},children:a.text})]})]})}function KV({event:e}){return u.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[u.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0}}),u.jsx("span",{style:{color:"var(--fg-3)"},children:"thinking…"}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:qf(e.createdAt)})]})}function YV({event:e}){const t=nO(e.payload),n=qf(e.createdAt);return u.jsxs("div",{style:{padding:"var(--sp-1_5) var(--sp-2_5)",borderLeft:"var(--hairline-bold) solid var(--state-error)",background:"color-mix(in oklch, var(--state-error) 6%, transparent)",borderRadius:"0 var(--radius-input) var(--radius-input) 0"},children:[u.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),u.jsx("div",{className:"text-label",style:{marginTop:2,color:"var(--fg-2)",whiteSpace:"pre-wrap"},children:(t==null?void 0:t.message)??"(invalid error payload)"})]})}function r_({name:e,isSelf:t}){const n=e.slice(0,2).toUpperCase();return u.jsx("div",{className:"mono text-eyebrow font-bold",style:{width:20,height:20,borderRadius:"var(--radius-input)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:t?"linear-gradient(135deg, var(--accent), oklch(0.58 0.14 170))":"var(--bg-active)",border:t?"none":"var(--hairline) solid var(--border-strong)",color:t?"oklch(0.14 0.01 150)":"var(--fg-2)"},children:t?n:u.jsx(Wu,{width:9,height:10,style:{color:"var(--accent)"}})})}function XV({msg:e,myAgentId:t,agentNameFn:n}){const a=n(e.senderId),s=t===e.senderId;return u.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[u.jsx(r_,{name:a,isSelf:s}),u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[u.jsx("span",{className:"mono text-body font-semibold",style:{color:s?"var(--fg)":"var(--accent)"},children:a}),u.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:qf(e.createdAt)}),u.jsx("span",{style:{marginLeft:"auto"},children:u.jsx(VV,{msg:e,myAgentId:t})})]}),u.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&JV(e.content)?u.jsx("img",{src:`data:${e.content.mimeType};base64,${e.content.data}`,alt:e.content.filename??"image",style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):e.format==="file"&&WV(e.content)?u.jsx(eQ,{content:e.content}):e.format==="text"?u.jsx(ky,{children:typeof e.content=="string"?e.content:JSON.stringify(e.content)}):u.jsx("pre",{className:"mono text-label",style:{background:"var(--bg-sunken)",padding:8,borderRadius:"var(--radius-input)",overflow:"auto",maxHeight:160},children:JSON.stringify(e.content,null,2)})})]})]})}function JV(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.data=="string"&&typeof t.mimeType=="string"&&t.mimeType.startsWith("image/")}function WV(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.imageId=="string"&&typeof t.mimeType=="string"&&t.mimeType.startsWith("image/")&&typeof t.filename=="string"}function eQ({content:e}){const[t,n]=x.useState({kind:"loading"});return x.useEffect(()=>{let a=!1;return qV(e.imageId).then(s=>{a||n(s?{kind:"hit",src:`data:${s.mimeType};base64,${s.base64}`}:{kind:"miss"})}),()=>{a=!0}},[e.imageId]),t.kind==="hit"?u.jsx("img",{src:t.src,alt:e.filename,style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):t.kind==="miss"?u.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",fontStyle:"italic"},children:['[Image "',e.filename,'" not available on this device]']}):u.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"…"})}function tk({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var jt;const o=nn(),c=Rf(),f=Uv(),{agentId:m}=kt(),[h,v]=x.useState(""),[p,b]=x.useState(0),[w,k]=x.useState([]),[j,N]=x.useState(!1),[C,A]=x.useState(null),O=x.useRef(null),M=x.useRef(null),P=x.useRef(null),z=x.useRef(!1),$=x.useRef(new Set);x.useEffect(()=>{z.current=!1},[t]);const{data:I}=He({queryKey:["chat-messages",t],queryFn:()=>zV(t,{limit:50}),refetchInterval:5e3}),{data:Z}=He({queryKey:["session-events",e,t],queryFn:()=>aO(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:D}=He({queryKey:["chat-detail",t],queryFn:()=>WE(t),enabled:!!t}),{data:te}=He({queryKey:["activity"],queryFn:Yu,refetchInterval:15e3}),ae=St({mutationFn:ie=>pf(t,ie),onSuccess:()=>{v(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:iw(e)})}}),xe=x.useCallback(ie=>{const De=ie.filter(On=>On.type.startsWith("image/"));if(De.length===0)return;const Ke=De.find(On=>On.size>5242880);if(Ke){A(`Image too large (${(Ke.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const zn=De.map(On=>({id:crypto.randomUUID(),file:On,previewUrl:URL.createObjectURL(On)}));k(On=>[...On,...zn]),A(null)},[]),G=x.useCallback(ie=>{k(ke=>{const De=ke.find(Ke=>Ke.id===ie);return De&&URL.revokeObjectURL(De.previewUrl),ke.filter(Ke=>Ke.id!==ie)})},[]),X=async()=>{const ie=h.trim(),ke=w;if(!(!ie&&ke.length===0)&&!j&&!(ge&&fe.length===0)){if(Ge.length>0)try{await JE(t,{participantIds:Ge}),await o.invalidateQueries({queryKey:["chat-detail",t]})}catch(De){A(De instanceof Error?De.message:"Failed to add participants");return}if(ke.length>0){N(!0),A(null);try{for(const De of ke){const Ke=await RV(De.file),zn=crypto.randomUUID();await FV({imageId:zn,base64:Ke,mimeType:De.file.type}),await TV(t,{data:Ke,mimeType:De.file.type,filename:De.file.name,size:De.file.size,imageId:zn}),URL.revokeObjectURL(De.previewUrl)}k([]),ie&&await pf(t,ie),v(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:iw(e)})}catch(De){A(De instanceof Error?De.message:"Failed to send image")}finally{N(!1)}return}ae.mutate(ie)}},[q,ee]=x.useState(!1),[ye,Ae]=x.useState(""),R=x.useRef(null);x.useEffect(()=>{var ie;q&&((ie=R.current)==null||ie.focus())},[q]);const U=St({mutationFn:ie=>_V(t,ie),onSuccess:()=>{ee(!1),o.invalidateQueries({queryKey:["chat-detail",t]}),o.invalidateQueries({queryKey:["agent-sessions",e]}),o.invalidateQueries({queryKey:["session",e,t]})}}),B=()=>{const ie=ye.trim();U.mutate(ie.length>0?ie:null)},T=x.useMemo(()=>{const ie=(I==null?void 0:I.items)??[],ke=HV((Z==null?void 0:Z.items)??[]),De=[...ie.map(Ke=>({kind:"message",at:Ke.createdAt,key:`m-${Ke.id}`,data:Ke})),...ke.map(Ke=>({kind:"event",at:Ke.createdAt,key:`e-${Ke.id}`,data:Ke}))];return De.sort((Ke,zn)=>Ke.at.localeCompare(zn.at)),De},[I,Z]),V=T.length;x.useEffect(()=>{var ie;V>0&&((ie=P.current)==null||ie.scrollIntoView({behavior:"smooth"}))},[V]);const W=c(e),ce=x.useMemo(()=>{var ie;return new Set(((ie=D==null?void 0:D.participants)==null?void 0:ie.map(ke=>ke.agentId))??[])},[D==null?void 0:D.participants]),be=x.useMemo(()=>{const ie=new Set;for(const De of(D==null?void 0:D.participants)??[])ie.add(De.agentId);for(const De of(te==null?void 0:te.agents)??[])ie.add(De.agentId);ie.size===0&&ie.add(e);const ke=[];for(const De of ie){if(De===m)continue;const Ke=f(De);!Ke||!Ke.name||ke.push({agentId:De,name:Ke.name,displayName:Ke.displayName})}return ke},[D==null?void 0:D.participants,te==null?void 0:te.agents,e,f,m]),ge=x.useMemo(()=>{if(!D)return!1;if(D.type==="group")return!0;const ie=D.participants.some(ke=>ke.agentId===m);return D.type==="direct"&&!ie&&D.participants.length>=2},[D,m]);x.useEffect(()=>{if(n||$.current.has(t)||!I||!Z||!D||T.length>0||h.length>0||ge||W===e)return;const ie=`Hi ${W}! What can you help with?`;v(ie),b(ie.length),$.current.add(t),requestAnimationFrame(()=>{const ke=M.current;ke&&(ke.focus(),ke.setSelectionRange(ie.length,ie.length))})},[t,e,I,Z,D,T.length,h.length,W,ge,n]);const fe=x.useMemo(()=>{const ie=be.map(ke=>({agentId:ke.agentId,name:ke.name}));return sN(h,ie)},[h,be]),Ge=x.useMemo(()=>ce.size===0?[]:fe.filter(ie=>!ce.has(ie)),[fe,ce]),Oe=e_({value:h,cursor:p,candidates:be,disabled:ae.isPending||j,onSelect:ie=>{v(ie.text),b(ie.cursor),requestAnimationFrame(()=>{const ke=M.current;ke&&(ke.focus(),ke.setSelectionRange(ie.cursor,ie.cursor))})}});return u.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[u.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6)",borderBottom:"var(--hairline) solid var(--border)"},children:u.jsxs("div",{className:"flex items-center",style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%",gap:10},children:[u.jsx("div",{className:"flex items-center min-w-0",style:{gap:8,flex:1},children:n?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"truncate text-subtitle min-w-0",style:{color:"var(--fg)"},children:(D==null?void 0:D.title)??a??"…"}),u.jsx("span",{className:"mono uppercase text-eyebrow shrink-0",style:{padding:"var(--hairline) var(--sp-1_25)",borderRadius:2,color:"var(--fg-3)",background:"var(--bg-sunken)"},children:"watching"})]}):q?u.jsxs(u.Fragment,{children:[u.jsx("input",{ref:R,value:ye,onChange:ie=>Ae(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?(ie.preventDefault(),B()):ie.key==="Escape"&&(ie.preventDefault(),ee(!1))},disabled:U.isPending,maxLength:500,placeholder:(D==null?void 0:D.title)??"Chat name",className:"outline-none text-subtitle",style:{fieldSizing:"content",minWidth:200,maxWidth:480,color:"var(--fg)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:"var(--sp-0_5) var(--sp-1_5)"}}),u.jsx("button",{type:"button",onClick:B,disabled:U.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:u.jsx(Un,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:()=>ee(!1),disabled:U.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:u.jsx(Bl,{className:"h-3.5 w-3.5"})})]}):u.jsx("button",{type:"button",onClick:()=>{Ae((D==null?void 0:D.topic)??""),ee(!0)},title:"Click to rename",className:"truncate text-subtitle text-left min-w-0",style:{color:"var(--fg)",background:"transparent",border:"none",padding:0,cursor:"pointer"},children:(D==null?void 0:D.title)??"…"})}),u.jsx(tQ,{chatId:t,participantIds:((jt=D==null?void 0:D.participants)==null?void 0:jt.map(ie=>ie.agentId))??[e],candidates:be,agentIdentity:f,onAdded:()=>o.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),u.jsx("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-6)"},children:u.jsxs("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:[V===0&&u.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[u.jsx(Nv,{className:"h-8 w-8",style:{opacity:.3}}),n?"No messages yet":"Send a message to start the conversation"]}),u.jsx("div",{className:"flex flex-col",style:{gap:4},children:T.map(ie=>{if(ie.kind==="event"){const ke=ie.data;switch(ke.kind){case"tool_call":return u.jsx(QV,{event:ke},ie.key);case"assistant_text":return u.jsx(GV,{event:ke,agentId:e,agentNameFn:c},ie.key);case"thinking":return u.jsx(KV,{event:ke},ie.key);case"error":return u.jsx(YV,{event:ke},ie.key);default:return null}}return u.jsx(XV,{msg:ie.data,myAgentId:m,agentNameFn:c},ie.key)})}),u.jsx("div",{ref:P})]})}),u.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6) var(--sp-3)"},children:u.jsx("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:n?u.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},children:[u.jsx(lj,{className:"h-4 w-4 shrink-0",style:{color:"var(--fg-3)"}}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-body",style:{color:"var(--fg-2)"},children:"You're watching this chat — read-only."}),(s==null?void 0:s.error)&&u.jsx("div",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:2},children:s.error})]}),s&&u.jsx(he,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:s.onJoin,disabled:s.joining,children:s.joining?"Joining…":"Join to reply"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:ie=>ie.preventDefault(),onDrop:ie=>{ie.preventDefault(),xe(Array.from(ie.dataTransfer.files))},children:[w.length>0&&u.jsx("div",{className:"flex items-center",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) 0",overflowX:"auto"},children:w.map(ie=>u.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[u.jsx("img",{src:ie.previewUrl,alt:ie.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),u.jsx("button",{type:"button",onClick:()=>G(ie.id),style:{position:"absolute",top:1,right:1,width:14,height:14,borderRadius:"50%",background:"var(--color-overlay-scrim)",border:"none",color:"var(--bg-raised)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},children:u.jsx(Bl,{className:"h-2 w-2"})})]},ie.id))}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx(t_,{trigger:Oe.trigger,results:Oe.results,highlightIndex:Oe.highlightIndex,anchorRef:M,onPick:Oe.pick}),u.jsx("textarea",{ref:M,value:h,onChange:ie=>{v(ie.target.value),b(ie.target.selectionStart??ie.target.value.length)},onSelect:ie=>{b(ie.currentTarget.selectionStart??h.length)},onFocus:()=>{ge&&(z.current||h.length>0||be.length===0||(z.current=!0,v("@"),b(1),requestAnimationFrame(()=>{const ie=M.current;ie&&ie.setSelectionRange(1,1)})))},onPaste:ie=>{const ke=Array.from(ie.clipboardData.files);ke.length>0&&(ie.preventDefault(),xe(ke))},placeholder:ge?"Type @ to pick a recipient, then your message":`Message @${W} · / for commands · @ to mention`,rows:2,onKeyDown:ie=>{Oe.handleKey(ie)||ie.key==="Enter"&&!ie.shiftKey&&(ie.preventDefault(),X())},disabled:ae.isPending||j,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2_25) var(--sp-3) var(--sp-7_5)",background:"transparent",border:"none",resize:"none",color:"var(--fg)"}})]}),u.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[u.jsxs("span",{className:"mono flex items-center",style:{gap:10},children:[u.jsx("button",{type:"button",onClick:()=>{const ie=M.current;if(!ie)return;const ke=ie.selectionStart??h.length,De=ie.selectionEnd??ke,Ke=`${h.slice(0,ke)}@${h.slice(De)}`;v(Ke),b(ke+1),requestAnimationFrame(()=>{ie.focus(),ie.setSelectionRange(ke+1,ke+1)})},title:"Mention an agent (or type @)",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:u.jsx(gz,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:()=>{var ie;return(ie=O.current)==null?void 0:ie.click()},title:"Attach image",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:u.jsx(Vz,{className:"h-3.5 w-3.5"})}),u.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:ie=>{ie.target.files&&(xe(Array.from(ie.target.files)),ie.target.value="")}})]}),u.jsxs("span",{className:"flex items-center",style:{gap:8},children:[j&&u.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),u.jsx("button",{type:"button",onClick:X,disabled:ae.isPending||j||!h.trim()&&w.length===0||ge&&fe.length===0,title:ge&&fe.length===0?"Pick at least one recipient with @ before sending in a group chat":"Send (Enter)","aria-label":"Send",className:Te("inline-flex items-center justify-center transition-opacity",(ae.isPending||j||!h.trim()&&w.length===0||ge&&fe.length===0)&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:u.jsx(sj,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(ae.isError||C)&&u.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:C??(ae.error instanceof Error?ae.error.message:"Failed to send")})]})})})]})}function tQ({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:o=!1}){const[c,f]=x.useState(!1),m=x.useRef(null);x.useEffect(()=>{if(!c)return;const p=b=>{m.current&&(m.current.contains(b.target)||f(!1))};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[c]);const h=St({mutationFn:p=>JE(e,{participantIds:[p]}),onSuccess:()=>{f(!1),s()}}),v=x.useMemo(()=>n.filter(p=>!t.includes(p.agentId)),[n,t]);return u.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(p=>{const b=a(p),w=(b==null?void 0:b.displayName)??(b==null?void 0:b.name)??p.slice(0,8);return u.jsx("span",{className:"inline-flex items-center text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg-2)"},children:w},p)}),!o&&u.jsxs("div",{ref:m,style:{position:"relative"},children:[u.jsx("button",{type:"button",onClick:()=>f(!c),disabled:v.length===0||h.isPending,title:v.length===0?"All available agents are already in this chat":"Add participant","aria-label":"Add participant",className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:v.length===0?"var(--fg-4)":"var(--fg-3)",cursor:v.length===0?"not-allowed":"pointer"},children:u.jsx(qr,{className:"h-3 w-3"})}),c&&v.length>0&&u.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",right:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const p=Cy(v);return v.map(b=>u.jsx("button",{type:"button",role:"option","aria-selected":"false",title:b.name?`@${b.name}`:void 0,onClick:()=>h.mutate(b.agentId),disabled:h.isPending,className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:u.jsx(Ny,{candidate:b,ambiguous:p})},b.agentId))})()})]})]})}function nk(e,t){return e?e.find(n=>n.chatId===t)??null:null}function nQ(e,t){var s;const n=e.filter(o=>o.agentId!==t),a=n.find(o=>o.type!==void 0&&o.type!=="human");return a?a.agentId:((s=n[0])==null?void 0:s.agentId)??null}function rQ({chatId:e}){const t=nn(),{agentId:n}=kt(),a=x.useRef(new Map),{data:s}=He({queryKey:["chat-detail",e],queryFn:()=>WE(e),enabled:!!e}),{data:o}=He({queryKey:["me","chats","all"],queryFn:()=>hf({filter:"all"}),refetchInterval:3e4}),{data:c}=He({queryKey:["me","chats","watching"],queryFn:()=>hf({filter:"watching"}),refetchInterval:3e4}),f=x.useMemo(()=>nk(o==null?void 0:o.rows,e)??nk(c==null?void 0:c.rows,e)??null,[o,c,e]),m=x.useMemo(()=>f?f.participants.map(j=>({agentId:j.agentId,type:j.type})):s?s.participants.map(j=>({agentId:j.agentId,type:void 0})):[],[f,s]),h=x.useMemo(()=>nQ(m,n),[m,n]),p=St({mutationFn:()=>SV(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,b=(f==null?void 0:f.lastMessageAt)??"";x.useEffect(()=>{!f||a.current.get(e)===b||(a.current.set(e,b),p())},[e,f,b,p]);const w=St({mutationFn:()=>kV(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),k=(f==null?void 0:f.membershipKind)==="watching";return h?k?u.jsx(tk,{agentId:h,chatId:e,readOnly:!0,titleFallback:(f==null?void 0:f.title)??null,joinAction:{onJoin:()=>w.mutate(),joining:w.isPending,error:w.isError?w.error instanceof Error?w.error.message:"Failed to join":null}}):u.jsx(tk,{agentId:h,chatId:e}):u.jsx("div",{className:"flex-1 flex items-center justify-center",style:{padding:"var(--sp-8)"},children:u.jsxs("div",{className:"text-center",style:{color:"var(--fg-3)"},children:[u.jsx("div",{className:"text-subtitle",style:{color:"var(--fg-2)",marginBottom:6},children:"Loading chat…"}),u.jsx("div",{className:"text-body",children:"Resolving participants."})]})})}function aQ(){return u.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:u.jsxs("div",{className:"text-center max-w-sm",children:[u.jsx(Wu,{width:36,height:40,className:"mx-auto mb-3 text-primary opacity-60"}),u.jsx("div",{className:"text-subtitle mb-1",children:"Select a chat"}),u.jsx("div",{className:"text-body text-muted-foreground",children:"Pick an agent from the roster to view its sessions, or open a chat to start collaborating."})]})})}async function iQ(){return(await Se.get("/me/github/repos")).repos}async function gf(e,t){try{await Se.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}const sQ=3e4,lQ=1e3,oQ=3e3,a_="https://github.com/agent-team-foundation/first-tree";function uQ(e,t){return["Bind my source repo to an existing context-tree.","",`Source repo: ${e}`,`Existing tree: ${t}`,"","Your workspace already has the source repo cloned in a subdirectory; the first-tree skill will locate it. Use the first-tree CLI to install the skill in the source repo and write the binding metadata pointing at the existing tree, then open a PR back to the source with those changes. Walk me through the PR when it's up.","",`Reference: ${a_}`].join(`
387
+ `)}function cQ(e){return["Create a brand-new context-tree for my source repo.","",`Source repo: ${e}`,"","Your workspace already has the source repo cloned in a subdirectory; the first-tree skill will locate it. Use the first-tree CLI to install the skill in the source, scaffold a sibling tree directory, and write the binding metadata. Then push that new tree directory up to GitHub as a sibling repo under the same owner as the source, and open a PR back to the source with the skill + binding files.","","Once you know the URL of the new tree repo, use the first-tree-hub CLI's `org bind-tree` command to record it on the Hub so future agents in this team can find it.","","When everything is up, walk me through what was created — which directory, which repo, which PR.","",`Reference: ${a_}`].join(`
388
+ `)}function dQ(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function fQ(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s}=kt(),[o,c]=Sf(),f=o.get("step"),[m]=x.useState(()=>VA()),[h,v]=x.useState(()=>tj()),p=x.useCallback(j=>{qA(j),v(j)},[]),b=s==="admin",w=x.useMemo(()=>f==="team"&&b?"step1":f==="agent"?"step2":f==="tree"||e==="completed"?"step3-intro":e==="connect"&&!h&&m!=="invite"&&b?"step1":"step2",[f,e,h,m,b]),k=x.useCallback(()=>{p(!0);const j=new URLSearchParams(o);j.delete("step"),c(j,{replace:!0})},[p,o,c]);return u.jsx("div",{className:"flex-1 overflow-auto",style:{display:"flex",justifyContent:"center",padding:"clamp(var(--sp-16), 12vh, var(--sp-45)) var(--sp-4) var(--sp-12)"},children:u.jsx("div",{style:{width:"100%",maxWidth:720},children:w==="step1"?u.jsx(hQ,{organizationId:n,onContinue:k}):w==="step2"?u.jsx(mQ,{organizationId:n,memberId:a,joinPath:m,refreshMe:t}):u.jsx(vQ,{})})})}function hQ({organizationId:e,onContinue:t}){const[n,a]=x.useState([]),[s,o]=x.useState(""),[c,f]=x.useState(""),[m,h]=x.useState(!1),[v,p]=x.useState(null),[b,w]=x.useState(!1),[k,j]=x.useState(null),N=x.useRef(null);x.useEffect(()=>{(async()=>{try{const M=await Se.get("/me/organizations");a(M)}catch(M){j(M instanceof Error?M.message:"Failed to load your team")}finally{w(!0)}})()},[]),x.useEffect(()=>{var P;const M=((P=n.find(z=>z.id===e))==null?void 0:P.displayName)??"";o(M),f(M)},[n,e]),x.useEffect(()=>{const M=N.current;if(!M||!c)return;M.focus();const P=M.value.length;M.setSelectionRange(P,P)},[c]);const C=s.trim(),A=C.length>0&&!m&&b&&!k,O=x.useCallback(async M=>{if(M==null||M.preventDefault(),!(!A||!e)){p(null);try{C!==c.trim()&&(h(!0),await Se.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:C}),gf("team_renamed")),t()}catch(P){p(P instanceof Error?P.message:"Failed to rename team")}finally{h(!1)}}},[A,e,C,c,t]);return u.jsxs("form",{onSubmit:O,className:"flex flex-col",style:{gap:"var(--sp-5)"},children:[u.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:["Name your ",u.jsx("span",{style:{color:"var(--fg-2)"},children:"agent team"})," — where humans and AIs collaborate."]}),u.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[u.jsx("label",{htmlFor:"onboarding-team-name",className:"text-label",style:{color:"var(--fg-3)"},children:"Team name"}),u.jsx("input",{ref:N,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:M=>o(M.target.value),maxLength:200,disabled:m,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",caretColor:"var(--accent)"},onFocus:M=>{M.currentTarget.style.borderColor="var(--accent)"},onBlur:M=>{M.currentTarget.style.borderColor="var(--border)"}})]}),v||k?u.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:v??`Couldn't load your team — ${k}. Refresh the page and try again.`}):null,u.jsx("div",{className:"flex justify-end",children:u.jsxs(he,{type:"submit",disabled:!A,children:[u.jsx("span",{children:"Continue"}),u.jsx(ij,{className:"h-4 w-4"})]})})]})}function mQ({organizationId:e,memberId:t,joinPath:n,refreshMe:a}){var be;const s=jn(),o=GA(e,t),c=YA(o),f=c!=null&&c.connectToken&&c.connectTokenExpiresAt&&c.connectTokenExpiresAt>Date.now()?c.connectToken:null,m=f?(c==null?void 0:c.connectTokenExpiresAt)??null:null,[h,v]=x.useState(()=>(c==null?void 0:c.displayName)??"Coder"),[p,b]=x.useState(()=>(c==null?void 0:c.selectedRuntime)??null),[w,k]=x.useState(null),[j,N]=x.useState(null),[C,A]=x.useState(null),[O,M]=x.useState(()=>f),[P,z]=x.useState(()=>m),[$,I]=x.useState([]),[Z,D]=x.useState("form"),[te,ae]=x.useState(null),xe=x.useRef(null),G=x.useRef(null),X=x.useRef(null),q=x.useRef(0);x.useEffect(()=>()=>{G.current&&(G.current.cancelled=!0)},[]),x.useEffect(()=>{XA(o,{displayName:h,selectedRuntime:p,connectToken:O,connectTokenExpiresAt:P})},[o,h,p,O,P]),x.useEffect(()=>{(async()=>{try{const ge=await Se.get("/me/organizations");I(ge)}catch{}})()},[]),x.useEffect(()=>{if(Z!=="form")return;let ge=!1;const fe=async()=>{const Oe=++q.current;try{const jt=await Ei();if(ge||Oe!==q.current)return;const ke=jt.filter(De=>De.status==="connected").sort((De,Ke)=>Ke.lastSeenAt.localeCompare(De.lastSeenAt))[0]??null;if(k(De=>(De==null?void 0:De.id)===(ke==null?void 0:ke.id)?De:ke),ke){X.current!==ke.id&&(X.current=null,A(null),N(null));try{const De=await Rv(ke.id);if(ge||Oe!==q.current)return;X.current=ke.id,A(ke.id),N(De.capabilities)}catch{}}else X.current=null,A(null),N(null)}catch{}};fe();const Ge=setInterval(fe,oQ);return()=>{ge=!0,clearInterval(Ge)}},[Z]),x.useEffect(()=>{if(w)return;if(O&&P&&P>Date.now()){const fe=Math.max(P-Date.now(),0),Ge=window.setTimeout(()=>{M(null),z(null)},fe);return()=>window.clearTimeout(Ge)}O&&(M(null),z(null));let ge=!1;return(async()=>{try{const fe=await Se.post("/me/connect-tokens",{});ge||(M(fe.token),z(Date.now()+fe.expiresIn*1e3))}catch(fe){ge||ae(fe instanceof Error?fe.message:"Failed to generate connect token")}})(),()=>{ge=!0}},[w,O,P]);const ee=w&&C===w.id?j:null;x.useEffect(()=>{b(ge=>{var Ge;if(!ee)return ge;const fe=pQ(ee);return ge&&fe&&Object.keys(ee).includes(ge)&&((Ge=ee[ge])==null?void 0:Ge.state)==="ok"?ge:fe})},[ee]);const ye=ee?Object.entries(ee).filter(([,ge])=>ge.state==="ok").map(([ge])=>ge):[],Ae=((be=$.find(ge=>ge.id===e))==null?void 0:be.displayName)??"",R=h.trim(),U=R||"your agent",B=O?`npm install -g @agent-team-foundation/first-tree-hub
389
+ first-tree-hub connect ${O}`:null,T=x.useCallback(async ge=>{G.current&&(G.current.cancelled=!0);const fe={cancelled:!1};G.current=fe;const Ge=Date.now();for(;!fe.cancelled;){let Oe=!1;try{const jt=await Se.get(`/agents/${encodeURIComponent(ge)}/client-status`);if(fe.cancelled)return;Oe=jt.online===!0}catch{if(fe.cancelled)return}if(Oe){JA(o);try{await a()}catch{}if(fe.cancelled)return;s("/",{replace:!0});return}if(Date.now()-Ge>sQ){fe.cancelled||D("timeout");return}await new Promise(jt=>setTimeout(jt,lQ))}},[o,a,s]),V=!!(R&&w&&p&&ye.includes(p)&&Z==="form"),W=x.useCallback(async()=>{if(!w||!p||!R)return;ae(null),D("creating");const ge=av(R);let fe;try{fe=(await Se.post(hn("/agents"),{type:"personal_assistant",displayName:R,...ge?{name:ge}:{},clientId:w.id,runtimeProvider:p,...e?{organizationId:e}:{}})).uuid,xe.current=fe,ZA(fe),gf("agent_created",{runtimeProvider:p,repoBound:!1})}catch(Ge){ae(Ge instanceof Error?Ge.message:"Failed to create agent"),D("form");return}await T(fe)},[R,w,p,T,e]),ce=x.useCallback(async()=>{const ge=xe.current;ge&&(ae(null),D("creating"),await T(ge))},[T]);return Z==="creating"?u.jsx(CQ,{nameOrFallback:U}):Z==="timeout"?u.jsx(NQ,{nameOrFallback:U,hostname:(w==null?void 0:w.hostname)??null,error:te,onRetry:ce}):u.jsx(gQ,{joinPath:n,teamName:Ae,displayName:h,setDisplayName:v,trimmedName:R,connectedClient:w,cliCommand:B,capabilitiesLoaded:ee!==null,okRuntimes:ye,selectedRuntime:p,setSelectedRuntime:b,error:te,canCreate:V,onCreate:W})}function pQ(e){const t=a=>{var s;return((s=e[a])==null?void 0:s.state)==="ok"};if(t("claude-code"))return"claude-code";if(t("codex"))return"codex";const n=Object.entries(e).find(([,a])=>a.state==="ok");return n?n[0]:null}function gQ({joinPath:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:c,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:v,error:p,canCreate:b,onCreate:w}){const k=x.useRef(null),j=e==="invite"&&t,N=f&&m.length===0&&!!o,C=s?o?N?"Install Claude Code (or Codex) on that computer, then sign in.":h?"Ready to create.":"Detecting installed runtimes…":"Next: connect the computer where they'll work.":"Next: name your agent.";return x.useEffect(()=>{var A;s||(A=k.current)==null||A.focus()},[s]),u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:j?u.jsxs(u.Fragment,{children:["You've joined"," ",u.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Set up your first agent — a"," ",u.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:"code agent"})," ","that helps with your code."]}):u.jsxs(u.Fragment,{children:["Set up your first agent — a"," ",u.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:"code agent"})," ","that helps with your code."]})}),u.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[u.jsx(i_,{}),u.jsx(wu,{number:"01",state:s?"complete":"active",children:u.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",flexWrap:"wrap"},children:[u.jsx("label",{htmlFor:"onboarding-name",className:"text-body font-normal",style:{color:"var(--fg-2)",whiteSpace:"nowrap"},children:"Name your agent"}),u.jsx("input",{ref:k,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:A=>a(A.target.value),placeholder:"e.g. Code Reviewer",maxLength:200,className:"onboarding-name-input text-body font-medium",style:{flex:"0 1 28ch",minWidth:"22ch",maxWidth:"30ch",padding:"var(--sp-0_5) 0",background:"transparent",border:0,borderBottom:"var(--hairline) solid var(--border-faint)",borderRadius:0,boxShadow:"none",color:"var(--fg)",outline:"none",caretColor:"var(--accent)",transition:"border-color 160ms ease, color 160ms ease"},onFocus:A=>{A.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:A=>{A.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),u.jsx(wu,{number:"02",state:b?"complete":s?"active":"idle",children:u.jsxs("div",{style:{animation:s?"subtle-fade 200ms ease-out":void 0},children:[u.jsx("h2",{className:"text-subtitle font-semibold",style:{color:s?"var(--fg)":"var(--fg-4)",fontWeight:s?600:500},children:"Connect a computer"}),s?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:o?`${s} will run on this computer and stay connected to Hub.`:`${s} needs a computer to run on. Connect one with the command below.`}),!o&&u.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-2)"},children:"Open Terminal on that computer and run this command."}),o?u.jsxs(u.Fragment,{children:[u.jsx(kQ,{hostname:o.hostname??o.id}),u.jsx(SQ,{runtimes:m,selected:h,onSelect:v,capabilitiesLoaded:f})]}):u.jsxs(u.Fragment,{children:[u.jsx(xQ,{command:c}),u.jsx(wQ,{})]})]}):null]})})]}),p&&u.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:p}),s&&u.jsxs("div",{style:{marginTop:b?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!b&&u.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:C}),b&&u.jsxs(he,{type:"button",size:"default",style:{marginTop:0,border:"var(--hairline) solid color-mix(in oklch, var(--accent) 32%, transparent)",background:"var(--accent)",boxShadow:"var(--shadow-md)",color:"var(--primary-foreground, var(--color-primary-foreground))",opacity:1,transform:"translateZ(0)",transition:"box-shadow 160ms ease, transform 160ms ease"},onClick:w,onMouseEnter:A=>{A.currentTarget.style.transform="scale(1.01)",A.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:A=>{A.currentTarget.style.transform="scale(1)",A.currentTarget.style.boxShadow="var(--shadow-md)"},children:[u.jsxs("span",{children:["Create ",s]}),u.jsx(ij,{className:"h-4 w-4"})]}),u.jsx("p",{className:"text-caption",style:{margin:b?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function vQ(){const e=jn(),{dismissOnboarding:t,organizationId:n}=kt(),{addToast:a}=EC(),[s,o]=x.useState(!1),[c,f]=x.useState(null),[m,h]=x.useState(null),[v,p]=x.useState(""),[b,w]=x.useState(null),[k,j]=x.useState(null),[N,C]=x.useState(null);x.useEffect(()=>{let Z=!1;return(async()=>{try{const D=await iQ();if(Z)return;j(D)}catch(D){Z||C(D instanceof Error?D.message:"Failed to list GitHub repositories")}})(),()=>{Z=!0}},[]),x.useEffect(()=>{if(!n)return;let Z=!1;return(async()=>{try{const D=await YE(n);if(Z)return;D.repo&&(p(D.repo),h(te=>te??"existing"))}catch{}})(),()=>{Z=!0}},[n]);const A=v.trim(),O=(()=>{if(m!=="existing")return!0;if(!A)return!1;try{const Z=new URL(A);return Z.protocol==="https:"||Z.protocol==="http:"}catch{return!1}})(),M=x.useCallback(()=>{a({title:"Setup hidden",description:"Resume any time in Settings → Setup. Your agent isn't bound to a source repo yet — add one in Agent settings when ready.",action:{label:"Open settings",onClick:()=>e("/settings/setup")}})},[a,e]),P=x.useCallback(()=>{gf("tree_intro_dismissed"),t(),M()},[t,M]),z=x.useCallback(async()=>{if(b&&m&&!(m==="existing"&&!O)){f(null),o(!0);try{const Z=HA(),D=await Lv(),te=D.filter(q=>q.type!=="human"),ae=(Z?D.find(q=>q.uuid===Z):void 0)??te.slice().sort((q,ee)=>ee.uuid.localeCompare(q.uuid))[0]??D[0];if(!ae)throw new Error("No agent available to chat with — finish Step 2 first.");const xe=await zN(ae.uuid);if(await ON(ae.uuid,{expectedVersion:xe.version,payload:{gitRepos:[{url:b}]}}),m==="existing"&&n)try{await XE(n,{repo:A})}catch(q){console.warn("Step 3: PUT context_tree settings failed; agent will still proceed",q)}const G=await AV(ae.uuid),X=m==="existing"?uQ(b,A):cQ(b);try{await pf(G.id,X)}catch{}gf("tree_chat_started",{agentUuid:ae.uuid,chatId:G.id,treeMode:m}),t(),e(`/?c=${encodeURIComponent(G.id)}`,{replace:!1})}catch(Z){f(Z instanceof Error?Z.message:"Failed to start the tree-init chat"),o(!1)}}},[b,m,O,A,n,e,t]),$=!!b&&m!==null&&!s&&(m==="new"||O),I=!!m&&(m==="new"||O);return u.jsxs(u.Fragment,{children:[u.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Build the ",u.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"})," — your team's shared knowledge that grows with your code."]}),u.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[u.jsx(i_,{}),u.jsx(wu,{number:"01",state:b?"complete":"active",children:u.jsx(yQ,{disabled:s,repos:k,error:N,selectedRepoUrl:b,onSelect:w})}),u.jsxs(wu,{number:"02",state:I?"complete":b?"active":"idle",children:[u.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:b?"var(--fg)":"var(--fg-4)",fontWeight:b?600:500},children:"Bind or create the tree"}),b?u.jsxs("div",{style:{marginTop:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[u.jsxs("fieldset",{"aria-label":"Bind or create the tree",disabled:s,style:{display:"inline-flex",alignSelf:"flex-start",padding:"var(--sp-0_5)",margin:0,background:"var(--surface-2)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",gap:"var(--sp-0_5)"},children:[u.jsx("legend",{className:"sr-only",children:"Bind or create the tree"}),[{value:"existing",label:"Bind to an existing tree"},{value:"new",label:"Create a new tree"}].map(Z=>{const D=m===Z.value;return u.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:D?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:D?"var(--fg)":"var(--fg-3)",fontWeight:D?600:400,boxShadow:D?"var(--shadow-sm)":"none",cursor:s?"not-allowed":"pointer",userSelect:"none"},children:[u.jsx("input",{type:"radio",name:"tree-mode",value:Z.value,checked:D,onChange:()=>h(Z.value),className:"sr-only"}),Z.label]},Z.value)})]}),m==="existing"?u.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[u.jsx("label",{htmlFor:"onboarding-existing-tree-url",className:"text-label",style:{color:"var(--fg-3)"},children:"Tree GitHub URL"}),u.jsx("input",{id:"onboarding-existing-tree-url",type:"url",value:v,onChange:Z=>p(Z.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:s,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",fontFamily:"var(--font-mono)"}})]}):null,m==="new"?u.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:"Your agent will scaffold a new GitHub repo for the tree and bind it to your source repo."}):null]}):null]}),u.jsxs(wu,{number:"03",state:I?"active":"idle",children:[u.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:I?"var(--fg)":"var(--fg-4)",fontWeight:I?600:500},children:"Let your agent build it"}),I?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"It'll install the skill, set up the tree, and open a PR back to your source repo."}),c?u.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-3)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:c}):null,u.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[u.jsx(he,{type:"button",disabled:!$,onClick:()=>void z(),children:s?"Starting…":"Continue"}),u.jsx(he,{type:"button",variant:"outline",onClick:P,disabled:s,children:"I'll do it later"})]})]}):null]})]})]})}function yQ({disabled:e,repos:t,error:n,selectedRepoUrl:a,onSelect:s}){const o=u.jsx("h2",{className:"text-subtitle font-semibold",style:{color:e?"var(--fg-4)":"var(--fg)",fontWeight:e?500:600},children:"Pick the source repo"});return e?u.jsx("div",{children:o}):n?u.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,u.jsxs("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[n,". Reconnect your GitHub account to grant repo access."]}),u.jsx("div",{style:{marginTop:"var(--sp-2)"},children:u.jsx(he,{type:"button",variant:"outline",size:"sm",asChild:!0,children:u.jsx("a",{href:"/api/v1/auth/github/start?next=/",children:"Reconnect GitHub"})})})]}):t===null?u.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,u.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"Loading your GitHub repositories…"})]}):t.length===0?u.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,u.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"No repositories found on your GitHub account. Create one and refresh this page."})]}):u.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"The code your tree will organize knowledge about."}),u.jsx(bQ,{repos:t,selectedRepoUrl:a,onSelect:s})]})}function bQ({repos:e,selectedRepoUrl:t,onSelect:n}){const[a,s]=x.useState(!1),o=x.useRef(null);x.useEffect(()=>{if(!a)return;const m=v=>{o.current&&!o.current.contains(v.target)&&s(!1)},h=v=>{v.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",m),window.addEventListener("keydown",h),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("keydown",h)}},[a]);const c=x.useMemo(()=>{const m=new Map;for(const h of e){const v=h.fullName.split("/")[0]??"",p=m.get(v);p?p.push(h):m.set(v,[h])}return[...m.entries()].sort(([h],[v])=>h.localeCompare(v))},[e]),f=e.find(m=>m.cloneUrl===t)??null;return u.jsxs("div",{ref:o,className:"relative",style:{marginTop:"var(--sp-2)"},children:[u.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(m=>!m),className:"text-body",style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:f?"var(--fg)":"var(--fg-3)",outline:"none",cursor:"pointer",textAlign:"left"},children:[u.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:f?f.fullName:"Select a repository…"}),u.jsx(Cv,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&u.jsx("div",{role:"listbox","aria-label":"GitHub repository",className:"absolute z-30 rounded-md border bg-popover shadow-md",style:{top:"calc(100% + var(--sp-1))",left:0,right:0,maxHeight:"min(56vh, 30rem)",overflowY:"auto",padding:"var(--sp-1) 0"},children:c.map(([m,h],v)=>u.jsxs("div",{children:[v>0&&u.jsx("div",{"aria-hidden":"true",style:{margin:"var(--sp-1) 0",height:"var(--hairline)",background:"var(--border-faint)"}}),u.jsx("div",{className:"text-eyebrow",style:{padding:"var(--sp-1) var(--sp-3)",color:"var(--fg-3)"},children:m}),h.map(p=>{const b=p.cloneUrl===t,w=p.fullName.slice(m.length+1);return u.jsxs("button",{type:"button",role:"option","aria-selected":b,onClick:()=>{n(p.cloneUrl),s(!1)},className:"text-body transition-colors w-full",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1_5) var(--sp-3)",background:b?"var(--accent-bg)":"transparent",color:b?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:k=>{b||(k.currentTarget.style.background="var(--surface-1)")},onMouseLeave:k=>{b||(k.currentTarget.style.background="transparent")},children:[u.jsx("span",{style:{width:14,display:"inline-flex",flexShrink:0},children:b?u.jsx(Un,{className:"h-3.5 w-3.5"}):null}),u.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:w}),p.private&&u.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:"var(--fg-3)",border:"var(--hairline) solid var(--border)",background:"var(--bg-sunken)",flexShrink:0},children:"private"})]},p.cloneUrl)})]},m))})]})}function i_(){return u.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"var(--sp-5)",bottom:"var(--sp-5)",left:"calc(var(--sp-2_5) - var(--hairline))",width:"var(--hairline)",background:"color-mix(in oklch, var(--border-faint) 56%, transparent)"}})}function wu({number:e,state:t,children:n}){const a=t==="active",s=t==="complete";return u.jsxs("section",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:"var(--sp-3)",marginTop:e==="01"?0:"var(--sp-5)",position:"relative"},children:[u.jsx("div",{className:"mono text-caption flex items-center justify-center",style:{width:"var(--sp-5)",height:"var(--sp-5)",borderRadius:999,background:a||s?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:a||s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",color:a||s?"var(--accent)":"var(--fg-4)",zIndex:1},children:s?u.jsx(Un,{className:"h-3 w-3"}):e}),u.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}function xQ({command:e}){const[t,n]=x.useState(!1),s=(e?e.split(`
390
+ `):[]).find(m=>m.startsWith("first-tree-hub"))??"",o="first-tree-hub connect ",c=s.startsWith(o)?`${o}${s.slice(o.length,o.length+22)}…`:s.length>52?`${s.slice(0,52)}…`:s,f=async()=>{e&&(await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500))};return u.jsx("div",{style:{marginTop:"var(--sp-2)"},children:u.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[u.jsx("pre",{className:"mono text-label",title:s,style:{flex:1,minHeight:38,margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--bg-sunken) 42%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--border-faint) 58%, transparent)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},children:c||"Generating token…"}),u.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:!e,style:{alignSelf:"stretch",background:"color-mix(in oklch, var(--bg-raised) 48%, transparent)",borderColor:"color-mix(in oklch, var(--border) 58%, transparent)",boxShadow:"none",height:"auto",minHeight:38},children:[t?u.jsx(Un,{className:"h-3.5 w-3.5"}):u.jsx(jf,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function wQ(){return u.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",color:"color-mix(in oklch, var(--accent) 24%, var(--fg-3))"},children:[u.jsx(jQ,{}),u.jsx("span",{children:"Waiting for your computer…"})]})}function SQ({runtimes:e,selected:t,onSelect:n,capabilitiesLoaded:a}){return e.length===0?u.jsx("p",{className:"text-label",style:{marginTop:"var(--sp-3)",color:"var(--fg-3)"},children:a?"No runtime ready on this computer. Install Claude Code or Codex, then check back.":"Detecting installed runtimes…"}):u.jsxs("div",{style:{marginTop:"var(--sp-3)"},children:[u.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Powered by"}),u.jsxs("fieldset",{className:"flex",style:{gap:"var(--sp-4)",flexWrap:"wrap",margin:0,padding:0,border:0},children:[u.jsx("legend",{className:"sr-only",children:"Runtime provider"}),e.map((s,o)=>{const c=t===s;return u.jsxs("label",{className:"onboarding-runtime-option inline-flex items-center text-body",style:{gap:"var(--sp-1_5)",padding:"var(--sp-1) 0",cursor:"pointer",color:c?"color-mix(in oklch, var(--accent) 30%, var(--fg))":"var(--fg)",fontWeight:c?600:400,animation:`onboarding-rise 220ms ease-out ${o*80}ms both`,transition:"color 160ms ease, opacity 160ms ease, transform 160ms ease"},children:[u.jsx("input",{type:"radio",name:"onboarding-runtime",value:s,checked:c,onChange:()=>n(s),className:"sr-only"}),u.jsx("span",{"aria-hidden":"true",className:"inline-flex items-center justify-center",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",borderRadius:"50%",border:c?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-strong)",background:c?"color-mix(in oklch, var(--accent) 8%, transparent)":"transparent",boxShadow:c?"0 0 0 var(--sp-0_5) color-mix(in oklch, var(--accent) 10%, transparent)":"none",transition:"border-color 160ms ease, background 160ms ease, box-shadow 160ms ease"},children:c&&u.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),dQ(s)]},s)})]})]})}function kQ({hostname:e}){return u.jsxs("div",{className:"inline-flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",padding:"var(--sp-1_5) var(--sp-2_5)",borderRadius:999,background:"color-mix(in oklch, var(--accent) 10%, transparent)",color:"color-mix(in oklch, var(--accent) 26%, var(--fg))",animation:"onboarding-pop 260ms cubic-bezier(0.2, 0.9, 0.2, 1.15)"},children:[u.jsx(Un,{className:"h-3.5 w-3.5"}),u.jsxs("span",{children:[u.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function jQ(){return u.jsxs("span",{"aria-hidden":"true",style:{position:"relative",display:"inline-block",width:8,height:8,flexShrink:0},children:[u.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)"}}),u.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.55}})]})}function CQ({nameOrFallback:e}){return u.jsxs("div",{className:"flex flex-col items-center text-center",style:{paddingTop:"var(--sp-12)",gap:"var(--sp-4)"},children:[u.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:["Creating ",e,"…"]}),u.jsx(EQ,{}),u.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function NQ({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const s=t??"your computer";return u.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[u.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?u.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 10%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 25%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:n}):u.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[u.jsx("p",{children:"This usually means:"}),u.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[u.jsxs("li",{children:["The runtime can't start on ",s," (missing API key, etc.)"]}),u.jsxs("li",{children:["The connection to ",s," dropped"]})]}),u.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",s,", then click ",u.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),u.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:u.jsx(he,{onClick:a,children:"Try again"})})]})}function EQ(){return u.jsxs("span",{className:"flex items-center",style:{gap:6},children:[u.jsx(Wp,{delayMs:0}),u.jsx(Wp,{delayMs:160}),u.jsx(Wp,{delayMs:320})]})}function Wp({delayMs:e}){return u.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",animationDelay:`${e}ms`,display:"inline-block"}})}function _Q({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=kt();return e===mf?u.jsx(LV,{onCreated:t}):e?u.jsx(rQ,{chatId:e}):n!==null&&!a?u.jsx(fQ,{}):u.jsx(aQ,{})}const TQ={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function RQ(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=kt(),{addToast:a}=EC(),s=jn(),[o,c]=Sf(),f=o.get("c"),m=o.get("step"),h=tj(),v=x.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||f||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h?1:2,[m,f,e,h]);if(e===null||t)return null;const p=e==="completed",b=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Setup.",action:{label:"Open settings",onClick:()=>s("/settings/setup")}})},w={1:eg(1,v,e),2:eg(2,v,e),3:eg(3,v,e)},k=j=>{if(j!==3)return;const N=new URLSearchParams(o);N.delete("c"),N.set("step","tree"),c(N,{replace:!1})};return u.jsxs("nav",{"aria-label":"Onboarding progress",className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-4)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg)"},children:[u.jsx("ol",{className:"flex items-center justify-center flex-1 min-w-0",style:{gap:0,listStyle:"none",margin:0,padding:0},children:[1,2,3].map((j,N)=>{const C=w[j],A=[1,2,3][N+1],O=A?rk(C)&&rk(w[A]):!1;return u.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[u.jsx(AQ,{index:j,state:C,label:TQ[j],onClick:j===3&&C==="active"?()=>k(j):void 0}),A?u.jsx(OQ,{solid:O}):null]},j)})}),u.jsx("button",{type:"button",onClick:b,disabled:!p,title:p?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:p?"cursor-pointer":"cursor-not-allowed",style:{flexShrink:0,width:24,height:24,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:0,borderRadius:"var(--rd-1)",color:p?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:p?1:.5},onMouseEnter:j=>{p&&(j.currentTarget.style.background="var(--surface-2)")},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:"✕"})]})}function eg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function rk(e){return e==="active"||e==="completed"}function AQ({index:e,state:t,label:n,onClick:a}){const s=!!a,o=zQ(t,e);return u.jsxs("button",{type:"button",onClick:s?a:void 0,disabled:!s,"aria-current":t==="active"?"step":void 0,className:`flex items-center ${s?"cursor-pointer":"cursor-default"}`,style:{gap:"var(--sp-2)",background:"transparent",border:0,padding:0,font:"inherit",color:t==="active"?"var(--fg)":t==="completed"?"var(--fg-2)":"var(--fg-3)",fontWeight:t==="active"?600:500},children:[o,u.jsxs("span",{className:"text-label whitespace-nowrap",style:{textDecoration:s?"none":void 0},children:["Step ",e," · ",n]})]})}function zQ(e,t){return e==="completed"?u.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,lineHeight:1,flexShrink:0},children:"✓"}):e==="active"?u.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:22,height:22,flexShrink:0,display:"inline-block"},children:[u.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.5}}),u.jsx("span",{className:"mono",style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)",border:"var(--hairline-bold) solid var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,fontWeight:600,lineHeight:1},children:t})]}):e==="error"?u.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--state-error)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:13,lineHeight:1,flexShrink:0},children:"⊗"}):u.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"transparent",border:"var(--hairline) solid var(--fg-3)",flexShrink:0,display:"inline-block"}})}function OQ({solid:e}){return u.jsx("span",{"aria-hidden":"true",style:{flex:"0 1 var(--sp-15)",minWidth:24,height:0,margin:"0 var(--sp-2)",borderTop:e?"var(--hairline-bold) solid var(--accent)":"var(--hairline) dashed var(--fg-3)"}})}function DQ(){const[e,t]=Sf(),n=e.get("c"),a=e.get("a");AN(),x.useEffect(()=>{if(a&&n){t({c:n},{replace:!0});return}a&&!n&&t({},{replace:!0})},[a,n,t]);const s=x.useCallback(c=>{t({c})},[t]),o=x.useCallback(()=>{t({c:mf})},[t]);return u.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[u.jsx(EV,{selectedChatId:n,onSelectChat:s,onNewChat:o}),u.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[u.jsx(RQ,{}),u.jsx(_Q,{selectedChatId:n,onSelectChat:s})]})]})}const MQ=new eR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function IQ(){return u.jsx(tR,{client:MQ,children:u.jsx(tz,{children:u.jsx(n4,{children:u.jsx(RA,{children:u.jsxs(iA,{children:[u.jsx(At,{path:"/login",element:u.jsx(dZ,{})}),u.jsx(At,{path:"/signup",element:u.jsx(dr,{to:"/login",replace:!0})}),u.jsx(At,{path:"/auth/github/complete",element:u.jsx(fZ,{})}),u.jsx(At,{path:"/invite/:token",element:u.jsx(lZ,{})}),u.jsx(At,{element:u.jsx(sz,{}),children:u.jsxs(At,{element:u.jsx(bP,{children:u.jsx(e4,{})}),children:[u.jsx(At,{index:!0,element:u.jsx(DQ,{})}),u.jsx(At,{path:"context",element:u.jsx(DH,{})}),u.jsx(At,{path:"agents/:uuid",element:u.jsx(G7,{})}),u.jsxs(At,{path:"team",element:u.jsx(xV,{}),children:[u.jsx(At,{index:!0,element:u.jsx(tV,{})}),u.jsx(At,{path:"settings",element:u.jsx(bV,{})})]}),u.jsxs(At,{path:"settings",element:u.jsx(ZZ,{}),children:[u.jsx(At,{index:!0,element:u.jsx(dr,{to:"computers",replace:!0})}),u.jsx(At,{path:"computers",element:u.jsx(EZ,{})}),u.jsx(At,{path:"integrations",element:u.jsx(qZ,{})}),u.jsx(At,{path:"setup",element:u.jsx(HZ,{})})]}),u.jsx(At,{path:"agents",element:u.jsx(dr,{to:"/team",replace:!0})}),u.jsx(At,{path:"clients",element:u.jsx(dr,{to:"/settings/computers",replace:!0})}),u.jsx(At,{path:"integrations",element:u.jsx(dr,{to:"/settings/integrations",replace:!0})}),u.jsx(At,{path:"team/members",element:u.jsx(dr,{to:"/team",replace:!0})}),u.jsx(At,{path:"team/agents",element:u.jsx(dr,{to:"/team",replace:!0})}),u.jsx(At,{path:"team/invite",element:u.jsx(dr,{to:"/team",replace:!0})}),u.jsx(At,{path:"admin",element:u.jsx(LQ,{})})]})})]})})})})})}function LQ(){const e=Jn();return e.hash==="#bindings"?u.jsx(dr,{to:`/settings/integrations${e.search}`,replace:!0}):u.jsx(dr,{to:`/team${e.hash}`,replace:!0})}const s_=document.getElementById("root");if(!s_)throw new Error("Root element not found");_T.createRoot(s_).render(u.jsx(x.StrictMode,{children:u.jsx(IQ,{})}));export{ij as A,Wu as F,Gu as L,lt as c,u as j,x as r};