@agent-team-foundation/first-tree-hub 0.14.1 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bootstrap-C15ZBOCC.mjs → bootstrap-CQQGgIx1.mjs} +0 -7
- package/dist/cli/index.mjs +14 -39
- package/dist/{client-CzXmweS9-DhUiuQvL.mjs → client-BSfCc0pJ-BP_1f21y.mjs} +3095 -1291
- package/dist/{client-CREn8bJ0-C5fHJir6.mjs → client-q1EYQD1n-ypjoumIO.mjs} +3 -3
- package/dist/{dist-1XGLJMOq.mjs → dist-CwsiHGX7.mjs} +51 -19
- package/dist/{feishu-BGx71p5s.mjs → feishu-DHSy6WDD.mjs} +1 -1
- package/dist/index.mjs +7 -7
- package/dist/invitation-C9m2gQx4-BSErdb8x.mjs +4 -0
- package/dist/{invitation-DZO4NX3P-BPxTeHf-.mjs → invitation-D_ENPHyj-5ETiae5r.mjs} +3 -23
- package/dist/{saas-connect-BBRxjmBS.mjs → saas-connect-ChxZv2YQ.mjs} +621 -2078
- package/dist/{errors-LPcARA4K-Dbrptiyz.mjs → uuid-DbS_4vFh-iFghv4zA.mjs} +37 -2
- package/dist/web/assets/{index-DMqnX4IR.js → index-B76SVAz8.js} +1 -1
- package/dist/web/assets/index-DAAemCLz.js +416 -0
- package/dist/web/assets/index-DE7Q3QWE.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/invitation-CNv7gfFF-DOFZ75wb.mjs +0 -4
- package/dist/web/assets/index-BOK7e_td.css +0 -1
- package/dist/web/assets/index-QDcpYpEa.js +0 -416
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
var _S=e=>{throw TypeError(e)};var Gp=(e,t,n)=>t.has(e)||_S("Cannot "+n);var F=(e,t,n)=>(Gp(e,t,"read from private field"),n?n.call(e):t.get(e)),Te=(e,t,n)=>t.has(e)?_S("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ke=(e,t,n,a)=>(Gp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Ke=(e,t,n)=>(Gp(e,t,"access private method"),n);var cf=(e,t,n,a)=>({set _(s){ke(e,t,s,n)},get _(){return F(e,t,a)}});function uR(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 oh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vp={exports:{}},Ou={};/**
|
|
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 TS;function cR(){if(TS)return Ou;TS=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 Ou.Fragment=t,Ou.jsx=n,Ou.jsxs=n,Ou}var AS;function dR(){return AS||(AS=1,Vp.exports=cR()),Vp.exports}var l=dR(),Qp={exports:{}},et={};/**
|
|
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 RS;function fR(){if(RS)return et;RS=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"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),w=Symbol.iterator;function x(P){return P===null||typeof P!="object"?null:(P=w&&P[w]||P["@@iterator"],typeof P=="function"?P:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function E(P,U,_){this.props=P,this.context=U,this.refs=C,this.updater=_||k}E.prototype.isReactComponent={},E.prototype.setState=function(P,U){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,U,"setState")},E.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function T(){}T.prototype=E.prototype;function O(P,U,_){this.props=P,this.context=U,this.refs=C,this.updater=_||k}var D=O.prototype=new T;D.constructor=O,j(D,E.prototype),D.isPureReactComponent=!0;var I=Array.isArray;function R(){}var B={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function ee(P,U,_){var V=_.ref;return{$$typeof:e,type:P,key:U,ref:V!==void 0?V:null,props:_}}function z(P,U){return ee(P.type,U,P.props)}function $(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function Q(P){var U={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(_){return U[_]})}var ne=/\/+/g;function Y(P,U){return typeof P=="object"&&P!==null&&P.key!=null?Q(""+P.key):U.toString(36)}function X(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(R,R):(P.status="pending",P.then(function(U){P.status==="pending"&&(P.status="fulfilled",P.value=U)},function(U){P.status==="pending"&&(P.status="rejected",P.reason=U)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function G(P,U,_,V,Z){var re=typeof P;(re==="undefined"||re==="boolean")&&(P=null);var xe=!1;if(P===null)xe=!0;else switch(re){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(P.$$typeof){case e:case t:xe=!0;break;case p:return xe=P._init,G(xe(P._payload),U,_,V,Z)}}if(xe)return Z=Z(P),xe=V===""?"."+Y(P,0):V,I(Z)?(_="",xe!=null&&(_=xe.replace(ne,"$&/")+"/"),G(Z,U,_,"",function(Ye){return Ye})):Z!=null&&($(Z)&&(Z=z(Z,_+(Z.key==null||P&&P.key===Z.key?"":(""+Z.key).replace(ne,"$&/")+"/")+xe)),U.push(Z)),1;xe=0;var Ae=V===""?".":V+":";if(I(P))for(var Ce=0;Ce<P.length;Ce++)V=P[Ce],re=Ae+Y(V,Ce),xe+=G(V,U,_,re,Z);else if(Ce=x(P),typeof Ce=="function")for(P=Ce.call(P),Ce=0;!(V=P.next()).done;)V=V.value,re=Ae+Y(V,Ce++),xe+=G(V,U,_,re,Z);else if(re==="object"){if(typeof P.then=="function")return G(X(P),U,_,V,Z);throw U=String(P),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return xe}function ie(P,U,_){if(P==null)return P;var V=[],Z=0;return G(P,V,"","",function(re){return U.call(_,re,Z++)}),V}function J(P){if(P._status===-1){var U=P._result;U=U(),U.then(function(_){(P._status===0||P._status===-1)&&(P._status=1,P._result=_)},function(_){(P._status===0||P._status===-1)&&(P._status=2,P._result=_)}),P._status===-1&&(P._status=0,P._result=U)}if(P._status===1)return P._result.default;throw P._result}var ve=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},M={map:ie,forEach:function(P,U,_){ie(P,function(){U.apply(this,arguments)},_)},count:function(P){var U=0;return ie(P,function(){U++}),U},toArray:function(P){return ie(P,function(U){return U})||[]},only:function(P){if(!$(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return et.Activity=g,et.Children=M,et.Component=E,et.Fragment=n,et.Profiler=s,et.PureComponent=O,et.StrictMode=a,et.Suspense=m,et.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,et.__COMPILER_RUNTIME={__proto__:null,c:function(P){return B.H.useMemoCache(P)}},et.cache=function(P){return function(){return P.apply(null,arguments)}},et.cacheSignal=function(){return null},et.cloneElement=function(P,U,_){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var V=j({},P.props),Z=P.key;if(U!=null)for(re in U.key!==void 0&&(Z=""+U.key),U)!L.call(U,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&U.ref===void 0||(V[re]=U[re]);var re=arguments.length-2;if(re===1)V.children=_;else if(1<re){for(var xe=Array(re),Ae=0;Ae<re;Ae++)xe[Ae]=arguments[Ae+2];V.children=xe}return ee(P.type,Z,V)},et.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:o,_context:P},P},et.createElement=function(P,U,_){var V,Z={},re=null;if(U!=null)for(V in U.key!==void 0&&(re=""+U.key),U)L.call(U,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(Z[V]=U[V]);var xe=arguments.length-2;if(xe===1)Z.children=_;else if(1<xe){for(var Ae=Array(xe),Ce=0;Ce<xe;Ce++)Ae[Ce]=arguments[Ce+2];Z.children=Ae}if(P&&P.defaultProps)for(V in xe=P.defaultProps,xe)Z[V]===void 0&&(Z[V]=xe[V]);return ee(P,re,Z)},et.createRef=function(){return{current:null}},et.forwardRef=function(P){return{$$typeof:f,render:P}},et.isValidElement=$,et.lazy=function(P){return{$$typeof:p,_payload:{_status:-1,_result:P},_init:J}},et.memo=function(P,U){return{$$typeof:h,type:P,compare:U===void 0?null:U}},et.startTransition=function(P){var U=B.T,_={};B.T=_;try{var V=P(),Z=B.S;Z!==null&&Z(_,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(R,ve)}catch(re){ve(re)}finally{U!==null&&_.types!==null&&(U.types=_.types),B.T=U}},et.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},et.use=function(P){return B.H.use(P)},et.useActionState=function(P,U,_){return B.H.useActionState(P,U,_)},et.useCallback=function(P,U){return B.H.useCallback(P,U)},et.useContext=function(P){return B.H.useContext(P)},et.useDebugValue=function(){},et.useDeferredValue=function(P,U){return B.H.useDeferredValue(P,U)},et.useEffect=function(P,U){return B.H.useEffect(P,U)},et.useEffectEvent=function(P){return B.H.useEffectEvent(P)},et.useId=function(){return B.H.useId()},et.useImperativeHandle=function(P,U,_){return B.H.useImperativeHandle(P,U,_)},et.useInsertionEffect=function(P,U){return B.H.useInsertionEffect(P,U)},et.useLayoutEffect=function(P,U){return B.H.useLayoutEffect(P,U)},et.useMemo=function(P,U){return B.H.useMemo(P,U)},et.useOptimistic=function(P,U){return B.H.useOptimistic(P,U)},et.useReducer=function(P,U,_){return B.H.useReducer(P,U,_)},et.useRef=function(P){return B.H.useRef(P)},et.useState=function(P){return B.H.useState(P)},et.useSyncExternalStore=function(P,U,_){return B.H.useSyncExternalStore(P,U,_)},et.useTransition=function(){return B.H.useTransition()},et.version="19.2.4",et}var OS;function ov(){return OS||(OS=1,Qp.exports=fR()),Qp.exports}var b=ov();const hR=oh(b),uv=uR({__proto__:null,default:hR},[b]);var Kp={exports:{}},Mu={},Yp={exports:{}},Xp={};/**
|
|
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 MS;function mR(){return MS||(MS=1,(function(e){function t(G,ie){var J=G.length;G.push(ie);e:for(;0<J;){var ve=J-1>>>1,M=G[ve];if(0<s(M,ie))G[ve]=ie,G[J]=M,J=ve;else break e}}function n(G){return G.length===0?null:G[0]}function a(G){if(G.length===0)return null;var ie=G[0],J=G.pop();if(J!==ie){G[0]=J;e:for(var ve=0,M=G.length,P=M>>>1;ve<P;){var U=2*(ve+1)-1,_=G[U],V=U+1,Z=G[V];if(0>s(_,J))V<M&&0>s(Z,_)?(G[ve]=Z,G[V]=J,ve=V):(G[ve]=_,G[U]=J,ve=U);else if(V<M&&0>s(Z,J))G[ve]=Z,G[V]=J,ve=V;else break e}}return ie}function s(G,ie){var J=G.sortIndex-ie.sortIndex;return J!==0?J:G.id-ie.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=[],p=1,g=null,w=3,x=!1,k=!1,j=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function D(G){for(var ie=n(h);ie!==null;){if(ie.callback===null)a(h);else if(ie.startTime<=G)a(h),ie.sortIndex=ie.expirationTime,t(m,ie);else break;ie=n(h)}}function I(G){if(j=!1,D(G),!k)if(n(m)!==null)k=!0,R||(R=!0,Q());else{var ie=n(h);ie!==null&&X(I,ie.startTime-G)}}var R=!1,B=-1,L=5,ee=-1;function z(){return C?!0:!(e.unstable_now()-ee<L)}function $(){if(C=!1,R){var G=e.unstable_now();ee=G;var ie=!0;try{e:{k=!1,j&&(j=!1,T(B),B=-1),x=!0;var J=w;try{t:{for(D(G),g=n(m);g!==null&&!(g.expirationTime>G&&z());){var ve=g.callback;if(typeof ve=="function"){g.callback=null,w=g.priorityLevel;var M=ve(g.expirationTime<=G);if(G=e.unstable_now(),typeof M=="function"){g.callback=M,D(G),ie=!0;break t}g===n(m)&&a(m),D(G)}else a(m);g=n(m)}if(g!==null)ie=!0;else{var P=n(h);P!==null&&X(I,P.startTime-G),ie=!1}}break e}finally{g=null,w=J,x=!1}ie=void 0}}finally{ie?Q():R=!1}}}var Q;if(typeof O=="function")Q=function(){O($)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,Y=ne.port2;ne.port1.onmessage=$,Q=function(){Y.postMessage(null)}}else Q=function(){E($,0)};function X(G,ie){B=E(function(){G(e.unstable_now())},ie)}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(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(G){switch(w){case 1:case 2:case 3:var ie=3;break;default:ie=w}var J=w;w=ie;try{return G()}finally{w=J}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(G,ie){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var J=w;w=G;try{return ie()}finally{w=J}},e.unstable_scheduleCallback=function(G,ie,J){var ve=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ve+J:ve):J=ve,G){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=J+M,G={id:p++,callback:ie,priorityLevel:G,startTime:J,expirationTime:M,sortIndex:-1},J>ve?(G.sortIndex=J,t(h,G),n(m)===null&&G===n(h)&&(j?(T(B),B=-1):j=!0,X(I,J-ve))):(G.sortIndex=M,t(m,G),k||x||(k=!0,R||(R=!0,Q()))),G},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(G){var ie=w;return function(){var J=w;w=ie;try{return G.apply(this,arguments)}finally{w=J}}}})(Xp)),Xp}var DS;function pR(){return DS||(DS=1,Yp.exports=mR()),Yp.exports}var Wp={exports:{}},Wn={};/**
|
|
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 zS;function gR(){if(zS)return Wn;zS=1;var e=ov();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}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,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:m,containerInfo:h,implementation:p}}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 Wn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Wn.createPortal=function(m,h){var p=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,p)},Wn.flushSync=function(m){var h=c.T,p=a.p;try{if(c.T=null,a.p=2,m)return m()}finally{c.T=h,a.p=p,a.d.f()}},Wn.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))},Wn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Wn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin),w=typeof h.integrity=="string"?h.integrity:void 0,x=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:w,fetchPriority:x}):p==="script"&&a.d.X(m,{crossOrigin:g,integrity:w,fetchPriority:x,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Wn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:p,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)},Wn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin);a.d.L(m,p,{crossOrigin:g,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})}},Wn.preloadModule=function(m,h){if(typeof m=="string")if(h){var p=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Wn.requestFormReset=function(m){a.d.r(m)},Wn.unstable_batchedUpdates=function(m,h){return m(h)},Wn.useFormState=function(m,h,p){return c.H.useFormState(m,h,p)},Wn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Wn.version="19.2.4",Wn}var IS;function Xj(){if(IS)return Wp.exports;IS=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(),Wp.exports=gR(),Wp.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 LS;function yR(){if(LS)return Mu;LS=1;var e=pR(),t=ov(),n=Xj();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)i+="&args[]="+encodeURIComponent(arguments[u])}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,u=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(u=i.return),r=i.return;while(r)}return i.tag===3?u: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 u=r,d=i;;){var y=u.return;if(y===null)break;var v=y.alternate;if(v===null){if(d=y.return,d!==null){u=d;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===u)return m(y),r;if(v===d)return m(y),i;v=v.sibling}throw Error(a(188))}if(u.return!==d.return)u=y,d=v;else{for(var S=!1,A=y.child;A;){if(A===u){S=!0,u=y,d=v;break}if(A===d){S=!0,d=y,u=v;break}A=A.sibling}if(!S){for(A=v.child;A;){if(A===u){S=!0,u=v,d=y;break}if(A===d){S=!0,d=v,u=y;break}A=A.sibling}if(!S)throw Error(a(189))}}if(u.alternate!==d)throw Error(a(190))}if(u.tag!==3)throw Error(a(188));return u.stateNode.current===u?r:i}function p(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=p(r),i!==null)return i;r=r.sibling}return null}var g=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),O=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),z=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function Q(r){return r===null||typeof r!="object"?null:(r=$&&r[$]||r["@@iterator"],typeof r=="function"?r:null)}var ne=Symbol.for("react.client.reference");function Y(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===ne?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case I:return"Suspense";case R:return"SuspenseList";case ee:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case k:return"Portal";case O:return r.displayName||"Context";case T:return(r._context.displayName||"Context")+".Consumer";case D:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case B:return i=r.displayName||null,i!==null?i:Y(r.type)||"Memo";case L:i=r._payload,r=r._init;try{return Y(r(i))}catch{}}return null}var X=Array.isArray,G=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},ve=[],M=-1;function P(r){return{current:r}}function U(r){0>M||(r.current=ve[M],ve[M]=null,M--)}function _(r,i){M++,ve[M]=r.current,r.current=i}var V=P(null),Z=P(null),re=P(null),xe=P(null);function Ae(r,i){switch(_(re,i),_(Z,r),_(V,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?Xw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Xw(i),r=Ww(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}U(V),_(V,r)}function Ce(){U(V),U(Z),U(re)}function Ye(r){r.memoizedState!==null&&_(xe,r);var i=V.current,u=Ww(i,r.type);i!==u&&(_(Z,r),_(V,u))}function Be(r){Z.current===r&&(U(V),U(Z)),xe.current===r&&(U(xe),_u._currentValue=J)}var qe,We;function it(r){if(qe===void 0)try{throw Error()}catch(u){var i=u.stack.trim().match(/\n( *(at )?)/);qe=i&&i[1]||"",We=-1<u.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+qe+r+We}var Se=!1;function Ie(r,i){if(!r||Se)return"";Se=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ue){var oe=ue}Reflect.construct(r,[],pe)}else{try{pe.call()}catch(ue){oe=ue}r.call(pe.prototype)}}else{try{throw Error()}catch(ue){oe=ue}(pe=r())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ue){if(ue&&oe&&typeof ue.stack=="string")return[ue.stack,oe.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),S=v[0],A=v[1];if(S&&A){var q=S.split(`
|
|
44
|
+
`),le=A.split(`
|
|
45
|
+
`);for(y=d=0;d<q.length&&!q[d].includes("DetermineComponentFrameRoot");)d++;for(;y<le.length&&!le[y].includes("DetermineComponentFrameRoot");)y++;if(d===q.length||y===le.length)for(d=q.length-1,y=le.length-1;1<=d&&0<=y&&q[d]!==le[y];)y--;for(;1<=d&&0<=y;d--,y--)if(q[d]!==le[y]){if(d!==1||y!==1)do if(d--,y--,0>y||q[d]!==le[y]){var de=`
|
|
46
|
+
`+q[d].replace(" at new "," at ");return r.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",r.displayName)),de}while(1<=d&&0<=y);break}}}finally{Se=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?it(u):""}function ot(r,i){switch(r.tag){case 26:case 27:case 5:return it(r.type);case 16:return it("Lazy");case 13:return r.child!==i&&i!==null?it("Suspense Fallback"):it("Suspense");case 19:return it("SuspenseList");case 0:case 15:return Ie(r.type,!1);case 11:return Ie(r.type.render,!1);case 1:return Ie(r.type,!0);case 31:return it("Activity");default:return""}}function se(r){try{var i="",u=null;do i+=ot(r,u),u=r,r=r.return;while(r);return i}catch(d){return`
|
|
47
|
+
Error generating stack: `+d.message+`
|
|
48
|
+
`+d.stack}}var Ee=Object.prototype.hasOwnProperty,Ne=e.unstable_scheduleCallback,Ze=e.unstable_cancelCallback,wt=e.unstable_shouldYield,Gt=e.unstable_requestPaint,Ut=e.unstable_now,pr=e.unstable_getCurrentPriorityLevel,ce=e.unstable_ImmediatePriority,me=e.unstable_UserBlockingPriority,Fe=e.unstable_NormalPriority,Je=e.unstable_LowPriority,St=e.unstable_IdlePriority,An=e.log,gr=e.unstable_setDisableYieldValue,Yt=null,qt=null;function Bt(r){if(typeof An=="function"&&gr(r),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Yt,r)}catch{}}var yt=Math.clz32?Math.clz32:Bo,yr=Math.log,Bn=Math.LN2;function Bo(r){return r>>>=0,r===0?32:31-(yr(r)/Bn|0)|0}var ja=256,sr=262144,ma=4194304;function Fn(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 Pa(r,i,u){var d=r.pendingLanes;if(d===0)return 0;var y=0,v=r.suspendedLanes,S=r.pingedLanes;r=r.warmLanes;var A=d&134217727;return A!==0?(d=A&~v,d!==0?y=Fn(d):(S&=A,S!==0?y=Fn(S):u||(u=A&~r,u!==0&&(y=Fn(u))))):(A=d&~v,A!==0?y=Fn(A):S!==0?y=Fn(S):u||(u=d&~r,u!==0&&(y=Fn(u)))),y===0?0:i!==0&&i!==y&&(i&v)===0&&(v=y&-y,u=i&-i,v>=u||v===32&&(u&4194048)!==0)?i:y}function pa(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function rn(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 Qr(){var r=ma;return ma<<=1,(ma&62914560)===0&&(ma=4194304),r}function wi(r){for(var i=[],u=0;31>u;u++)i.push(r);return i}function ga(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Si(r,i,u,d,y,v){var S=r.pendingLanes;r.pendingLanes=u,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=u,r.entangledLanes&=u,r.errorRecoveryDisabledLanes&=u,r.shellSuspendCounter=0;var A=r.entanglements,q=r.expirationTimes,le=r.hiddenUpdates;for(u=S&~u;0<u;){var de=31-yt(u),pe=1<<de;A[de]=0,q[de]=-1;var oe=le[de];if(oe!==null)for(le[de]=null,de=0;de<oe.length;de++){var ue=oe[de];ue!==null&&(ue.lane&=-536870913)}u&=~pe}d!==0&&ki(r,d,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(S&~i))}function ki(r,i,u){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-yt(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|u&261930}function ji(r,i){var u=r.entangledLanes|=i;for(r=r.entanglements;u;){var d=31-yt(u),y=1<<d;y&i|r[d]&i&&(r[d]|=i),u&=~y}}function js(r,i){var u=i&-i;return u=(u&42)!==0?1:In(u),(u&(r.suspendedLanes|i))!==0?0:u}function In(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 vr(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Ci(){var r=ie.p;return r!==0?r:(r=window.event,r===void 0?32:wS(r.type))}function Ei(r,i){var u=ie.p;try{return ie.p=r,i()}finally{ie.p=u}}var ye=Math.random().toString(36).slice(2),Ve="__reactFiber$"+ye,vt="__reactProps$"+ye,$n="__reactContainer$"+ye,Ua="__reactEvents$"+ye,Fo="__reactListeners$"+ye,Kc="__reactHandles$"+ye,$o="__reactResources$"+ye,Ni="__reactMarker$"+ye;function $e(r){delete r[Ve],delete r[vt],delete r[Ua],delete r[Fo],delete r[Kc]}function H(r){var i=r[Ve];if(i)return i;for(var u=r.parentNode;u;){if(i=u[$n]||u[Ve]){if(u=i.alternate,i.child!==null||u!==null&&u.child!==null)for(r=iS(r);r!==null;){if(u=r[Ve])return u;r=iS(r)}return i}r=u,u=r.parentNode}return null}function ge(r){if(r=r[Ve]||r[$n]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function _e(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function Nt(r){var i=r[$o];return i||(i=r[$o]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function kt(r){r[Ni]=!0}var an=new Set,Hn={};function xn(r,i){Ln(r,i),Ln(r+"Capture",i)}function Ln(r,i){for(Hn[r]=i,r=0;r<i.length;r++)an.add(i[r])}var Ho=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]*$"),pn={},qo={};function Yc(r){return Ee.call(qo,r)?!0:Ee.call(pn,r)?!1:Ho.test(r)?qo[r]=!0:(pn[r]=!0,!1)}function Xc(r,i,u){if(Yc(i))if(u===null)r.removeAttribute(i);else{switch(typeof u){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,""+u)}}function Wc(r,i,u){if(u===null)r.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+u)}}function Ba(r,i,u,d){if(d===null)r.removeAttribute(u);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(u);return}r.setAttributeNS(i,u,""+d)}}function Kr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Hb(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function nA(r,i,u){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,v=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return y.call(this)},set:function(S){u=""+S,v.call(this,S)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return u},setValue:function(S){u=""+S},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Uh(r){if(!r._valueTracker){var i=Hb(r)?"checked":"value";r._valueTracker=nA(r,i,""+r[i])}}function qb(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var u=i.getValue(),d="";return r&&(d=Hb(r)?r.checked?"true":"false":r.value),r=d,r!==u?(i.setValue(r),!0):!1}function Jc(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 rA=/[\n"\\]/g;function Yr(r){return r.replace(rA,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Bh(r,i,u,d,y,v,S,A){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=""+Kr(i)):r.value!==""+Kr(i)&&(r.value=""+Kr(i)):S!=="submit"&&S!=="reset"||r.removeAttribute("value"),i!=null?Fh(r,S,Kr(i)):u!=null?Fh(r,S,Kr(u)):d!=null&&r.removeAttribute("value"),y==null&&v!=null&&(r.defaultChecked=!!v),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?r.name=""+Kr(A):r.removeAttribute("name")}function Zb(r,i,u,d,y,v,S,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Uh(r);return}u=u!=null?""+Kr(u):"",i=i!=null?""+Kr(i):u,A||i===r.value||(r.value=i),r.defaultValue=i}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=A?r.checked:!!d,r.defaultChecked=!!d,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(r.name=S),Uh(r)}function Fh(r,i,u){i==="number"&&Jc(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function cl(r,i,u,d){if(r=r.options,i){i={};for(var y=0;y<u.length;y++)i["$"+u[y]]=!0;for(u=0;u<r.length;u++)y=i.hasOwnProperty("$"+r[u].value),r[u].selected!==y&&(r[u].selected=y),y&&d&&(r[u].defaultSelected=!0)}else{for(u=""+Kr(u),i=null,y=0;y<r.length;y++){if(r[y].value===u){r[y].selected=!0,d&&(r[y].defaultSelected=!0);return}i!==null||r[y].disabled||(i=r[y])}i!==null&&(i.selected=!0)}}function Gb(r,i,u){if(i!=null&&(i=""+Kr(i),i!==r.value&&(r.value=i),u==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=u!=null?""+Kr(u):""}function Vb(r,i,u,d){if(i==null){if(d!=null){if(u!=null)throw Error(a(92));if(X(d)){if(1<d.length)throw Error(a(93));d=d[0]}u=d}u==null&&(u=""),i=u}u=Kr(i),r.defaultValue=u,d=r.textContent,d===u&&d!==""&&d!==null&&(r.value=d),Uh(r)}function dl(r,i){if(i){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=i;return}}r.textContent=i}var aA=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 Qb(r,i,u){var d=i.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,u):typeof u!="number"||u===0||aA.has(i)?i==="float"?r.cssFloat=u:r[i]=(""+u).trim():r[i]=u+"px"}function Kb(r,i,u){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,u!=null){for(var d in u)!u.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var y in i)d=i[y],i.hasOwnProperty(y)&&u[y]!==d&&Qb(r,y,d)}else for(var v in i)i.hasOwnProperty(v)&&Qb(r,v,i[v])}function $h(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 iA=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"]]),sA=/^[\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 ed(r){return sA.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Fa(){}var Hh=null;function qh(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var fl=null,hl=null;function Yb(r){var i=ge(r);if(i&&(r=i.stateNode)){var u=r[vt]||null;e:switch(r=i.stateNode,i.type){case"input":if(Bh(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),i=u.name,u.type==="radio"&&i!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Yr(""+i)+'"][type="radio"]'),i=0;i<u.length;i++){var d=u[i];if(d!==r&&d.form===r.form){var y=d[vt]||null;if(!y)throw Error(a(90));Bh(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<u.length;i++)d=u[i],d.form===r.form&&qb(d)}break e;case"textarea":Gb(r,u.value,u.defaultValue);break e;case"select":i=u.value,i!=null&&cl(r,!!u.multiple,i,!1)}}}var Zh=!1;function Xb(r,i,u){if(Zh)return r(i,u);Zh=!0;try{var d=r(i);return d}finally{if(Zh=!1,(fl!==null||hl!==null)&&(Fd(),fl&&(i=fl,r=hl,hl=fl=null,Yb(i),r)))for(i=0;i<r.length;i++)Yb(r[i])}}function Zo(r,i){var u=r.stateNode;if(u===null)return null;var d=u[vt]||null;if(d===null)return null;u=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(u&&typeof u!="function")throw Error(a(231,i,typeof u));return u}var $a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gh=!1;if($a)try{var Go={};Object.defineProperty(Go,"passive",{get:function(){Gh=!0}}),window.addEventListener("test",Go,Go),window.removeEventListener("test",Go,Go)}catch{Gh=!1}var _i=null,Vh=null,td=null;function Wb(){if(td)return td;var r,i=Vh,u=i.length,d,y="value"in _i?_i.value:_i.textContent,v=y.length;for(r=0;r<u&&i[r]===y[r];r++);var S=u-r;for(d=1;d<=S&&i[u-d]===y[v-d];d++);return td=y.slice(r,1<d?1-d:void 0)}function nd(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 rd(){return!0}function Jb(){return!1}function br(r){function i(u,d,y,v,S){this._reactName=u,this._targetInst=y,this.type=d,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var A in r)r.hasOwnProperty(A)&&(u=r[A],this[A]=u?u(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?rd:Jb,this.isPropagationStopped=Jb,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=rd)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=rd)},persist:function(){},isPersistent:rd}),i}var Cs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ad=br(Cs),Vo=g({},Cs,{view:0,detail:0}),lA=br(Vo),Qh,Kh,Qo,id=g({},Vo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xh,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!==Qo&&(Qo&&r.type==="mousemove"?(Qh=r.screenX-Qo.screenX,Kh=r.screenY-Qo.screenY):Kh=Qh=0,Qo=r),Qh)},movementY:function(r){return"movementY"in r?r.movementY:Kh}}),ex=br(id),oA=g({},id,{dataTransfer:0}),uA=br(oA),cA=g({},Vo,{relatedTarget:0}),Yh=br(cA),dA=g({},Cs,{animationName:0,elapsedTime:0,pseudoElement:0}),fA=br(dA),hA=g({},Cs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),mA=br(hA),pA=g({},Cs,{data:0}),tx=br(pA),gA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yA={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"},vA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bA(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=vA[r])?!!i[r]:!1}function Xh(){return bA}var xA=g({},Vo,{key:function(r){if(r.key){var i=gA[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=nd(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?yA[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xh,charCode:function(r){return r.type==="keypress"?nd(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?nd(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),wA=br(xA),SA=g({},id,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nx=br(SA),kA=g({},Vo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xh}),jA=br(kA),CA=g({},Cs,{propertyName:0,elapsedTime:0,pseudoElement:0}),EA=br(CA),NA=g({},id,{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}),_A=br(NA),TA=g({},Cs,{newState:0,oldState:0}),AA=br(TA),RA=[9,13,27,32],Wh=$a&&"CompositionEvent"in window,Ko=null;$a&&"documentMode"in document&&(Ko=document.documentMode);var OA=$a&&"TextEvent"in window&&!Ko,rx=$a&&(!Wh||Ko&&8<Ko&&11>=Ko),ax=" ",ix=!1;function sx(r,i){switch(r){case"keyup":return RA.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ml=!1;function MA(r,i){switch(r){case"compositionend":return lx(i);case"keypress":return i.which!==32?null:(ix=!0,ax);case"textInput":return r=i.data,r===ax&&ix?null:r;default:return null}}function DA(r,i){if(ml)return r==="compositionend"||!Wh&&sx(r,i)?(r=Wb(),td=Vh=_i=null,ml=!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 rx&&i.locale!=="ko"?null:i.data;default:return null}}var zA={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 ox(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!zA[r.type]:i==="textarea"}function ux(r,i,u,d){fl?hl?hl.push(d):hl=[d]:fl=d,i=Qd(i,"onChange"),0<i.length&&(u=new ad("onChange","change",null,u,d),r.push({event:u,listeners:i}))}var Yo=null,Xo=null;function IA(r){Zw(r,0)}function sd(r){var i=_e(r);if(qb(i))return r}function cx(r,i){if(r==="change")return i}var dx=!1;if($a){var Jh;if($a){var em="oninput"in document;if(!em){var fx=document.createElement("div");fx.setAttribute("oninput","return;"),em=typeof fx.oninput=="function"}Jh=em}else Jh=!1;dx=Jh&&(!document.documentMode||9<document.documentMode)}function hx(){Yo&&(Yo.detachEvent("onpropertychange",mx),Xo=Yo=null)}function mx(r){if(r.propertyName==="value"&&sd(Xo)){var i=[];ux(i,Xo,r,qh(r)),Xb(IA,i)}}function LA(r,i,u){r==="focusin"?(hx(),Yo=i,Xo=u,Yo.attachEvent("onpropertychange",mx)):r==="focusout"&&hx()}function PA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return sd(Xo)}function UA(r,i){if(r==="click")return sd(i)}function BA(r,i){if(r==="input"||r==="change")return sd(i)}function FA(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var zr=typeof Object.is=="function"?Object.is:FA;function Wo(r,i){if(zr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var u=Object.keys(r),d=Object.keys(i);if(u.length!==d.length)return!1;for(d=0;d<u.length;d++){var y=u[d];if(!Ee.call(i,y)||!zr(r[y],i[y]))return!1}return!0}function px(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function gx(r,i){var u=px(r);r=0;for(var d;u;){if(u.nodeType===3){if(d=r+u.textContent.length,r<=i&&d>=i)return{node:u,offset:i-r};r=d}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=px(u)}}function yx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?yx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function vx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=Jc(r.document);i instanceof r.HTMLIFrameElement;){try{var u=typeof i.contentWindow.location.href=="string"}catch{u=!1}if(u)r=i.contentWindow;else break;i=Jc(r.document)}return i}function tm(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 $A=$a&&"documentMode"in document&&11>=document.documentMode,pl=null,nm=null,Jo=null,rm=!1;function bx(r,i,u){var d=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;rm||pl==null||pl!==Jc(d)||(d=pl,"selectionStart"in d&&tm(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}),Jo&&Wo(Jo,d)||(Jo=d,d=Qd(nm,"onSelect"),0<d.length&&(i=new ad("onSelect","select",null,i,u),r.push({event:i,listeners:d}),i.target=pl)))}function Es(r,i){var u={};return u[r.toLowerCase()]=i.toLowerCase(),u["Webkit"+r]="webkit"+i,u["Moz"+r]="moz"+i,u}var gl={animationend:Es("Animation","AnimationEnd"),animationiteration:Es("Animation","AnimationIteration"),animationstart:Es("Animation","AnimationStart"),transitionrun:Es("Transition","TransitionRun"),transitionstart:Es("Transition","TransitionStart"),transitioncancel:Es("Transition","TransitionCancel"),transitionend:Es("Transition","TransitionEnd")},am={},xx={};$a&&(xx=document.createElement("div").style,"AnimationEvent"in window||(delete gl.animationend.animation,delete gl.animationiteration.animation,delete gl.animationstart.animation),"TransitionEvent"in window||delete gl.transitionend.transition);function Ns(r){if(am[r])return am[r];if(!gl[r])return r;var i=gl[r],u;for(u in i)if(i.hasOwnProperty(u)&&u in xx)return am[r]=i[u];return r}var wx=Ns("animationend"),Sx=Ns("animationiteration"),kx=Ns("animationstart"),HA=Ns("transitionrun"),qA=Ns("transitionstart"),ZA=Ns("transitioncancel"),jx=Ns("transitionend"),Cx=new Map,im="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(" ");im.push("scrollEnd");function ya(r,i){Cx.set(r,i),xn(i,[r])}var ld=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)},Xr=[],yl=0,sm=0;function od(){for(var r=yl,i=sm=yl=0;i<r;){var u=Xr[i];Xr[i++]=null;var d=Xr[i];Xr[i++]=null;var y=Xr[i];Xr[i++]=null;var v=Xr[i];if(Xr[i++]=null,d!==null&&y!==null){var S=d.pending;S===null?y.next=y:(y.next=S.next,S.next=y),d.pending=y}v!==0&&Ex(u,y,v)}}function ud(r,i,u,d){Xr[yl++]=r,Xr[yl++]=i,Xr[yl++]=u,Xr[yl++]=d,sm|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function lm(r,i,u,d){return ud(r,i,u,d),cd(r)}function _s(r,i){return ud(r,null,null,i),cd(r)}function Ex(r,i,u){r.lanes|=u;var d=r.alternate;d!==null&&(d.lanes|=u);for(var y=!1,v=r.return;v!==null;)v.childLanes|=u,d=v.alternate,d!==null&&(d.childLanes|=u),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(y=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,y&&i!==null&&(y=31-yt(u),r=v.hiddenUpdates,d=r[y],d===null?r[y]=[i]:d.push(i),i.lane=u|536870912),v):null}function cd(r){if(50<wu)throw wu=0,gp=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var vl={};function GA(r,i,u,d){this.tag=r,this.key=u,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 Ir(r,i,u,d){return new GA(r,i,u,d)}function om(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ha(r,i){var u=r.alternate;return u===null?(u=Ir(r.tag,i,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=i,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&65011712,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,i=r.dependencies,u.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u.refCleanup=r.refCleanup,u}function Nx(r,i){r.flags&=65011714;var u=r.alternate;return u===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=u.childLanes,r.lanes=u.lanes,r.child=u.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=u.memoizedProps,r.memoizedState=u.memoizedState,r.updateQueue=u.updateQueue,r.type=u.type,i=u.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function dd(r,i,u,d,y,v){var S=0;if(d=r,typeof r=="function")om(r)&&(S=1);else if(typeof r=="string")S=X2(r,u,V.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case ee:return r=Ir(31,u,i,y),r.elementType=ee,r.lanes=v,r;case j:return Ts(u.children,y,v,i);case C:S=8,y|=24;break;case E:return r=Ir(12,u,i,y|2),r.elementType=E,r.lanes=v,r;case I:return r=Ir(13,u,i,y),r.elementType=I,r.lanes=v,r;case R:return r=Ir(19,u,i,y),r.elementType=R,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case O:S=10;break e;case T:S=9;break e;case D:S=11;break e;case B:S=14;break e;case L:S=16,d=null;break e}S=29,u=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Ir(S,u,i,y),i.elementType=r,i.type=d,i.lanes=v,i}function Ts(r,i,u,d){return r=Ir(7,r,d,i),r.lanes=u,r}function um(r,i,u){return r=Ir(6,r,null,i),r.lanes=u,r}function _x(r){var i=Ir(18,null,null,0);return i.stateNode=r,i}function cm(r,i,u){return i=Ir(4,r.children!==null?r.children:[],r.key,i),i.lanes=u,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Tx=new WeakMap;function Wr(r,i){if(typeof r=="object"&&r!==null){var u=Tx.get(r);return u!==void 0?u:(i={value:r,source:i,stack:se(i)},Tx.set(r,i),i)}return{value:r,source:i,stack:se(i)}}var bl=[],xl=0,fd=null,eu=0,Jr=[],ea=0,Ti=null,Ca=1,Ea="";function qa(r,i){bl[xl++]=eu,bl[xl++]=fd,fd=r,eu=i}function Ax(r,i,u){Jr[ea++]=Ca,Jr[ea++]=Ea,Jr[ea++]=Ti,Ti=r;var d=Ca;r=Ea;var y=32-yt(d)-1;d&=~(1<<y),u+=1;var v=32-yt(i)+y;if(30<v){var S=y-y%5;v=(d&(1<<S)-1).toString(32),d>>=S,y-=S,Ca=1<<32-yt(i)+y|u<<y|d,Ea=v+r}else Ca=1<<v|u<<y|d,Ea=r}function dm(r){r.return!==null&&(qa(r,1),Ax(r,1,0))}function fm(r){for(;r===fd;)fd=bl[--xl],bl[xl]=null,eu=bl[--xl],bl[xl]=null;for(;r===Ti;)Ti=Jr[--ea],Jr[ea]=null,Ea=Jr[--ea],Jr[ea]=null,Ca=Jr[--ea],Jr[ea]=null}function Rx(r,i){Jr[ea++]=Ca,Jr[ea++]=Ea,Jr[ea++]=Ti,Ca=i.id,Ea=i.overflow,Ti=r}var qn=null,Vt=null,jt=!1,Ai=null,ta=!1,hm=Error(a(519));function Ri(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw tu(Wr(i,r)),hm}function Ox(r){var i=r.stateNode,u=r.type,d=r.memoizedProps;switch(i[Ve]=r,i[vt]=d,u){case"dialog":ht("cancel",i),ht("close",i);break;case"iframe":case"object":case"embed":ht("load",i);break;case"video":case"audio":for(u=0;u<ku.length;u++)ht(ku[u],i);break;case"source":ht("error",i);break;case"img":case"image":case"link":ht("error",i),ht("load",i);break;case"details":ht("toggle",i);break;case"input":ht("invalid",i),Zb(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ht("invalid",i);break;case"textarea":ht("invalid",i),Vb(i,d.value,d.defaultValue,d.children)}u=d.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||i.textContent===""+u||d.suppressHydrationWarning===!0||Kw(i.textContent,u)?(d.popover!=null&&(ht("beforetoggle",i),ht("toggle",i)),d.onScroll!=null&&ht("scroll",i),d.onScrollEnd!=null&&ht("scrollend",i),d.onClick!=null&&(i.onclick=Fa),i=!0):i=!1,i||Ri(r,!0)}function Mx(r){for(qn=r.return;qn;)switch(qn.tag){case 5:case 31:case 13:ta=!1;return;case 27:case 3:ta=!0;return;default:qn=qn.return}}function wl(r){if(r!==qn)return!1;if(!jt)return Mx(r),jt=!0,!1;var i=r.tag,u;if((u=i!==3&&i!==27)&&((u=i===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||Rp(r.type,r.memoizedProps)),u=!u),u&&Vt&&Ri(r),Mx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Vt=aS(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Vt=aS(r)}else i===27?(i=Vt,Zi(r.type)?(r=Ip,Ip=null,Vt=r):Vt=i):Vt=qn?ra(r.stateNode.nextSibling):null;return!0}function As(){Vt=qn=null,jt=!1}function mm(){var r=Ai;return r!==null&&(kr===null?kr=r:kr.push.apply(kr,r),Ai=null),r}function tu(r){Ai===null?Ai=[r]:Ai.push(r)}var pm=P(null),Rs=null,Za=null;function Oi(r,i,u){_(pm,i._currentValue),i._currentValue=u}function Ga(r){r._currentValue=pm.current,U(pm)}function gm(r,i,u){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===u)break;r=r.return}}function ym(r,i,u,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var S=y.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=y;for(var q=0;q<i.length;q++)if(A.context===i[q]){v.lanes|=u,A=v.alternate,A!==null&&(A.lanes|=u),gm(v.return,u,r),d||(S=null);break e}v=A.next}}else if(y.tag===18){if(S=y.return,S===null)throw Error(a(341));S.lanes|=u,v=S.alternate,v!==null&&(v.lanes|=u),gm(S,u,r),S=null}else S=y.child;if(S!==null)S.return=y;else for(S=y;S!==null;){if(S===r){S=null;break}if(y=S.sibling,y!==null){y.return=S.return,S=y;break}S=S.return}y=S}}function Sl(r,i,u,d){r=null;for(var y=i,v=!1;y!==null;){if(!v){if((y.flags&524288)!==0)v=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var S=y.alternate;if(S===null)throw Error(a(387));if(S=S.memoizedProps,S!==null){var A=y.type;zr(y.pendingProps.value,S.value)||(r!==null?r.push(A):r=[A])}}else if(y===xe.current){if(S=y.alternate,S===null)throw Error(a(387));S.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(_u):r=[_u])}y=y.return}r!==null&&ym(i,r,u,d),i.flags|=262144}function hd(r){for(r=r.firstContext;r!==null;){if(!zr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Os(r){Rs=r,Za=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Zn(r){return Dx(Rs,r)}function md(r,i){return Rs===null&&Os(r),Dx(r,i)}function Dx(r,i){var u=i._currentValue;if(i={context:i,memoizedValue:u,next:null},Za===null){if(r===null)throw Error(a(308));Za=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Za=Za.next=i;return u}var VA=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(u,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(u){return u()})}},QA=e.unstable_scheduleCallback,KA=e.unstable_NormalPriority,wn={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vm(){return{controller:new VA,data:new Map,refCount:0}}function nu(r){r.refCount--,r.refCount===0&&QA(KA,function(){r.controller.abort()})}var ru=null,bm=0,kl=0,jl=null;function YA(r,i){if(ru===null){var u=ru=[];bm=0,kl=Sp(),jl={status:"pending",value:void 0,then:function(d){u.push(d)}}}return bm++,i.then(zx,zx),i}function zx(){if(--bm===0&&ru!==null){jl!==null&&(jl.status="fulfilled");var r=ru;ru=null,kl=0,jl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function XA(r,i){var u=[],d={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var y=0;y<u.length;y++)(0,u[y])(i)},function(y){for(d.status="rejected",d.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),d}var Ix=G.S;G.S=function(r,i){bw=Ut(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&YA(r,i),Ix!==null&&Ix(r,i)};var Ms=P(null);function xm(){var r=Ms.current;return r!==null?r:Ft.pooledCache}function pd(r,i){i===null?_(Ms,Ms.current):_(Ms,i.pool)}function Lx(){var r=xm();return r===null?null:{parent:wn._currentValue,pool:r}}var Cl=Error(a(460)),wm=Error(a(474)),gd=Error(a(542)),yd={then:function(){}};function Px(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Ux(r,i,u){switch(u=r[u],u===void 0?r.push(i):u!==i&&(i.then(Fa,Fa),i=u),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Fx(r),r;default:if(typeof i.status=="string")i.then(Fa,Fa);else{if(r=Ft,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=d}},function(d){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Fx(r),r}throw zs=i,Cl}}function Ds(r){try{var i=r._init;return i(r._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(zs=u,Cl):u}}var zs=null;function Bx(){if(zs===null)throw Error(a(459));var r=zs;return zs=null,r}function Fx(r){if(r===Cl||r===gd)throw Error(a(483))}var El=null,au=0;function vd(r){var i=au;return au+=1,El===null&&(El=[]),Ux(El,r,i)}function iu(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function bd(r,i){throw i.$$typeof===w?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function $x(r){function i(W,K){if(r){var ae=W.deletions;ae===null?(W.deletions=[K],W.flags|=16):ae.push(K)}}function u(W,K){if(!r)return null;for(;K!==null;)i(W,K),K=K.sibling;return null}function d(W){for(var K=new Map;W!==null;)W.key!==null?K.set(W.key,W):K.set(W.index,W),W=W.sibling;return K}function y(W,K){return W=Ha(W,K),W.index=0,W.sibling=null,W}function v(W,K,ae){return W.index=ae,r?(ae=W.alternate,ae!==null?(ae=ae.index,ae<K?(W.flags|=67108866,K):ae):(W.flags|=67108866,K)):(W.flags|=1048576,K)}function S(W){return r&&W.alternate===null&&(W.flags|=67108866),W}function A(W,K,ae,he){return K===null||K.tag!==6?(K=um(ae,W.mode,he),K.return=W,K):(K=y(K,ae),K.return=W,K)}function q(W,K,ae,he){var He=ae.type;return He===j?de(W,K,ae.props.children,he,ae.key):K!==null&&(K.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===L&&Ds(He)===K.type)?(K=y(K,ae.props),iu(K,ae),K.return=W,K):(K=dd(ae.type,ae.key,ae.props,null,W.mode,he),iu(K,ae),K.return=W,K)}function le(W,K,ae,he){return K===null||K.tag!==4||K.stateNode.containerInfo!==ae.containerInfo||K.stateNode.implementation!==ae.implementation?(K=cm(ae,W.mode,he),K.return=W,K):(K=y(K,ae.children||[]),K.return=W,K)}function de(W,K,ae,he,He){return K===null||K.tag!==7?(K=Ts(ae,W.mode,he,He),K.return=W,K):(K=y(K,ae),K.return=W,K)}function pe(W,K,ae){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=um(""+K,W.mode,ae),K.return=W,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case x:return ae=dd(K.type,K.key,K.props,null,W.mode,ae),iu(ae,K),ae.return=W,ae;case k:return K=cm(K,W.mode,ae),K.return=W,K;case L:return K=Ds(K),pe(W,K,ae)}if(X(K)||Q(K))return K=Ts(K,W.mode,ae,null),K.return=W,K;if(typeof K.then=="function")return pe(W,vd(K),ae);if(K.$$typeof===O)return pe(W,md(W,K),ae);bd(W,K)}return null}function oe(W,K,ae,he){var He=K!==null?K.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return He!==null?null:A(W,K,""+ae,he);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:return ae.key===He?q(W,K,ae,he):null;case k:return ae.key===He?le(W,K,ae,he):null;case L:return ae=Ds(ae),oe(W,K,ae,he)}if(X(ae)||Q(ae))return He!==null?null:de(W,K,ae,he,null);if(typeof ae.then=="function")return oe(W,K,vd(ae),he);if(ae.$$typeof===O)return oe(W,K,md(W,ae),he);bd(W,ae)}return null}function ue(W,K,ae,he,He){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return W=W.get(ae)||null,A(K,W,""+he,He);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case x:return W=W.get(he.key===null?ae:he.key)||null,q(K,W,he,He);case k:return W=W.get(he.key===null?ae:he.key)||null,le(K,W,he,He);case L:return he=Ds(he),ue(W,K,ae,he,He)}if(X(he)||Q(he))return W=W.get(ae)||null,de(K,W,he,He,null);if(typeof he.then=="function")return ue(W,K,ae,vd(he),He);if(he.$$typeof===O)return ue(W,K,ae,md(K,he),He);bd(K,he)}return null}function Re(W,K,ae,he){for(var He=null,_t=null,Le=K,nt=K=0,xt=null;Le!==null&&nt<ae.length;nt++){Le.index>nt?(xt=Le,Le=null):xt=Le.sibling;var Tt=oe(W,Le,ae[nt],he);if(Tt===null){Le===null&&(Le=xt);break}r&&Le&&Tt.alternate===null&&i(W,Le),K=v(Tt,K,nt),_t===null?He=Tt:_t.sibling=Tt,_t=Tt,Le=xt}if(nt===ae.length)return u(W,Le),jt&&qa(W,nt),He;if(Le===null){for(;nt<ae.length;nt++)Le=pe(W,ae[nt],he),Le!==null&&(K=v(Le,K,nt),_t===null?He=Le:_t.sibling=Le,_t=Le);return jt&&qa(W,nt),He}for(Le=d(Le);nt<ae.length;nt++)xt=ue(Le,W,nt,ae[nt],he),xt!==null&&(r&&xt.alternate!==null&&Le.delete(xt.key===null?nt:xt.key),K=v(xt,K,nt),_t===null?He=xt:_t.sibling=xt,_t=xt);return r&&Le.forEach(function(Yi){return i(W,Yi)}),jt&&qa(W,nt),He}function Qe(W,K,ae,he){if(ae==null)throw Error(a(151));for(var He=null,_t=null,Le=K,nt=K=0,xt=null,Tt=ae.next();Le!==null&&!Tt.done;nt++,Tt=ae.next()){Le.index>nt?(xt=Le,Le=null):xt=Le.sibling;var Yi=oe(W,Le,Tt.value,he);if(Yi===null){Le===null&&(Le=xt);break}r&&Le&&Yi.alternate===null&&i(W,Le),K=v(Yi,K,nt),_t===null?He=Yi:_t.sibling=Yi,_t=Yi,Le=xt}if(Tt.done)return u(W,Le),jt&&qa(W,nt),He;if(Le===null){for(;!Tt.done;nt++,Tt=ae.next())Tt=pe(W,Tt.value,he),Tt!==null&&(K=v(Tt,K,nt),_t===null?He=Tt:_t.sibling=Tt,_t=Tt);return jt&&qa(W,nt),He}for(Le=d(Le);!Tt.done;nt++,Tt=ae.next())Tt=ue(Le,W,nt,Tt.value,he),Tt!==null&&(r&&Tt.alternate!==null&&Le.delete(Tt.key===null?nt:Tt.key),K=v(Tt,K,nt),_t===null?He=Tt:_t.sibling=Tt,_t=Tt);return r&&Le.forEach(function(oR){return i(W,oR)}),jt&&qa(W,nt),He}function Lt(W,K,ae,he){if(typeof ae=="object"&&ae!==null&&ae.type===j&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:e:{for(var He=ae.key;K!==null;){if(K.key===He){if(He=ae.type,He===j){if(K.tag===7){u(W,K.sibling),he=y(K,ae.props.children),he.return=W,W=he;break e}}else if(K.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===L&&Ds(He)===K.type){u(W,K.sibling),he=y(K,ae.props),iu(he,ae),he.return=W,W=he;break e}u(W,K);break}else i(W,K);K=K.sibling}ae.type===j?(he=Ts(ae.props.children,W.mode,he,ae.key),he.return=W,W=he):(he=dd(ae.type,ae.key,ae.props,null,W.mode,he),iu(he,ae),he.return=W,W=he)}return S(W);case k:e:{for(He=ae.key;K!==null;){if(K.key===He)if(K.tag===4&&K.stateNode.containerInfo===ae.containerInfo&&K.stateNode.implementation===ae.implementation){u(W,K.sibling),he=y(K,ae.children||[]),he.return=W,W=he;break e}else{u(W,K);break}else i(W,K);K=K.sibling}he=cm(ae,W.mode,he),he.return=W,W=he}return S(W);case L:return ae=Ds(ae),Lt(W,K,ae,he)}if(X(ae))return Re(W,K,ae,he);if(Q(ae)){if(He=Q(ae),typeof He!="function")throw Error(a(150));return ae=He.call(ae),Qe(W,K,ae,he)}if(typeof ae.then=="function")return Lt(W,K,vd(ae),he);if(ae.$$typeof===O)return Lt(W,K,md(W,ae),he);bd(W,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,K!==null&&K.tag===6?(u(W,K.sibling),he=y(K,ae),he.return=W,W=he):(u(W,K),he=um(ae,W.mode,he),he.return=W,W=he),S(W)):u(W,K)}return function(W,K,ae,he){try{au=0;var He=Lt(W,K,ae,he);return El=null,He}catch(Le){if(Le===Cl||Le===gd)throw Le;var _t=Ir(29,Le,null,W.mode);return _t.lanes=he,_t.return=W,_t}finally{}}}var Is=$x(!0),Hx=$x(!1),Mi=!1;function Sm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function km(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 Di(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function zi(r,i,u){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(At&2)!==0){var y=d.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),d.pending=i,i=cd(r),Ex(r,null,u),i}return ud(r,d,i,u),cd(r)}function su(r,i,u){if(i=i.updateQueue,i!==null&&(i=i.shared,(u&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,ji(r,u)}}function jm(r,i){var u=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,u===d)){var y=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var S={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?y=v=S:v=v.next=S,u=u.next}while(u!==null);v===null?y=v=i:v=v.next=i}else y=v=i;u={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=i:r.next=i,u.lastBaseUpdate=i}var Cm=!1;function lu(){if(Cm){var r=jl;if(r!==null)throw r}}function ou(r,i,u,d){Cm=!1;var y=r.updateQueue;Mi=!1;var v=y.firstBaseUpdate,S=y.lastBaseUpdate,A=y.shared.pending;if(A!==null){y.shared.pending=null;var q=A,le=q.next;q.next=null,S===null?v=le:S.next=le,S=q;var de=r.alternate;de!==null&&(de=de.updateQueue,A=de.lastBaseUpdate,A!==S&&(A===null?de.firstBaseUpdate=le:A.next=le,de.lastBaseUpdate=q))}if(v!==null){var pe=y.baseState;S=0,de=le=q=null,A=v;do{var oe=A.lane&-536870913,ue=oe!==A.lane;if(ue?(bt&oe)===oe:(d&oe)===oe){oe!==0&&oe===kl&&(Cm=!0),de!==null&&(de=de.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Re=r,Qe=A;oe=i;var Lt=u;switch(Qe.tag){case 1:if(Re=Qe.payload,typeof Re=="function"){pe=Re.call(Lt,pe,oe);break e}pe=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Qe.payload,oe=typeof Re=="function"?Re.call(Lt,pe,oe):Re,oe==null)break e;pe=g({},pe,oe);break e;case 2:Mi=!0}}oe=A.callback,oe!==null&&(r.flags|=64,ue&&(r.flags|=8192),ue=y.callbacks,ue===null?y.callbacks=[oe]:ue.push(oe))}else ue={lane:oe,tag:A.tag,payload:A.payload,callback:A.callback,next:null},de===null?(le=de=ue,q=pe):de=de.next=ue,S|=oe;if(A=A.next,A===null){if(A=y.shared.pending,A===null)break;ue=A,A=ue.next,ue.next=null,y.lastBaseUpdate=ue,y.shared.pending=null}}while(!0);de===null&&(q=pe),y.baseState=q,y.firstBaseUpdate=le,y.lastBaseUpdate=de,v===null&&(y.shared.lanes=0),Bi|=S,r.lanes=S,r.memoizedState=pe}}function qx(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Zx(r,i){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)qx(u[r],i)}var Nl=P(null),xd=P(0);function Gx(r,i){r=ti,_(xd,r),_(Nl,i),ti=r|i.baseLanes}function Em(){_(xd,ti),_(Nl,Nl.current)}function Nm(){ti=xd.current,U(Nl),U(xd)}var Lr=P(null),na=null;function Ii(r){var i=r.alternate;_(gn,gn.current&1),_(Lr,r),na===null&&(i===null||Nl.current!==null||i.memoizedState!==null)&&(na=r)}function _m(r){_(gn,gn.current),_(Lr,r),na===null&&(na=r)}function Vx(r){r.tag===22?(_(gn,gn.current),_(Lr,r),na===null&&(na=r)):Li()}function Li(){_(gn,gn.current),_(Lr,Lr.current)}function Pr(r){U(Lr),na===r&&(na=null),U(gn)}var gn=P(0);function wd(r){for(var i=r;i!==null;){if(i.tag===13){var u=i.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Dp(u)||zp(u)))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 Va=0,tt=null,zt=null,Sn=null,Sd=!1,_l=!1,Ls=!1,kd=0,uu=0,Tl=null,WA=0;function on(){throw Error(a(321))}function Tm(r,i){if(i===null)return!1;for(var u=0;u<i.length&&u<r.length;u++)if(!zr(r[u],i[u]))return!1;return!0}function Am(r,i,u,d,y,v){return Va=v,tt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,G.H=r===null||r.memoizedState===null?A0:Zm,Ls=!1,v=u(d,y),Ls=!1,_l&&(v=Kx(i,u,d,y)),Qx(r),v}function Qx(r){G.H=fu;var i=zt!==null&&zt.next!==null;if(Va=0,Sn=zt=tt=null,Sd=!1,uu=0,Tl=null,i)throw Error(a(300));r===null||kn||(r=r.dependencies,r!==null&&hd(r)&&(kn=!0))}function Kx(r,i,u,d){tt=r;var y=0;do{if(_l&&(Tl=null),uu=0,_l=!1,25<=y)throw Error(a(301));if(y+=1,Sn=zt=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}G.H=R0,v=i(u,d)}while(_l);return v}function JA(){var r=G.H,i=r.useState()[0];return i=typeof i.then=="function"?cu(i):i,r=r.useState()[0],(zt!==null?zt.memoizedState:null)!==r&&(tt.flags|=1024),i}function Rm(){var r=kd!==0;return kd=0,r}function Om(r,i,u){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~u}function Mm(r){if(Sd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Sd=!1}Va=0,Sn=zt=tt=null,_l=!1,uu=kd=0,Tl=null}function lr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Sn===null?tt.memoizedState=Sn=r:Sn=Sn.next=r,Sn}function yn(){if(zt===null){var r=tt.alternate;r=r!==null?r.memoizedState:null}else r=zt.next;var i=Sn===null?tt.memoizedState:Sn.next;if(i!==null)Sn=i,zt=r;else{if(r===null)throw tt.alternate===null?Error(a(467)):Error(a(310));zt=r,r={memoizedState:zt.memoizedState,baseState:zt.baseState,baseQueue:zt.baseQueue,queue:zt.queue,next:null},Sn===null?tt.memoizedState=Sn=r:Sn=Sn.next=r}return Sn}function jd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function cu(r){var i=uu;return uu+=1,Tl===null&&(Tl=[]),r=Ux(Tl,r,i),i=tt,(Sn===null?i.memoizedState:Sn.next)===null&&(i=i.alternate,G.H=i===null||i.memoizedState===null?A0:Zm),r}function Cd(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return cu(r);if(r.$$typeof===O)return Zn(r)}throw Error(a(438,String(r)))}function Dm(r){var i=null,u=tt.updateQueue;if(u!==null&&(i=u.memoCache),i==null){var d=tt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),u===null&&(u=jd(),tt.updateQueue=u),u.memoCache=i,u=i.data[i.index],u===void 0)for(u=i.data[i.index]=Array(r),d=0;d<r;d++)u[d]=z;return i.index++,u}function Qa(r,i){return typeof i=="function"?i(r):i}function Ed(r){var i=yn();return zm(i,zt,r)}function zm(r,i,u){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=u;var y=r.baseQueue,v=d.pending;if(v!==null){if(y!==null){var S=y.next;y.next=v.next,v.next=S}i.baseQueue=y=v,d.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var A=S=null,q=null,le=i,de=!1;do{var pe=le.lane&-536870913;if(pe!==le.lane?(bt&pe)===pe:(Va&pe)===pe){var oe=le.revertLane;if(oe===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null}),pe===kl&&(de=!0);else if((Va&oe)===oe){le=le.next,oe===kl&&(de=!0);continue}else pe={lane:0,revertLane:le.revertLane,gesture:null,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},q===null?(A=q=pe,S=v):q=q.next=pe,tt.lanes|=oe,Bi|=oe;pe=le.action,Ls&&u(v,pe),v=le.hasEagerState?le.eagerState:u(v,pe)}else oe={lane:pe,revertLane:le.revertLane,gesture:le.gesture,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null},q===null?(A=q=oe,S=v):q=q.next=oe,tt.lanes|=pe,Bi|=pe;le=le.next}while(le!==null&&le!==i);if(q===null?S=v:q.next=A,!zr(v,r.memoizedState)&&(kn=!0,de&&(u=jl,u!==null)))throw u;r.memoizedState=v,r.baseState=S,r.baseQueue=q,d.lastRenderedState=v}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Im(r){var i=yn(),u=i.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=r;var d=u.dispatch,y=u.pending,v=i.memoizedState;if(y!==null){u.pending=null;var S=y=y.next;do v=r(v,S.action),S=S.next;while(S!==y);zr(v,i.memoizedState)||(kn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),u.lastRenderedState=v}return[v,d]}function Yx(r,i,u){var d=tt,y=yn(),v=jt;if(v){if(u===void 0)throw Error(a(407));u=u()}else u=i();var S=!zr((zt||y).memoizedState,u);if(S&&(y.memoizedState=u,kn=!0),y=y.queue,Um(Jx.bind(null,d,y,r),[r]),y.getSnapshot!==i||S||Sn!==null&&Sn.memoizedState.tag&1){if(d.flags|=2048,Al(9,{destroy:void 0},Wx.bind(null,d,y,u,i),null),Ft===null)throw Error(a(349));v||(Va&127)!==0||Xx(d,i,u)}return u}function Xx(r,i,u){r.flags|=16384,r={getSnapshot:i,value:u},i=tt.updateQueue,i===null?(i=jd(),tt.updateQueue=i,i.stores=[r]):(u=i.stores,u===null?i.stores=[r]:u.push(r))}function Wx(r,i,u,d){i.value=u,i.getSnapshot=d,e0(i)&&t0(r)}function Jx(r,i,u){return u(function(){e0(i)&&t0(r)})}function e0(r){var i=r.getSnapshot;r=r.value;try{var u=i();return!zr(r,u)}catch{return!0}}function t0(r){var i=_s(r,2);i!==null&&jr(i,r,2)}function Lm(r){var i=lr();if(typeof r=="function"){var u=r;if(r=u(),Ls){Bt(!0);try{u()}finally{Bt(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:r},i}function n0(r,i,u,d){return r.baseState=u,zm(r,zt,typeof d=="function"?d:Qa)}function e2(r,i,u,d,y){if(Td(r))throw Error(a(485));if(r=i.action,r!==null){var v={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};G.T!==null?u(!0):v.isTransition=!1,d(v),u=i.pending,u===null?(v.next=i.pending=v,r0(i,v)):(v.next=u.next,i.pending=u.next=v)}}function r0(r,i){var u=i.action,d=i.payload,y=r.state;if(i.isTransition){var v=G.T,S={};G.T=S;try{var A=u(y,d),q=G.S;q!==null&&q(S,A),a0(r,i,A)}catch(le){Pm(r,i,le)}finally{v!==null&&S.types!==null&&(v.types=S.types),G.T=v}}else try{v=u(y,d),a0(r,i,v)}catch(le){Pm(r,i,le)}}function a0(r,i,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(d){i0(r,i,d)},function(d){return Pm(r,i,d)}):i0(r,i,u)}function i0(r,i,u){i.status="fulfilled",i.value=u,s0(i),r.state=u,i=r.pending,i!==null&&(u=i.next,u===i?r.pending=null:(u=u.next,i.next=u,r0(r,u)))}function Pm(r,i,u){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=u,s0(i),i=i.next;while(i!==d)}r.action=null}function s0(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function l0(r,i){return i}function o0(r,i){if(jt){var u=Ft.formState;if(u!==null){e:{var d=tt;if(jt){if(Vt){t:{for(var y=Vt,v=ta;y.nodeType!==8;){if(!v){y=null;break t}if(y=ra(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){Vt=ra(y.nextSibling),d=y.data==="F!";break e}}Ri(d)}d=!1}d&&(i=u[0])}}return u=lr(),u.memoizedState=u.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l0,lastRenderedState:i},u.queue=d,u=N0.bind(null,tt,d),d.dispatch=u,d=Lm(!1),v=qm.bind(null,tt,!1,d.queue),d=lr(),y={state:i,dispatch:null,action:r,pending:null},d.queue=y,u=e2.bind(null,tt,y,v,u),y.dispatch=u,d.memoizedState=r,[i,u,!1]}function u0(r){var i=yn();return c0(i,zt,r)}function c0(r,i,u){if(i=zm(r,i,l0)[0],r=Ed(Qa)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=cu(i)}catch(S){throw S===Cl?gd:S}else d=i;i=yn();var y=i.queue,v=y.dispatch;return u!==i.memoizedState&&(tt.flags|=2048,Al(9,{destroy:void 0},t2.bind(null,y,u),null)),[d,v,r]}function t2(r,i){r.action=i}function d0(r){var i=yn(),u=zt;if(u!==null)return c0(i,u,r);yn(),i=i.memoizedState,u=yn();var d=u.queue.dispatch;return u.memoizedState=r,[i,d,!1]}function Al(r,i,u,d){return r={tag:r,create:u,deps:d,inst:i,next:null},i=tt.updateQueue,i===null&&(i=jd(),tt.updateQueue=i),u=i.lastEffect,u===null?i.lastEffect=r.next=r:(d=u.next,u.next=r,r.next=d,i.lastEffect=r),r}function f0(){return yn().memoizedState}function Nd(r,i,u,d){var y=lr();tt.flags|=r,y.memoizedState=Al(1|i,{destroy:void 0},u,d===void 0?null:d)}function _d(r,i,u,d){var y=yn();d=d===void 0?null:d;var v=y.memoizedState.inst;zt!==null&&d!==null&&Tm(d,zt.memoizedState.deps)?y.memoizedState=Al(i,v,u,d):(tt.flags|=r,y.memoizedState=Al(1|i,v,u,d))}function h0(r,i){Nd(8390656,8,r,i)}function Um(r,i){_d(2048,8,r,i)}function n2(r){tt.flags|=4;var i=tt.updateQueue;if(i===null)i=jd(),tt.updateQueue=i,i.events=[r];else{var u=i.events;u===null?i.events=[r]:u.push(r)}}function m0(r){var i=yn().memoizedState;return n2({ref:i,nextImpl:r}),function(){if((At&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function p0(r,i){return _d(4,2,r,i)}function g0(r,i){return _d(4,4,r,i)}function y0(r,i){if(typeof i=="function"){r=r();var u=i(r);return function(){typeof u=="function"?u():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function v0(r,i,u){u=u!=null?u.concat([r]):null,_d(4,4,y0.bind(null,i,r),u)}function Bm(){}function b0(r,i){var u=yn();i=i===void 0?null:i;var d=u.memoizedState;return i!==null&&Tm(i,d[1])?d[0]:(u.memoizedState=[r,i],r)}function x0(r,i){var u=yn();i=i===void 0?null:i;var d=u.memoizedState;if(i!==null&&Tm(i,d[1]))return d[0];if(d=r(),Ls){Bt(!0);try{r()}finally{Bt(!1)}}return u.memoizedState=[d,i],d}function Fm(r,i,u){return u===void 0||(Va&1073741824)!==0&&(bt&261930)===0?r.memoizedState=i:(r.memoizedState=u,r=ww(),tt.lanes|=r,Bi|=r,u)}function w0(r,i,u,d){return zr(u,i)?u:Nl.current!==null?(r=Fm(r,u,d),zr(r,i)||(kn=!0),r):(Va&42)===0||(Va&1073741824)!==0&&(bt&261930)===0?(kn=!0,r.memoizedState=u):(r=ww(),tt.lanes|=r,Bi|=r,i)}function S0(r,i,u,d,y){var v=ie.p;ie.p=v!==0&&8>v?v:8;var S=G.T,A={};G.T=A,qm(r,!1,i,u);try{var q=y(),le=G.S;if(le!==null&&le(A,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var de=XA(q,d);du(r,i,de,Fr(r))}else du(r,i,d,Fr(r))}catch(pe){du(r,i,{then:function(){},status:"rejected",reason:pe},Fr())}finally{ie.p=v,S!==null&&A.types!==null&&(S.types=A.types),G.T=S}}function r2(){}function $m(r,i,u,d){if(r.tag!==5)throw Error(a(476));var y=k0(r).queue;S0(r,y,i,J,u===null?r2:function(){return j0(r),u(d)})}function k0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:J},next:null};var u={};return i.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:u},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function j0(r){var i=k0(r);i.next===null&&(i=r.alternate.memoizedState),du(r,i.next.queue,{},Fr())}function Hm(){return Zn(_u)}function C0(){return yn().memoizedState}function E0(){return yn().memoizedState}function a2(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var u=Fr();r=Di(u);var d=zi(i,r,u);d!==null&&(jr(d,i,u),su(d,i,u)),i={cache:vm()},r.payload=i;return}i=i.return}}function i2(r,i,u){var d=Fr();u={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Td(r)?_0(i,u):(u=lm(r,i,u,d),u!==null&&(jr(u,r,d),T0(u,i,d)))}function N0(r,i,u){var d=Fr();du(r,i,u,d)}function du(r,i,u,d){var y={lane:d,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Td(r))_0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var S=i.lastRenderedState,A=v(S,u);if(y.hasEagerState=!0,y.eagerState=A,zr(A,S))return ud(r,i,y,0),Ft===null&&od(),!1}catch{}finally{}if(u=lm(r,i,y,d),u!==null)return jr(u,r,d),T0(u,i,d),!0}return!1}function qm(r,i,u,d){if(d={lane:2,revertLane:Sp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Td(r)){if(i)throw Error(a(479))}else i=lm(r,u,d,2),i!==null&&jr(i,r,2)}function Td(r){var i=r.alternate;return r===tt||i!==null&&i===tt}function _0(r,i){_l=Sd=!0;var u=r.pending;u===null?i.next=i:(i.next=u.next,u.next=i),r.pending=i}function T0(r,i,u){if((u&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,u|=d,i.lanes=u,ji(r,u)}}var fu={readContext:Zn,use:Cd,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on};fu.useEffectEvent=on;var A0={readContext:Zn,use:Cd,useCallback:function(r,i){return lr().memoizedState=[r,i===void 0?null:i],r},useContext:Zn,useEffect:h0,useImperativeHandle:function(r,i,u){u=u!=null?u.concat([r]):null,Nd(4194308,4,y0.bind(null,i,r),u)},useLayoutEffect:function(r,i){return Nd(4194308,4,r,i)},useInsertionEffect:function(r,i){Nd(4,2,r,i)},useMemo:function(r,i){var u=lr();i=i===void 0?null:i;var d=r();if(Ls){Bt(!0);try{r()}finally{Bt(!1)}}return u.memoizedState=[d,i],d},useReducer:function(r,i,u){var d=lr();if(u!==void 0){var y=u(i);if(Ls){Bt(!0);try{u(i)}finally{Bt(!1)}}}else y=i;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=i2.bind(null,tt,r),[d.memoizedState,r]},useRef:function(r){var i=lr();return r={current:r},i.memoizedState=r},useState:function(r){r=Lm(r);var i=r.queue,u=N0.bind(null,tt,i);return i.dispatch=u,[r.memoizedState,u]},useDebugValue:Bm,useDeferredValue:function(r,i){var u=lr();return Fm(u,r,i)},useTransition:function(){var r=Lm(!1);return r=S0.bind(null,tt,r.queue,!0,!1),lr().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,u){var d=tt,y=lr();if(jt){if(u===void 0)throw Error(a(407));u=u()}else{if(u=i(),Ft===null)throw Error(a(349));(bt&127)!==0||Xx(d,i,u)}y.memoizedState=u;var v={value:u,getSnapshot:i};return y.queue=v,h0(Jx.bind(null,d,v,r),[r]),d.flags|=2048,Al(9,{destroy:void 0},Wx.bind(null,d,v,u,i),null),u},useId:function(){var r=lr(),i=Ft.identifierPrefix;if(jt){var u=Ea,d=Ca;u=(d&~(1<<32-yt(d)-1)).toString(32)+u,i="_"+i+"R_"+u,u=kd++,0<u&&(i+="H"+u.toString(32)),i+="_"}else u=WA++,i="_"+i+"r_"+u.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Hm,useFormState:o0,useActionState:o0,useOptimistic:function(r){var i=lr();i.memoizedState=i.baseState=r;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=u,i=qm.bind(null,tt,!0,u),u.dispatch=i,[r,i]},useMemoCache:Dm,useCacheRefresh:function(){return lr().memoizedState=a2.bind(null,tt)},useEffectEvent:function(r){var i=lr(),u={impl:r};return i.memoizedState=u,function(){if((At&2)!==0)throw Error(a(440));return u.impl.apply(void 0,arguments)}}},Zm={readContext:Zn,use:Cd,useCallback:b0,useContext:Zn,useEffect:Um,useImperativeHandle:v0,useInsertionEffect:p0,useLayoutEffect:g0,useMemo:x0,useReducer:Ed,useRef:f0,useState:function(){return Ed(Qa)},useDebugValue:Bm,useDeferredValue:function(r,i){var u=yn();return w0(u,zt.memoizedState,r,i)},useTransition:function(){var r=Ed(Qa)[0],i=yn().memoizedState;return[typeof r=="boolean"?r:cu(r),i]},useSyncExternalStore:Yx,useId:C0,useHostTransitionStatus:Hm,useFormState:u0,useActionState:u0,useOptimistic:function(r,i){var u=yn();return n0(u,zt,r,i)},useMemoCache:Dm,useCacheRefresh:E0};Zm.useEffectEvent=m0;var R0={readContext:Zn,use:Cd,useCallback:b0,useContext:Zn,useEffect:Um,useImperativeHandle:v0,useInsertionEffect:p0,useLayoutEffect:g0,useMemo:x0,useReducer:Im,useRef:f0,useState:function(){return Im(Qa)},useDebugValue:Bm,useDeferredValue:function(r,i){var u=yn();return zt===null?Fm(u,r,i):w0(u,zt.memoizedState,r,i)},useTransition:function(){var r=Im(Qa)[0],i=yn().memoizedState;return[typeof r=="boolean"?r:cu(r),i]},useSyncExternalStore:Yx,useId:C0,useHostTransitionStatus:Hm,useFormState:d0,useActionState:d0,useOptimistic:function(r,i){var u=yn();return zt!==null?n0(u,zt,r,i):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:Dm,useCacheRefresh:E0};R0.useEffectEvent=m0;function Gm(r,i,u,d){i=r.memoizedState,u=u(d,i),u=u==null?i:g({},i,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Vm={enqueueSetState:function(r,i,u){r=r._reactInternals;var d=Fr(),y=Di(d);y.payload=i,u!=null&&(y.callback=u),i=zi(r,y,d),i!==null&&(jr(i,r,d),su(i,r,d))},enqueueReplaceState:function(r,i,u){r=r._reactInternals;var d=Fr(),y=Di(d);y.tag=1,y.payload=i,u!=null&&(y.callback=u),i=zi(r,y,d),i!==null&&(jr(i,r,d),su(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var u=Fr(),d=Di(u);d.tag=2,i!=null&&(d.callback=i),i=zi(r,d,u),i!==null&&(jr(i,r,u),su(i,r,u))}};function O0(r,i,u,d,y,v,S){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,S):i.prototype&&i.prototype.isPureReactComponent?!Wo(u,d)||!Wo(y,v):!0}function M0(r,i,u,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(u,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(u,d),i.state!==r&&Vm.enqueueReplaceState(i,i.state,null)}function Ps(r,i){var u=i;if("ref"in i){u={};for(var d in i)d!=="ref"&&(u[d]=i[d])}if(r=r.defaultProps){u===i&&(u=g({},u));for(var y in r)u[y]===void 0&&(u[y]=r[y])}return u}function D0(r){ld(r)}function z0(r){console.error(r)}function I0(r){ld(r)}function Ad(r,i){try{var u=r.onUncaughtError;u(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function L0(r,i,u){try{var d=r.onCaughtError;d(u.value,{componentStack:u.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Qm(r,i,u){return u=Di(u),u.tag=3,u.payload={element:null},u.callback=function(){Ad(r,i)},u}function P0(r){return r=Di(r),r.tag=3,r}function U0(r,i,u,d){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var v=d.value;r.payload=function(){return y(v)},r.callback=function(){L0(i,u,d)}}var S=u.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(r.callback=function(){L0(i,u,d),typeof y!="function"&&(Fi===null?Fi=new Set([this]):Fi.add(this));var A=d.stack;this.componentDidCatch(d.value,{componentStack:A!==null?A:""})})}function s2(r,i,u,d,y){if(u.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=u.alternate,i!==null&&Sl(i,u,y,!0),u=Lr.current,u!==null){switch(u.tag){case 31:case 13:return na===null?$d():u.alternate===null&&un===0&&(un=3),u.flags&=-257,u.flags|=65536,u.lanes=y,d===yd?u.flags|=16384:(i=u.updateQueue,i===null?u.updateQueue=new Set([d]):i.add(d),bp(r,d,y)),!1;case 22:return u.flags|=65536,d===yd?u.flags|=16384:(i=u.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},u.updateQueue=i):(u=i.retryQueue,u===null?i.retryQueue=new Set([d]):u.add(d)),bp(r,d,y)),!1}throw Error(a(435,u.tag))}return bp(r,d,y),$d(),!1}if(jt)return i=Lr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,d!==hm&&(r=Error(a(422),{cause:d}),tu(Wr(r,u)))):(d!==hm&&(i=Error(a(423),{cause:d}),tu(Wr(i,u))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Wr(d,u),y=Qm(r.stateNode,d,y),jm(r,y),un!==4&&(un=2)),!1;var v=Error(a(520),{cause:d});if(v=Wr(v,u),xu===null?xu=[v]:xu.push(v),un!==4&&(un=2),i===null)return!0;d=Wr(d,u),u=i;do{switch(u.tag){case 3:return u.flags|=65536,r=y&-y,u.lanes|=r,r=Qm(u.stateNode,d,r),jm(u,r),!1;case 1:if(i=u.type,v=u.stateNode,(u.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Fi===null||!Fi.has(v))))return u.flags|=65536,y&=-y,u.lanes|=y,y=P0(y),U0(y,r,u,d),jm(u,y),!1}u=u.return}while(u!==null);return!1}var Km=Error(a(461)),kn=!1;function Gn(r,i,u,d){i.child=r===null?Hx(i,null,u,d):Is(i,r.child,u,d)}function B0(r,i,u,d,y){u=u.render;var v=i.ref;if("ref"in d){var S={};for(var A in d)A!=="ref"&&(S[A]=d[A])}else S=d;return Os(i),d=Am(r,i,u,S,v,y),A=Rm(),r!==null&&!kn?(Om(r,i,y),Ka(r,i,y)):(jt&&A&&dm(i),i.flags|=1,Gn(r,i,d,y),i.child)}function F0(r,i,u,d,y){if(r===null){var v=u.type;return typeof v=="function"&&!om(v)&&v.defaultProps===void 0&&u.compare===null?(i.tag=15,i.type=v,$0(r,i,v,d,y)):(r=dd(u.type,null,d,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!rp(r,y)){var S=v.memoizedProps;if(u=u.compare,u=u!==null?u:Wo,u(S,d)&&r.ref===i.ref)return Ka(r,i,y)}return i.flags|=1,r=Ha(v,d),r.ref=i.ref,r.return=i,i.child=r}function $0(r,i,u,d,y){if(r!==null){var v=r.memoizedProps;if(Wo(v,d)&&r.ref===i.ref)if(kn=!1,i.pendingProps=d=v,rp(r,y))(r.flags&131072)!==0&&(kn=!0);else return i.lanes=r.lanes,Ka(r,i,y)}return Ym(r,i,u,d,y)}function H0(r,i,u,d){var y=d.children,v=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(v=v!==null?v.baseLanes|u:u,r!==null){for(d=i.child=r.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~v}else d=0,i.child=null;return q0(r,i,v,u,d)}if((u&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&pd(i,v!==null?v.cachePool:null),v!==null?Gx(i,v):Em(),Vx(i);else return d=i.lanes=536870912,q0(r,i,v!==null?v.baseLanes|u:u,u,d)}else v!==null?(pd(i,v.cachePool),Gx(i,v),Li(),i.memoizedState=null):(r!==null&&pd(i,null),Em(),Li());return Gn(r,i,y,u),i.child}function hu(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function q0(r,i,u,d,y){var v=xm();return v=v===null?null:{parent:wn._currentValue,pool:v},i.memoizedState={baseLanes:u,cachePool:v},r!==null&&pd(i,null),Em(),Vx(i),r!==null&&Sl(r,i,d,!0),i.childLanes=y,null}function Rd(r,i){return i=Md({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function Z0(r,i,u){return Is(i,r.child,null,u),r=Rd(i,i.pendingProps),r.flags|=2,Pr(i),i.memoizedState=null,r}function l2(r,i,u){var d=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(jt){if(d.mode==="hidden")return r=Rd(i,d),i.lanes=536870912,hu(null,r);if(_m(i),(r=Vt)?(r=rS(r,ta),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ti!==null?{id:Ca,overflow:Ea}:null,retryLane:536870912,hydrationErrors:null},u=_x(r),u.return=i,i.child=u,qn=i,Vt=null)):r=null,r===null)throw Ri(i);return i.lanes=536870912,null}return Rd(i,d)}var v=r.memoizedState;if(v!==null){var S=v.dehydrated;if(_m(i),y)if(i.flags&256)i.flags&=-257,i=Z0(r,i,u);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(kn||Sl(r,i,u,!1),y=(u&r.childLanes)!==0,kn||y){if(d=Ft,d!==null&&(S=js(d,u),S!==0&&S!==v.retryLane))throw v.retryLane=S,_s(r,S),jr(d,r,S),Km;$d(),i=Z0(r,i,u)}else r=v.treeContext,Vt=ra(S.nextSibling),qn=i,jt=!0,Ai=null,ta=!1,r!==null&&Rx(i,r),i=Rd(i,d),i.flags|=4096;return i}return r=Ha(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Od(r,i){var u=i.ref;if(u===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(a(284));(r===null||r.ref!==u)&&(i.flags|=4194816)}}function Ym(r,i,u,d,y){return Os(i),u=Am(r,i,u,d,void 0,y),d=Rm(),r!==null&&!kn?(Om(r,i,y),Ka(r,i,y)):(jt&&d&&dm(i),i.flags|=1,Gn(r,i,u,y),i.child)}function G0(r,i,u,d,y,v){return Os(i),i.updateQueue=null,u=Kx(i,d,u,y),Qx(r),d=Rm(),r!==null&&!kn?(Om(r,i,v),Ka(r,i,v)):(jt&&d&&dm(i),i.flags|=1,Gn(r,i,u,v),i.child)}function V0(r,i,u,d,y){if(Os(i),i.stateNode===null){var v=vl,S=u.contextType;typeof S=="object"&&S!==null&&(v=Zn(S)),v=new u(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Vm,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},Sm(i),S=u.contextType,v.context=typeof S=="object"&&S!==null?Zn(S):vl,v.state=i.memoizedState,S=u.getDerivedStateFromProps,typeof S=="function"&&(Gm(i,u,S,d),v.state=i.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&Vm.enqueueReplaceState(v,v.state,null),ou(i,d,v,y),lu(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){v=i.stateNode;var A=i.memoizedProps,q=Ps(u,A);v.props=q;var le=v.context,de=u.contextType;S=vl,typeof de=="object"&&de!==null&&(S=Zn(de));var pe=u.getDerivedStateFromProps;de=typeof pe=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=i.pendingProps!==A,de||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||le!==S)&&M0(i,v,d,S),Mi=!1;var oe=i.memoizedState;v.state=oe,ou(i,d,v,y),lu(),le=i.memoizedState,A||oe!==le||Mi?(typeof pe=="function"&&(Gm(i,u,pe,d),le=i.memoizedState),(q=Mi||O0(i,u,q,d,oe,le,S))?(de||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=le),v.props=d,v.state=le,v.context=S,d=q):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,km(r,i),S=i.memoizedProps,de=Ps(u,S),v.props=de,pe=i.pendingProps,oe=v.context,le=u.contextType,q=vl,typeof le=="object"&&le!==null&&(q=Zn(le)),A=u.getDerivedStateFromProps,(le=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==pe||oe!==q)&&M0(i,v,d,q),Mi=!1,oe=i.memoizedState,v.state=oe,ou(i,d,v,y),lu();var ue=i.memoizedState;S!==pe||oe!==ue||Mi||r!==null&&r.dependencies!==null&&hd(r.dependencies)?(typeof A=="function"&&(Gm(i,u,A,d),ue=i.memoizedState),(de=Mi||O0(i,u,de,d,oe,ue,q)||r!==null&&r.dependencies!==null&&hd(r.dependencies))?(le||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,ue,q),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,ue,q)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===r.memoizedProps&&oe===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&oe===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=ue),v.props=d,v.state=ue,v.context=q,d=de):(typeof v.componentDidUpdate!="function"||S===r.memoizedProps&&oe===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&oe===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,Od(r,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,u=d&&typeof u.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&d?(i.child=Is(i,r.child,null,y),i.child=Is(i,null,u,y)):Gn(r,i,u,y),i.memoizedState=v.state,r=i.child):r=Ka(r,i,y),r}function Q0(r,i,u,d){return As(),i.flags|=256,Gn(r,i,u,d),i.child}var Xm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wm(r){return{baseLanes:r,cachePool:Lx()}}function Jm(r,i,u){return r=r!==null?r.childLanes&~u:0,i&&(r|=Br),r}function K0(r,i,u){var d=i.pendingProps,y=!1,v=(i.flags&128)!==0,S;if((S=v)||(S=r!==null&&r.memoizedState===null?!1:(gn.current&2)!==0),S&&(y=!0,i.flags&=-129),S=(i.flags&32)!==0,i.flags&=-33,r===null){if(jt){if(y?Ii(i):Li(),(r=Vt)?(r=rS(r,ta),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ti!==null?{id:Ca,overflow:Ea}:null,retryLane:536870912,hydrationErrors:null},u=_x(r),u.return=i,i.child=u,qn=i,Vt=null)):r=null,r===null)throw Ri(i);return zp(r)?i.lanes=32:i.lanes=536870912,null}var A=d.children;return d=d.fallback,y?(Li(),y=i.mode,A=Md({mode:"hidden",children:A},y),d=Ts(d,y,u,null),A.return=i,d.return=i,A.sibling=d,i.child=A,d=i.child,d.memoizedState=Wm(u),d.childLanes=Jm(r,S,u),i.memoizedState=Xm,hu(null,d)):(Ii(i),ep(i,A))}var q=r.memoizedState;if(q!==null&&(A=q.dehydrated,A!==null)){if(v)i.flags&256?(Ii(i),i.flags&=-257,i=tp(r,i,u)):i.memoizedState!==null?(Li(),i.child=r.child,i.flags|=128,i=null):(Li(),A=d.fallback,y=i.mode,d=Md({mode:"visible",children:d.children},y),A=Ts(A,y,u,null),A.flags|=2,d.return=i,A.return=i,d.sibling=A,i.child=d,Is(i,r.child,null,u),d=i.child,d.memoizedState=Wm(u),d.childLanes=Jm(r,S,u),i.memoizedState=Xm,i=hu(null,d));else if(Ii(i),zp(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var le=S.dgst;S=le,d=Error(a(419)),d.stack="",d.digest=S,tu({value:d,source:null,stack:null}),i=tp(r,i,u)}else if(kn||Sl(r,i,u,!1),S=(u&r.childLanes)!==0,kn||S){if(S=Ft,S!==null&&(d=js(S,u),d!==0&&d!==q.retryLane))throw q.retryLane=d,_s(r,d),jr(S,r,d),Km;Dp(A)||$d(),i=tp(r,i,u)}else Dp(A)?(i.flags|=192,i.child=r.child,i=null):(r=q.treeContext,Vt=ra(A.nextSibling),qn=i,jt=!0,Ai=null,ta=!1,r!==null&&Rx(i,r),i=ep(i,d.children),i.flags|=4096);return i}return y?(Li(),A=d.fallback,y=i.mode,q=r.child,le=q.sibling,d=Ha(q,{mode:"hidden",children:d.children}),d.subtreeFlags=q.subtreeFlags&65011712,le!==null?A=Ha(le,A):(A=Ts(A,y,u,null),A.flags|=2),A.return=i,d.return=i,d.sibling=A,i.child=d,hu(null,d),d=i.child,A=r.child.memoizedState,A===null?A=Wm(u):(y=A.cachePool,y!==null?(q=wn._currentValue,y=y.parent!==q?{parent:q,pool:q}:y):y=Lx(),A={baseLanes:A.baseLanes|u,cachePool:y}),d.memoizedState=A,d.childLanes=Jm(r,S,u),i.memoizedState=Xm,hu(r.child,d)):(Ii(i),u=r.child,r=u.sibling,u=Ha(u,{mode:"visible",children:d.children}),u.return=i,u.sibling=null,r!==null&&(S=i.deletions,S===null?(i.deletions=[r],i.flags|=16):S.push(r)),i.child=u,i.memoizedState=null,u)}function ep(r,i){return i=Md({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Md(r,i){return r=Ir(22,r,null,i),r.lanes=0,r}function tp(r,i,u){return Is(i,r.child,null,u),r=ep(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function Y0(r,i,u){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),gm(r.return,i,u)}function np(r,i,u,d,y,v){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:u,tailMode:y,treeForkCount:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=u,S.tailMode=y,S.treeForkCount=v)}function X0(r,i,u){var d=i.pendingProps,y=d.revealOrder,v=d.tail;d=d.children;var S=gn.current,A=(S&2)!==0;if(A?(S=S&1|2,i.flags|=128):S&=1,_(gn,S),Gn(r,i,d,u),d=jt?eu:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Y0(r,u,i);else if(r.tag===19)Y0(r,u,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(y){case"forwards":for(u=i.child,y=null;u!==null;)r=u.alternate,r!==null&&wd(r)===null&&(y=u),u=u.sibling;u=y,u===null?(y=i.child,i.child=null):(y=u.sibling,u.sibling=null),np(i,!1,y,u,v,d);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=i.child,i.child=null;y!==null;){if(r=y.alternate,r!==null&&wd(r)===null){i.child=y;break}r=y.sibling,y.sibling=u,u=y,y=r}np(i,!0,u,null,v,d);break;case"together":np(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Ka(r,i,u){if(r!==null&&(i.dependencies=r.dependencies),Bi|=i.lanes,(u&i.childLanes)===0)if(r!==null){if(Sl(r,i,u,!1),(u&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,u=Ha(r,r.pendingProps),i.child=u,u.return=i;r.sibling!==null;)r=r.sibling,u=u.sibling=Ha(r,r.pendingProps),u.return=i;u.sibling=null}return i.child}function rp(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&hd(r)))}function o2(r,i,u){switch(i.tag){case 3:Ae(i,i.stateNode.containerInfo),Oi(i,wn,r.memoizedState.cache),As();break;case 27:case 5:Ye(i);break;case 4:Ae(i,i.stateNode.containerInfo);break;case 10:Oi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,_m(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Ii(i),i.flags|=128,null):(u&i.child.childLanes)!==0?K0(r,i,u):(Ii(i),r=Ka(r,i,u),r!==null?r.sibling:null);Ii(i);break;case 19:var y=(r.flags&128)!==0;if(d=(u&i.childLanes)!==0,d||(Sl(r,i,u,!1),d=(u&i.childLanes)!==0),y){if(d)return X0(r,i,u);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),_(gn,gn.current),d)break;return null;case 22:return i.lanes=0,H0(r,i,u,i.pendingProps);case 24:Oi(i,wn,r.memoizedState.cache)}return Ka(r,i,u)}function W0(r,i,u){if(r!==null)if(r.memoizedProps!==i.pendingProps)kn=!0;else{if(!rp(r,u)&&(i.flags&128)===0)return kn=!1,o2(r,i,u);kn=(r.flags&131072)!==0}else kn=!1,jt&&(i.flags&1048576)!==0&&Ax(i,eu,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Ds(i.elementType),i.type=r,typeof r=="function")om(r)?(d=Ps(r,d),i.tag=1,i=V0(null,i,r,d,u)):(i.tag=0,i=Ym(null,i,r,d,u));else{if(r!=null){var y=r.$$typeof;if(y===D){i.tag=11,i=B0(null,i,r,d,u);break e}else if(y===B){i.tag=14,i=F0(null,i,r,d,u);break e}}throw i=Y(r)||r,Error(a(306,i,""))}}return i;case 0:return Ym(r,i,i.type,i.pendingProps,u);case 1:return d=i.type,y=Ps(d,i.pendingProps),V0(r,i,d,y,u);case 3:e:{if(Ae(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var v=i.memoizedState;y=v.element,km(r,i),ou(i,d,null,u);var S=i.memoizedState;if(d=S.cache,Oi(i,wn,d),d!==v.cache&&ym(i,[wn],u,!0),lu(),d=S.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:S.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=Q0(r,i,d,u);break e}else if(d!==y){y=Wr(Error(a(424)),i),tu(y),i=Q0(r,i,d,u);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(Vt=ra(r.firstChild),qn=i,jt=!0,Ai=null,ta=!0,u=Hx(i,null,d,u),i.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(As(),d===y){i=Ka(r,i,u);break e}Gn(r,i,d,u)}i=i.child}return i;case 26:return Od(r,i),r===null?(u=uS(i.type,null,i.pendingProps,null))?i.memoizedState=u:jt||(u=i.type,r=i.pendingProps,d=Kd(re.current).createElement(u),d[Ve]=i,d[vt]=r,Vn(d,u,r),kt(d),i.stateNode=d):i.memoizedState=uS(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ye(i),r===null&&jt&&(d=i.stateNode=sS(i.type,i.pendingProps,re.current),qn=i,ta=!0,y=Vt,Zi(i.type)?(Ip=y,Vt=ra(d.firstChild)):Vt=y),Gn(r,i,i.pendingProps.children,u),Od(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&jt&&((y=d=Vt)&&(d=P2(d,i.type,i.pendingProps,ta),d!==null?(i.stateNode=d,qn=i,Vt=ra(d.firstChild),ta=!1,y=!0):y=!1),y||Ri(i)),Ye(i),y=i.type,v=i.pendingProps,S=r!==null?r.memoizedProps:null,d=v.children,Rp(y,v)?d=null:S!==null&&Rp(y,S)&&(i.flags|=32),i.memoizedState!==null&&(y=Am(r,i,JA,null,null,u),_u._currentValue=y),Od(r,i),Gn(r,i,d,u),i.child;case 6:return r===null&&jt&&((r=u=Vt)&&(u=U2(u,i.pendingProps,ta),u!==null?(i.stateNode=u,qn=i,Vt=null,r=!0):r=!1),r||Ri(i)),null;case 13:return K0(r,i,u);case 4:return Ae(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Is(i,null,d,u):Gn(r,i,d,u),i.child;case 11:return B0(r,i,i.type,i.pendingProps,u);case 7:return Gn(r,i,i.pendingProps,u),i.child;case 8:return Gn(r,i,i.pendingProps.children,u),i.child;case 12:return Gn(r,i,i.pendingProps.children,u),i.child;case 10:return d=i.pendingProps,Oi(i,i.type,d.value),Gn(r,i,d.children,u),i.child;case 9:return y=i.type._context,d=i.pendingProps.children,Os(i),y=Zn(y),d=d(y),i.flags|=1,Gn(r,i,d,u),i.child;case 14:return F0(r,i,i.type,i.pendingProps,u);case 15:return $0(r,i,i.type,i.pendingProps,u);case 19:return X0(r,i,u);case 31:return l2(r,i,u);case 22:return H0(r,i,u,i.pendingProps);case 24:return Os(i),d=Zn(wn),r===null?(y=xm(),y===null&&(y=Ft,v=vm(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=u),y=v),i.memoizedState={parent:d,cache:y},Sm(i),Oi(i,wn,y)):((r.lanes&u)!==0&&(km(r,i),ou(i,null,null,u),lu()),y=r.memoizedState,v=i.memoizedState,y.parent!==d?(y={parent:d,cache:d},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),Oi(i,wn,d)):(d=v.cache,Oi(i,wn,d),d!==y.cache&&ym(i,[wn],u,!0))),Gn(r,i,i.pendingProps.children,u),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ya(r){r.flags|=4}function ap(r,i,u,d,y){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(y&335544128)===y)if(r.stateNode.complete)r.flags|=8192;else if(Cw())r.flags|=8192;else throw zs=yd,wm}else r.flags&=-16777217}function J0(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!mS(i))if(Cw())r.flags|=8192;else throw zs=yd,wm}function Dd(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Qr():536870912,r.lanes|=i,Dl|=i)}function mu(r,i){if(!jt)switch(r.tailMode){case"hidden":i=r.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var d=null;u!==null;)u.alternate!==null&&(d=u),u=u.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Qt(r){var i=r.alternate!==null&&r.alternate.child===r.child,u=0,d=0;if(i)for(var y=r.child;y!==null;)u|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)u|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=d,r.childLanes=u,i}function u2(r,i,u){var d=i.pendingProps;switch(fm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(i),null;case 1:return Qt(i),null;case 3:return u=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Ga(wn),Ce(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(wl(i)?Ya(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,mm())),Qt(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Ya(i),v!==null?(Qt(i),J0(i,v)):(Qt(i),ap(i,y,null,d,u))):v?v!==r.memoizedState?(Ya(i),Qt(i),J0(i,v)):(Qt(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Ya(i),Qt(i),ap(i,y,r,d,u)),null;case 27:if(Be(i),u=re.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ya(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Qt(i),null}r=V.current,wl(i)?Ox(i):(r=sS(y,d,u),i.stateNode=r,Ya(i))}return Qt(i),null;case 5:if(Be(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ya(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Qt(i),null}if(v=V.current,wl(i))Ox(i);else{var S=Kd(re.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?S.createElement(y,{is:d.is}):S.createElement(y)}}v[Ve]=i,v[vt]=d;e:for(S=i.child;S!==null;){if(S.tag===5||S.tag===6)v.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=v;e:switch(Vn(v,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Ya(i)}}return Qt(i),ap(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,u),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Ya(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=re.current,wl(i)){if(r=i.stateNode,u=i.memoizedProps,d=null,y=qn,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[Ve]=i,r=!!(r.nodeValue===u||d!==null&&d.suppressHydrationWarning===!0||Kw(r.nodeValue,u)),r||Ri(i,!0)}else r=Kd(r).createTextNode(d),r[Ve]=i,i.stateNode=r}return Qt(i),null;case 31:if(u=i.memoizedState,r===null||r.memoizedState!==null){if(d=wl(i),u!==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[Ve]=i}else As(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Qt(i),r=!1}else u=mm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return i.flags&256?(Pr(i),i):(Pr(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Qt(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=wl(i),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(a(318));if(y=i.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[Ve]=i}else As(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Qt(i),y=!1}else y=mm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Pr(i),i):(Pr(i),null)}return Pr(i),(i.flags&128)!==0?(i.lanes=u,i):(u=d!==null,r=r!==null&&r.memoizedState!==null,u&&(d=i.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==y&&(d.flags|=2048)),u!==r&&u&&(i.child.flags|=8192),Dd(i,i.updateQueue),Qt(i),null);case 4:return Ce(),r===null&&Ep(i.stateNode.containerInfo),Qt(i),null;case 10:return Ga(i.type),Qt(i),null;case 19:if(U(gn),d=i.memoizedState,d===null)return Qt(i),null;if(y=(i.flags&128)!==0,v=d.rendering,v===null)if(y)mu(d,!1);else{if(un!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=wd(r),v!==null){for(i.flags|=128,mu(d,!1),r=v.updateQueue,i.updateQueue=r,Dd(i,r),i.subtreeFlags=0,r=u,u=i.child;u!==null;)Nx(u,r),u=u.sibling;return _(gn,gn.current&1|2),jt&&qa(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&Ut()>Ud&&(i.flags|=128,y=!0,mu(d,!1),i.lanes=4194304)}else{if(!y)if(r=wd(v),r!==null){if(i.flags|=128,y=!0,r=r.updateQueue,i.updateQueue=r,Dd(i,r),mu(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!jt)return Qt(i),null}else 2*Ut()-d.renderingStartTime>Ud&&u!==536870912&&(i.flags|=128,y=!0,mu(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(r=d.last,r!==null?r.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=Ut(),r.sibling=null,u=gn.current,_(gn,y?u&1|2:u&1),jt&&qa(i,d.treeForkCount),r):(Qt(i),null);case 22:case 23:return Pr(i),Nm(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(u&536870912)!==0&&(i.flags&128)===0&&(Qt(i),i.subtreeFlags&6&&(i.flags|=8192)):Qt(i),u=i.updateQueue,u!==null&&Dd(i,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==u&&(i.flags|=2048),r!==null&&U(Ms),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),i.memoizedState.cache!==u&&(i.flags|=2048),Ga(wn),Qt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function c2(r,i){switch(fm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Ga(wn),Ce(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Be(i),null;case 31:if(i.memoizedState!==null){if(Pr(i),i.alternate===null)throw Error(a(340));As()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Pr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));As()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return U(gn),null;case 4:return Ce(),null;case 10:return Ga(i.type),null;case 22:case 23:return Pr(i),Nm(),r!==null&&U(Ms),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Ga(wn),null;case 25:return null;default:return null}}function ew(r,i){switch(fm(i),i.tag){case 3:Ga(wn),Ce();break;case 26:case 27:case 5:Be(i);break;case 4:Ce();break;case 31:i.memoizedState!==null&&Pr(i);break;case 13:Pr(i);break;case 19:U(gn);break;case 10:Ga(i.type);break;case 22:case 23:Pr(i),Nm(),r!==null&&U(Ms);break;case 24:Ga(wn)}}function pu(r,i){try{var u=i.updateQueue,d=u!==null?u.lastEffect:null;if(d!==null){var y=d.next;u=y;do{if((u.tag&r)===r){d=void 0;var v=u.create,S=u.inst;d=v(),S.destroy=d}u=u.next}while(u!==y)}}catch(A){Dt(i,i.return,A)}}function Pi(r,i,u){try{var d=i.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var v=y.next;d=v;do{if((d.tag&r)===r){var S=d.inst,A=S.destroy;if(A!==void 0){S.destroy=void 0,y=i;var q=u,le=A;try{le()}catch(de){Dt(y,q,de)}}}d=d.next}while(d!==v)}}catch(de){Dt(i,i.return,de)}}function tw(r){var i=r.updateQueue;if(i!==null){var u=r.stateNode;try{Zx(i,u)}catch(d){Dt(r,r.return,d)}}}function nw(r,i,u){u.props=Ps(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(d){Dt(r,i,d)}}function gu(r,i){try{var u=r.ref;if(u!==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 u=="function"?r.refCleanup=u(d):u.current=d}}catch(y){Dt(r,i,y)}}function Na(r,i){var u=r.ref,d=r.refCleanup;if(u!==null)if(typeof d=="function")try{d()}catch(y){Dt(r,i,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){Dt(r,i,y)}else u.current=null}function rw(r){var i=r.type,u=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":u.autoFocus&&d.focus();break e;case"img":u.src?d.src=u.src:u.srcSet&&(d.srcset=u.srcSet)}}catch(y){Dt(r,r.return,y)}}function ip(r,i,u){try{var d=r.stateNode;O2(d,r.type,u,i),d[vt]=i}catch(y){Dt(r,r.return,y)}}function aw(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Zi(r.type)||r.tag===4}function sp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||aw(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&&Zi(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 lp(r,i,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(r,i):(i=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,i.appendChild(r),u=u._reactRootContainer,u!=null||i.onclick!==null||(i.onclick=Fa));else if(d!==4&&(d===27&&Zi(r.type)&&(u=r.stateNode,i=null),r=r.child,r!==null))for(lp(r,i,u),r=r.sibling;r!==null;)lp(r,i,u),r=r.sibling}function zd(r,i,u){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?u.insertBefore(r,i):u.appendChild(r);else if(d!==4&&(d===27&&Zi(r.type)&&(u=r.stateNode),r=r.child,r!==null))for(zd(r,i,u),r=r.sibling;r!==null;)zd(r,i,u),r=r.sibling}function iw(r){var i=r.stateNode,u=r.memoizedProps;try{for(var d=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);Vn(i,d,u),i[Ve]=r,i[vt]=u}catch(v){Dt(r,r.return,v)}}var Xa=!1,jn=!1,op=!1,sw=typeof WeakSet=="function"?WeakSet:Set,Pn=null;function d2(r,i){if(r=r.containerInfo,Tp=nf,r=vx(r),tm(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var d=u.getSelection&&u.getSelection();if(d&&d.rangeCount!==0){u=d.anchorNode;var y=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var S=0,A=-1,q=-1,le=0,de=0,pe=r,oe=null;t:for(;;){for(var ue;pe!==u||y!==0&&pe.nodeType!==3||(A=S+y),pe!==v||d!==0&&pe.nodeType!==3||(q=S+d),pe.nodeType===3&&(S+=pe.nodeValue.length),(ue=pe.firstChild)!==null;)oe=pe,pe=ue;for(;;){if(pe===r)break t;if(oe===u&&++le===y&&(A=S),oe===v&&++de===d&&(q=S),(ue=pe.nextSibling)!==null)break;pe=oe,oe=pe.parentNode}pe=ue}u=A===-1||q===-1?null:{start:A,end:q}}else u=null}u=u||{start:0,end:0}}else u=null;for(Ap={focusedElem:r,selectionRange:u},nf=!1,Pn=i;Pn!==null;)if(i=Pn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,Pn=r;else for(;Pn!==null;){switch(i=Pn,v=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(u=0;u<r.length;u++)y=r[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,u=i,y=v.memoizedProps,v=v.memoizedState,d=u.stateNode;try{var Re=Ps(u.type,y);r=d.getSnapshotBeforeUpdate(Re,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Qe){Dt(u,u.return,Qe)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,u=r.nodeType,u===9)Mp(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Mp(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,Pn=r;break}Pn=i.return}}function lw(r,i,u){var d=u.flags;switch(u.tag){case 0:case 11:case 15:Ja(r,u),d&4&&pu(5,u);break;case 1:if(Ja(r,u),d&4)if(r=u.stateNode,i===null)try{r.componentDidMount()}catch(S){Dt(u,u.return,S)}else{var y=Ps(u.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(S){Dt(u,u.return,S)}}d&64&&tw(u),d&512&&gu(u,u.return);break;case 3:if(Ja(r,u),d&64&&(r=u.updateQueue,r!==null)){if(i=null,u.child!==null)switch(u.child.tag){case 27:case 5:i=u.child.stateNode;break;case 1:i=u.child.stateNode}try{Zx(r,i)}catch(S){Dt(u,u.return,S)}}break;case 27:i===null&&d&4&&iw(u);case 26:case 5:Ja(r,u),i===null&&d&4&&rw(u),d&512&&gu(u,u.return);break;case 12:Ja(r,u);break;case 31:Ja(r,u),d&4&&cw(r,u);break;case 13:Ja(r,u),d&4&&dw(r,u),d&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=x2.bind(null,u),B2(r,u))));break;case 22:if(d=u.memoizedState!==null||Xa,!d){i=i!==null&&i.memoizedState!==null||jn,y=Xa;var v=jn;Xa=d,(jn=i)&&!v?ei(r,u,(u.subtreeFlags&8772)!==0):Ja(r,u),Xa=y,jn=v}break;case 30:break;default:Ja(r,u)}}function ow(r){var i=r.alternate;i!==null&&(r.alternate=null,ow(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&$e(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 Xt=null,xr=!1;function Wa(r,i,u){for(u=u.child;u!==null;)uw(r,i,u),u=u.sibling}function uw(r,i,u){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Yt,u)}catch{}switch(u.tag){case 26:jn||Na(u,i),Wa(r,i,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:jn||Na(u,i);var d=Xt,y=xr;Zi(u.type)&&(Xt=u.stateNode,xr=!1),Wa(r,i,u),Cu(u.stateNode),Xt=d,xr=y;break;case 5:jn||Na(u,i);case 6:if(d=Xt,y=xr,Xt=null,Wa(r,i,u),Xt=d,xr=y,Xt!==null)if(xr)try{(Xt.nodeType===9?Xt.body:Xt.nodeName==="HTML"?Xt.ownerDocument.body:Xt).removeChild(u.stateNode)}catch(v){Dt(u,i,v)}else try{Xt.removeChild(u.stateNode)}catch(v){Dt(u,i,v)}break;case 18:Xt!==null&&(xr?(r=Xt,tS(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),$l(r)):tS(Xt,u.stateNode));break;case 4:d=Xt,y=xr,Xt=u.stateNode.containerInfo,xr=!0,Wa(r,i,u),Xt=d,xr=y;break;case 0:case 11:case 14:case 15:Pi(2,u,i),jn||Pi(4,u,i),Wa(r,i,u);break;case 1:jn||(Na(u,i),d=u.stateNode,typeof d.componentWillUnmount=="function"&&nw(u,i,d)),Wa(r,i,u);break;case 21:Wa(r,i,u);break;case 22:jn=(d=jn)||u.memoizedState!==null,Wa(r,i,u),jn=d;break;default:Wa(r,i,u)}}function cw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{$l(r)}catch(u){Dt(i,i.return,u)}}}function dw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{$l(r)}catch(u){Dt(i,i.return,u)}}function f2(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new sw),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new sw),i;default:throw Error(a(435,r.tag))}}function Id(r,i){var u=f2(r);i.forEach(function(d){if(!u.has(d)){u.add(d);var y=w2.bind(null,r,d);d.then(y,y)}})}function wr(r,i){var u=i.deletions;if(u!==null)for(var d=0;d<u.length;d++){var y=u[d],v=r,S=i,A=S;e:for(;A!==null;){switch(A.tag){case 27:if(Zi(A.type)){Xt=A.stateNode,xr=!1;break e}break;case 5:Xt=A.stateNode,xr=!1;break e;case 3:case 4:Xt=A.stateNode.containerInfo,xr=!0;break e}A=A.return}if(Xt===null)throw Error(a(160));uw(v,S,y),Xt=null,xr=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)fw(i,r),i=i.sibling}var va=null;function fw(r,i){var u=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:wr(i,r),Sr(r),d&4&&(Pi(3,r,r.return),pu(3,r),Pi(5,r,r.return));break;case 1:wr(i,r),Sr(r),d&512&&(jn||u===null||Na(u,u.return)),d&64&&Xa&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(u=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=u===null?d:u.concat(d))));break;case 26:var y=va;if(wr(i,r),Sr(r),d&512&&(jn||u===null||Na(u,u.return)),d&4){var v=u!==null?u.memoizedState:null;if(d=r.memoizedState,u===null)if(d===null)if(r.stateNode===null){e:{d=r.type,u=r.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":v=y.getElementsByTagName("title")[0],(!v||v[Ni]||v[Ve]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=y.createElement(d),y.head.insertBefore(v,y.querySelector("head > title"))),Vn(v,d,u),v[Ve]=r,kt(v),d=v;break e;case"link":var S=fS("link","href",y).get(d+(u.href||""));if(S){for(var A=0;A<S.length;A++)if(v=S[A],v.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&v.getAttribute("rel")===(u.rel==null?null:u.rel)&&v.getAttribute("title")===(u.title==null?null:u.title)&&v.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){S.splice(A,1);break t}}v=y.createElement(d),Vn(v,d,u),y.head.appendChild(v);break;case"meta":if(S=fS("meta","content",y).get(d+(u.content||""))){for(A=0;A<S.length;A++)if(v=S[A],v.getAttribute("content")===(u.content==null?null:""+u.content)&&v.getAttribute("name")===(u.name==null?null:u.name)&&v.getAttribute("property")===(u.property==null?null:u.property)&&v.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&v.getAttribute("charset")===(u.charSet==null?null:u.charSet)){S.splice(A,1);break t}}v=y.createElement(d),Vn(v,d,u),y.head.appendChild(v);break;default:throw Error(a(468,d))}v[Ve]=r,kt(v),d=v}r.stateNode=d}else hS(y,r.type,r.stateNode);else r.stateNode=dS(y,d,r.memoizedProps);else v!==d?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,d===null?hS(y,r.type,r.stateNode):dS(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&ip(r,r.memoizedProps,u.memoizedProps)}break;case 27:wr(i,r),Sr(r),d&512&&(jn||u===null||Na(u,u.return)),u!==null&&d&4&&ip(r,r.memoizedProps,u.memoizedProps);break;case 5:if(wr(i,r),Sr(r),d&512&&(jn||u===null||Na(u,u.return)),r.flags&32){y=r.stateNode;try{dl(y,"")}catch(Re){Dt(r,r.return,Re)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,ip(r,y,u!==null?u.memoizedProps:y)),d&1024&&(op=!0);break;case 6:if(wr(i,r),Sr(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,u=r.stateNode;try{u.nodeValue=d}catch(Re){Dt(r,r.return,Re)}}break;case 3:if(Wd=null,y=va,va=Yd(i.containerInfo),wr(i,r),va=y,Sr(r),d&4&&u!==null&&u.memoizedState.isDehydrated)try{$l(i.containerInfo)}catch(Re){Dt(r,r.return,Re)}op&&(op=!1,hw(r));break;case 4:d=va,va=Yd(r.stateNode.containerInfo),wr(i,r),Sr(r),va=d;break;case 12:wr(i,r),Sr(r);break;case 31:wr(i,r),Sr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Id(r,d)));break;case 13:wr(i,r),Sr(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Pd=Ut()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Id(r,d)));break;case 22:y=r.memoizedState!==null;var q=u!==null&&u.memoizedState!==null,le=Xa,de=jn;if(Xa=le||y,jn=de||q,wr(i,r),jn=de,Xa=le,Sr(r),d&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(u===null||q||Xa||jn||Us(r)),u=null,i=r;;){if(i.tag===5||i.tag===26){if(u===null){q=u=i;try{if(v=q.stateNode,y)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=q.stateNode;var pe=q.memoizedProps.style,oe=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;A.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Re){Dt(q,q.return,Re)}}}else if(i.tag===6){if(u===null){q=i;try{q.stateNode.nodeValue=y?"":q.memoizedProps}catch(Re){Dt(q,q.return,Re)}}}else if(i.tag===18){if(u===null){q=i;try{var ue=q.stateNode;y?nS(ue,!0):nS(q.stateNode,!1)}catch(Re){Dt(q,q.return,Re)}}}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;u===i&&(u=null),i=i.return}u===i&&(u=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(u=d.retryQueue,u!==null&&(d.retryQueue=null,Id(r,u))));break;case 19:wr(i,r),Sr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Id(r,d)));break;case 30:break;case 21:break;default:wr(i,r),Sr(r)}}function Sr(r){var i=r.flags;if(i&2){try{for(var u,d=r.return;d!==null;){if(aw(d)){u=d;break}d=d.return}if(u==null)throw Error(a(160));switch(u.tag){case 27:var y=u.stateNode,v=sp(r);zd(r,v,y);break;case 5:var S=u.stateNode;u.flags&32&&(dl(S,""),u.flags&=-33);var A=sp(r);zd(r,A,S);break;case 3:case 4:var q=u.stateNode.containerInfo,le=sp(r);lp(r,le,q);break;default:throw Error(a(161))}}catch(de){Dt(r,r.return,de)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function hw(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;hw(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ja(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)lw(r,i.alternate,i),i=i.sibling}function Us(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Pi(4,i,i.return),Us(i);break;case 1:Na(i,i.return);var u=i.stateNode;typeof u.componentWillUnmount=="function"&&nw(i,i.return,u),Us(i);break;case 27:Cu(i.stateNode);case 26:case 5:Na(i,i.return),Us(i);break;case 22:i.memoizedState===null&&Us(i);break;case 30:Us(i);break;default:Us(i)}r=r.sibling}}function ei(r,i,u){for(u=u&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,y=r,v=i,S=v.flags;switch(v.tag){case 0:case 11:case 15:ei(y,v,u),pu(4,v);break;case 1:if(ei(y,v,u),d=v,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(le){Dt(d,d.return,le)}if(d=v,y=d.updateQueue,y!==null){var A=d.stateNode;try{var q=y.shared.hiddenCallbacks;if(q!==null)for(y.shared.hiddenCallbacks=null,y=0;y<q.length;y++)qx(q[y],A)}catch(le){Dt(d,d.return,le)}}u&&S&64&&tw(v),gu(v,v.return);break;case 27:iw(v);case 26:case 5:ei(y,v,u),u&&d===null&&S&4&&rw(v),gu(v,v.return);break;case 12:ei(y,v,u);break;case 31:ei(y,v,u),u&&S&4&&cw(y,v);break;case 13:ei(y,v,u),u&&S&4&&dw(y,v);break;case 22:v.memoizedState===null&&ei(y,v,u),gu(v,v.return);break;case 30:break;default:ei(y,v,u)}i=i.sibling}}function up(r,i){var u=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==u&&(r!=null&&r.refCount++,u!=null&&nu(u))}function cp(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&nu(r))}function ba(r,i,u,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)mw(r,i,u,d),i=i.sibling}function mw(r,i,u,d){var y=i.flags;switch(i.tag){case 0:case 11:case 15:ba(r,i,u,d),y&2048&&pu(9,i);break;case 1:ba(r,i,u,d);break;case 3:ba(r,i,u,d),y&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&nu(r)));break;case 12:if(y&2048){ba(r,i,u,d),r=i.stateNode;try{var v=i.memoizedProps,S=v.id,A=v.onPostCommit;typeof A=="function"&&A(S,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(q){Dt(i,i.return,q)}}else ba(r,i,u,d);break;case 31:ba(r,i,u,d);break;case 13:ba(r,i,u,d);break;case 23:break;case 22:v=i.stateNode,S=i.alternate,i.memoizedState!==null?v._visibility&2?ba(r,i,u,d):yu(r,i):v._visibility&2?ba(r,i,u,d):(v._visibility|=2,Rl(r,i,u,d,(i.subtreeFlags&10256)!==0||!1)),y&2048&&up(S,i);break;case 24:ba(r,i,u,d),y&2048&&cp(i.alternate,i);break;default:ba(r,i,u,d)}}function Rl(r,i,u,d,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,S=i,A=u,q=d,le=S.flags;switch(S.tag){case 0:case 11:case 15:Rl(v,S,A,q,y),pu(8,S);break;case 23:break;case 22:var de=S.stateNode;S.memoizedState!==null?de._visibility&2?Rl(v,S,A,q,y):yu(v,S):(de._visibility|=2,Rl(v,S,A,q,y)),y&&le&2048&&up(S.alternate,S);break;case 24:Rl(v,S,A,q,y),y&&le&2048&&cp(S.alternate,S);break;default:Rl(v,S,A,q,y)}i=i.sibling}}function yu(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var u=r,d=i,y=d.flags;switch(d.tag){case 22:yu(u,d),y&2048&&up(d.alternate,d);break;case 24:yu(u,d),y&2048&&cp(d.alternate,d);break;default:yu(u,d)}i=i.sibling}}var vu=8192;function Ol(r,i,u){if(r.subtreeFlags&vu)for(r=r.child;r!==null;)pw(r,i,u),r=r.sibling}function pw(r,i,u){switch(r.tag){case 26:Ol(r,i,u),r.flags&vu&&r.memoizedState!==null&&W2(u,va,r.memoizedState,r.memoizedProps);break;case 5:Ol(r,i,u);break;case 3:case 4:var d=va;va=Yd(r.stateNode.containerInfo),Ol(r,i,u),va=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=vu,vu=16777216,Ol(r,i,u),vu=d):Ol(r,i,u));break;default:Ol(r,i,u)}}function gw(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 bu(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var d=i[u];Pn=d,vw(d,r)}gw(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)yw(r),r=r.sibling}function yw(r){switch(r.tag){case 0:case 11:case 15:bu(r),r.flags&2048&&Pi(9,r,r.return);break;case 3:bu(r);break;case 12:bu(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Ld(r)):bu(r);break;default:bu(r)}}function Ld(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var u=0;u<i.length;u++){var d=i[u];Pn=d,vw(d,r)}gw(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Pi(8,i,i.return),Ld(i);break;case 22:u=i.stateNode,u._visibility&2&&(u._visibility&=-3,Ld(i));break;default:Ld(i)}r=r.sibling}}function vw(r,i){for(;Pn!==null;){var u=Pn;switch(u.tag){case 0:case 11:case 15:Pi(8,u,i);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var d=u.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:nu(u.memoizedState.cache)}if(d=u.child,d!==null)d.return=u,Pn=d;else e:for(u=r;Pn!==null;){d=Pn;var y=d.sibling,v=d.return;if(ow(d),d===u){Pn=null;break e}if(y!==null){y.return=v,Pn=y;break e}Pn=v}}}var h2={getCacheForType:function(r){var i=Zn(wn),u=i.data.get(r);return u===void 0&&(u=r(),i.data.set(r,u)),u},cacheSignal:function(){return Zn(wn).controller.signal}},m2=typeof WeakMap=="function"?WeakMap:Map,At=0,Ft=null,ft=null,bt=0,Mt=0,Ur=null,Ui=!1,Ml=!1,dp=!1,ti=0,un=0,Bi=0,Bs=0,fp=0,Br=0,Dl=0,xu=null,kr=null,hp=!1,Pd=0,bw=0,Ud=1/0,Bd=null,Fi=null,Rn=0,$i=null,zl=null,ni=0,mp=0,pp=null,xw=null,wu=0,gp=null;function Fr(){return(At&2)!==0&&bt!==0?bt&-bt:G.T!==null?Sp():Ci()}function ww(){if(Br===0)if((bt&536870912)===0||jt){var r=sr;sr<<=1,(sr&3932160)===0&&(sr=262144),Br=r}else Br=536870912;return r=Lr.current,r!==null&&(r.flags|=32),Br}function jr(r,i,u){(r===Ft&&(Mt===2||Mt===9)||r.cancelPendingCommit!==null)&&(Il(r,0),Hi(r,bt,Br,!1)),ga(r,u),((At&2)===0||r!==Ft)&&(r===Ft&&((At&2)===0&&(Bs|=u),un===4&&Hi(r,bt,Br,!1)),_a(r))}function Sw(r,i,u){if((At&6)!==0)throw Error(a(327));var d=!u&&(i&127)===0&&(i&r.expiredLanes)===0||pa(r,i),y=d?y2(r,i):vp(r,i,!0),v=d;do{if(y===0){Ml&&!d&&Hi(r,i,0,!1);break}else{if(u=r.current.alternate,v&&!p2(u)){y=vp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var S=0;else S=r.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){i=S;e:{var A=r;y=xu;var q=A.current.memoizedState.isDehydrated;if(q&&(Il(A,S).flags|=256),S=vp(A,S,!1),S!==2){if(dp&&!q){A.errorRecoveryDisabledLanes|=v,Bs|=v,y=4;break e}v=kr,kr=y,v!==null&&(kr===null?kr=v:kr.push.apply(kr,v))}y=S}if(v=!1,y!==2)continue}}if(y===1){Il(r,0),Hi(r,i,0,!0);break}e:{switch(d=r,v=y,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Hi(d,i,Br,!Ui);break e;case 2:kr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Pd+300-Ut(),10<y)){if(Hi(d,i,Br,!Ui),Pa(d,0,!0)!==0)break e;ni=i,d.timeoutHandle=Jw(kw.bind(null,d,u,kr,Bd,hp,i,Br,Bs,Dl,Ui,v,"Throttled",-0,0),y);break e}kw(d,u,kr,Bd,hp,i,Br,Bs,Dl,Ui,v,null,-0,0)}}break}while(!0);_a(r)}function kw(r,i,u,d,y,v,S,A,q,le,de,pe,oe,ue){if(r.timeoutHandle=-1,pe=i.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fa},pw(i,v,pe);var Re=(v&62914560)===v?Pd-Ut():(v&4194048)===v?bw-Ut():0;if(Re=J2(pe,Re),Re!==null){ni=v,r.cancelPendingCommit=Re(Rw.bind(null,r,i,v,u,d,y,S,A,q,de,pe,null,oe,ue)),Hi(r,v,S,!le);return}}Rw(r,i,v,u,d,y,S,A,q)}function p2(r){for(var i=r;;){var u=i.tag;if((u===0||u===11||u===15)&&i.flags&16384&&(u=i.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var d=0;d<u.length;d++){var y=u[d],v=y.getSnapshot;y=y.value;try{if(!zr(v(),y))return!1}catch{return!1}}if(u=i.child,i.subtreeFlags&16384&&u!==null)u.return=i,i=u;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 Hi(r,i,u,d){i&=~fp,i&=~Bs,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var y=i;0<y;){var v=31-yt(y),S=1<<v;d[v]=-1,y&=~S}u!==0&&ki(r,u,i)}function Fd(){return(At&6)===0?(Su(0),!1):!0}function yp(){if(ft!==null){if(Mt===0)var r=ft.return;else r=ft,Za=Rs=null,Mm(r),El=null,au=0,r=ft;for(;r!==null;)ew(r.alternate,r),r=r.return;ft=null}}function Il(r,i){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,z2(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),ni=0,yp(),Ft=r,ft=u=Ha(r.current,null),bt=i,Mt=0,Ur=null,Ui=!1,Ml=pa(r,i),dp=!1,Dl=Br=fp=Bs=Bi=un=0,kr=xu=null,hp=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var y=31-yt(d),v=1<<y;i|=r[y],d&=~v}return ti=i,od(),u}function jw(r,i){tt=null,G.H=fu,i===Cl||i===gd?(i=Bx(),Mt=3):i===wm?(i=Bx(),Mt=4):Mt=i===Km?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Ur=i,ft===null&&(un=1,Ad(r,Wr(i,r.current)))}function Cw(){var r=Lr.current;return r===null?!0:(bt&4194048)===bt?na===null:(bt&62914560)===bt||(bt&536870912)!==0?r===na:!1}function Ew(){var r=G.H;return G.H=fu,r===null?fu:r}function Nw(){var r=G.A;return G.A=h2,r}function $d(){un=4,Ui||(bt&4194048)!==bt&&Lr.current!==null||(Ml=!0),(Bi&134217727)===0&&(Bs&134217727)===0||Ft===null||Hi(Ft,bt,Br,!1)}function vp(r,i,u){var d=At;At|=2;var y=Ew(),v=Nw();(Ft!==r||bt!==i)&&(Bd=null,Il(r,i)),i=!1;var S=un;e:do try{if(Mt!==0&&ft!==null){var A=ft,q=Ur;switch(Mt){case 8:yp(),S=6;break e;case 3:case 2:case 9:case 6:Lr.current===null&&(i=!0);var le=Mt;if(Mt=0,Ur=null,Ll(r,A,q,le),u&&Ml){S=0;break e}break;default:le=Mt,Mt=0,Ur=null,Ll(r,A,q,le)}}g2(),S=un;break}catch(de){jw(r,de)}while(!0);return i&&r.shellSuspendCounter++,Za=Rs=null,At=d,G.H=y,G.A=v,ft===null&&(Ft=null,bt=0,od()),S}function g2(){for(;ft!==null;)_w(ft)}function y2(r,i){var u=At;At|=2;var d=Ew(),y=Nw();Ft!==r||bt!==i?(Bd=null,Ud=Ut()+500,Il(r,i)):Ml=pa(r,i);e:do try{if(Mt!==0&&ft!==null){i=ft;var v=Ur;t:switch(Mt){case 1:Mt=0,Ur=null,Ll(r,i,v,1);break;case 2:case 9:if(Px(v)){Mt=0,Ur=null,Tw(i);break}i=function(){Mt!==2&&Mt!==9||Ft!==r||(Mt=7),_a(r)},v.then(i,i);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:Px(v)?(Mt=0,Ur=null,Tw(i)):(Mt=0,Ur=null,Ll(r,i,v,7));break;case 5:var S=null;switch(ft.tag){case 26:S=ft.memoizedState;case 5:case 27:var A=ft;if(S?mS(S):A.stateNode.complete){Mt=0,Ur=null;var q=A.sibling;if(q!==null)ft=q;else{var le=A.return;le!==null?(ft=le,Hd(le)):ft=null}break t}}Mt=0,Ur=null,Ll(r,i,v,5);break;case 6:Mt=0,Ur=null,Ll(r,i,v,6);break;case 8:yp(),un=6;break e;default:throw Error(a(462))}}v2();break}catch(de){jw(r,de)}while(!0);return Za=Rs=null,G.H=d,G.A=y,At=u,ft!==null?0:(Ft=null,bt=0,od(),un)}function v2(){for(;ft!==null&&!wt();)_w(ft)}function _w(r){var i=W0(r.alternate,r,ti);r.memoizedProps=r.pendingProps,i===null?Hd(r):ft=i}function Tw(r){var i=r,u=i.alternate;switch(i.tag){case 15:case 0:i=G0(u,i,i.pendingProps,i.type,void 0,bt);break;case 11:i=G0(u,i,i.pendingProps,i.type.render,i.ref,bt);break;case 5:Mm(i);default:ew(u,i),i=ft=Nx(i,ti),i=W0(u,i,ti)}r.memoizedProps=r.pendingProps,i===null?Hd(r):ft=i}function Ll(r,i,u,d){Za=Rs=null,Mm(i),El=null,au=0;var y=i.return;try{if(s2(r,y,i,u,bt)){un=1,Ad(r,Wr(u,r.current)),ft=null;return}}catch(v){if(y!==null)throw ft=y,v;un=1,Ad(r,Wr(u,r.current)),ft=null;return}i.flags&32768?(jt||d===1?r=!0:Ml||(bt&536870912)!==0?r=!1:(Ui=r=!0,(d===2||d===9||d===3||d===6)&&(d=Lr.current,d!==null&&d.tag===13&&(d.flags|=16384))),Aw(i,r)):Hd(i)}function Hd(r){var i=r;do{if((i.flags&32768)!==0){Aw(i,Ui);return}r=i.return;var u=u2(i.alternate,i,ti);if(u!==null){ft=u;return}if(i=i.sibling,i!==null){ft=i;return}ft=i=r}while(i!==null);un===0&&(un=5)}function Aw(r,i){do{var u=c2(r.alternate,r);if(u!==null){u.flags&=32767,ft=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!i&&(r=r.sibling,r!==null)){ft=r;return}ft=r=u}while(r!==null);un=6,ft=null}function Rw(r,i,u,d,y,v,S,A,q){r.cancelPendingCommit=null;do qd();while(Rn!==0);if((At&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=sm,Si(r,u,v,S,A,q),r===Ft&&(ft=Ft=null,bt=0),zl=i,$i=r,ni=u,mp=v,pp=y,xw=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,S2(Fe,function(){return Iw(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=G.T,G.T=null,y=ie.p,ie.p=2,S=At,At|=4;try{d2(r,i,u)}finally{At=S,ie.p=y,G.T=d}}Rn=1,Ow(),Mw(),Dw()}}function Ow(){if(Rn===1){Rn=0;var r=$i,i=zl,u=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||u){u=G.T,G.T=null;var d=ie.p;ie.p=2;var y=At;At|=4;try{fw(i,r);var v=Ap,S=vx(r.containerInfo),A=v.focusedElem,q=v.selectionRange;if(S!==A&&A&&A.ownerDocument&&yx(A.ownerDocument.documentElement,A)){if(q!==null&&tm(A)){var le=q.start,de=q.end;if(de===void 0&&(de=le),"selectionStart"in A)A.selectionStart=le,A.selectionEnd=Math.min(de,A.value.length);else{var pe=A.ownerDocument||document,oe=pe&&pe.defaultView||window;if(oe.getSelection){var ue=oe.getSelection(),Re=A.textContent.length,Qe=Math.min(q.start,Re),Lt=q.end===void 0?Qe:Math.min(q.end,Re);!ue.extend&&Qe>Lt&&(S=Lt,Lt=Qe,Qe=S);var W=gx(A,Qe),K=gx(A,Lt);if(W&&K&&(ue.rangeCount!==1||ue.anchorNode!==W.node||ue.anchorOffset!==W.offset||ue.focusNode!==K.node||ue.focusOffset!==K.offset)){var ae=pe.createRange();ae.setStart(W.node,W.offset),ue.removeAllRanges(),Qe>Lt?(ue.addRange(ae),ue.extend(K.node,K.offset)):(ae.setEnd(K.node,K.offset),ue.addRange(ae))}}}}for(pe=[],ue=A;ue=ue.parentNode;)ue.nodeType===1&&pe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<pe.length;A++){var he=pe[A];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}nf=!!Tp,Ap=Tp=null}finally{At=y,ie.p=d,G.T=u}}r.current=i,Rn=2}}function Mw(){if(Rn===2){Rn=0;var r=$i,i=zl,u=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||u){u=G.T,G.T=null;var d=ie.p;ie.p=2;var y=At;At|=4;try{lw(r,i.alternate,i)}finally{At=y,ie.p=d,G.T=u}}Rn=3}}function Dw(){if(Rn===4||Rn===3){Rn=0,Gt();var r=$i,i=zl,u=ni,d=xw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Rn=5:(Rn=0,zl=$i=null,zw(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Fi=null),vr(u),i=i.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Yt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=G.T,y=ie.p,ie.p=2,G.T=null;try{for(var v=r.onRecoverableError,S=0;S<d.length;S++){var A=d[S];v(A.value,{componentStack:A.stack})}}finally{G.T=i,ie.p=y}}(ni&3)!==0&&qd(),_a(r),y=r.pendingLanes,(u&261930)!==0&&(y&42)!==0?r===gp?wu++:(wu=0,gp=r):wu=0,Su(0)}}function zw(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,nu(i)))}function qd(){return Ow(),Mw(),Dw(),Iw()}function Iw(){if(Rn!==5)return!1;var r=$i,i=mp;mp=0;var u=vr(ni),d=G.T,y=ie.p;try{ie.p=32>u?32:u,G.T=null,u=pp,pp=null;var v=$i,S=ni;if(Rn=0,zl=$i=null,ni=0,(At&6)!==0)throw Error(a(331));var A=At;if(At|=4,yw(v.current),mw(v,v.current,S,u),At=A,Su(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Yt,v)}catch{}return!0}finally{ie.p=y,G.T=d,zw(r,i)}}function Lw(r,i,u){i=Wr(u,i),i=Qm(r.stateNode,i,2),r=zi(r,i,2),r!==null&&(ga(r,2),_a(r))}function Dt(r,i,u){if(r.tag===3)Lw(r,r,u);else for(;i!==null;){if(i.tag===3){Lw(i,r,u);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Fi===null||!Fi.has(d))){r=Wr(u,r),u=P0(2),d=zi(i,u,2),d!==null&&(U0(u,d,i,r),ga(d,2),_a(d));break}}i=i.return}}function bp(r,i,u){var d=r.pingCache;if(d===null){d=r.pingCache=new m2;var y=new Set;d.set(i,y)}else y=d.get(i),y===void 0&&(y=new Set,d.set(i,y));y.has(u)||(dp=!0,y.add(u),r=b2.bind(null,r,i,u),i.then(r,r))}function b2(r,i,u){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,Ft===r&&(bt&u)===u&&(un===4||un===3&&(bt&62914560)===bt&&300>Ut()-Pd?(At&2)===0&&Il(r,0):fp|=u,Dl===bt&&(Dl=0)),_a(r)}function Pw(r,i){i===0&&(i=Qr()),r=_s(r,i),r!==null&&(ga(r,i),_a(r))}function x2(r){var i=r.memoizedState,u=0;i!==null&&(u=i.retryLane),Pw(r,u)}function w2(r,i){var u=0;switch(r.tag){case 31:case 13:var d=r.stateNode,y=r.memoizedState;y!==null&&(u=y.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),Pw(r,u)}function S2(r,i){return Ne(r,i)}var Zd=null,Pl=null,xp=!1,Gd=!1,wp=!1,qi=0;function _a(r){r!==Pl&&r.next===null&&(Pl===null?Zd=Pl=r:Pl=Pl.next=r),Gd=!0,xp||(xp=!0,j2())}function Su(r,i){if(!wp&&Gd){wp=!0;do for(var u=!1,d=Zd;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var v=0;else{var S=d.suspendedLanes,A=d.pingedLanes;v=(1<<31-yt(42|r)+1)-1,v&=y&~(S&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,$w(d,v))}else v=bt,v=Pa(d,d===Ft?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||pa(d,v)||(u=!0,$w(d,v));d=d.next}while(u);wp=!1}}function k2(){Uw()}function Uw(){Gd=xp=!1;var r=0;qi!==0&&D2()&&(r=qi);for(var i=Ut(),u=null,d=Zd;d!==null;){var y=d.next,v=Bw(d,i);v===0?(d.next=null,u===null?Zd=y:u.next=y,y===null&&(Pl=u)):(u=d,(r!==0||(v&3)!==0)&&(Gd=!0)),d=y}Rn!==0&&Rn!==5||Su(r),qi!==0&&(qi=0)}function Bw(r,i){for(var u=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var S=31-yt(v),A=1<<S,q=y[S];q===-1?((A&u)===0||(A&d)!==0)&&(y[S]=rn(A,i)):q<=i&&(r.expiredLanes|=A),v&=~A}if(i=Ft,u=bt,u=Pa(r,r===i?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,u===0||r===i&&(Mt===2||Mt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&Ze(d),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||pa(r,u)){if(i=u&-u,i===r.callbackPriority)return i;switch(d!==null&&Ze(d),vr(u)){case 2:case 8:u=me;break;case 32:u=Fe;break;case 268435456:u=St;break;default:u=Fe}return d=Fw.bind(null,r),u=Ne(u,d),r.callbackPriority=i,r.callbackNode=u,i}return d!==null&&d!==null&&Ze(d),r.callbackPriority=2,r.callbackNode=null,2}function Fw(r,i){if(Rn!==0&&Rn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(qd()&&r.callbackNode!==u)return null;var d=bt;return d=Pa(r,r===Ft?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Sw(r,d,i),Bw(r,Ut()),r.callbackNode!=null&&r.callbackNode===u?Fw.bind(null,r):null)}function $w(r,i){if(qd())return null;Sw(r,i,!0)}function j2(){I2(function(){(At&6)!==0?Ne(ce,k2):Uw()})}function Sp(){if(qi===0){var r=kl;r===0&&(r=ja,ja<<=1,(ja&261888)===0&&(ja=256)),qi=r}return qi}function Hw(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:ed(""+r)}function qw(r,i){var u=i.ownerDocument.createElement("input");return u.name=i.name,u.value=i.value,r.id&&u.setAttribute("form",r.id),i.parentNode.insertBefore(u,i),r=new FormData(r),u.parentNode.removeChild(u),r}function C2(r,i,u,d,y){if(i==="submit"&&u&&u.stateNode===y){var v=Hw((y[vt]||null).action),S=d.submitter;S&&(i=(i=S[vt]||null)?Hw(i.formAction):S.getAttribute("formAction"),i!==null&&(v=i,S=null));var A=new ad("action","action",null,d,y);r.push({event:A,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(qi!==0){var q=S?qw(y,S):new FormData(y);$m(u,{pending:!0,data:q,method:y.method,action:v},null,q)}}else typeof v=="function"&&(A.preventDefault(),q=S?qw(y,S):new FormData(y),$m(u,{pending:!0,data:q,method:y.method,action:v},v,q))},currentTarget:y}]})}}for(var kp=0;kp<im.length;kp++){var jp=im[kp],E2=jp.toLowerCase(),N2=jp[0].toUpperCase()+jp.slice(1);ya(E2,"on"+N2)}ya(wx,"onAnimationEnd"),ya(Sx,"onAnimationIteration"),ya(kx,"onAnimationStart"),ya("dblclick","onDoubleClick"),ya("focusin","onFocus"),ya("focusout","onBlur"),ya(HA,"onTransitionRun"),ya(qA,"onTransitionStart"),ya(ZA,"onTransitionCancel"),ya(jx,"onTransitionEnd"),Ln("onMouseEnter",["mouseout","mouseover"]),Ln("onMouseLeave",["mouseout","mouseover"]),Ln("onPointerEnter",["pointerout","pointerover"]),Ln("onPointerLeave",["pointerout","pointerover"]),xn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xn("onBeforeInput",["compositionend","keypress","textInput","paste"]),xn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ku="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(" "),_2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ku));function Zw(r,i){i=(i&4)!==0;for(var u=0;u<r.length;u++){var d=r[u],y=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var S=d.length-1;0<=S;S--){var A=d[S],q=A.instance,le=A.currentTarget;if(A=A.listener,q!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=le;try{v(y)}catch(de){ld(de)}y.currentTarget=null,v=q}else for(S=0;S<d.length;S++){if(A=d[S],q=A.instance,le=A.currentTarget,A=A.listener,q!==v&&y.isPropagationStopped())break e;v=A,y.currentTarget=le;try{v(y)}catch(de){ld(de)}y.currentTarget=null,v=q}}}}function ht(r,i){var u=i[Ua];u===void 0&&(u=i[Ua]=new Set);var d=r+"__bubble";u.has(d)||(Gw(i,r,2,!1),u.add(d))}function Cp(r,i,u){var d=0;i&&(d|=4),Gw(u,r,d,i)}var Vd="_reactListening"+Math.random().toString(36).slice(2);function Ep(r){if(!r[Vd]){r[Vd]=!0,an.forEach(function(u){u!=="selectionchange"&&(_2.has(u)||Cp(u,!1,r),Cp(u,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Vd]||(i[Vd]=!0,Cp("selectionchange",!1,i))}}function Gw(r,i,u,d){switch(wS(i)){case 2:var y=nR;break;case 8:y=rR;break;default:y=Fp}u=y.bind(null,i,u,r),y=void 0,!Gh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(i,u,{capture:!0,passive:y}):r.addEventListener(i,u,!0):y!==void 0?r.addEventListener(i,u,{passive:y}):r.addEventListener(i,u,!1)}function Np(r,i,u,d,y){var v=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 A=d.stateNode.containerInfo;if(A===y)break;if(S===4)for(S=d.return;S!==null;){var q=S.tag;if((q===3||q===4)&&S.stateNode.containerInfo===y)return;S=S.return}for(;A!==null;){if(S=H(A),S===null)return;if(q=S.tag,q===5||q===6||q===26||q===27){d=v=S;continue e}A=A.parentNode}}d=d.return}Xb(function(){var le=v,de=qh(u),pe=[];e:{var oe=Cx.get(r);if(oe!==void 0){var ue=ad,Re=r;switch(r){case"keypress":if(nd(u)===0)break e;case"keydown":case"keyup":ue=wA;break;case"focusin":Re="focus",ue=Yh;break;case"focusout":Re="blur",ue=Yh;break;case"beforeblur":case"afterblur":ue=Yh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=ex;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=uA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=jA;break;case wx:case Sx:case kx:ue=fA;break;case jx:ue=EA;break;case"scroll":case"scrollend":ue=lA;break;case"wheel":ue=_A;break;case"copy":case"cut":case"paste":ue=mA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=nx;break;case"toggle":case"beforetoggle":ue=AA}var Qe=(i&4)!==0,Lt=!Qe&&(r==="scroll"||r==="scrollend"),W=Qe?oe!==null?oe+"Capture":null:oe;Qe=[];for(var K=le,ae;K!==null;){var he=K;if(ae=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ae===null||W===null||(he=Zo(K,W),he!=null&&Qe.push(ju(K,he,ae))),Lt)break;K=K.return}0<Qe.length&&(oe=new ue(oe,Re,null,u,de),pe.push({event:oe,listeners:Qe}))}}if((i&7)===0){e:{if(oe=r==="mouseover"||r==="pointerover",ue=r==="mouseout"||r==="pointerout",oe&&u!==Hh&&(Re=u.relatedTarget||u.fromElement)&&(H(Re)||Re[$n]))break e;if((ue||oe)&&(oe=de.window===de?de:(oe=de.ownerDocument)?oe.defaultView||oe.parentWindow:window,ue?(Re=u.relatedTarget||u.toElement,ue=le,Re=Re?H(Re):null,Re!==null&&(Lt=o(Re),Qe=Re.tag,Re!==Lt||Qe!==5&&Qe!==27&&Qe!==6)&&(Re=null)):(ue=null,Re=le),ue!==Re)){if(Qe=ex,he="onMouseLeave",W="onMouseEnter",K="mouse",(r==="pointerout"||r==="pointerover")&&(Qe=nx,he="onPointerLeave",W="onPointerEnter",K="pointer"),Lt=ue==null?oe:_e(ue),ae=Re==null?oe:_e(Re),oe=new Qe(he,K+"leave",ue,u,de),oe.target=Lt,oe.relatedTarget=ae,he=null,H(de)===le&&(Qe=new Qe(W,K+"enter",Re,u,de),Qe.target=ae,Qe.relatedTarget=Lt,he=Qe),Lt=he,ue&&Re)t:{for(Qe=T2,W=ue,K=Re,ae=0,he=W;he;he=Qe(he))ae++;he=0;for(var He=K;He;He=Qe(He))he++;for(;0<ae-he;)W=Qe(W),ae--;for(;0<he-ae;)K=Qe(K),he--;for(;ae--;){if(W===K||K!==null&&W===K.alternate){Qe=W;break t}W=Qe(W),K=Qe(K)}Qe=null}else Qe=null;ue!==null&&Vw(pe,oe,ue,Qe,!1),Re!==null&&Lt!==null&&Vw(pe,Lt,Re,Qe,!0)}}e:{if(oe=le?_e(le):window,ue=oe.nodeName&&oe.nodeName.toLowerCase(),ue==="select"||ue==="input"&&oe.type==="file")var _t=cx;else if(ox(oe))if(dx)_t=BA;else{_t=PA;var Le=LA}else ue=oe.nodeName,!ue||ue.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?le&&$h(le.elementType)&&(_t=cx):_t=UA;if(_t&&(_t=_t(r,le))){ux(pe,_t,u,de);break e}Le&&Le(r,oe,le),r==="focusout"&&le&&oe.type==="number"&&le.memoizedProps.value!=null&&Fh(oe,"number",oe.value)}switch(Le=le?_e(le):window,r){case"focusin":(ox(Le)||Le.contentEditable==="true")&&(pl=Le,nm=le,Jo=null);break;case"focusout":Jo=nm=pl=null;break;case"mousedown":rm=!0;break;case"contextmenu":case"mouseup":case"dragend":rm=!1,bx(pe,u,de);break;case"selectionchange":if($A)break;case"keydown":case"keyup":bx(pe,u,de)}var nt;if(Wh)e:{switch(r){case"compositionstart":var xt="onCompositionStart";break e;case"compositionend":xt="onCompositionEnd";break e;case"compositionupdate":xt="onCompositionUpdate";break e}xt=void 0}else ml?sx(r,u)&&(xt="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(xt="onCompositionStart");xt&&(rx&&u.locale!=="ko"&&(ml||xt!=="onCompositionStart"?xt==="onCompositionEnd"&&ml&&(nt=Wb()):(_i=de,Vh="value"in _i?_i.value:_i.textContent,ml=!0)),Le=Qd(le,xt),0<Le.length&&(xt=new tx(xt,r,null,u,de),pe.push({event:xt,listeners:Le}),nt?xt.data=nt:(nt=lx(u),nt!==null&&(xt.data=nt)))),(nt=OA?MA(r,u):DA(r,u))&&(xt=Qd(le,"onBeforeInput"),0<xt.length&&(Le=new tx("onBeforeInput","beforeinput",null,u,de),pe.push({event:Le,listeners:xt}),Le.data=nt)),C2(pe,r,le,u,de)}Zw(pe,i)})}function ju(r,i,u){return{instance:r,listener:i,currentTarget:u}}function Qd(r,i){for(var u=i+"Capture",d=[];r!==null;){var y=r,v=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||v===null||(y=Zo(r,u),y!=null&&d.unshift(ju(r,y,v)),y=Zo(r,i),y!=null&&d.push(ju(r,y,v))),r.tag===3)return d;r=r.return}return[]}function T2(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Vw(r,i,u,d,y){for(var v=i._reactName,S=[];u!==null&&u!==d;){var A=u,q=A.alternate,le=A.stateNode;if(A=A.tag,q!==null&&q===d)break;A!==5&&A!==26&&A!==27||le===null||(q=le,y?(le=Zo(u,v),le!=null&&S.unshift(ju(u,le,q))):y||(le=Zo(u,v),le!=null&&S.push(ju(u,le,q)))),u=u.return}S.length!==0&&r.push({event:i,listeners:S})}var A2=/\r\n?/g,R2=/\u0000|\uFFFD/g;function Qw(r){return(typeof r=="string"?r:""+r).replace(A2,`
|
|
49
|
+
`).replace(R2,"")}function Kw(r,i){return i=Qw(i),Qw(r)===i}function It(r,i,u,d,y,v){switch(u){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||dl(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&dl(r,""+d);break;case"className":Wc(r,"class",d);break;case"tabIndex":Wc(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Wc(r,u,d);break;case"style":Kb(r,d,v);break;case"data":if(i!=="object"){Wc(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||u!=="href")){r.removeAttribute(u);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=ed(""+d),r.setAttribute(u,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(u,"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 v=="function"&&(u==="formAction"?(i!=="input"&&It(r,i,"name",y.name,y,null),It(r,i,"formEncType",y.formEncType,y,null),It(r,i,"formMethod",y.formMethod,y,null),It(r,i,"formTarget",y.formTarget,y,null)):(It(r,i,"encType",y.encType,y,null),It(r,i,"method",y.method,y,null),It(r,i,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(u);break}d=ed(""+d),r.setAttribute(u,d);break;case"onClick":d!=null&&(r.onclick=Fa);break;case"onScroll":d!=null&&ht("scroll",r);break;case"onScrollEnd":d!=null&&ht("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(u=d.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}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}u=ed(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);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(u,""+d):r.removeAttribute(u);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(u,""):r.removeAttribute(u);break;case"capture":case"download":d===!0?r.setAttribute(u,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(u,d):r.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(u,d):r.removeAttribute(u);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(u):r.setAttribute(u,d);break;case"popover":ht("beforetoggle",r),ht("toggle",r),Xc(r,"popover",d);break;case"xlinkActuate":Ba(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ba(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ba(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ba(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ba(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ba(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Xc(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=iA.get(u)||u,Xc(r,u,d))}}function _p(r,i,u,d,y,v){switch(u){case"style":Kb(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(u=d.__html,u!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=u}}break;case"children":typeof d=="string"?dl(r,d):(typeof d=="number"||typeof d=="bigint")&&dl(r,""+d);break;case"onScroll":d!=null&&ht("scroll",r);break;case"onScrollEnd":d!=null&&ht("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Fa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Hn.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),i=u.slice(2,y?u.length-7:void 0),v=r[vt]||null,v=v!=null?v[u]:null,typeof v=="function"&&r.removeEventListener(i,v,y),typeof d=="function")){typeof v!="function"&&v!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(i,d,y);break e}u in r?r[u]=d:d===!0?r.setAttribute(u,""):Xc(r,u,d)}}}function Vn(r,i,u){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ht("error",r),ht("load",r);var d=!1,y=!1,v;for(v in u)if(u.hasOwnProperty(v)){var S=u[v];if(S!=null)switch(v){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:It(r,i,v,S,u,null)}}y&&It(r,i,"srcSet",u.srcSet,u,null),d&&It(r,i,"src",u.src,u,null);return;case"input":ht("invalid",r);var A=v=S=y=null,q=null,le=null;for(d in u)if(u.hasOwnProperty(d)){var de=u[d];if(de!=null)switch(d){case"name":y=de;break;case"type":S=de;break;case"checked":q=de;break;case"defaultChecked":le=de;break;case"value":v=de;break;case"defaultValue":A=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(a(137,i));break;default:It(r,i,d,de,u,null)}}Zb(r,v,A,q,le,S,y,!1);return;case"select":ht("invalid",r),d=S=v=null;for(y in u)if(u.hasOwnProperty(y)&&(A=u[y],A!=null))switch(y){case"value":v=A;break;case"defaultValue":S=A;break;case"multiple":d=A;default:It(r,i,y,A,u,null)}i=v,u=S,r.multiple=!!d,i!=null?cl(r,!!d,i,!1):u!=null&&cl(r,!!d,u,!0);return;case"textarea":ht("invalid",r),v=y=d=null;for(S in u)if(u.hasOwnProperty(S)&&(A=u[S],A!=null))switch(S){case"value":d=A;break;case"defaultValue":y=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(a(91));break;default:It(r,i,S,A,u,null)}Vb(r,d,y,v);return;case"option":for(q in u)if(u.hasOwnProperty(q)&&(d=u[q],d!=null))switch(q){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:It(r,i,q,d,u,null)}return;case"dialog":ht("beforetoggle",r),ht("toggle",r),ht("cancel",r),ht("close",r);break;case"iframe":case"object":ht("load",r);break;case"video":case"audio":for(d=0;d<ku.length;d++)ht(ku[d],r);break;case"image":ht("error",r),ht("load",r);break;case"details":ht("toggle",r);break;case"embed":case"source":case"link":ht("error",r),ht("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(le in u)if(u.hasOwnProperty(le)&&(d=u[le],d!=null))switch(le){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:It(r,i,le,d,u,null)}return;default:if($h(i)){for(de in u)u.hasOwnProperty(de)&&(d=u[de],d!==void 0&&_p(r,i,de,d,u,void 0));return}}for(A in u)u.hasOwnProperty(A)&&(d=u[A],d!=null&&It(r,i,A,d,u,null))}function O2(r,i,u,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,v=null,S=null,A=null,q=null,le=null,de=null;for(ue in u){var pe=u[ue];if(u.hasOwnProperty(ue)&&pe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":q=pe;default:d.hasOwnProperty(ue)||It(r,i,ue,null,d,pe)}}for(var oe in d){var ue=d[oe];if(pe=u[oe],d.hasOwnProperty(oe)&&(ue!=null||pe!=null))switch(oe){case"type":v=ue;break;case"name":y=ue;break;case"checked":le=ue;break;case"defaultChecked":de=ue;break;case"value":S=ue;break;case"defaultValue":A=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(a(137,i));break;default:ue!==pe&&It(r,i,oe,ue,d,pe)}}Bh(r,S,A,q,le,de,v,y);return;case"select":ue=S=A=oe=null;for(v in u)if(q=u[v],u.hasOwnProperty(v)&&q!=null)switch(v){case"value":break;case"multiple":ue=q;default:d.hasOwnProperty(v)||It(r,i,v,null,d,q)}for(y in d)if(v=d[y],q=u[y],d.hasOwnProperty(y)&&(v!=null||q!=null))switch(y){case"value":oe=v;break;case"defaultValue":A=v;break;case"multiple":S=v;default:v!==q&&It(r,i,y,v,d,q)}i=A,u=S,d=ue,oe!=null?cl(r,!!u,oe,!1):!!d!=!!u&&(i!=null?cl(r,!!u,i,!0):cl(r,!!u,u?[]:"",!1));return;case"textarea":ue=oe=null;for(A in u)if(y=u[A],u.hasOwnProperty(A)&&y!=null&&!d.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:It(r,i,A,null,d,y)}for(S in d)if(y=d[S],v=u[S],d.hasOwnProperty(S)&&(y!=null||v!=null))switch(S){case"value":oe=y;break;case"defaultValue":ue=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&It(r,i,S,y,d,v)}Gb(r,oe,ue);return;case"option":for(var Re in u)if(oe=u[Re],u.hasOwnProperty(Re)&&oe!=null&&!d.hasOwnProperty(Re))switch(Re){case"selected":r.selected=!1;break;default:It(r,i,Re,null,d,oe)}for(q in d)if(oe=d[q],ue=u[q],d.hasOwnProperty(q)&&oe!==ue&&(oe!=null||ue!=null))switch(q){case"selected":r.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:It(r,i,q,oe,d,ue)}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 Qe in u)oe=u[Qe],u.hasOwnProperty(Qe)&&oe!=null&&!d.hasOwnProperty(Qe)&&It(r,i,Qe,null,d,oe);for(le in d)if(oe=d[le],ue=u[le],d.hasOwnProperty(le)&&oe!==ue&&(oe!=null||ue!=null))switch(le){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:It(r,i,le,oe,d,ue)}return;default:if($h(i)){for(var Lt in u)oe=u[Lt],u.hasOwnProperty(Lt)&&oe!==void 0&&!d.hasOwnProperty(Lt)&&_p(r,i,Lt,void 0,d,oe);for(de in d)oe=d[de],ue=u[de],!d.hasOwnProperty(de)||oe===ue||oe===void 0&&ue===void 0||_p(r,i,de,oe,d,ue);return}}for(var W in u)oe=u[W],u.hasOwnProperty(W)&&oe!=null&&!d.hasOwnProperty(W)&&It(r,i,W,null,d,oe);for(pe in d)oe=d[pe],ue=u[pe],!d.hasOwnProperty(pe)||oe===ue||oe==null&&ue==null||It(r,i,pe,oe,d,ue)}function Yw(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function M2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,u=performance.getEntriesByType("resource"),d=0;d<u.length;d++){var y=u[d],v=y.transferSize,S=y.initiatorType,A=y.duration;if(v&&A&&Yw(S)){for(S=0,A=y.responseEnd,d+=1;d<u.length;d++){var q=u[d],le=q.startTime;if(le>A)break;var de=q.transferSize,pe=q.initiatorType;de&&Yw(pe)&&(q=q.responseEnd,S+=de*(q<A?1:(A-le)/(q-le)))}if(--d,i+=8*(v+S)/(y.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 Tp=null,Ap=null;function Kd(r){return r.nodeType===9?r:r.ownerDocument}function Xw(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 Ww(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 Rp(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 Op=null;function D2(){var r=window.event;return r&&r.type==="popstate"?r===Op?!1:(Op=r,!0):(Op=null,!1)}var Jw=typeof setTimeout=="function"?setTimeout:void 0,z2=typeof clearTimeout=="function"?clearTimeout:void 0,eS=typeof Promise=="function"?Promise:void 0,I2=typeof queueMicrotask=="function"?queueMicrotask:typeof eS<"u"?function(r){return eS.resolve(null).then(r).catch(L2)}:Jw;function L2(r){setTimeout(function(){throw r})}function Zi(r){return r==="head"}function tS(r,i){var u=i,d=0;do{var y=u.nextSibling;if(r.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(d===0){r.removeChild(y),$l(i);return}d--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")d++;else if(u==="html")Cu(r.ownerDocument.documentElement);else if(u==="head"){u=r.ownerDocument.head,Cu(u);for(var v=u.firstChild;v;){var S=v.nextSibling,A=v.nodeName;v[Ni]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=S}}else u==="body"&&Cu(r.ownerDocument.body);u=y}while(u);$l(i)}function nS(r,i){var u=r;r=0;do{var d=u.nextSibling;if(u.nodeType===1?i?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(i?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),d&&d.nodeType===8)if(u=d.data,u==="/$"){if(r===0)break;r--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||r++;u=d}while(u)}function Mp(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var u=i;switch(i=i.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Mp(u),$e(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function P2(r,i,u,d){for(;r.nodeType===1;){var y=u;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Ni])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==y.rel||r.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||r.getAttribute("title")!==(y.title==null?null:y.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(y.src==null?null:y.src)||r.getAttribute("type")!==(y.type==null?null:y.type)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=y.name==null?null:""+y.name;if(y.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=ra(r.nextSibling),r===null)break}return null}function U2(r,i,u){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=ra(r.nextSibling),r===null))return null;return r}function rS(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=ra(r.nextSibling),r===null))return null;return r}function Dp(r){return r.data==="$?"||r.data==="$~"}function zp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function B2(r,i){var u=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||u.readyState!=="loading")i();else{var d=function(){i(),u.removeEventListener("DOMContentLoaded",d)};u.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function ra(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 Ip=null;function aS(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(i===0)return ra(r.nextSibling);i--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||i++}r=r.nextSibling}return null}function iS(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(i===0)return r;i--}else u!=="/$"&&u!=="/&"||i++}r=r.previousSibling}return null}function sS(r,i,u){switch(i=Kd(u),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 Cu(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);$e(r)}var aa=new Map,lS=new Set;function Yd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var ri=ie.d;ie.d={f:F2,r:$2,D:H2,C:q2,L:Z2,m:G2,X:Q2,S:V2,M:K2};function F2(){var r=ri.f(),i=Fd();return r||i}function $2(r){var i=ge(r);i!==null&&i.tag===5&&i.type==="form"?j0(i):ri.r(r)}var Ul=typeof document>"u"?null:document;function oS(r,i,u){var d=Ul;if(d&&typeof i=="string"&&i){var y=Yr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),lS.has(y)||(lS.add(y),r={rel:r,crossOrigin:u,href:i},d.querySelector(y)===null&&(i=d.createElement("link"),Vn(i,"link",r),kt(i),d.head.appendChild(i)))}}function H2(r){ri.D(r),oS("dns-prefetch",r,null)}function q2(r,i){ri.C(r,i),oS("preconnect",r,i)}function Z2(r,i,u){ri.L(r,i,u);var d=Ul;if(d&&r&&i){var y='link[rel="preload"][as="'+Yr(i)+'"]';i==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+Yr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+Yr(u.imageSizes)+'"]')):y+='[href="'+Yr(r)+'"]';var v=y;switch(i){case"style":v=Bl(r);break;case"script":v=Fl(r)}aa.has(v)||(r=g({rel:"preload",href:i==="image"&&u&&u.imageSrcSet?void 0:r,as:i},u),aa.set(v,r),d.querySelector(y)!==null||i==="style"&&d.querySelector(Eu(v))||i==="script"&&d.querySelector(Nu(v))||(i=d.createElement("link"),Vn(i,"link",r),kt(i),d.head.appendChild(i)))}}function G2(r,i){ri.m(r,i);var u=Ul;if(u&&r){var d=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Yr(d)+'"][href="'+Yr(r)+'"]',v=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Fl(r)}if(!aa.has(v)&&(r=g({rel:"modulepreload",href:r},i),aa.set(v,r),u.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Nu(v)))return}d=u.createElement("link"),Vn(d,"link",r),kt(d),u.head.appendChild(d)}}}function V2(r,i,u){ri.S(r,i,u);var d=Ul;if(d&&r){var y=Nt(d).hoistableStyles,v=Bl(r);i=i||"default";var S=y.get(v);if(!S){var A={loading:0,preload:null};if(S=d.querySelector(Eu(v)))A.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},u),(u=aa.get(v))&&Lp(r,u);var q=S=d.createElement("link");kt(q),Vn(q,"link",r),q._p=new Promise(function(le,de){q.onload=le,q.onerror=de}),q.addEventListener("load",function(){A.loading|=1}),q.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Xd(S,i,d)}S={type:"stylesheet",instance:S,count:1,state:A},y.set(v,S)}}}function Q2(r,i){ri.X(r,i);var u=Ul;if(u&&r){var d=Nt(u).hoistableScripts,y=Fl(r),v=d.get(y);v||(v=u.querySelector(Nu(y)),v||(r=g({src:r,async:!0},i),(i=aa.get(y))&&Pp(r,i),v=u.createElement("script"),kt(v),Vn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function K2(r,i){ri.M(r,i);var u=Ul;if(u&&r){var d=Nt(u).hoistableScripts,y=Fl(r),v=d.get(y);v||(v=u.querySelector(Nu(y)),v||(r=g({src:r,async:!0,type:"module"},i),(i=aa.get(y))&&Pp(r,i),v=u.createElement("script"),kt(v),Vn(v,"link",r),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function uS(r,i,u,d){var y=(y=re.current)?Yd(y):null;if(!y)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(i=Bl(u.href),u=Nt(y).hoistableStyles,d=u.get(i),d||(d={type:"style",instance:null,count:0,state:null},u.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){r=Bl(u.href);var v=Nt(y).hoistableStyles,S=v.get(r);if(S||(y=y.ownerDocument||y,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,S),(v=y.querySelector(Eu(r)))&&!v._p&&(S.instance=v,S.state.loading=5),aa.has(r)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},aa.set(r,u),v||Y2(y,r,u,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=u.async,u=u.src,typeof u=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Fl(u),u=Nt(y).hoistableScripts,d=u.get(i),d||(d={type:"script",instance:null,count:0,state:null},u.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Bl(r){return'href="'+Yr(r)+'"'}function Eu(r){return'link[rel="stylesheet"]['+r+"]"}function cS(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function Y2(r,i,u,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}),Vn(i,"link",u),kt(i),r.head.appendChild(i))}function Fl(r){return'[src="'+Yr(r)+'"]'}function Nu(r){return"script[async]"+r}function dS(r,i,u){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Yr(u.href)+'"]');if(d)return i.instance=d,kt(d),d;var y=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),kt(d),Vn(d,"style",y),Xd(d,u.precedence,r),i.instance=d;case"stylesheet":y=Bl(u.href);var v=r.querySelector(Eu(y));if(v)return i.state.loading|=4,i.instance=v,kt(v),v;d=cS(u),(y=aa.get(y))&&Lp(d,y),v=(r.ownerDocument||r).createElement("link"),kt(v);var S=v;return S._p=new Promise(function(A,q){S.onload=A,S.onerror=q}),Vn(v,"link",d),i.state.loading|=4,Xd(v,u.precedence,r),i.instance=v;case"script":return v=Fl(u.src),(y=r.querySelector(Nu(v)))?(i.instance=y,kt(y),y):(d=u,(y=aa.get(v))&&(d=g({},u),Pp(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),kt(y),Vn(y,"link",d),r.head.appendChild(y),i.instance=y);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,Xd(d,u.precedence,r));return i.instance}function Xd(r,i,u){for(var d=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,v=y,S=0;S<d.length;S++){var A=d[S];if(A.dataset.precedence===i)v=A;else if(v!==y)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=u.nodeType===9?u.head:u,i.insertBefore(r,i.firstChild))}function Lp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Pp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Wd=null;function fS(r,i,u){if(Wd===null){var d=new Map,y=Wd=new Map;y.set(u,d)}else y=Wd,d=y.get(u),d||(d=new Map,y.set(u,d));if(d.has(r))return d;for(d.set(r,null),u=u.getElementsByTagName(r),y=0;y<u.length;y++){var v=u[y];if(!(v[Ni]||v[Ve]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(i)||"";S=r+S;var A=d.get(S);A?A.push(v):d.set(S,[v])}}return d}function hS(r,i,u){r=r.ownerDocument||r,r.head.insertBefore(u,i==="title"?r.querySelector("head > title"):null)}function X2(r,i,u){if(u===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 mS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function W2(r,i,u,d){if(u.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=Bl(d.href),v=i.querySelector(Eu(y));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=Jd.bind(r),i.then(r,r)),u.state.loading|=4,u.instance=v,kt(v);return}v=i.ownerDocument||i,d=cS(d),(y=aa.get(y))&&Lp(d,y),v=v.createElement("link"),kt(v);var S=v;S._p=new Promise(function(A,q){S.onload=A,S.onerror=q}),Vn(v,"link",d),u.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(u,i),(i=u.state.preload)&&(u.state.loading&3)===0&&(r.count++,u=Jd.bind(r),i.addEventListener("load",u),i.addEventListener("error",u))}}var Up=0;function J2(r,i){return r.stylesheets&&r.count===0&&tf(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var d=setTimeout(function(){if(r.stylesheets&&tf(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Up===0&&(Up=62500*M2());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&tf(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Up?50:800)+i);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function Jd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tf(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var ef=null;function tf(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,ef=new Map,i.forEach(eR,r),ef=null,Jd.call(r))}function eR(r,i){if(!(i.state.loading&4)){var u=ef.get(r);if(u)var d=u.get(null);else{u=new Map,ef.set(r,u);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<y.length;v++){var S=y[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(u.set(S.dataset.precedence,S),d=S)}d&&u.set(null,d)}y=i.instance,S=y.getAttribute("data-precedence"),v=u.get(S)||d,v===d&&u.set(null,y),u.set(S,y),this.count++,d=Jd.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),v?v.parentNode.insertBefore(y,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(y,r.firstChild)),i.state.loading|=4}}var _u={$$typeof:O,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function tR(r,i,u,d,y,v,S,A,q){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=wi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wi(0),this.hiddenUpdates=wi(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function pS(r,i,u,d,y,v,S,A,q,le,de,pe){return r=new tR(r,i,u,S,q,le,de,pe,A),i=1,v===!0&&(i|=24),v=Ir(3,null,null,i),r.current=v,v.stateNode=r,i=vm(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:u,cache:i},Sm(v),r}function gS(r){return r?(r=vl,r):vl}function yS(r,i,u,d,y,v){y=gS(y),d.context===null?d.context=y:d.pendingContext=y,d=Di(i),d.payload={element:u},v=v===void 0?null:v,v!==null&&(d.callback=v),u=zi(r,d,i),u!==null&&(jr(u,r,i),su(u,r,i))}function vS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<i?u:i}}function Bp(r,i){vS(r,i),(r=r.alternate)&&vS(r,i)}function bS(r){if(r.tag===13||r.tag===31){var i=_s(r,67108864);i!==null&&jr(i,r,67108864),Bp(r,67108864)}}function xS(r){if(r.tag===13||r.tag===31){var i=Fr();i=In(i);var u=_s(r,i);u!==null&&jr(u,r,i),Bp(r,i)}}var nf=!0;function nR(r,i,u,d){var y=G.T;G.T=null;var v=ie.p;try{ie.p=2,Fp(r,i,u,d)}finally{ie.p=v,G.T=y}}function rR(r,i,u,d){var y=G.T;G.T=null;var v=ie.p;try{ie.p=8,Fp(r,i,u,d)}finally{ie.p=v,G.T=y}}function Fp(r,i,u,d){if(nf){var y=$p(d);if(y===null)Np(r,i,d,rf,u),SS(r,d);else if(iR(y,r,i,u,d))d.stopPropagation();else if(SS(r,d),i&4&&-1<aR.indexOf(r)){for(;y!==null;){var v=ge(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=Fn(v.pendingLanes);if(S!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var q=1<<31-yt(S);A.entanglements[1]|=q,S&=~q}_a(v),(At&6)===0&&(Ud=Ut()+500,Su(0))}}break;case 31:case 13:A=_s(v,2),A!==null&&jr(A,v,2),Fd(),Bp(v,2)}if(v=$p(d),v===null&&Np(r,i,d,rf,u),v===y)break;y=v}y!==null&&d.stopPropagation()}else Np(r,i,d,null,u)}}function $p(r){return r=qh(r),Hp(r)}var rf=null;function Hp(r){if(rf=null,r=H(r),r!==null){var i=o(r);if(i===null)r=null;else{var u=i.tag;if(u===13){if(r=c(i),r!==null)return r;r=null}else if(u===31){if(r=f(i),r!==null)return r;r=null}else if(u===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return rf=r,null}function wS(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(pr()){case ce:return 2;case me:return 8;case Fe:case Je:return 32;case St:return 268435456;default:return 32}default:return 32}}var qp=!1,Gi=null,Vi=null,Qi=null,Tu=new Map,Au=new Map,Ki=[],aR="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 SS(r,i){switch(r){case"focusin":case"focusout":Gi=null;break;case"dragenter":case"dragleave":Vi=null;break;case"mouseover":case"mouseout":Qi=null;break;case"pointerover":case"pointerout":Tu.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Au.delete(i.pointerId)}}function Ru(r,i,u,d,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:u,eventSystemFlags:d,nativeEvent:v,targetContainers:[y]},i!==null&&(i=ge(i),i!==null&&bS(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function iR(r,i,u,d,y){switch(i){case"focusin":return Gi=Ru(Gi,r,i,u,d,y),!0;case"dragenter":return Vi=Ru(Vi,r,i,u,d,y),!0;case"mouseover":return Qi=Ru(Qi,r,i,u,d,y),!0;case"pointerover":var v=y.pointerId;return Tu.set(v,Ru(Tu.get(v)||null,r,i,u,d,y)),!0;case"gotpointercapture":return v=y.pointerId,Au.set(v,Ru(Au.get(v)||null,r,i,u,d,y)),!0}return!1}function kS(r){var i=H(r.target);if(i!==null){var u=o(i);if(u!==null){if(i=u.tag,i===13){if(i=c(u),i!==null){r.blockedOn=i,Ei(r.priority,function(){xS(u)});return}}else if(i===31){if(i=f(u),i!==null){r.blockedOn=i,Ei(r.priority,function(){xS(u)});return}}else if(i===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function af(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var u=$p(r.nativeEvent);if(u===null){u=r.nativeEvent;var d=new u.constructor(u.type,u);Hh=d,u.target.dispatchEvent(d),Hh=null}else return i=ge(u),i!==null&&bS(i),r.blockedOn=u,!1;i.shift()}return!0}function jS(r,i,u){af(r)&&u.delete(i)}function sR(){qp=!1,Gi!==null&&af(Gi)&&(Gi=null),Vi!==null&&af(Vi)&&(Vi=null),Qi!==null&&af(Qi)&&(Qi=null),Tu.forEach(jS),Au.forEach(jS)}function sf(r,i){r.blockedOn===i&&(r.blockedOn=null,qp||(qp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,sR)))}var lf=null;function CS(r){lf!==r&&(lf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){lf===r&&(lf=null);for(var i=0;i<r.length;i+=3){var u=r[i],d=r[i+1],y=r[i+2];if(typeof d!="function"){if(Hp(d||u)===null)continue;break}var v=ge(u);v!==null&&(r.splice(i,3),i-=3,$m(v,{pending:!0,data:y,method:u.method,action:d},d,y))}}))}function $l(r){function i(q){return sf(q,r)}Gi!==null&&sf(Gi,r),Vi!==null&&sf(Vi,r),Qi!==null&&sf(Qi,r),Tu.forEach(i),Au.forEach(i);for(var u=0;u<Ki.length;u++){var d=Ki[u];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Ki.length&&(u=Ki[0],u.blockedOn===null);)kS(u),u.blockedOn===null&&Ki.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(d=0;d<u.length;d+=3){var y=u[d],v=u[d+1],S=y[vt]||null;if(typeof v=="function")S||CS(u);else if(S){var A=null;if(v&&v.hasAttribute("formAction")){if(y=v,S=v[vt]||null)A=S.formAction;else if(Hp(y)!==null)continue}else A=S.action;typeof A=="function"?u[d+1]=A:(u.splice(d,3),d-=3),CS(u)}}}function ES(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return y=S})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),d||setTimeout(u,20)}function u(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(u,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function Zp(r){this._internalRoot=r}of.prototype.render=Zp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var u=i.current,d=Fr();yS(u,d,r,i,null,null)},of.prototype.unmount=Zp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;yS(r.current,2,null,r,null,null),Fd(),i[$n]=null}};function of(r){this._internalRoot=r}of.prototype.unstable_scheduleHydration=function(r){if(r){var i=Ci();r={blockedOn:null,target:r,priority:i};for(var u=0;u<Ki.length&&i!==0&&i<Ki[u].priority;u++);Ki.splice(u,0,r),u===0&&kS(r)}};var NS=t.version;if(NS!=="19.2.4")throw Error(a(527,NS,"19.2.4"));ie.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?p(r):null,r=r===null?null:r.stateNode,r};var lR={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:G,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uf.isDisabled&&uf.supportsFiber)try{Yt=uf.inject(lR),qt=uf}catch{}}return Mu.createRoot=function(r,i){if(!s(r))throw Error(a(299));var u=!1,d="",y=D0,v=z0,S=I0;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError)),i=pS(r,1,!1,null,null,u,d,null,y,v,S,ES),r[$n]=i.current,Ep(r),new Zp(i)},Mu.hydrateRoot=function(r,i,u){if(!s(r))throw Error(a(299));var d=!1,y="",v=D0,S=z0,A=I0,q=null;return u!=null&&(u.unstable_strictMode===!0&&(d=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(v=u.onUncaughtError),u.onCaughtError!==void 0&&(S=u.onCaughtError),u.onRecoverableError!==void 0&&(A=u.onRecoverableError),u.formState!==void 0&&(q=u.formState)),i=pS(r,1,!0,i,u??null,d,y,q,v,S,A,ES),i.context=gS(null),u=i.current,d=Fr(),d=In(d),y=Di(d),y.callback=null,zi(u,y,d),u=d,i.current.lanes=u,ga(i,u),_a(i),r[$n]=i.current,Ep(r),new of(i)},Mu.version="19.2.4",Mu}var PS;function vR(){if(PS)return Kp.exports;PS=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(),Kp.exports=yR(),Kp.exports}var bR=vR(),il=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(){}},Gs,rs,oo,Uj,xR=(Uj=class extends il{constructor(){super();Te(this,Gs);Te(this,rs);Te(this,oo);ke(this,oo,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){F(this,rs)||this.setEventListener(F(this,oo))}onUnsubscribe(){var t;this.hasListeners()||((t=F(this,rs))==null||t.call(this),ke(this,rs,void 0))}setEventListener(t){var n;ke(this,oo,t),(n=F(this,rs))==null||n.call(this),ke(this,rs,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){F(this,Gs)!==t&&(ke(this,Gs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof F(this,Gs)=="boolean"?F(this,Gs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Gs=new WeakMap,rs=new WeakMap,oo=new WeakMap,Uj),cv=new xR,wR={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},as,lv,Bj,SR=(Bj=class{constructor(){Te(this,as,wR);Te(this,lv,!1)}setTimeoutProvider(e){ke(this,as,e)}setTimeout(e,t){return F(this,as).setTimeout(e,t)}clearTimeout(e){F(this,as).clearTimeout(e)}setInterval(e,t){return F(this,as).setInterval(e,t)}clearInterval(e){F(this,as).clearInterval(e)}},as=new WeakMap,lv=new WeakMap,Bj),qs=new SR;function kR(e){setTimeout(e,0)}var jR=typeof window>"u"||"Deno"in globalThis;function tr(){}function CR(e,t){return typeof e=="function"?e(t):e}function Qg(e){return typeof e=="number"&&e>=0&&e!==1/0}function Wj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ms(e,t){return typeof e=="function"?e(t):e}function oa(e,t){return typeof e=="function"?e(t):e}function US(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:c,stale:f}=e;if(c){if(a){if(t.queryHash!==dv(c,t.options))return!1}else if(!ic(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 BS(e,t){const{exact:n,status:a,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(tl(t.options.mutationKey)!==tl(o))return!1}else if(!ic(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function dv(e,t){return((t==null?void 0:t.queryKeyHashFn)||tl)(e)}function tl(e){return JSON.stringify(e,(t,n)=>Kg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function ic(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>ic(e[n],t[n])):!1}var ER=Object.prototype.hasOwnProperty;function fv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=FS(e)&&FS(t);if(!a&&!(Kg(e)&&Kg(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 p=0;p<f;p++){const g=a?p:c[p],w=e[g],x=t[g];if(w===x){m[g]=w,(a?p<o:ER.call(e,g))&&h++;continue}if(w===null||x===null||typeof w!="object"||typeof x!="object"){m[g]=x;continue}const k=fv(w,x,n+1);m[g]=k,k===w&&h++}return o===f&&h===o?e:m}function sc(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 FS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Kg(e){if(!$S(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!$S(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $S(e){return Object.prototype.toString.call(e)==="[object Object]"}function NR(e){return new Promise(t=>{qs.setTimeout(t,e)})}function Yg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?fv(e,t):t}function _R(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function TR(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var hv=Symbol();function Jj(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===hv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function mv(e,t){return typeof e=="function"?e(...t):!!e}function AR(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 lc=(()=>{let e=()=>jR;return{isServer(){return e()},setIsServer(t){e=t}}})();function Xg(){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 RR=kR;function OR(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=RR;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 fn=OR(),uo,is,co,Fj,MR=(Fj=class extends il{constructor(){super();Te(this,uo,!0);Te(this,is);Te(this,co);ke(this,co,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(){F(this,is)||this.setEventListener(F(this,co))}onUnsubscribe(){var t;this.hasListeners()||((t=F(this,is))==null||t.call(this),ke(this,is,void 0))}setEventListener(t){var n;ke(this,co,t),(n=F(this,is))==null||n.call(this),ke(this,is,t(this.setOnline.bind(this)))}setOnline(t){F(this,uo)!==t&&(ke(this,uo,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return F(this,uo)}},uo=new WeakMap,is=new WeakMap,co=new WeakMap,Fj),Ff=new MR;function DR(e){return Math.min(1e3*2**e,3e4)}function eC(e){return(e??"online")==="online"?Ff.isOnline():!0}var Wg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function tC(e){let t=!1,n=0,a;const s=Xg(),o=()=>s.status!=="pending",c=j=>{var C;if(!o()){const E=new Wg(j);w(E),(C=e.onCancel)==null||C.call(e,E)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>cv.isFocused()&&(e.networkMode==="always"||Ff.isOnline())&&e.canRun(),p=()=>eC(e.networkMode)&&e.canRun(),g=j=>{o()||(a==null||a(),s.resolve(j))},w=j=>{o()||(a==null||a(),s.reject(j))},x=()=>new Promise(j=>{var C;a=E=>{(o()||h())&&j(E)},(C=e.onPause)==null||C.call(e)}).then(()=>{var j;a=void 0,o()||(j=e.onContinue)==null||j.call(e)}),k=()=>{if(o())return;let j;const C=n===0?e.initialPromise:void 0;try{j=C??e.fn()}catch(E){j=Promise.reject(E)}Promise.resolve(j).then(g).catch(E=>{var R;if(o())return;const T=e.retry??(lc.isServer()?0:3),O=e.retryDelay??DR,D=typeof O=="function"?O(n,E):O,I=T===!0||typeof T=="number"&&n<T||typeof T=="function"&&T(n,E);if(t||!I){w(E);return}n++,(R=e.onFail)==null||R.call(e,n,E),NR(D).then(()=>h()?void 0:x()).then(()=>{t?w(E):k()})})};return{promise:s,status:()=>s.status,cancel:c,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:p,start:()=>(p()?k():x().then(k),s)}}var Vs,$j,nC=($j=class{constructor(){Te(this,Vs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Qg(this.gcTime)&&ke(this,Vs,qs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(lc.isServer()?1/0:300*1e3))}clearGcTimeout(){F(this,Vs)&&(qs.clearTimeout(F(this,Vs)),ke(this,Vs,void 0))}},Vs=new WeakMap,$j),Qs,fo,sa,Ks,Un,kc,Ys,qr,rC,ii,Hj,zR=(Hj=class extends nC{constructor(t){super();Te(this,qr);Te(this,Qs);Te(this,fo);Te(this,sa);Te(this,Ks);Te(this,Un);Te(this,kc);Te(this,Ys);ke(this,Ys,!1),ke(this,kc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ke(this,Ks,t.client),ke(this,sa,F(this,Ks).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ke(this,Qs,qS(this.options)),this.state=t.state??F(this,Qs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=F(this,Un))==null?void 0:t.promise}setOptions(t){if(this.options={...F(this,kc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=qS(this.options);n.data!==void 0&&(this.setState(HS(n.data,n.dataUpdatedAt)),ke(this,Qs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&F(this,sa).remove(this)}setData(t,n){const a=Yg(this.state.data,t,this.options);return Ke(this,qr,ii).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){Ke(this,qr,ii).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=F(this,Un))==null?void 0:a.promise;return(s=F(this,Un))==null||s.cancel(t),n?n.then(tr).catch(tr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return F(this,Qs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>oa(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===hv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ms(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:!Wj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=F(this,Un))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=F(this,Un))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),F(this,sa).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(F(this,Un)&&(F(this,Ys)||Ke(this,qr,rC).call(this)?F(this,Un).cancel({revert:!0}):F(this,Un).cancelRetry()),this.scheduleGc()),F(this,sa).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ke(this,qr,ii).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,p,g,w,x,k,j,C,E,T,O;if(this.state.fetchStatus!=="idle"&&((m=F(this,Un))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(F(this,Un))return F(this,Un).continueRetry(),F(this,Un).promise}if(t&&this.setOptions(t),!this.options.queryFn){const D=this.observers.find(I=>I.options.queryFn);D&&this.setOptions(D.options)}const a=new AbortController,s=D=>{Object.defineProperty(D,"signal",{enumerable:!0,get:()=>(ke(this,Ys,!0),a.signal)})},o=()=>{const D=Jj(this.options,n),R=(()=>{const B={client:F(this,Ks),queryKey:this.queryKey,meta:this.meta};return s(B),B})();return ke(this,Ys,!1),this.options.persister?this.options.persister(D,R,this):D(R)},f=(()=>{const D={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:F(this,Ks),state:this.state,fetchFn:o};return s(D),D})();(h=this.options.behavior)==null||h.onFetch(f,this),ke(this,fo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=f.fetchOptions)==null?void 0:p.meta))&&Ke(this,qr,ii).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),ke(this,Un,tC({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:D=>{D instanceof Wg&&D.revert&&this.setState({...F(this,fo),fetchStatus:"idle"}),a.abort()},onFail:(D,I)=>{Ke(this,qr,ii).call(this,{type:"failed",failureCount:D,error:I})},onPause:()=>{Ke(this,qr,ii).call(this,{type:"pause"})},onContinue:()=>{Ke(this,qr,ii).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const D=await F(this,Un).start();if(D===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(D),(x=(w=F(this,sa).config).onSuccess)==null||x.call(w,D,this),(j=(k=F(this,sa).config).onSettled)==null||j.call(k,D,this.state.error,this),D}catch(D){if(D instanceof Wg){if(D.silent)return F(this,Un).promise;if(D.revert){if(this.state.data===void 0)throw D;return this.state.data}}throw Ke(this,qr,ii).call(this,{type:"error",error:D}),(E=(C=F(this,sa).config).onError)==null||E.call(C,D,this),(O=(T=F(this,sa).config).onSettled)==null||O.call(T,this.state.data,D,this),D}finally{this.scheduleGc()}}},Qs=new WeakMap,fo=new WeakMap,sa=new WeakMap,Ks=new WeakMap,Un=new WeakMap,kc=new WeakMap,Ys=new WeakMap,qr=new WeakSet,rC=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ii=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,...aC(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...HS(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ke(this,fo,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),fn.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),F(this,sa).notify({query:this,type:"updated",action:t})})},Hj);function aC(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:eC(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function HS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function qS(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 Nr,Ct,jc,cr,Xs,ho,si,ss,Cc,mo,po,Ws,Js,ls,go,Ot,Yu,Jg,ey,ty,ny,ry,ay,iy,iC,qj,pv=(qj=class extends il{constructor(t,n){super();Te(this,Ot);Te(this,Nr);Te(this,Ct);Te(this,jc);Te(this,cr);Te(this,Xs);Te(this,ho);Te(this,si);Te(this,ss);Te(this,Cc);Te(this,mo);Te(this,po);Te(this,Ws);Te(this,Js);Te(this,ls);Te(this,go,new Set);this.options=n,ke(this,Nr,t),ke(this,ss,null),ke(this,si,Xg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(F(this,Ct).addObserver(this),ZS(F(this,Ct),this.options)?Ke(this,Ot,Yu).call(this):this.updateResult(),Ke(this,Ot,ny).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return sy(F(this,Ct),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return sy(F(this,Ct),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ke(this,Ot,ry).call(this),Ke(this,Ot,ay).call(this),F(this,Ct).removeObserver(this)}setOptions(t){const n=this.options,a=F(this,Ct);if(this.options=F(this,Nr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof oa(this.options.enabled,F(this,Ct))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ke(this,Ot,iy).call(this),F(this,Ct).setOptions(this.options),n._defaulted&&!sc(this.options,n)&&F(this,Nr).getQueryCache().notify({type:"observerOptionsUpdated",query:F(this,Ct),observer:this});const s=this.hasListeners();s&&GS(F(this,Ct),a,this.options,n)&&Ke(this,Ot,Yu).call(this),this.updateResult(),s&&(F(this,Ct)!==a||oa(this.options.enabled,F(this,Ct))!==oa(n.enabled,F(this,Ct))||ms(this.options.staleTime,F(this,Ct))!==ms(n.staleTime,F(this,Ct)))&&Ke(this,Ot,Jg).call(this);const o=Ke(this,Ot,ey).call(this);s&&(F(this,Ct)!==a||oa(this.options.enabled,F(this,Ct))!==oa(n.enabled,F(this,Ct))||o!==F(this,ls))&&Ke(this,Ot,ty).call(this,o)}getOptimisticResult(t){const n=F(this,Nr).getQueryCache().build(F(this,Nr),t),a=this.createResult(n,t);return LR(this,a)&&(ke(this,cr,a),ke(this,ho,this.options),ke(this,Xs,F(this,Ct).state)),a}getCurrentResult(){return F(this,cr)}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&&F(this,si).status==="pending"&&F(this,si).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){F(this,go).add(t)}getCurrentQuery(){return F(this,Ct)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=F(this,Nr).defaultQueryOptions(t),a=F(this,Nr).getQueryCache().build(F(this,Nr),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return Ke(this,Ot,Yu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),F(this,cr)))}createResult(t,n){var ee;const a=F(this,Ct),s=this.options,o=F(this,cr),c=F(this,Xs),f=F(this,ho),h=t!==a?t.state:F(this,jc),{state:p}=t;let g={...p},w=!1,x;if(n._optimisticResults){const z=this.hasListeners(),$=!z&&ZS(t,n),Q=z&&GS(t,a,n,s);($||Q)&&(g={...g,...aC(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:k,errorUpdatedAt:j,status:C}=g;x=g.data;let E=!1;if(n.placeholderData!==void 0&&x===void 0&&C==="pending"){let z;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(z=o.data,E=!0):z=typeof n.placeholderData=="function"?n.placeholderData((ee=F(this,po))==null?void 0:ee.state.data,F(this,po)):n.placeholderData,z!==void 0&&(C="success",x=Yg(o==null?void 0:o.data,z,n),w=!0)}if(n.select&&x!==void 0&&!E)if(o&&x===(c==null?void 0:c.data)&&n.select===F(this,Cc))x=F(this,mo);else try{ke(this,Cc,n.select),x=n.select(x),x=Yg(o==null?void 0:o.data,x,n),ke(this,mo,x),ke(this,ss,null)}catch(z){ke(this,ss,z)}F(this,ss)&&(k=F(this,ss),x=F(this,mo),j=Date.now(),C="error");const T=g.fetchStatus==="fetching",O=C==="pending",D=C==="error",I=O&&T,R=x!==void 0,L={status:C,fetchStatus:g.fetchStatus,isPending:O,isSuccess:C==="success",isError:D,isInitialLoading:I,isLoading:I,data:x,dataUpdatedAt:g.dataUpdatedAt,error:k,errorUpdatedAt:j,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:T,isRefetching:T&&!O,isLoadingError:D&&!R,isPaused:g.fetchStatus==="paused",isPlaceholderData:w,isRefetchError:D&&R,isStale:gv(t,n),refetch:this.refetch,promise:F(this,si),isEnabled:oa(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const z=L.data!==void 0,$=L.status==="error"&&!z,Q=X=>{$?X.reject(L.error):z&&X.resolve(L.data)},ne=()=>{const X=ke(this,si,L.promise=Xg());Q(X)},Y=F(this,si);switch(Y.status){case"pending":t.queryHash===a.queryHash&&Q(Y);break;case"fulfilled":($||L.data!==Y.value)&&ne();break;case"rejected":(!$||L.error!==Y.reason)&&ne();break}}return L}updateResult(){const t=F(this,cr),n=this.createResult(F(this,Ct),this.options);if(ke(this,Xs,F(this,Ct).state),ke(this,ho,this.options),F(this,Xs).data!==void 0&&ke(this,po,F(this,Ct)),sc(n,t))return;ke(this,cr,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!F(this,go).size)return!0;const c=new Set(o??F(this,go));return this.options.throwOnError&&c.add("error"),Object.keys(F(this,cr)).some(f=>{const m=f;return F(this,cr)[m]!==t[m]&&c.has(m)})};Ke(this,Ot,iC).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ke(this,Ot,ny).call(this)}},Nr=new WeakMap,Ct=new WeakMap,jc=new WeakMap,cr=new WeakMap,Xs=new WeakMap,ho=new WeakMap,si=new WeakMap,ss=new WeakMap,Cc=new WeakMap,mo=new WeakMap,po=new WeakMap,Ws=new WeakMap,Js=new WeakMap,ls=new WeakMap,go=new WeakMap,Ot=new WeakSet,Yu=function(t){Ke(this,Ot,iy).call(this);let n=F(this,Ct).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(tr)),n},Jg=function(){Ke(this,Ot,ry).call(this);const t=ms(this.options.staleTime,F(this,Ct));if(lc.isServer()||F(this,cr).isStale||!Qg(t))return;const a=Wj(F(this,cr).dataUpdatedAt,t)+1;ke(this,Ws,qs.setTimeout(()=>{F(this,cr).isStale||this.updateResult()},a))},ey=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(F(this,Ct)):this.options.refetchInterval)??!1},ty=function(t){Ke(this,Ot,ay).call(this),ke(this,ls,t),!(lc.isServer()||oa(this.options.enabled,F(this,Ct))===!1||!Qg(F(this,ls))||F(this,ls)===0)&&ke(this,Js,qs.setInterval(()=>{(this.options.refetchIntervalInBackground||cv.isFocused())&&Ke(this,Ot,Yu).call(this)},F(this,ls)))},ny=function(){Ke(this,Ot,Jg).call(this),Ke(this,Ot,ty).call(this,Ke(this,Ot,ey).call(this))},ry=function(){F(this,Ws)&&(qs.clearTimeout(F(this,Ws)),ke(this,Ws,void 0))},ay=function(){F(this,Js)&&(qs.clearInterval(F(this,Js)),ke(this,Js,void 0))},iy=function(){const t=F(this,Nr).getQueryCache().build(F(this,Nr),this.options);if(t===F(this,Ct))return;const n=F(this,Ct);ke(this,Ct,t),ke(this,jc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},iC=function(t){fn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(F(this,cr))}),F(this,Nr).getQueryCache().notify({query:F(this,Ct),type:"observerResultsUpdated"})})},qj);function IR(e,t){return oa(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ZS(e,t){return IR(e,t)||e.state.data!==void 0&&sy(e,t,t.refetchOnMount)}function sy(e,t,n){if(oa(t.enabled,e)!==!1&&ms(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&gv(e,t)}return!1}function GS(e,t,n,a){return(e!==t||oa(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&gv(e,n)}function gv(e,t){return oa(t.enabled,e)!==!1&&e.isStaleByTime(ms(t.staleTime,e))}function LR(e,t){return!sc(e.getCurrentResult(),t)}function VS(e){return{onFetch:(t,n)=>{var p,g,w,x,k;const a=t.options,s=(w=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:w.direction,o=((x=t.state.data)==null?void 0:x.pages)||[],c=((k=t.state.data)==null?void 0:k.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let j=!1;const C=O=>{AR(O,()=>t.signal,()=>j=!0)},E=Jj(t.options,t.fetchOptions),T=async(O,D,I)=>{if(j)return Promise.reject();if(D==null&&O.pages.length)return Promise.resolve(O);const B=(()=>{const $={client:t.client,queryKey:t.queryKey,pageParam:D,direction:I?"backward":"forward",meta:t.options.meta};return C($),$})(),L=await E(B),{maxPages:ee}=t.options,z=I?TR:_R;return{pages:z(O.pages,L,ee),pageParams:z(O.pageParams,D,ee)}};if(s&&o.length){const O=s==="backward",D=O?PR:QS,I={pages:o,pageParams:c},R=D(a,I);f=await T(I,R,O)}else{const O=e??o.length;do{const D=m===0?c[0]??a.initialPageParam:QS(a,f);if(m>0&&D==null)break;f=await T(f,D),m++}while(m<O)}return f};t.options.persister?t.fetchFn=()=>{var j,C;return(C=(j=t.options).persister)==null?void 0:C.call(j,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function QS(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 PR(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 Ec,Aa,Jn,el,Ra,es,Zj,UR=(Zj=class extends nC{constructor(t){super();Te(this,Ra);Te(this,Ec);Te(this,Aa);Te(this,Jn);Te(this,el);ke(this,Ec,t.client),this.mutationId=t.mutationId,ke(this,Jn,t.mutationCache),ke(this,Aa,[]),this.state=t.state||sC(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){F(this,Aa).includes(t)||(F(this,Aa).push(t),this.clearGcTimeout(),F(this,Jn).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ke(this,Aa,F(this,Aa).filter(n=>n!==t)),this.scheduleGc(),F(this,Jn).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){F(this,Aa).length||(this.state.status==="pending"?this.scheduleGc():F(this,Jn).remove(this))}continue(){var t;return((t=F(this,el))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,f,m,h,p,g,w,x,k,j,C,E,T,O,D,I,R,B;const n=()=>{Ke(this,Ra,es).call(this,{type:"continue"})},a={client:F(this,Ec),meta:this.options.meta,mutationKey:this.options.mutationKey};ke(this,el,tC({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(L,ee)=>{Ke(this,Ra,es).call(this,{type:"failed",failureCount:L,error:ee})},onPause:()=>{Ke(this,Ra,es).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>F(this,Jn).canRun(this)}));const s=this.state.status==="pending",o=!F(this,el).canStart();try{if(s)n();else{Ke(this,Ra,es).call(this,{type:"pending",variables:t,isPaused:o}),F(this,Jn).config.onMutate&&await F(this,Jn).config.onMutate(t,this,a);const ee=await((f=(c=this.options).onMutate)==null?void 0:f.call(c,t,a));ee!==this.state.context&&Ke(this,Ra,es).call(this,{type:"pending",context:ee,variables:t,isPaused:o})}const L=await F(this,el).start();return await((h=(m=F(this,Jn).config).onSuccess)==null?void 0:h.call(m,L,t,this.state.context,this,a)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,L,t,this.state.context,a)),await((x=(w=F(this,Jn).config).onSettled)==null?void 0:x.call(w,L,null,this.state.variables,this.state.context,this,a)),await((j=(k=this.options).onSettled)==null?void 0:j.call(k,L,null,t,this.state.context,a)),Ke(this,Ra,es).call(this,{type:"success",data:L}),L}catch(L){try{await((E=(C=F(this,Jn).config).onError)==null?void 0:E.call(C,L,t,this.state.context,this,a))}catch(ee){Promise.reject(ee)}try{await((O=(T=this.options).onError)==null?void 0:O.call(T,L,t,this.state.context,a))}catch(ee){Promise.reject(ee)}try{await((I=(D=F(this,Jn).config).onSettled)==null?void 0:I.call(D,void 0,L,this.state.variables,this.state.context,this,a))}catch(ee){Promise.reject(ee)}try{await((B=(R=this.options).onSettled)==null?void 0:B.call(R,void 0,L,t,this.state.context,a))}catch(ee){Promise.reject(ee)}throw Ke(this,Ra,es).call(this,{type:"error",error:L}),L}finally{F(this,Jn).runNext(this)}}},Ec=new WeakMap,Aa=new WeakMap,Jn=new WeakMap,el=new WeakMap,Ra=new WeakSet,es=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),fn.batch(()=>{F(this,Aa).forEach(a=>{a.onMutationUpdate(t)}),F(this,Jn).notify({mutation:this,type:"updated",action:t})})},Zj);function sC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var li,xa,Nc,Gj,BR=(Gj=class extends il{constructor(t={}){super();Te(this,li);Te(this,xa);Te(this,Nc);this.config=t,ke(this,li,new Set),ke(this,xa,new Map),ke(this,Nc,0)}build(t,n,a){const s=new UR({client:t,mutationCache:this,mutationId:++cf(this,Nc)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){F(this,li).add(t);const n=df(t);if(typeof n=="string"){const a=F(this,xa).get(n);a?a.push(t):F(this,xa).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(F(this,li).delete(t)){const n=df(t);if(typeof n=="string"){const a=F(this,xa).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&F(this,xa).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=df(t);if(typeof n=="string"){const a=F(this,xa).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=df(t);if(typeof n=="string"){const s=(a=F(this,xa).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(){fn.batch(()=>{F(this,li).forEach(t=>{this.notify({type:"removed",mutation:t})}),F(this,li).clear(),F(this,xa).clear()})}getAll(){return Array.from(F(this,li))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>BS(n,a))}findAll(t={}){return this.getAll().filter(n=>BS(t,n))}notify(t){fn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return fn.batch(()=>Promise.all(t.map(n=>n.continue().catch(tr))))}},li=new WeakMap,xa=new WeakMap,Nc=new WeakMap,Gj);function df(e){var t;return(t=e.options.scope)==null?void 0:t.id}var oi,os,_r,ui,fi,Mf,ly,Vj,FR=(Vj=class extends il{constructor(n,a){super();Te(this,fi);Te(this,oi);Te(this,os);Te(this,_r);Te(this,ui);ke(this,oi,n),this.setOptions(a),this.bindMethods(),Ke(this,fi,Mf).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=F(this,oi).defaultMutationOptions(n),sc(this.options,a)||F(this,oi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:F(this,_r),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&tl(a.mutationKey)!==tl(this.options.mutationKey)?this.reset():((s=F(this,_r))==null?void 0:s.state.status)==="pending"&&F(this,_r).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=F(this,_r))==null||n.removeObserver(this)}onMutationUpdate(n){Ke(this,fi,Mf).call(this),Ke(this,fi,ly).call(this,n)}getCurrentResult(){return F(this,os)}reset(){var n;(n=F(this,_r))==null||n.removeObserver(this),ke(this,_r,void 0),Ke(this,fi,Mf).call(this),Ke(this,fi,ly).call(this)}mutate(n,a){var s;return ke(this,ui,a),(s=F(this,_r))==null||s.removeObserver(this),ke(this,_r,F(this,oi).getMutationCache().build(F(this,oi),this.options)),F(this,_r).addObserver(this),F(this,_r).execute(n)}},oi=new WeakMap,os=new WeakMap,_r=new WeakMap,ui=new WeakMap,fi=new WeakSet,Mf=function(){var a;const n=((a=F(this,_r))==null?void 0:a.state)??sC();ke(this,os,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},ly=function(n){fn.batch(()=>{var a,s,o,c,f,m,h,p;if(F(this,ui)&&this.hasListeners()){const g=F(this,os).variables,w=F(this,os).context,x={client:F(this,oi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=F(this,ui)).onSuccess)==null||s.call(a,n.data,g,w,x)}catch(k){Promise.reject(k)}try{(c=(o=F(this,ui)).onSettled)==null||c.call(o,n.data,null,g,w,x)}catch(k){Promise.reject(k)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=F(this,ui)).onError)==null||m.call(f,n.error,g,w,x)}catch(k){Promise.reject(k)}try{(p=(h=F(this,ui)).onSettled)==null||p.call(h,void 0,n.error,g,w,x)}catch(k){Promise.reject(k)}}}this.listeners.forEach(g=>{g(F(this,os))})})},Vj);function KS(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function $R(e,t,n){const a=e.slice(0);return a[t]=n,a}var yo,Hr,vo,bo,la,us,_c,Tc,Ac,Rc,Xn,oy,uy,cy,dy,fy,Qj,HR=(Qj=class extends il{constructor(t,n,a){super();Te(this,Xn);Te(this,yo);Te(this,Hr);Te(this,vo);Te(this,bo);Te(this,la);Te(this,us);Te(this,_c);Te(this,Tc);Te(this,Ac);Te(this,Rc,[]);ke(this,yo,t),ke(this,bo,a),ke(this,vo,[]),ke(this,la,[]),ke(this,Hr,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&F(this,la).forEach(t=>{t.subscribe(n=>{Ke(this,Xn,dy).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,F(this,la).forEach(t=>{t.destroy()})}setQueries(t,n){ke(this,vo,t),ke(this,bo,n),fn.batch(()=>{const a=F(this,la),s=Ke(this,Xn,cy).call(this,F(this,vo));s.forEach(g=>g.observer.setOptions(g.defaultedQueryOptions));const o=s.map(g=>g.observer),c=o.map(g=>g.getCurrentResult()),f=a.length!==o.length,m=o.some((g,w)=>g!==a[w]),h=f||m,p=h?!0:c.some((g,w)=>{const x=F(this,Hr)[w];return!x||!sc(g,x)});!h&&!p||(h&&(ke(this,Rc,s),ke(this,la,o)),ke(this,Hr,c),this.hasListeners()&&(h&&(KS(a,o).forEach(g=>{g.destroy()}),KS(o,a).forEach(g=>{g.subscribe(w=>{Ke(this,Xn,dy).call(this,g,w)})})),Ke(this,Xn,fy).call(this)))})}getCurrentResult(){return F(this,Hr)}getQueries(){return F(this,la).map(t=>t.getCurrentQuery())}getObservers(){return F(this,la)}getOptimisticResult(t,n){const a=Ke(this,Xn,cy).call(this,t),s=a.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=a.map(c=>c.defaultedQueryOptions.queryHash);return[s,c=>Ke(this,Xn,uy).call(this,c??s,n,o),()=>Ke(this,Xn,oy).call(this,s,a)]}},yo=new WeakMap,Hr=new WeakMap,vo=new WeakMap,bo=new WeakMap,la=new WeakMap,us=new WeakMap,_c=new WeakMap,Tc=new WeakMap,Ac=new WeakMap,Rc=new WeakMap,Xn=new WeakSet,oy=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)})})})},uy=function(t,n,a){if(n){const s=F(this,Ac),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((c,f)=>c!==s[f]));return(!F(this,us)||F(this,Hr)!==F(this,Tc)||o||n!==F(this,_c))&&(ke(this,_c,n),ke(this,Tc,F(this,Hr)),a!==void 0&&ke(this,Ac,a),ke(this,us,fv(F(this,us),n(t)))),F(this,us)}return t},cy=function(t){const n=new Map;F(this,la).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=F(this,yo).defaultQueryOptions(s),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new pv(F(this,yo),o);a.push({defaultedQueryOptions:o,observer:f})}),a},dy=function(t,n){const a=F(this,la).indexOf(t);a!==-1&&(ke(this,Hr,$R(F(this,Hr),a,n)),Ke(this,Xn,fy).call(this))},fy=function(){var t;if(this.hasListeners()){const n=F(this,us),a=Ke(this,Xn,oy).call(this,F(this,Hr),F(this,Rc)),s=Ke(this,Xn,uy).call(this,a,(t=F(this,bo))==null?void 0:t.combine);n!==s&&fn.batch(()=>{this.listeners.forEach(o=>{o(F(this,Hr))})})}},Qj),Oa,Kj,qR=(Kj=class extends il{constructor(t={}){super();Te(this,Oa);this.config=t,ke(this,Oa,new Map)}build(t,n,a){const s=n.queryKey,o=n.queryHash??dv(s,n);let c=this.get(o);return c||(c=new zR({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(c)),c}add(t){F(this,Oa).has(t.queryHash)||(F(this,Oa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=F(this,Oa).get(t.queryHash);n&&(t.destroy(),n===t&&F(this,Oa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){fn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return F(this,Oa).get(t)}getAll(){return[...F(this,Oa).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>US(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>US(t,a)):n}notify(t){fn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Oa=new WeakMap,Kj),dn,cs,ds,xo,wo,fs,So,ko,Yj,ZR=(Yj=class{constructor(e={}){Te(this,dn);Te(this,cs);Te(this,ds);Te(this,xo);Te(this,wo);Te(this,fs);Te(this,So);Te(this,ko);ke(this,dn,e.queryCache||new qR),ke(this,cs,e.mutationCache||new BR),ke(this,ds,e.defaultOptions||{}),ke(this,xo,new Map),ke(this,wo,new Map),ke(this,fs,0)}mount(){cf(this,fs)._++,F(this,fs)===1&&(ke(this,So,cv.subscribe(async e=>{e&&(await this.resumePausedMutations(),F(this,dn).onFocus())})),ke(this,ko,Ff.subscribe(async e=>{e&&(await this.resumePausedMutations(),F(this,dn).onOnline())})))}unmount(){var e,t;cf(this,fs)._--,F(this,fs)===0&&((e=F(this,So))==null||e.call(this),ke(this,So,void 0),(t=F(this,ko))==null||t.call(this),ke(this,ko,void 0))}isFetching(e){return F(this,dn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return F(this,cs).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=F(this,dn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=F(this,dn).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ms(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return F(this,dn).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=F(this,dn).get(a.queryHash),o=s==null?void 0:s.state.data,c=CR(t,o);if(c!==void 0)return F(this,dn).build(this,a).setData(c,{...n,manual:!0})}setQueriesData(e,t,n){return fn.batch(()=>F(this,dn).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=F(this,dn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=F(this,dn);fn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=F(this,dn);return fn.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=fn.batch(()=>F(this,dn).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(tr).catch(tr)}invalidateQueries(e,t={}){return fn.batch(()=>(F(this,dn).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=fn.batch(()=>F(this,dn).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(tr)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(tr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=F(this,dn).build(this,t);return n.isStaleByTime(ms(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(tr).catch(tr)}fetchInfiniteQuery(e){return e.behavior=VS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(tr).catch(tr)}ensureInfiniteQueryData(e){return e.behavior=VS(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ff.isOnline()?F(this,cs).resumePausedMutations():Promise.resolve()}getQueryCache(){return F(this,dn)}getMutationCache(){return F(this,cs)}getDefaultOptions(){return F(this,ds)}setDefaultOptions(e){ke(this,ds,e)}setQueryDefaults(e,t){F(this,xo).set(tl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...F(this,xo).values()],n={};return t.forEach(a=>{ic(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){F(this,wo).set(tl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...F(this,wo).values()],n={};return t.forEach(a=>{ic(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...F(this,ds).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=dv(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===hv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...F(this,ds).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){F(this,dn).clear(),F(this,cs).clear()}},dn=new WeakMap,cs=new WeakMap,ds=new WeakMap,xo=new WeakMap,wo=new WeakMap,fs=new WeakMap,So=new WeakMap,ko=new WeakMap,Yj),lC=b.createContext(void 0),vn=e=>{const t=b.useContext(lC);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},GR=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(lC.Provider,{value:e,children:t})),oC=b.createContext(!1),uC=()=>b.useContext(oC);oC.Provider;function VR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var QR=b.createContext(VR()),cC=()=>b.useContext(QR),dC=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?mv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},fC=e=>{b.useEffect(()=>{e.clearReset()},[e])},hC=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||mv(n,[e.error,a])),mC=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))}},KR=(e,t)=>e.isLoading&&e.isFetching&&!t,hy=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,my=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function YR({queries:e,...t},n){const a=vn(),s=uC(),o=cC(),c=b.useMemo(()=>e.map(j=>{const C=a.defaultQueryOptions(j);return C._optimisticResults=s?"isRestoring":"optimistic",C}),[e,a,s]);c.forEach(j=>{mC(j);const C=a.getQueryCache().get(j.queryHash);dC(j,o,C)}),fC(o);const[f]=b.useState(()=>new HR(a,c,t)),[m,h,p]=f.getOptimisticResult(c,t.combine),g=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(j=>g?f.subscribe(fn.batchCalls(j)):tr,[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),b.useEffect(()=>{f.setQueries(c,t)},[c,t,f]);const x=m.some((j,C)=>hy(c[C],j))?m.flatMap((j,C)=>{const E=c[C];if(E&&hy(E,j)){const T=new pv(a,E);return my(E,T,o)}return[]}):[];if(x.length>0)throw Promise.all(x);const k=m.find((j,C)=>{const E=c[C];return E&&hC({result:j,errorResetBoundary:o,throwOnError:E.throwOnError,query:a.getQueryCache().get(E.queryHash),suspense:E.suspense})});if(k!=null&&k.error)throw k.error;return h(p())}function XR(e,t,n){var w,x,k,j;const a=uC(),s=cC(),o=vn(),c=o.defaultQueryOptions(e);(x=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_beforeQuery)==null||x.call(w,c);const f=o.getQueryCache().get(c.queryHash);c._optimisticResults=a?"isRestoring":"optimistic",mC(c),dC(c,s,f),fC(s);const m=!o.getQueryCache().get(c.queryHash),[h]=b.useState(()=>new t(o,c)),p=h.getOptimisticResult(c),g=!a&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(C=>{const E=g?h.subscribe(fn.batchCalls(C)):tr;return h.updateResult(),E},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),b.useEffect(()=>{h.setOptions(c)},[c,h]),hy(c,p))throw my(c,h,s);if(hC({result:p,errorResetBoundary:s,throwOnError:c.throwOnError,query:f,suspense:c.suspense}))throw p.error;if((j=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||j.call(k,c,p),c.experimental_prefetchInRender&&!lc.isServer()&&KR(p,a)){const C=m?my(c,h,s):f==null?void 0:f.promise;C==null||C.catch(tr).finally(()=>{h.updateResult()})}return c.notifyOnChangeProps?p:h.trackResult(p)}function Xe(e,t){return XR(e,pv)}function pt(e,t){const n=vn(),[a]=b.useState(()=>new FR(n,e));b.useEffect(()=>{a.setOptions(e)},[a,e]);const s=b.useSyncExternalStore(b.useCallback(c=>a.subscribe(fn.batchCalls(c)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=b.useCallback((c,f)=>{a.mutate(c,f).catch(tr)},[a]);if(s.error&&mv(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 YS="popstate";function XS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function WR(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 py("",{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:oc(s)}return eO(t,n,null,e)}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ca(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function JR(){return Math.random().toString(36).substring(2,10)}function WS(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 py(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?To(t):t,state:n,key:t&&t.key||a||JR(),unstable_mask:s}}function oc({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 To(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 eO(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:o=!1}=a,c=s.history,f="POP",m=null,h=p();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function p(){return(c.state||{idx:null}).idx}function g(){f="POP";let C=p(),E=C==null?null:C-h;h=C,m&&m({action:f,location:j.location,delta:E})}function w(C,E){f="PUSH";let T=XS(C)?C:py(j.location,C,E);h=p()+1;let O=WS(T,h),D=j.createHref(T.unstable_mask||T);try{c.pushState(O,"",D)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;s.location.assign(D)}o&&m&&m({action:f,location:j.location,delta:1})}function x(C,E){f="REPLACE";let T=XS(C)?C:py(j.location,C,E);h=p();let O=WS(T,h),D=j.createHref(T.unstable_mask||T);c.replaceState(O,"",D),o&&m&&m({action:f,location:j.location,delta:0})}function k(C){return tO(C)}let j={get action(){return f},get location(){return e(s,c)},listen(C){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(YS,g),m=C,()=>{s.removeEventListener(YS,g),m=null}},createHref(C){return t(s,C)},createURL:k,encodeLocation(C){let E=k(C);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:w,replace:x,go(C){return c.go(C)}};return j}function tO(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Jt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:oc(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function pC(e,t,n="/"){return nO(e,t,n,!1)}function nO(e,t,n,a){let s=typeof t=="string"?To(t):t,o=hi(s.pathname||"/",n);if(o==null)return null;let c=gC(e);rO(c);let f=null;for(let m=0;f==null&&m<c.length;++m){let h=mO(o);f=fO(c[m],h,a)}return f}function gC(e,t=[],n=[],a="",s=!1){let o=(c,f,m=s,h)=>{let p={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:f,route:c};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(a)&&m)return;Jt(p.relativePath.startsWith(a),`Absolute route path "${p.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(a.length)}let g=Da([a,p.relativePath]),w=n.concat(p);c.children&&c.children.length>0&&(Jt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),gC(c.children,t,w,g,m)),!(c.path==null&&!c.index)&&t.push({path:g,score:cO(g,c.index),routesMeta:w})};return e.forEach((c,f)=>{var m;if(c.path===""||!((m=c.path)!=null&&m.includes("?")))o(c,f);else for(let h of yC(c.path))o(c,f,!0,h)}),t}function yC(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=yC(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 rO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:dO(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var aO=/^:[\w-]+$/,iO=3,sO=2,lO=1,oO=10,uO=-2,JS=e=>e==="*";function cO(e,t){let n=e.split("/"),a=n.length;return n.some(JS)&&(a+=uO),t&&(a+=sO),n.filter(s=>!JS(s)).reduce((s,o)=>s+(aO.test(o)?iO:o===""?lO:oO),a)}function dO(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 fO(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,p=o==="/"?t:t.slice(o.length)||"/",g=$f({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},p),w=m.route;if(!g&&h&&n&&!a[a.length-1].route.index&&(g=$f({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!g)return null;Object.assign(s,g.params),c.push({params:s,pathname:Da([o,g.pathname]),pathnameBase:vO(Da([o,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(o=Da([o,g.pathnameBase]))}return c}function $f(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=hO(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:p,isOptional:g},w)=>{if(p==="*"){let k=f[w]||"";c=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const x=f[w];return g&&!x?h[p]=void 0:h[p]=(x||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function hO(e,t=!1,n=!0){ca(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,p)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=p.charAt(h+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 mO(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ca(!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 hi(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 pO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function gO(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?To(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=e1(n.substring(1),"/"):o=e1(n,t)):o=t,{pathname:o,search:bO(a),hash:xO(s)}}function e1(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 Jp(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 yO(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function yv(e){let t=yO(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function uh(e,t,n,a=!1){let s;typeof e=="string"?s=To(e):(s={...e},Jt(!s.pathname||!s.pathname.includes("?"),Jp("?","pathname","search",s)),Jt(!s.pathname||!s.pathname.includes("#"),Jp("#","pathname","hash",s)),Jt(!s.search||!s.search.includes("#"),Jp("#","search","hash",s)));let o=e===""||s.pathname==="",c=o?"/":s.pathname,f;if(c==null)f=n;else{let g=t.length-1;if(!a&&c.startsWith("..")){let w=c.split("/");for(;w[0]==="..";)w.shift(),g-=1;s.pathname=w.join("/")}f=g>=0?t[g]:"/"}let m=gO(s,f),h=c&&c!=="/"&&c.endsWith("/"),p=(o||c===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}var Da=e=>e.join("/").replace(/\/\/+/g,"/"),vO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),bO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,xO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,wO=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 SO(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function kO(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var vC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function bC(e,t){let n=e;if(typeof n!="string"||!pO.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(vC)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=hi(c.pathname,t);c.origin===o.origin&&f!=null?n=f+c.search+c.hash:s=!0}catch{ca(!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 xC=["POST","PUT","PATCH","DELETE"];new Set(xC);var jO=["GET",...xC];new Set(jO);var Ao=b.createContext(null);Ao.displayName="DataRouter";var ch=b.createContext(null);ch.displayName="DataRouterState";var CO=b.createContext(!1),wC=b.createContext({isTransitioning:!1});wC.displayName="ViewTransition";var EO=b.createContext(new Map);EO.displayName="Fetchers";var NO=b.createContext(null);NO.displayName="Await";var Gr=b.createContext(null);Gr.displayName="Navigation";var Oc=b.createContext(null);Oc.displayName="Location";var fa=b.createContext({outlet:null,matches:[],isDataRoute:!1});fa.displayName="Route";var vv=b.createContext(null);vv.displayName="RouteError";var SC="REACT_ROUTER_ERROR",_O="REDIRECT",TO="ROUTE_ERROR_RESPONSE";function AO(e){if(e.startsWith(`${SC}:${_O}:{`))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 RO(e){if(e.startsWith(`${SC}:${TO}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new wO(t.status,t.statusText,t.data)}catch{}}function OO(e,{relative:t}={}){Jt(Ro(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=b.useContext(Gr),{hash:s,pathname:o,search:c}=Mc(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:Da([n,o])),a.createHref({pathname:f,search:c,hash:s})}function Ro(){return b.useContext(Oc)!=null}function Rr(){return Jt(Ro(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Oc).location}var kC="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function jC(e){b.useContext(Gr).static||b.useLayoutEffect(e)}function Dn(){let{isDataRoute:e}=b.useContext(fa);return e?VO():MO()}function MO(){Jt(Ro(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Ao),{basename:t,navigator:n}=b.useContext(Gr),{matches:a}=b.useContext(fa),{pathname:s}=Rr(),o=JSON.stringify(yv(a)),c=b.useRef(!1);return jC(()=>{c.current=!0}),b.useCallback((m,h={})=>{if(ca(c.current,kC),!c.current)return;if(typeof m=="number"){n.go(m);return}let p=uh(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Da([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,o,s,e])}var DO=b.createContext(null);function zO(e){let t=b.useContext(fa).outlet;return b.useMemo(()=>t&&b.createElement(DO.Provider,{value:e},t),[t,e])}function CC(){let{matches:e}=b.useContext(fa),t=e[e.length-1];return t?t.params:{}}function Mc(e,{relative:t}={}){let{matches:n}=b.useContext(fa),{pathname:a}=Rr(),s=JSON.stringify(yv(n));return b.useMemo(()=>uh(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function IO(e,t){return EC(e,t)}function EC(e,t,n){var C;Jt(Ro(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext(Gr),{matches:s}=b.useContext(fa),o=s[s.length-1],c=o?o.params:{},f=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let E=h&&h.path||"";_C(f,!h||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${E}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
|
|
60
|
+
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let p=Rr(),g;if(t){let E=typeof t=="string"?To(t):t;Jt(m==="/"||((C=E.pathname)==null?void 0:C.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 "${E.pathname}" was given in the \`location\` prop.`),g=E}else g=p;let w=g.pathname||"/",x=w;if(m!=="/"){let E=m.replace(/^\//,"").split("/");x="/"+w.replace(/^\//,"").split("/").slice(E.length).join("/")}let k=pC(e,{pathname:x});ca(h||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ca(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 "${g.pathname}${g.search}${g.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=FO(k&&k.map(E=>Object.assign({},E,{params:Object.assign({},c,E.params),pathname:Da([m,a.encodeLocation?a.encodeLocation(E.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?m:Da([m,a.encodeLocation?a.encodeLocation(E.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),s,n);return t&&j?b.createElement(Oc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function LO(){let e=GO(),t=SO(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=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:o},"ErrorBoundary")," or"," ",b.createElement("code",{style:o},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,c)}var PO=b.createElement(LO,null),NC=class extends b.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=RO(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(fa.Provider,{value:this.props.routeContext},b.createElement(vv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(UO,{error:e},t):t}};NC.contextType=CO;var eg=new WeakMap;function UO({children:e,error:t}){let{basename:n}=b.useContext(Gr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=AO(t.digest);if(a){let s=eg.get(t);if(s)throw s;let o=bC(a.location,n);if(vC&&!eg.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 eg.set(t,c),c}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function BO({routeContext:e,match:t,children:n}){let a=b.useContext(Ao);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(fa.Provider,{value:e},n)}function FO(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 p=s.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Jt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let c=!1,f=-1;if(n&&a){c=a.renderFallback;for(let p=0;p<s.length;p++){let g=s[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=p),g.route.id){let{loaderData:w,errors:x}=a,k=g.route.loader&&!w.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.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?(p,g)=>{var w,x;m(p,{location:a.location,params:((x=(w=a.matches)==null?void 0:w[0])==null?void 0:x.params)??{},unstable_pattern:kO(a.matches),errorInfo:g})}:void 0;return s.reduceRight((p,g,w)=>{let x,k=!1,j=null,C=null;a&&(x=o&&g.route.id?o[g.route.id]:void 0,j=g.route.errorElement||PO,c&&(f<0&&w===0?(_C("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,C=null):f===w&&(k=!0,C=g.route.hydrateFallbackElement||null)));let E=t.concat(s.slice(0,w+1)),T=()=>{let O;return x?O=j:k?O=C:g.route.Component?O=b.createElement(g.route.Component,null):g.route.element?O=g.route.element:O=p,b.createElement(BO,{match:g,routeContext:{outlet:p,matches:E,isDataRoute:a!=null},children:O})};return a&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?b.createElement(NC,{location:a.location,revalidation:a.revalidation,component:j,error:x,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:h}):T()},null)}function bv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $O(e){let t=b.useContext(Ao);return Jt(t,bv(e)),t}function HO(e){let t=b.useContext(ch);return Jt(t,bv(e)),t}function qO(e){let t=b.useContext(fa);return Jt(t,bv(e)),t}function xv(e){let t=qO(e),n=t.matches[t.matches.length-1];return Jt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ZO(){return xv("useRouteId")}function GO(){var a;let e=b.useContext(vv),t=HO("useRouteError"),n=xv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function VO(){let{router:e}=$O("useNavigate"),t=xv("useNavigate"),n=b.useRef(!1);return jC(()=>{n.current=!0}),b.useCallback(async(s,o={})=>{ca(n.current,kC),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var t1={};function _C(e,t,n){!t&&!t1[e]&&(t1[e]=!0,ca(!1,n))}b.memo(QO);function QO({routes:e,future:t,state:n,isStatic:a,onError:s}){return EC(e,void 0,{state:n,isStatic:a,onError:s})}function er({to:e,replace:t,state:n,relative:a}){Jt(Ro(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(Gr);ca(!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}=b.useContext(fa),{pathname:c}=Rr(),f=Dn(),m=uh(e,yv(o),c,a==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:t,state:n,relative:a})},[f,h,a,t,n]),null}function Hf(e){return zO(e.context)}function $t(e){Jt(!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 KO({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:o=!1,unstable_useTransitions:c}){Jt(!Ro(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=b.useMemo(()=>({basename:f,navigator:s,static:o,unstable_useTransitions:c,future:{}}),[f,s,o,c]);typeof n=="string"&&(n=To(n));let{pathname:h="/",search:p="",hash:g="",state:w=null,key:x="default",unstable_mask:k}=n,j=b.useMemo(()=>{let C=hi(h,f);return C==null?null:{location:{pathname:C,search:p,hash:g,state:w,key:x,unstable_mask:k},navigationType:a}},[f,h,p,g,w,x,a,k]);return ca(j!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:b.createElement(Gr.Provider,{value:m},b.createElement(Oc.Provider,{children:t,value:j}))}function YO({children:e,location:t}){return IO(gy(e),t)}function gy(e,t=[]){let n=[];return b.Children.forEach(e,(a,s)=>{if(!b.isValidElement(a))return;let o=[...t,s];if(a.type===b.Fragment){n.push.apply(n,gy(a.props.children,o));return}Jt(a.type===$t,`[${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>`),Jt(!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=gy(a.props.children,o)),n.push(c)}),n}var Df="get",zf="application/x-www-form-urlencoded";function dh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function XO(e){return dh(e)&&e.tagName.toLowerCase()==="button"}function WO(e){return dh(e)&&e.tagName.toLowerCase()==="form"}function JO(e){return dh(e)&&e.tagName.toLowerCase()==="input"}function eM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tM(e,t){return e.button===0&&(!t||t==="_self")&&!eM(e)}function yy(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 nM(e,t){let n=yy(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var ff=null;function rM(){if(ff===null)try{new FormData(document.createElement("form"),0),ff=!1}catch{ff=!0}return ff}var aM=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function tg(e){return e!=null&&!aM.has(e)?(ca(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zf}"`),null):e}function iM(e,t){let n,a,s,o,c;if(WO(e)){let f=e.getAttribute("action");a=f?hi(f,t):null,n=e.getAttribute("method")||Df,s=tg(e.getAttribute("enctype"))||zf,o=new FormData(e)}else if(XO(e)||JO(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?hi(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||Df,s=tg(e.getAttribute("formenctype"))||tg(f.getAttribute("enctype"))||zf,o=new FormData(f,e),!rM()){let{name:h,type:p,value:g}=e;if(p==="image"){let w=h?`${h}.`:"";o.append(`${w}x`,"0"),o.append(`${w}y`,"0")}else h&&o.append(h,g)}}else{if(dh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Df,a=null,s=zf,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 wv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sM(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&&hi(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function lM(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 oM(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 uM(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let c=await lM(o,n);return c.links?c.links():[]}return[]}));return hM(a.flat(1).filter(oM).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function n1(e,t,n,a,s,o){let c=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,f=(m,h)=>{var p;return n[h].pathname!==m.pathname||((p=n[h].route.path)==null?void 0:p.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 g;let p=a.routes[m.route.id];if(!p||!p.hasLoader)return!1;if(c(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let w=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function cM(e,t,{includeHydrateFallback:n}={}){return dM(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 dM(e){return[...new Set(e)]}function fM(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function hM(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let o=JSON.stringify(fM(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function TC(){let e=b.useContext(Ao);return wv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function mM(){let e=b.useContext(ch);return wv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Sv=b.createContext(void 0);Sv.displayName="FrameworkContext";function AC(){let e=b.useContext(Sv);return wv(e,"You must render this element inside a <HydratedRouter> element"),e}function pM(e,t){let n=b.useContext(Sv),[a,s]=b.useState(!1),[o,c]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,w=b.useRef(null);b.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=E=>{E.forEach(T=>{c(T.isIntersecting)})},C=new IntersectionObserver(j,{threshold:.5});return w.current&&C.observe(w.current),()=>{C.disconnect()}}},[e]),b.useEffect(()=>{if(a){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[a]);let x=()=>{s(!0)},k=()=>{s(!1),c(!1)};return n?e!=="intent"?[o,w,{}]:[o,w,{onFocus:Du(f,x),onBlur:Du(m,k),onMouseEnter:Du(h,x),onMouseLeave:Du(p,k),onTouchStart:Du(g,x)}]:[!1,w,{}]}function Du(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function gM({page:e,...t}){let{router:n}=TC(),a=b.useMemo(()=>pC(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?b.createElement(vM,{page:e,matches:a,...t}):null}function yM(e){let{manifest:t,routeModules:n}=AC(),[a,s]=b.useState([]);return b.useEffect(()=>{let o=!1;return uM(e,t,n).then(c=>{o||s(c)}),()=>{o=!0}},[e,t,n]),a}function vM({page:e,matches:t,...n}){let a=Rr(),{future:s,manifest:o,routeModules:c}=AC(),{basename:f}=TC(),{loaderData:m,matches:h}=mM(),p=b.useMemo(()=>n1(e,t,h,o,a,"data"),[e,t,h,o,a]),g=b.useMemo(()=>n1(e,t,h,o,a,"assets"),[e,t,h,o,a]),w=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let j=new Set,C=!1;if(t.forEach(T=>{var D;let O=o.routes[T.route.id];!O||!O.hasLoader||(!p.some(I=>I.route.id===T.route.id)&&T.route.id in m&&((D=c[T.route.id])!=null&&D.shouldRevalidate)||O.hasClientLoader?C=!0:j.add(T.route.id))}),j.size===0)return[];let E=sM(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return C&&j.size>0&&E.searchParams.set("_routes",t.filter(T=>j.has(T.route.id)).map(T=>T.route.id).join(",")),[E.pathname+E.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,o,p,t,e,c]),x=b.useMemo(()=>cM(g,o),[g,o]),k=yM(g);return b.createElement(b.Fragment,null,w.map(j=>b.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),x.map(j=>b.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:C})=>b.createElement("link",{key:j,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function bM(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var xM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{xM&&(window.__reactRouterVersion="7.13.1")}catch{}function wM({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=b.useRef();s.current==null&&(s.current=WR({window:a,v5Compat:!0}));let o=s.current,[c,f]=b.useState({action:o.action,location:o.location}),m=b.useCallback(h=>{n===!1?f(h):b.startTransition(()=>f(h))},[n]);return b.useLayoutEffect(()=>o.listen(m),[o,m]),b.createElement(KO,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,unstable_useTransitions:n})}var RC=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dc=b.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:o,replace:c,unstable_mask:f,state:m,target:h,to:p,preventScrollReset:g,viewTransition:w,unstable_defaultShouldRevalidate:x,...k},j){let{basename:C,navigator:E,unstable_useTransitions:T}=b.useContext(Gr),O=typeof p=="string"&&RC.test(p),D=bC(p,C);p=D.to;let I=OO(p,{relative:s}),R=Rr(),B=null;if(f){let X=uh(f,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);C!=="/"&&(X.pathname=X.pathname==="/"?C:Da([C,X.pathname])),B=E.createHref(X)}let[L,ee,z]=pM(a,k),$=jM(p,{replace:c,unstable_mask:f,state:m,target:h,preventScrollReset:g,relative:s,viewTransition:w,unstable_defaultShouldRevalidate:x,unstable_useTransitions:T});function Q(X){t&&t(X),X.defaultPrevented||$(X)}let ne=!(D.isExternal||o),Y=b.createElement("a",{...k,...z,href:(ne?B:void 0)||D.absoluteURL||I,onClick:ne?Q:t,ref:bM(j,ee),target:h,"data-discover":!O&&n==="render"?"true":void 0});return L&&!O?b.createElement(b.Fragment,null,Y,b.createElement(gM,{page:I})):Y});Dc.displayName="Link";var kv=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:o,to:c,viewTransition:f,children:m,...h},p){let g=Mc(c,{relative:h.relative}),w=Rr(),x=b.useContext(ch),{navigator:k,basename:j}=b.useContext(Gr),C=x!=null&&TM(g)&&f===!0,E=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,T=w.pathname,O=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(T=T.toLowerCase(),O=O?O.toLowerCase():null,E=E.toLowerCase()),O&&j&&(O=hi(O,j)||O);const D=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let I=T===E||!s&&T.startsWith(E)&&T.charAt(D)==="/",R=O!=null&&(O===E||!s&&O.startsWith(E)&&O.charAt(E.length)==="/"),B={isActive:I,isPending:R,isTransitioning:C},L=I?t:void 0,ee;typeof a=="function"?ee=a(B):ee=[a,I?"active":null,R?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let z=typeof o=="function"?o(B):o;return b.createElement(Dc,{...h,"aria-current":L,className:ee,ref:p,style:z,to:c,viewTransition:f},typeof m=="function"?m(B):m)});kv.displayName="NavLink";var SM=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:o,method:c=Df,action:f,onSubmit:m,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:w,...x},k)=>{let{unstable_useTransitions:j}=b.useContext(Gr),C=NM(),E=_M(f,{relative:h}),T=c.toLowerCase()==="get"?"get":"post",O=typeof f=="string"&&RC.test(f),D=I=>{if(m&&m(I),I.defaultPrevented)return;I.preventDefault();let R=I.nativeEvent.submitter,B=(R==null?void 0:R.getAttribute("formmethod"))||c,L=()=>C(R||I.currentTarget,{fetcherKey:t,method:B,navigate:n,replace:s,state:o,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:w});j&&n!==!1?b.startTransition(()=>L()):L()};return b.createElement("form",{ref:k,method:T,action:E,onSubmit:a?m:D,...x,"data-discover":!O&&e==="render"?"true":void 0})});SM.displayName="Form";function kM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function OC(e){let t=b.useContext(Ao);return Jt(t,kM(e)),t}function jM(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let p=Dn(),g=Rr(),w=Mc(e,{relative:c});return b.useCallback(x=>{if(tM(x,t)){x.preventDefault();let k=n!==void 0?n:oc(g)===oc(w),j=()=>p(e,{replace:k,unstable_mask:a,state:s,preventScrollReset:o,relative:c,viewTransition:f,unstable_defaultShouldRevalidate:m});h?b.startTransition(()=>j()):j()}},[g,p,w,n,a,s,t,e,o,c,f,m,h])}function Oo(e){ca(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=b.useRef(yy(e)),n=b.useRef(!1),a=Rr(),s=b.useMemo(()=>nM(a.search,n.current?null:t.current),[a.search]),o=Dn(),c=b.useCallback((f,m)=>{const h=yy(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,o("?"+h,m)},[o,s]);return[s,c]}var CM=0,EM=()=>`__${String(++CM)}__`;function NM(){let{router:e}=OC("useSubmit"),{basename:t}=b.useContext(Gr),n=ZO(),a=e.fetch,s=e.navigate;return b.useCallback(async(o,c={})=>{let{action:f,method:m,encType:h,formData:p,body:g}=iM(o,t);if(c.navigate===!1){let w=c.fetcherKey||EM();await a(w,n,c.action||f,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:p,body:g,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:p,body:g,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 _M(e,{relative:t}={}){let{basename:n}=b.useContext(Gr),a=b.useContext(fa);Jt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Mc(e||".",{relative:t})},c=Rr();if(e==null){o.search=c.search;let f=new URLSearchParams(o.search),m=f.getAll("index");if(m.some(p=>p==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let p=f.toString();o.search=p?`?${p}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Da([n,o.pathname])),oc(o)}function TM(e,{relative:t}={}){let n=b.useContext(wC);Jt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=OC("useViewTransitionState"),s=Mc(e,{relative:t});if(!n.isTransitioning)return!1;let o=hi(n.currentLocation.pathname,a)||n.currentLocation.pathname,c=hi(n.nextLocation.pathname,a)||n.nextLocation.pathname;return $f(s.pathname,c)!=null||$f(s.pathname,o)!=null}const AM="/api/v1";async function RM(e,t){const n=await fetch(`${AM}/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 MC="/api/v1",jv="first-tree-hub:tokens";let vy=null;function zu(e){vy=e}function hn(e){if(!vy)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(vy)}${e}`}function by(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function zc(){const e=localStorage.getItem(jv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function xy(e){localStorage.setItem(jv,JSON.stringify(e))}function DC(){localStorage.removeItem(jv)}class xs extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let Iu=null;async function OM(){const e=zc();return e!=null&&e.refreshToken?zC(e.refreshToken):null}async function zC(e){return Iu||(Iu=(async()=>{try{const t=await fetch(`${MC}/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 xy(a),a}catch{return null}finally{Iu=null}})(),Iu)}async function Lu(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(`${MC}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=zc();let c=await s(o==null?void 0:o.accessToken);if(c.status===401&&(o!=null&&o.refreshToken)){const f=await zC(o.refreshToken);f&&(c=await s(f.accessToken))}if(!c.ok){c.status===401&&(DC(),window.dispatchEvent(new CustomEvent("auth:logout")));const f=await c.text();let m,h;try{const p=JSON.parse(f);m=p.error??f,Array.isArray(p.details)&&(h=p.details.filter(g=>typeof g=="object"&&g!==null&&Array.isArray(g.path)))}catch{m=f}throw new xs(c.status,m,h)}if(c.status!==204)return await c.json()}const je={get:e=>Lu(e),post:(e,t)=>Lu(e,{method:"POST",body:t}),patch:(e,t)=>Lu(e,{method:"PATCH",body:t}),put:(e,t)=>Lu(e,{method:"PUT",body:t}),delete:e=>Lu(e,{method:"DELETE"})};async function mi(e,t){try{await je.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}async function MM(){try{await je.post("/me/onboarding-completed",{})}catch{}}const Cv="onboarding:joinPath",DM="onboarding:draft",wy="onboarding:step1Confirmed";function IC(){return typeof window>"u"?!1:window.sessionStorage.getItem(wy)==="1"}function zM(e){typeof window>"u"||(e?window.sessionStorage.setItem(wy,"1"):window.sessionStorage.removeItem(wy))}const Sy="onboarding:agentUuid";function IM(){return typeof window>"u"?null:window.sessionStorage.getItem(Sy)}function LM(e){typeof window>"u"||(e?window.sessionStorage.setItem(Sy,e):window.sessionStorage.removeItem(Sy))}function LC(e){typeof window>"u"||window.sessionStorage.setItem(Cv,e)}function PM(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(Cv);return e==="solo"||e==="invite"?e:null}function UM(){typeof window>"u"||window.sessionStorage.removeItem(Cv)}function BM(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function Ev(e){return`${DM}:${e}`}function FM(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;if(a!==null&&typeof a!="number")return null;const s="visibility"in e?e.visibility:null,o=s==="private"||s==="organization"?s:null;return{displayName:e.displayName,selectedRuntime:t,connectToken:n,connectTokenExpiresAt:a,visibility:o}}function $M(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(Ev(e));if(!t)return null;try{return FM(JSON.parse(t))}catch{return null}}function HM(e,t){typeof window>"u"||window.sessionStorage.setItem(Ev(e),JSON.stringify(t))}function qM(e){typeof window>"u"||window.sessionStorage.removeItem(Ev(e))}function ZM(){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 PC=b.createContext(null),ky="first-tree-hub:selectedOrganizationId";function GM(){try{return localStorage.getItem(ky)}catch{return null}}function ng(e){try{e===null?localStorage.removeItem(ky):localStorage.setItem(ky,e)}catch{}}function VM({children:e}){const t=vn(),[n,a]=b.useState(()=>!!zc()),[s,o]=b.useState(null),[c,f]=b.useState([]),[m,h]=b.useState(()=>{const Q=GM();return zu(Q),Q}),[p,g]=b.useState(null),[w,x]=b.useState(null),[k,j]=b.useState(null),[C,E]=b.useState(!1),T=b.useCallback(()=>{DC(),ng(null),zu(null),t.clear(),ZM(),a(!1),o(null),f([]),h(null),g(null),x(null),j(null),E(!1)},[t]),O=b.useCallback(async()=>{var Q,ne,Y;try{const X=await je.get("/me");o(X.user??null);const G=X.memberships??[];f(G);const ie=((Q=X.onboarding)==null?void 0:Q.step)??null;g(ie),x(((ne=X.onboarding)==null?void 0:ne.dismissedAt)??null),j(((Y=X.onboarding)==null?void 0:Y.completedAt)??null),ie==="completed"&&UM(),h(J=>{var P;const ve=J&&G.some(U=>U.organizationId===J)?J:null;if(ve)return zu(ve),ve;const M=X.defaultOrganizationId??((P=G[0])==null?void 0:P.organizationId)??null;return ng(M),zu(M),M})}catch{}finally{E(!0)}},[]),D=b.useCallback(async(Q,ne)=>{const Y=await RM(Q,ne);xy({accessToken:Y.accessToken,refreshToken:Y.refreshToken}),a(!0),await O()},[O]),I=b.useCallback(async Q=>{xy(Q),a(!0),await O()},[O]),R=b.useCallback(async Q=>{ng(Q),zu(Q),t.clear(),h(Q),await O()},[O,t]),B=b.useRef(null);b.useEffect(()=>{B.current=w},[w]);const L=b.useCallback(async()=>{const Q=B.current;x(new Date().toISOString());try{const ne=await je.patch("/me/onboarding",{dismissed:!0});ne!=null&&ne.dismissedAt&&x(ne.dismissedAt)}catch{x(Q)}},[]),ee=b.useCallback(async()=>{const Q=B.current;x(null);try{await je.patch("/me/onboarding",{dismissed:!1})}catch{x(Q)}},[]),z=b.useCallback(async()=>{j(Q=>Q??new Date().toISOString()),await MM()},[]);b.useEffect(()=>{n&&!s&&O()},[n,s,O]),b.useEffect(()=>{const Q=()=>T();return window.addEventListener("auth:logout",Q),()=>window.removeEventListener("auth:logout",Q)},[T]);const $=b.useMemo(()=>c.length===0?null:c.find(ne=>ne.organizationId===m)??c[0]??null,[c,m]);return l.jsx(PC.Provider,{value:{isAuthenticated:n,meLoaded:C,user:s,memberships:c,currentMembership:$,organizationId:($==null?void 0:$.organizationId)??null,memberId:($==null?void 0:$.id)??null,role:($==null?void 0:$.role)??null,agentId:($==null?void 0:$.agentId)??null,teamDisplayName:($==null?void 0:$.organizationName)??null,orgHasOtherMembers:($==null?void 0:$.orgHasOtherMembers)??!1,onboardingStep:p,onboardingDismissedAt:w,onboardingCompletedAt:k,dismissOnboarding:L,restoreOnboarding:ee,markOnboardingCompleted:z,login:D,adoptTokens:I,selectOrganization:R,refreshMe:O,logout:T},children:e})}function ct(){const e=b.useContext(PC);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const QM="modulepreload",KM=function(e){return"/"+e},r1={},YM=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};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=KM(h),h in r1)return;r1[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const w=document.createElement("link");if(w.rel=p?"stylesheet":QM,p||(w.as="script"),w.crossOrigin="",w.href=h,m&&w.setAttribute("nonce",m),document.head.appendChild(w),p)return new Promise((x,k)=>{w.addEventListener("load",x),w.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)})},XM=b.lazy(()=>YM(()=>import("./index-B76SVAz8.js"),[]).then(e=>({default:e.LandingPage}))),a1=()=>l.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function WM(){const{isAuthenticated:e,meLoaded:t}=ct(),n=Rr();return e?t?l.jsx(Hf,{}):l.jsx(a1,{}):n.pathname==="/"?l.jsx(b.Suspense,{fallback:l.jsx(a1,{}),children:l.jsx(XM,{})}):l.jsx(er,{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 UC=(...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 JM=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 eD=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 i1=e=>{const t=eD(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 tD={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 nD=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 rD=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:c,...f},m)=>b.createElement("svg",{ref:m,...tD,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:UC("lucide",s),...!o&&!nD(f)&&{"aria-hidden":"true"},...f},[...c.map(([h,p])=>b.createElement(h,p)),...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=b.forwardRef(({className:a,...s},o)=>b.createElement(rD,{ref:o,iconNode:t,className:UC(`lucide-${JM(i1(e))}`,`lucide-${e}`,a),...s}));return n.displayName=i1(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 aD=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Nv=lt("arrow-left",aD);/**
|
|
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 iD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],BC=lt("arrow-right",iD);/**
|
|
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 sD=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],FC=lt("arrow-up",sD);/**
|
|
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 lD=[["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"}]],oD=lt("at-sign",lD);/**
|
|
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 uD=[["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"}]],cD=lt("bell",uD);/**
|
|
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 dD=[["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"}]],$C=lt("bot",dD);/**
|
|
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 fD=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],hD=lt("building-2",fD);/**
|
|
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 mD=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],hr=lt("check",mD);/**
|
|
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 pD=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_v=lt("chevron-down",pD);/**
|
|
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 gD=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],yD=lt("chevron-right",gD);/**
|
|
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 vD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],bD=lt("circle-pause",vD);/**
|
|
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 xD=[["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"}]],HC=lt("copy",xD);/**
|
|
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 wD=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],SD=lt("ellipsis",wD);/**
|
|
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 kD=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Tv=lt("external-link",kD);/**
|
|
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 jD=[["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"}]],CD=lt("eye-off",jD);/**
|
|
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 ED=[["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"}]],qC=lt("eye",ED);/**
|
|
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 ND=[["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"}]],ZC=lt("github",ND);/**
|
|
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 _D=[["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"}]],TD=lt("layout-dashboard",_D);/**
|
|
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 AD=[["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"}]],jy=lt("link-2",AD);/**
|
|
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 RD=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],qf=lt("loader-circle",RD);/**
|
|
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 OD=[["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"}]],fh=lt("lock",OD);/**
|
|
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 MD=[["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"}]],DD=lt("log-out",MD);/**
|
|
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 zD=[["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"}]],Av=lt("message-square",zD);/**
|
|
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 ID=[["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"}]],LD=lt("moon",ID);/**
|
|
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 PD=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],UD=lt("network",PD);/**
|
|
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 BD=[["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"}]],FD=lt("paperclip",BD);/**
|
|
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 $D=[["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"}]],hh=lt("pencil",$D);/**
|
|
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 HD=[["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"}]],GC=lt("play",HD);/**
|
|
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 qD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sa=lt("plus",qD);/**
|
|
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 ZD=[["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"}]],GD=lt("refresh-cw",ZD);/**
|
|
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 VD=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Rv=lt("search",VD);/**
|
|
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 QD=[["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"}]],KD=lt("sun",QD);/**
|
|
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 YD=[["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"}]],Zf=lt("trash-2",YD);/**
|
|
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 XD=[["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"}]],Ic=lt("triangle-alert",XD);/**
|
|
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 WD=[["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"}]],JD=lt("undo-2",WD);/**
|
|
276
|
+
* @license lucide-react v0.577.0 - ISC
|
|
277
|
+
*
|
|
278
|
+
* This source code is licensed under the ISC license.
|
|
279
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
+
*/const e3=[["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"}]],VC=lt("user-plus",e3);/**
|
|
281
|
+
* @license lucide-react v0.577.0 - ISC
|
|
282
|
+
*
|
|
283
|
+
* This source code is licensed under the ISC license.
|
|
284
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
+
*/const t3=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Ov=lt("user",t3);/**
|
|
286
|
+
* @license lucide-react v0.577.0 - ISC
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the ISC license.
|
|
289
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/const n3=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],QC=lt("users",n3);/**
|
|
291
|
+
* @license lucide-react v0.577.0 - ISC
|
|
292
|
+
*
|
|
293
|
+
* This source code is licensed under the ISC license.
|
|
294
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
+
*/const r3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],pi=lt("x",r3);/**
|
|
296
|
+
* @license lucide-react v0.577.0 - ISC
|
|
297
|
+
*
|
|
298
|
+
* This source code is licensed under the ISC license.
|
|
299
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
+
*/const a3=[["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"}]],i3=lt("zap",a3);function KC(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=KC(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function YC(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=KC(e))&&(a&&(a+=" "),a+=t);return a}const s3=(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},l3=(e,t)=>({classGroupId:e,validator:t}),XC=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Gf="-",s1=[],o3="arbitrary..",u3=e=>{const t=d3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return c3(c);const f=c.split(Gf),m=f[0]===""&&f.length>1?1:0;return WC(f,m,t)},getConflictingClassGroupIds:(c,f)=>{if(f){const m=a[c],h=n[c];return m?h?s3(h,m):m:h||s1}return n[c]||s1}}},WC=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=WC(e,t+1,o);if(h)return h}const c=n.validators;if(c===null)return;const f=t===0?e.join(Gf):e.slice(t).join(Gf),m=c.length;for(let h=0;h<m;h++){const p=c[h];if(p.validator(f))return p.classGroupId}},c3=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?o3+a:void 0})(),d3=e=>{const{theme:t,classGroups:n}=e;return f3(n,t)},f3=(e,t)=>{const n=XC();for(const a in e){const s=e[a];Mv(s,n,a,t)}return n},Mv=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const c=e[o];h3(c,t,n,a)}},h3=(e,t,n,a)=>{if(typeof e=="string"){m3(e,t,n);return}if(typeof e=="function"){p3(e,t,n,a);return}g3(e,t,n,a)},m3=(e,t,n)=>{const a=e===""?t:JC(t,e);a.classGroupId=n},p3=(e,t,n,a)=>{if(y3(e)){Mv(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(l3(n,e))},g3=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let c=0;c<o;c++){const[f,m]=s[c];Mv(m,JC(t,f),n,a)}},JC=(e,t)=>{let n=e;const a=t.split(Gf),s=a.length;for(let o=0;o<s;o++){const c=a[o];let f=n.nextPart.get(c);f||(f=XC(),n.nextPart.set(c,f)),n=f}return n},y3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,v3=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)}}},Cy="!",l1=":",b3=[],o1=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),x3=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const o=[];let c=0,f=0,m=0,h;const p=s.length;for(let j=0;j<p;j++){const C=s[j];if(c===0&&f===0){if(C===l1){o.push(s.slice(m,j)),m=j+1;continue}if(C==="/"){h=j;continue}}C==="["?c++:C==="]"?c--:C==="("?f++:C===")"&&f--}const g=o.length===0?s:s.slice(m);let w=g,x=!1;g.endsWith(Cy)?(w=g.slice(0,-1),x=!0):g.startsWith(Cy)&&(w=g.slice(1),x=!0);const k=h&&h>m?h-m:void 0;return o1(o,x,w,k)};if(t){const s=t+l1,o=a;a=c=>c.startsWith(s)?o(c.slice(s.length)):o1(b3,!1,c,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},w3=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}},S3=e=>({cache:v3(e.cacheSize),parseClassName:x3(e),sortModifiers:w3(e),...u3(e)}),k3=/\s+/,j3=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,c=[],f=e.trim().split(k3);let m="";for(let h=f.length-1;h>=0;h-=1){const p=f[h],{isExternal:g,modifiers:w,hasImportantModifier:x,baseClassName:k,maybePostfixModifierPosition:j}=n(p);if(g){m=p+(m.length>0?" "+m:m);continue}let C=!!j,E=a(C?k.substring(0,j):k);if(!E){if(!C){m=p+(m.length>0?" "+m:m);continue}if(E=a(k),!E){m=p+(m.length>0?" "+m:m);continue}C=!1}const T=w.length===0?"":w.length===1?w[0]:o(w).join(":"),O=x?T+Cy:T,D=O+E;if(c.indexOf(D)>-1)continue;c.push(D);const I=s(E,C);for(let R=0;R<I.length;++R){const B=I[R];c.push(O+B)}m=p+(m.length>0?" "+m:m)}return m},C3=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=eE(n))&&(s&&(s+=" "),s+=a);return s},eE=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=eE(e[a]))&&(n&&(n+=" "),n+=t);return n},E3=(e,...t)=>{let n,a,s,o;const c=m=>{const h=t.reduce((p,g)=>g(p),e());return n=S3(h),a=n.cache.get,s=n.cache.set,o=f,f(m)},f=m=>{const h=a(m);if(h)return h;const p=j3(m,n);return s(m,p),p};return o=c,(...m)=>o(C3(...m))},N3=[],On=e=>{const t=n=>n[e]||N3;return t.isThemeGetter=!0,t},tE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_3=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,T3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,A3=/\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$/,R3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,O3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,M3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xi=e=>_3.test(e),ut=e=>!!e&&!Number.isNaN(Number(e)),Wi=e=>!!e&&Number.isInteger(Number(e)),rg=e=>e.endsWith("%")&&ut(e.slice(0,-1)),ai=e=>T3.test(e),rE=()=>!0,D3=e=>A3.test(e)&&!R3.test(e),Dv=()=>!1,z3=e=>O3.test(e),I3=e=>M3.test(e),L3=e=>!Me(e)&&!De(e),P3=e=>ws(e,sE,Dv),Me=e=>tE.test(e),Fs=e=>ws(e,lE,D3),u1=e=>ws(e,G3,ut),U3=e=>ws(e,uE,rE),B3=e=>ws(e,oE,Dv),c1=e=>ws(e,aE,Dv),F3=e=>ws(e,iE,I3),hf=e=>ws(e,cE,z3),De=e=>nE.test(e),Pu=e=>sl(e,lE),$3=e=>sl(e,oE),d1=e=>sl(e,aE),H3=e=>sl(e,sE),q3=e=>sl(e,iE),mf=e=>sl(e,cE,!0),Z3=e=>sl(e,uE,!0),ws=(e,t,n)=>{const a=tE.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},sl=(e,t,n=!1)=>{const a=nE.exec(e);return a?a[1]?t(a[1]):n:!1},aE=e=>e==="position"||e==="percentage",iE=e=>e==="image"||e==="url",sE=e=>e==="length"||e==="size"||e==="bg-size",lE=e=>e==="length",G3=e=>e==="number",oE=e=>e==="family-name",uE=e=>e==="number"||e==="weight",cE=e=>e==="shadow",V3=()=>{const e=On("color"),t=On("font"),n=On("text"),a=On("font-weight"),s=On("tracking"),o=On("leading"),c=On("breakpoint"),f=On("container"),m=On("spacing"),h=On("radius"),p=On("shadow"),g=On("inset-shadow"),w=On("text-shadow"),x=On("drop-shadow"),k=On("blur"),j=On("perspective"),C=On("aspect"),E=On("ease"),T=On("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...D(),De,Me],R=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto","contain","none"],L=()=>[De,Me,m],ee=()=>[Xi,"full","auto",...L()],z=()=>[Wi,"none","subgrid",De,Me],$=()=>["auto",{span:["full",Wi,De,Me]},Wi,De,Me],Q=()=>[Wi,"auto",De,Me],ne=()=>["auto","min","max","fr",De,Me],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...L()],ie=()=>[Xi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],J=()=>[Xi,"screen","full","dvw","lvw","svw","min","max","fit",...L()],ve=()=>[Xi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],M=()=>[e,De,Me],P=()=>[...D(),d1,c1,{position:[De,Me]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",H3,P3,{size:[De,Me]}],V=()=>[rg,Pu,Fs],Z=()=>["","none","full",h,De,Me],re=()=>["",ut,Pu,Fs],xe=()=>["solid","dashed","dotted","double"],Ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ce=()=>[ut,rg,d1,c1],Ye=()=>["","none",k,De,Me],Be=()=>["none",ut,De,Me],qe=()=>["none",ut,De,Me],We=()=>[ut,De,Me],it=()=>[Xi,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ai],breakpoint:[ai],color:[rE],container:[ai],"drop-shadow":[ai],ease:["in","out","in-out"],font:[L3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ai],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ai],shadow:[ai],spacing:["px",ut],text:[ai],"text-shadow":[ai],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xi,Me,De,C]}],container:["container"],columns:[{columns:[ut,Me,De,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:I()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{"inset-s":ee(),start:ee()}],end:[{"inset-e":ee(),end:ee()}],"inset-bs":[{"inset-bs":ee()}],"inset-be":[{"inset-be":ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[Wi,"auto",De,Me]}],basis:[{basis:[Xi,"full","auto",f,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ut,Xi,"auto","initial","none",Me]}],grow:[{grow:["",ut,De,Me]}],shrink:[{shrink:["",ut,De,Me]}],order:[{order:[Wi,"first","last","none",De,Me]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":Q()}],"col-end":[{"col-end":Q()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":Q()}],"row-end":[{"row-end":Q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ne()}],"auto-rows":[{"auto-rows":ne()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:ie()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...ve()]}],"min-block-size":[{"min-block":["auto",...ve()]}],"max-block-size":[{"max-block":["none",...ve()]}],w:[{w:[f,"screen",...ie()]}],"min-w":[{"min-w":[f,"screen","none",...ie()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[c]},...ie()]}],h:[{h:["screen","lh",...ie()]}],"min-h":[{"min-h":["screen","lh","none",...ie()]}],"max-h":[{"max-h":["screen","lh",...ie()]}],"font-size":[{text:["base",n,Pu,Fs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Z3,U3]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rg,Me]}],"font-family":[{font:[$3,B3,t]}],"font-features":[{"font-features":[Me]}],"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,De,Me]}],"line-clamp":[{"line-clamp":[ut,"none",De,u1]}],leading:[{leading:[o,...L()]}],"list-image":[{"list-image":["none",De,Me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",De,Me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...xe(),"wavy"]}],"text-decoration-thickness":[{decoration:[ut,"from-font","auto",De,Fs]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[ut,"auto",De,Me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",De,Me]}],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",De,Me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Wi,De,Me],radial:["",De,Me],conic:[Wi,De,Me]},q3,F3]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...xe(),"hidden","none"]}],"divide-style":[{divide:[...xe(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...xe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ut,De,Me]}],"outline-w":[{outline:["",ut,Pu,Fs]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",p,mf,hf]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",g,mf,hf]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[ut,Fs]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",w,mf,hf]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[ut,De,Me]}],"mix-blend":[{"mix-blend":[...Ae(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ae()}],"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":[ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ce()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":Ce()}],"mask-image-t-to-pos":[{"mask-t-to":Ce()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":Ce()}],"mask-image-r-to-pos":[{"mask-r-to":Ce()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":Ce()}],"mask-image-b-to-pos":[{"mask-b-to":Ce()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":Ce()}],"mask-image-l-to-pos":[{"mask-l-to":Ce()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":Ce()}],"mask-image-x-to-pos":[{"mask-x-to":Ce()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":Ce()}],"mask-image-y-to-pos":[{"mask-y-to":Ce()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[De,Me]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ce()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":D()}],"mask-image-conic-pos":[{"mask-conic":[ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ce()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",De,Me]}],filter:[{filter:["","none",De,Me]}],blur:[{blur:Ye()}],brightness:[{brightness:[ut,De,Me]}],contrast:[{contrast:[ut,De,Me]}],"drop-shadow":[{"drop-shadow":["","none",x,mf,hf]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",ut,De,Me]}],"hue-rotate":[{"hue-rotate":[ut,De,Me]}],invert:[{invert:["",ut,De,Me]}],saturate:[{saturate:[ut,De,Me]}],sepia:[{sepia:["",ut,De,Me]}],"backdrop-filter":[{"backdrop-filter":["","none",De,Me]}],"backdrop-blur":[{"backdrop-blur":Ye()}],"backdrop-brightness":[{"backdrop-brightness":[ut,De,Me]}],"backdrop-contrast":[{"backdrop-contrast":[ut,De,Me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ut,De,Me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ut,De,Me]}],"backdrop-invert":[{"backdrop-invert":["",ut,De,Me]}],"backdrop-opacity":[{"backdrop-opacity":[ut,De,Me]}],"backdrop-saturate":[{"backdrop-saturate":[ut,De,Me]}],"backdrop-sepia":[{"backdrop-sepia":["",ut,De,Me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",De,Me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ut,"initial",De,Me]}],ease:[{ease:["linear","initial",E,De,Me]}],delay:[{delay:[ut,De,Me]}],animate:[{animate:["none",T,De,Me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,De,Me]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:Be()}],"rotate-x":[{"rotate-x":Be()}],"rotate-y":[{"rotate-y":Be()}],"rotate-z":[{"rotate-z":Be()}],scale:[{scale:qe()}],"scale-x":[{"scale-x":qe()}],"scale-y":[{"scale-y":qe()}],"scale-z":[{"scale-z":qe()}],"scale-3d":["scale-3d"],skew:[{skew:We()}],"skew-x":[{"skew-x":We()}],"skew-y":[{"skew-y":We()}],transform:[{transform:[De,Me,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:it()}],"translate-x":[{"translate-x":it()}],"translate-y":[{"translate-y":it()}],"translate-z":[{"translate-z":it()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",De,Me]}],"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":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"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",De,Me]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[ut,Pu,Fs,u1]}],stroke:[{stroke:["none",...M()]}],"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"]}},Q3=E3(V3);function Oe(...e){return Q3(YC(e))}function uc(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 dE(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function K3(e){return je.delete(`/clients/${encodeURIComponent(e)}`)}function Lc(){return je.get(hn("/activity"))}function gi(){return je.get("/me/clients")}function Y3(){return je.get(hn("/clients"))}function mh(e){return je.get(`/clients/${e}`)}function X3(e){return je.post(`/clients/${e}/disconnect`)}function W3(){return je.post("/me/connect-tokens")}const f1=e=>["agent-sessions",e];function J3(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 ez(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 tz(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function fE(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 je.get(`/agents/${e}/sessions${a?`?${a}`:""}`)}function nz(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 je.get(`/agents/${e}/sessions/${t}/events${s?`?${s}`:""}`)}var h1=1,rz=.9,az=.8,iz=.17,ag=.1,ig=.999,sz=.9999,lz=.99,oz=/[\\\/_+.#"@\[\(\{&]/,uz=/[\\\/_+.#"@\[\(\{&]/g,cz=/[\s-]/,hE=/[\s-]/g;function Ey(e,t,n,a,s,o,c){if(o===t.length)return s===e.length?h1:lz;var f=`${s},${o}`;if(c[f]!==void 0)return c[f];for(var m=a.charAt(o),h=n.indexOf(m,s),p=0,g,w,x,k;h>=0;)g=Ey(e,t,n,a,h+1,o+1,c),g>p&&(h===s?g*=h1:oz.test(e.charAt(h-1))?(g*=az,x=e.slice(s,h-1).match(uz),x&&s>0&&(g*=Math.pow(ig,x.length))):cz.test(e.charAt(h-1))?(g*=rz,k=e.slice(s,h-1).match(hE),k&&s>0&&(g*=Math.pow(ig,k.length))):(g*=iz,s>0&&(g*=Math.pow(ig,h-s))),e.charAt(h)!==t.charAt(o)&&(g*=sz)),(g<ag&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(w=Ey(e,t,n,a,h+1,o+2,c),w*ag>g&&(g=w*ag)),g>p&&(p=g),h=n.indexOf(m,h+1);return c[f]=p,p}function m1(e){return e.toLowerCase().replace(hE," ")}function dz(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ey(e,t,m1(e),m1(t),0,0,{})}function ps(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 p1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gs(...e){return t=>{let n=!1;const a=e.map(s=>{const o=p1(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():p1(e[s],null)}}}}function ll(...e){return b.useCallback(gs(...e),e)}function fz(e,t){const n=b.createContext(t),a=o=>{const{children:c,...f}=o,m=b.useMemo(()=>f,Object.values(f));return l.jsx(n.Provider,{value:m,children:c})};a.displayName=e+"Provider";function s(o){const c=b.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 hz(e,t=[]){let n=[];function a(o,c){const f=b.createContext(c),m=n.length;n=[...n,c];const h=g=>{var E;const{scope:w,children:x,...k}=g,j=((E=w==null?void 0:w[e])==null?void 0:E[m])||f,C=b.useMemo(()=>k,Object.values(k));return l.jsx(j.Provider,{value:C,children:x})};h.displayName=o+"Provider";function p(g,w){var j;const x=((j=w==null?void 0:w[e])==null?void 0:j[m])||f,k=b.useContext(x);if(k)return k;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${o}\``)}return[h,p]}const s=()=>{const o=n.map(c=>b.createContext(c));return function(f){const m=(f==null?void 0:f[e])||o;return b.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return s.scopeName=e,[a,mz(s,...t)]}function mz(...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 g=m(o)[`__scope${h}`];return{...f,...g}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var cc=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},pz=uv[" useId ".trim().toString()]||(()=>{}),gz=0;function ci(e){const[t,n]=b.useState(pz());return cc(()=>{n(a=>a??String(gz++))},[e]),t?`radix-${t}`:""}var yz=uv[" useInsertionEffect ".trim().toString()]||cc;function vz({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,c]=bz({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:s;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const g=p.current;g!==f&&console.warn(`${a} is changing from ${g?"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.`),p.current=f},[f,a])}const h=b.useCallback(p=>{var g;if(f){const w=xz(p)?p(e):p;w!==e&&((g=c.current)==null||g.call(c,w))}else o(p)},[f,e,o,c]);return[m,h]}function bz({defaultProp:e,onChange:t}){const[n,a]=b.useState(e),s=b.useRef(n),o=b.useRef(t);return yz(()=>{o.current=t},[t]),b.useEffect(()=>{var c;s.current!==n&&((c=o.current)==null||c.call(o,n),s.current=n)},[n,s]),[n,a,o]}function xz(e){return typeof e=="function"}var zv=Xj();const wz=oh(zv);function mE(e){const t=Sz(e),n=b.forwardRef((a,s)=>{const{children:o,...c}=a,f=b.Children.toArray(o),m=f.find(jz);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...c,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function Sz(e){const t=b.forwardRef((n,a)=>{const{children:s,...o}=n;if(b.isValidElement(s)){const c=Ez(s),f=Cz(o,s.props);return s.type!==b.Fragment&&(f.ref=a?gs(a,c):c),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kz=Symbol("radix.slottable");function jz(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kz}function Cz(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 Ez(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 Nz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yi=Nz.reduce((e,t)=>{const n=mE(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function _z(e,t){e&&zv.flushSync(()=>e.dispatchEvent(t))}function dc(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function Tz(e,t=globalThis==null?void 0:globalThis.document){const n=dc(e);b.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 Az="DismissableLayer",Ny="dismissableLayer.update",Rz="dismissableLayer.pointerDownOutside",Oz="dismissableLayer.focusOutside",g1,pE=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gE=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:c,onDismiss:f,...m}=e,h=b.useContext(pE),[p,g]=b.useState(null),w=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=b.useState({}),k=ll(t,B=>g(B)),j=Array.from(h.layers),[C]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=j.indexOf(C),T=p?j.indexOf(p):-1,O=h.layersWithOutsidePointerEventsDisabled.size>0,D=T>=E,I=zz(B=>{const L=B.target,ee=[...h.branches].some(z=>z.contains(L));!D||ee||(s==null||s(B),c==null||c(B),B.defaultPrevented||f==null||f())},w),R=Iz(B=>{const L=B.target;[...h.branches].some(z=>z.contains(L))||(o==null||o(B),c==null||c(B),B.defaultPrevented||f==null||f())},w);return Tz(B=>{T===h.layers.size-1&&(a==null||a(B),!B.defaultPrevented&&f&&(B.preventDefault(),f()))},w),b.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(g1=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),y1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=g1)}},[p,w,n,h]),b.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),y1())},[p,h]),b.useEffect(()=>{const B=()=>x({});return document.addEventListener(Ny,B),()=>document.removeEventListener(Ny,B)},[]),l.jsx(yi.div,{...m,ref:k,style:{pointerEvents:O?D?"auto":"none":void 0,...e.style},onFocusCapture:ps(e.onFocusCapture,R.onFocusCapture),onBlurCapture:ps(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:ps(e.onPointerDownCapture,I.onPointerDownCapture)})});gE.displayName=Az;var Mz="DismissableLayerBranch",Dz=b.forwardRef((e,t)=>{const n=b.useContext(pE),a=b.useRef(null),s=ll(t,a);return b.useEffect(()=>{const o=a.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(yi.div,{...e,ref:s})});Dz.displayName=Mz;function zz(e,t=globalThis==null?void 0:globalThis.document){const n=dc(e),a=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const o=f=>{if(f.target&&!a.current){let m=function(){yE(Rz,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 Iz(e,t=globalThis==null?void 0:globalThis.document){const n=dc(e),a=b.useRef(!1);return b.useEffect(()=>{const s=o=>{o.target&&!a.current&&yE(Oz,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 y1(){const e=new CustomEvent(Ny);document.dispatchEvent(e)}function yE(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?_z(s,o):s.dispatchEvent(o)}var sg="focusScope.autoFocusOnMount",lg="focusScope.autoFocusOnUnmount",v1={bubbles:!1,cancelable:!0},Lz="FocusScope",vE=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...c}=e,[f,m]=b.useState(null),h=dc(s),p=dc(o),g=b.useRef(null),w=ll(t,j=>m(j)),x=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(a){let j=function(O){if(x.paused||!f)return;const D=O.target;f.contains(D)?g.current=D:ts(g.current,{select:!0})},C=function(O){if(x.paused||!f)return;const D=O.relatedTarget;D!==null&&(f.contains(D)||ts(g.current,{select:!0}))},E=function(O){if(document.activeElement===document.body)for(const I of O)I.removedNodes.length>0&&ts(f)};document.addEventListener("focusin",j),document.addEventListener("focusout",C);const T=new MutationObserver(E);return f&&T.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",C),T.disconnect()}}},[a,f,x.paused]),b.useEffect(()=>{if(f){x1.add(x);const j=document.activeElement;if(!f.contains(j)){const E=new CustomEvent(sg,v1);f.addEventListener(sg,h),f.dispatchEvent(E),E.defaultPrevented||(Pz(Hz(bE(f)),{select:!0}),document.activeElement===j&&ts(f))}return()=>{f.removeEventListener(sg,h),setTimeout(()=>{const E=new CustomEvent(lg,v1);f.addEventListener(lg,p),f.dispatchEvent(E),E.defaultPrevented||ts(j??document.body,{select:!0}),f.removeEventListener(lg,p),x1.remove(x)},0)}}},[f,h,p,x]);const k=b.useCallback(j=>{if(!n&&!a||x.paused)return;const C=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,E=document.activeElement;if(C&&E){const T=j.currentTarget,[O,D]=Uz(T);O&&D?!j.shiftKey&&E===D?(j.preventDefault(),n&&ts(O,{select:!0})):j.shiftKey&&E===O&&(j.preventDefault(),n&&ts(D,{select:!0})):E===T&&j.preventDefault()}},[n,a,x.paused]);return l.jsx(yi.div,{tabIndex:-1,...c,ref:w,onKeyDown:k})});vE.displayName=Lz;function Pz(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ts(a,{select:t}),document.activeElement!==n)return}function Uz(e){const t=bE(e),n=b1(t,e),a=b1(t.reverse(),e);return[n,a]}function bE(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 b1(e,t){for(const n of e)if(!Bz(n,{upTo:t}))return n}function Bz(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 Fz(e){return e instanceof HTMLInputElement&&"select"in e}function ts(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Fz(e)&&t&&e.select()}}var x1=$z();function $z(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=w1(e,t),e.unshift(t)},remove(t){var n;e=w1(e,t),(n=e[0])==null||n.resume()}}}function w1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function Hz(e){return e.filter(t=>t.tagName!=="A")}var qz="Portal",xE=b.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[s,o]=b.useState(!1);cc(()=>o(!0),[]);const c=n||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return c?wz.createPortal(l.jsx(yi.div,{...a,ref:t}),c):null});xE.displayName=qz;function Zz(e,t){return b.useReducer((n,a)=>t[n][a]??n,e)}var ph=e=>{const{present:t,children:n}=e,a=Gz(t),s=typeof n=="function"?n({present:a.isPresent}):b.Children.only(n),o=ll(a.ref,Vz(s));return typeof n=="function"||a.isPresent?b.cloneElement(s,{ref:o}):null};ph.displayName="Presence";function Gz(e){const[t,n]=b.useState(),a=b.useRef(null),s=b.useRef(e),o=b.useRef("none"),c=e?"mounted":"unmounted",[f,m]=Zz(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=pf(a.current);o.current=f==="mounted"?h:"none"},[f]),cc(()=>{const h=a.current,p=s.current;if(p!==e){const w=o.current,x=pf(h);e?m("MOUNT"):x==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(p&&w!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),cc(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,g=x=>{const j=pf(a.current).includes(CSS.escape(x.animationName));if(x.target===t&&j&&(m("ANIMATION_END"),!s.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},w=x=>{x.target===t&&(o.current=pf(a.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:b.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function pf(e){return(e==null?void 0:e.animationName)||"none"}function Vz(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 og=0;function Qz(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??S1()),document.body.insertAdjacentElement("beforeend",e[1]??S1()),og++,()=>{og===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),og--}},[])}function S1(){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 Ma=function(){return Ma=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},Ma.apply(this,arguments)};function wE(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 Kz(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 If="right-scroll-bar-position",Lf="width-before-scroll-bar",Yz="with-scroll-bars-hidden",Xz="--removed-body-scroll-bar-size";function ug(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Wz(e,t){var n=b.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 Jz=typeof window<"u"?b.useLayoutEffect:b.useEffect,k1=new WeakMap;function eI(e,t){var n=Wz(null,function(a){return e.forEach(function(s){return ug(s,a)})});return Jz(function(){var a=k1.get(n);if(a){var s=new Set(a),o=new Set(e),c=n.current;s.forEach(function(f){o.has(f)||ug(f,null)}),o.forEach(function(f){s.has(f)||ug(f,c)})}k1.set(n,e)},[e]),n}function tI(e){return e}function nI(e,t){t===void 0&&(t=tI);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 p=c;c=[],p.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(p){c.push(p),h()},filter:function(p){return c=c.filter(p),n}}}};return s}function rI(e){e===void 0&&(e={});var t=nI(null);return t.options=Ma({async:!0,ssr:!1},e),t}var SE=function(e){var t=e.sideCar,n=wE(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 b.createElement(a,Ma({},n))};SE.isSideCarExport=!0;function aI(e,t){return e.useMedium(t),SE}var kE=rI(),cg=function(){},gh=b.forwardRef(function(e,t){var n=b.useRef(null),a=b.useState({onScrollCapture:cg,onWheelCapture:cg,onTouchMoveCapture:cg}),s=a[0],o=a[1],c=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,w=e.sideCar,x=e.noRelative,k=e.noIsolation,j=e.inert,C=e.allowPinchZoom,E=e.as,T=E===void 0?"div":E,O=e.gapMode,D=wE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=w,R=eI([n,t]),B=Ma(Ma({},D),s);return b.createElement(b.Fragment,null,p&&b.createElement(I,{sideCar:kE,removeScrollBar:h,shards:g,noRelative:x,noIsolation:k,inert:j,setCallbacks:o,allowPinchZoom:!!C,lockRef:n,gapMode:O}),c?b.cloneElement(b.Children.only(f),Ma(Ma({},B),{ref:R})):b.createElement(T,Ma({},B,{className:m,ref:R}),f))});gh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gh.classNames={fullWidth:Lf,zeroRight:If};var iI=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function sI(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=iI();return t&&e.setAttribute("nonce",t),e}function lI(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function oI(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var uI=function(){var e=0,t=null;return{add:function(n){e==0&&(t=sI())&&(lI(t,n),oI(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},cI=function(){var e=uI();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},jE=function(){var e=cI(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},dI={left:0,top:0,right:0,gap:0},dg=function(e){return parseInt(e||"",10)||0},fI=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[dg(n),dg(a),dg(s)]},hI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return dI;var t=fI(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])}},mI=jE(),ao="data-scroll-locked",pI=function(e,t,n,a){var s=e.left,o=e.top,c=e.right,f=e.gap;return n===void 0&&(n="margin"),`
|
|
301
|
+
.`.concat(Yz,` {
|
|
302
|
+
overflow: hidden `).concat(a,`;
|
|
303
|
+
padding-right: `).concat(f,"px ").concat(a,`;
|
|
304
|
+
}
|
|
305
|
+
body[`).concat(ao,`] {
|
|
306
|
+
overflow: hidden `).concat(a,`;
|
|
307
|
+
overscroll-behavior: contain;
|
|
308
|
+
`).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
|
|
309
|
+
padding-left: `.concat(s,`px;
|
|
310
|
+
padding-top: `).concat(o,`px;
|
|
311
|
+
padding-right: `).concat(c,`px;
|
|
312
|
+
margin-left:0;
|
|
313
|
+
margin-top:0;
|
|
314
|
+
margin-right: `).concat(f,"px ").concat(a,`;
|
|
315
|
+
`),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.`).concat(If,` {
|
|
319
|
+
right: `).concat(f,"px ").concat(a,`;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.`).concat(Lf,` {
|
|
323
|
+
margin-right: `).concat(f,"px ").concat(a,`;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.`).concat(If," .").concat(If,` {
|
|
327
|
+
right: 0 `).concat(a,`;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.`).concat(Lf," .").concat(Lf,` {
|
|
331
|
+
margin-right: 0 `).concat(a,`;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
body[`).concat(ao,`] {
|
|
335
|
+
`).concat(Xz,": ").concat(f,`px;
|
|
336
|
+
}
|
|
337
|
+
`)},j1=function(){var e=parseInt(document.body.getAttribute(ao)||"0",10);return isFinite(e)?e:0},gI=function(){b.useEffect(function(){return document.body.setAttribute(ao,(j1()+1).toString()),function(){var e=j1()-1;e<=0?document.body.removeAttribute(ao):document.body.setAttribute(ao,e.toString())}},[])},yI=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;gI();var o=b.useMemo(function(){return hI(s)},[s]);return b.createElement(mI,{styles:pI(o,!t,s,n?"":"!important")})},_y=!1;if(typeof window<"u")try{var gf=Object.defineProperty({},"passive",{get:function(){return _y=!0,!0}});window.addEventListener("test",gf,gf),window.removeEventListener("test",gf,gf)}catch{_y=!1}var Hl=_y?{passive:!1}:!1,vI=function(e){return e.tagName==="TEXTAREA"},CE=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!vI(e)&&n[t]==="visible")},bI=function(e){return CE(e,"overflowY")},xI=function(e){return CE(e,"overflowX")},C1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=EE(e,a);if(s){var o=NE(e,a),c=o[1],f=o[2];if(c>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},wI=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},SI=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},EE=function(e,t){return e==="v"?bI(t):xI(t)},NE=function(e,t){return e==="v"?wI(t):SI(t)},kI=function(e,t){return e==="h"&&t==="rtl"?-1:1},jI=function(e,t,n,a,s){var o=kI(e,window.getComputedStyle(t).direction),c=o*a,f=n.target,m=t.contains(f),h=!1,p=c>0,g=0,w=0;do{if(!f)break;var x=NE(e,f),k=x[0],j=x[1],C=x[2],E=j-C-o*k;(k||E)&&EE(e,f)&&(g+=E,w+=k);var T=f.parentNode;f=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(p&&Math.abs(g)<1||!p&&Math.abs(w)<1)&&(h=!0),h},yf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},E1=function(e){return[e.deltaX,e.deltaY]},N1=function(e){return e&&"current"in e?e.current:e},CI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},EI=function(e){return`
|
|
338
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
339
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
340
|
+
`)},NI=0,ql=[];function _I(e){var t=b.useRef([]),n=b.useRef([0,0]),a=b.useRef(),s=b.useState(NI++)[0],o=b.useState(jE)[0],c=b.useRef(e);b.useEffect(function(){c.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var j=Kz([e.lockRef.current],(e.shards||[]).map(N1),!0).filter(Boolean);return j.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),j.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=b.useCallback(function(j,C){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var E=yf(j),T=n.current,O="deltaX"in j?j.deltaX:T[0]-E[0],D="deltaY"in j?j.deltaY:T[1]-E[1],I,R=j.target,B=Math.abs(O)>Math.abs(D)?"h":"v";if("touches"in j&&B==="h"&&R.type==="range")return!1;var L=window.getSelection(),ee=L&&L.anchorNode,z=ee?ee===R||ee.contains(R):!1;if(z)return!1;var $=C1(B,R);if(!$)return!0;if($?I=B:(I=B==="v"?"h":"v",$=C1(B,R)),!$)return!1;if(!a.current&&"changedTouches"in j&&(O||D)&&(a.current=I),!I)return!0;var Q=a.current||I;return jI(Q,C,j,Q==="h"?O:D)},[]),m=b.useCallback(function(j){var C=j;if(!(!ql.length||ql[ql.length-1]!==o)){var E="deltaY"in C?E1(C):yf(C),T=t.current.filter(function(I){return I.name===C.type&&(I.target===C.target||C.target===I.shadowParent)&&CI(I.delta,E)})[0];if(T&&T.should){C.cancelable&&C.preventDefault();return}if(!T){var O=(c.current.shards||[]).map(N1).filter(Boolean).filter(function(I){return I.contains(C.target)}),D=O.length>0?f(C,O[0]):!c.current.noIsolation;D&&C.cancelable&&C.preventDefault()}}},[]),h=b.useCallback(function(j,C,E,T){var O={name:j,delta:C,target:E,should:T,shadowParent:TI(E)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(D){return D!==O})},1)},[]),p=b.useCallback(function(j){n.current=yf(j),a.current=void 0},[]),g=b.useCallback(function(j){h(j.type,E1(j),j.target,f(j,e.lockRef.current))},[]),w=b.useCallback(function(j){h(j.type,yf(j),j.target,f(j,e.lockRef.current))},[]);b.useEffect(function(){return ql.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:w}),document.addEventListener("wheel",m,Hl),document.addEventListener("touchmove",m,Hl),document.addEventListener("touchstart",p,Hl),function(){ql=ql.filter(function(j){return j!==o}),document.removeEventListener("wheel",m,Hl),document.removeEventListener("touchmove",m,Hl),document.removeEventListener("touchstart",p,Hl)}},[]);var x=e.removeScrollBar,k=e.inert;return b.createElement(b.Fragment,null,k?b.createElement(o,{styles:EI(s)}):null,x?b.createElement(yI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function TI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const AI=aI(kE,_I);var _E=b.forwardRef(function(e,t){return b.createElement(gh,Ma({},e,{ref:t,sideCar:AI}))});_E.classNames=gh.classNames;var RI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Zl=new WeakMap,vf=new WeakMap,bf={},fg=0,TE=function(e){return e&&(e.host||TE(e.parentNode))},OI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=TE(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})},MI=function(e,t,n,a){var s=OI(t,Array.isArray(e)?e:[e]);bf[n]||(bf[n]=new WeakMap);var o=bf[n],c=[],f=new Set,m=new Set(s),h=function(g){!g||f.has(g)||(f.add(g),h(g.parentNode))};s.forEach(h);var p=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(w){if(f.has(w))p(w);else try{var x=w.getAttribute(a),k=x!==null&&x!=="false",j=(Zl.get(w)||0)+1,C=(o.get(w)||0)+1;Zl.set(w,j),o.set(w,C),c.push(w),j===1&&k&&vf.set(w,!0),C===1&&w.setAttribute(n,"true"),k||w.setAttribute(a,"true")}catch(E){console.error("aria-hidden: cannot operate on ",w,E)}})};return p(t),f.clear(),fg++,function(){c.forEach(function(g){var w=Zl.get(g)-1,x=o.get(g)-1;Zl.set(g,w),o.set(g,x),w||(vf.has(g)||g.removeAttribute(a),vf.delete(g)),x||g.removeAttribute(n)}),fg--,fg||(Zl=new WeakMap,Zl=new WeakMap,vf=new WeakMap,bf={})}},DI=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=RI(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),MI(a,s,n,"aria-hidden")):function(){return null}},yh="Dialog",[AE]=hz(yh),[zI,ka]=AE(yh),RE=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:o,modal:c=!0}=e,f=b.useRef(null),m=b.useRef(null),[h,p]=vz({prop:a,defaultProp:s??!1,onChange:o,caller:yh});return l.jsx(zI,{scope:t,triggerRef:f,contentRef:m,contentId:ci(),titleId:ci(),descriptionId:ci(),open:h,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(g=>!g),[p]),modal:c,children:n})};RE.displayName=yh;var OE="DialogTrigger",II=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(OE,n),o=ll(t,s.triggerRef);return l.jsx(yi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Pv(s.open),...a,ref:o,onClick:ps(e.onClick,s.onOpenToggle)})});II.displayName=OE;var Iv="DialogPortal",[LI,ME]=AE(Iv,{forceMount:void 0}),DE=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=ka(Iv,t);return l.jsx(LI,{scope:t,forceMount:n,children:b.Children.map(a,c=>l.jsx(ph,{present:n||o.open,children:l.jsx(xE,{asChild:!0,container:s,children:c})}))})};DE.displayName=Iv;var Vf="DialogOverlay",zE=b.forwardRef((e,t)=>{const n=ME(Vf,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=ka(Vf,e.__scopeDialog);return o.modal?l.jsx(ph,{present:a||o.open,children:l.jsx(UI,{...s,ref:t})}):null});zE.displayName=Vf;var PI=mE("DialogOverlay.RemoveScroll"),UI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(Vf,n);return l.jsx(_E,{as:PI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(yi.div,{"data-state":Pv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),nl="DialogContent",IE=b.forwardRef((e,t)=>{const n=ME(nl,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=ka(nl,e.__scopeDialog);return l.jsx(ph,{present:a||o.open,children:o.modal?l.jsx(BI,{...s,ref:t}):l.jsx(FI,{...s,ref:t})})});IE.displayName=nl;var BI=b.forwardRef((e,t)=>{const n=ka(nl,e.__scopeDialog),a=b.useRef(null),s=ll(t,n.contentRef,a);return b.useEffect(()=>{const o=a.current;if(o)return DI(o)},[]),l.jsx(LE,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ps(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:ps(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0;(c.button===2||f)&&o.preventDefault()}),onFocusOutside:ps(e.onFocusOutside,o=>o.preventDefault())})}),FI=b.forwardRef((e,t)=>{const n=ka(nl,e.__scopeDialog),a=b.useRef(!1),s=b.useRef(!1);return l.jsx(LE,{...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()}})}),LE=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...c}=e,f=ka(nl,n),m=b.useRef(null),h=ll(t,m);return Qz(),l.jsxs(l.Fragment,{children:[l.jsx(vE,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(gE,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Pv(f.open),...c,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx($I,{titleId:f.titleId}),l.jsx(qI,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Lv="DialogTitle",PE=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(Lv,n);return l.jsx(yi.h2,{id:s.titleId,...a,ref:t})});PE.displayName=Lv;var UE="DialogDescription",BE=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(UE,n);return l.jsx(yi.p,{id:s.descriptionId,...a,ref:t})});BE.displayName=UE;var FE="DialogClose",$E=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(FE,n);return l.jsx(yi.button,{type:"button",...a,ref:t,onClick:ps(e.onClick,()=>s.onOpenChange(!1))})});$E.displayName=FE;function Pv(e){return e?"open":"closed"}var HE="DialogTitleWarning",[IX,qE]=fz(HE,{contentName:nl,titleName:Lv,docsSlug:"dialog"}),$I=({titleId:e})=>{const t=qE(HE),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
341
|
+
|
|
342
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
343
|
+
|
|
344
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},HI="DialogDescriptionWarning",qI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qE(HI).contentName}}.`;return b.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},ZE=RE,GE=DE,VE=zE,QE=IE,ZI=PE,GI=BE,VI=$E,QI=Symbol.for("react.lazy"),Qf=uv[" use ".trim().toString()];function KI(e){return typeof e=="object"&&e!==null&&"then"in e}function KE(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===QI&&"_payload"in e&&KI(e._payload)}function YE(e){const t=XI(e),n=b.forwardRef((a,s)=>{let{children:o,...c}=a;KE(o)&&typeof Qf=="function"&&(o=Qf(o._payload));const f=b.Children.toArray(o),m=f.find(JI);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...c,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...c,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var YI=YE("Slot");function XI(e){const t=b.forwardRef((n,a)=>{let{children:s,...o}=n;if(KE(s)&&typeof Qf=="function"&&(s=Qf(s._payload)),b.isValidElement(s)){const c=t4(s),f=e4(o,s.props);return s.type!==b.Fragment&&(f.ref=a?gs(a,c):c),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WI=Symbol("radix.slottable");function JI(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WI}function e4(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 t4(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 n4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vi=n4.reduce((e,t)=>{const n=YE(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:c,...f}=s,m=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Uu='[cmdk-group=""]',hg='[cmdk-group-items=""]',r4='[cmdk-group-heading=""]',XE='[cmdk-item=""]',_1=`${XE}:not([aria-disabled="true"])`,Ty="cmdk-item-select",Kl="data-value",a4=(e,t,n)=>dz(e,t,n),WE=b.createContext(void 0),Pc=()=>b.useContext(WE),JE=b.createContext(void 0),Uv=()=>b.useContext(JE),eN=b.createContext(void 0),tN=b.forwardRef((e,t)=>{let n=Yl(()=>{var U,_;return{search:"",value:(_=(U=e.value)!=null?U:e.defaultValue)!=null?_:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Yl(()=>new Set),s=Yl(()=>new Map),o=Yl(()=>new Map),c=Yl(()=>new Set),f=nN(e),{label:m,children:h,value:p,onValueChange:g,filter:w,shouldFilter:x,loop:k,disablePointerSelection:j=!1,vimBindings:C=!0,...E}=e,T=ci(),O=ci(),D=ci(),I=b.useRef(null),R=p4();rl(()=>{if(p!==void 0){let U=p.trim();n.current.value=U,B.emit()}},[p]),rl(()=>{R(6,ne)},[]);let B=b.useMemo(()=>({subscribe:U=>(c.current.add(U),()=>c.current.delete(U)),snapshot:()=>n.current,setState:(U,_,V)=>{var Z,re,xe,Ae;if(!Object.is(n.current[U],_)){if(n.current[U]=_,U==="search")Q(),z(),R(1,$);else if(U==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ce=document.getElementById(D);Ce?Ce.focus():(Z=document.getElementById(T))==null||Z.focus()}if(R(7,()=>{var Ce;n.current.selectedItemId=(Ce=Y())==null?void 0:Ce.id,B.emit()}),V||R(5,ne),((re=f.current)==null?void 0:re.value)!==void 0){let Ce=_??"";(Ae=(xe=f.current).onValueChange)==null||Ae.call(xe,Ce);return}}B.emit()}},emit:()=>{c.current.forEach(U=>U())}}),[]),L=b.useMemo(()=>({value:(U,_,V)=>{var Z;_!==((Z=o.current.get(U))==null?void 0:Z.value)&&(o.current.set(U,{value:_,keywords:V}),n.current.filtered.items.set(U,ee(_,V)),R(2,()=>{z(),B.emit()}))},item:(U,_)=>(a.current.add(U),_&&(s.current.has(_)?s.current.get(_).add(U):s.current.set(_,new Set([U]))),R(3,()=>{Q(),z(),n.current.value||$(),B.emit()}),()=>{o.current.delete(U),a.current.delete(U),n.current.filtered.items.delete(U);let V=Y();R(4,()=>{Q(),(V==null?void 0:V.getAttribute("id"))===U&&$(),B.emit()})}),group:U=>(s.current.has(U)||s.current.set(U,new Set),()=>{o.current.delete(U),s.current.delete(U)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:T,inputId:D,labelId:O,listInnerRef:I}),[]);function ee(U,_){var V,Z;let re=(Z=(V=f.current)==null?void 0:V.filter)!=null?Z:a4;return U?re(U,n.current.search,_):0}function z(){if(!n.current.search||f.current.shouldFilter===!1)return;let U=n.current.filtered.items,_=[];n.current.filtered.groups.forEach(Z=>{let re=s.current.get(Z),xe=0;re.forEach(Ae=>{let Ce=U.get(Ae);xe=Math.max(Ce,xe)}),_.push([Z,xe])});let V=I.current;X().sort((Z,re)=>{var xe,Ae;let Ce=Z.getAttribute("id"),Ye=re.getAttribute("id");return((xe=U.get(Ye))!=null?xe:0)-((Ae=U.get(Ce))!=null?Ae:0)}).forEach(Z=>{let re=Z.closest(hg);re?re.appendChild(Z.parentElement===re?Z:Z.closest(`${hg} > *`)):V.appendChild(Z.parentElement===V?Z:Z.closest(`${hg} > *`))}),_.sort((Z,re)=>re[1]-Z[1]).forEach(Z=>{var re;let xe=(re=I.current)==null?void 0:re.querySelector(`${Uu}[${Kl}="${encodeURIComponent(Z[0])}"]`);xe==null||xe.parentElement.appendChild(xe)})}function $(){let U=X().find(V=>V.getAttribute("aria-disabled")!=="true"),_=U==null?void 0:U.getAttribute(Kl);B.setState("value",_||void 0)}function Q(){var U,_,V,Z;if(!n.current.search||f.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let re=0;for(let xe of a.current){let Ae=(_=(U=o.current.get(xe))==null?void 0:U.value)!=null?_:"",Ce=(Z=(V=o.current.get(xe))==null?void 0:V.keywords)!=null?Z:[],Ye=ee(Ae,Ce);n.current.filtered.items.set(xe,Ye),Ye>0&&re++}for(let[xe,Ae]of s.current)for(let Ce of Ae)if(n.current.filtered.items.get(Ce)>0){n.current.filtered.groups.add(xe);break}n.current.filtered.count=re}function ne(){var U,_,V;let Z=Y();Z&&(((U=Z.parentElement)==null?void 0:U.firstChild)===Z&&((V=(_=Z.closest(Uu))==null?void 0:_.querySelector(r4))==null||V.scrollIntoView({block:"nearest"})),Z.scrollIntoView({block:"nearest"}))}function Y(){var U;return(U=I.current)==null?void 0:U.querySelector(`${XE}[aria-selected="true"]`)}function X(){var U;return Array.from(((U=I.current)==null?void 0:U.querySelectorAll(_1))||[])}function G(U){let _=X()[U];_&&B.setState("value",_.getAttribute(Kl))}function ie(U){var _;let V=Y(),Z=X(),re=Z.findIndex(Ae=>Ae===V),xe=Z[re+U];(_=f.current)!=null&&_.loop&&(xe=re+U<0?Z[Z.length-1]:re+U===Z.length?Z[0]:Z[re+U]),xe&&B.setState("value",xe.getAttribute(Kl))}function J(U){let _=Y(),V=_==null?void 0:_.closest(Uu),Z;for(;V&&!Z;)V=U>0?h4(V,Uu):m4(V,Uu),Z=V==null?void 0:V.querySelector(_1);Z?B.setState("value",Z.getAttribute(Kl)):ie(U)}let ve=()=>G(X().length-1),M=U=>{U.preventDefault(),U.metaKey?ve():U.altKey?J(1):ie(1)},P=U=>{U.preventDefault(),U.metaKey?G(0):U.altKey?J(-1):ie(-1)};return b.createElement(vi.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:U=>{var _;(_=E.onKeyDown)==null||_.call(E,U);let V=U.nativeEvent.isComposing||U.keyCode===229;if(!(U.defaultPrevented||V))switch(U.key){case"n":case"j":{C&&U.ctrlKey&&M(U);break}case"ArrowDown":{M(U);break}case"p":case"k":{C&&U.ctrlKey&&P(U);break}case"ArrowUp":{P(U);break}case"Home":{U.preventDefault(),G(0);break}case"End":{U.preventDefault(),ve();break}case"Enter":{U.preventDefault();let Z=Y();if(Z){let re=new Event(Ty);Z.dispatchEvent(re)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:L.inputId,id:L.labelId,style:y4},m),vh(e,U=>b.createElement(JE.Provider,{value:B},b.createElement(WE.Provider,{value:L},U))))}),i4=b.forwardRef((e,t)=>{var n,a;let s=ci(),o=b.useRef(null),c=b.useContext(eN),f=Pc(),m=nN(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:c==null?void 0:c.forceMount;rl(()=>{if(!h)return f.item(s,c==null?void 0:c.id)},[h]);let p=rN(s,o,[e.value,e.children,o],e.keywords),g=Uv(),w=ys(R=>R.value&&R.value===p.current),x=ys(R=>h||f.filter()===!1?!0:R.search?R.filtered.items.get(s)>0:!0);b.useEffect(()=>{let R=o.current;if(!(!R||e.disabled))return R.addEventListener(Ty,k),()=>R.removeEventListener(Ty,k)},[x,e.onSelect,e.disabled]);function k(){var R,B;j(),(B=(R=m.current).onSelect)==null||B.call(R,p.current)}function j(){g.setState("value",p.current,!0)}if(!x)return null;let{disabled:C,value:E,onSelect:T,forceMount:O,keywords:D,...I}=e;return b.createElement(vi.div,{ref:gs(o,t),...I,id:s,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!w,"data-disabled":!!C,"data-selected":!!w,onPointerMove:C||f.getDisablePointerSelection()?void 0:j,onClick:C?void 0:k},e.children)}),s4=b.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,c=ci(),f=b.useRef(null),m=b.useRef(null),h=ci(),p=Pc(),g=ys(x=>s||p.filter()===!1?!0:x.search?x.filtered.groups.has(c):!0);rl(()=>p.group(c),[]),rN(c,f,[e.value,e.heading,m]);let w=b.useMemo(()=>({id:c,forceMount:s}),[s]);return b.createElement(vi.div,{ref:gs(f,t),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&b.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),vh(e,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(eN.Provider,{value:w},x))))}),l4=b.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=b.useRef(null),o=ys(c=>!c.search);return!n&&!o?null:b.createElement(vi.div,{ref:gs(s,t),...a,"cmdk-separator":"",role:"separator"})}),o4=b.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Uv(),c=ys(h=>h.search),f=ys(h=>h.selectedItemId),m=Pc();return b.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),b.createElement(vi.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)}})}),u4=b.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,o=b.useRef(null),c=b.useRef(null),f=ys(h=>h.selectedItemId),m=Pc();return b.useEffect(()=>{if(c.current&&o.current){let h=c.current,p=o.current,g,w=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let x=h.offsetHeight;p.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return w.observe(h),()=>{cancelAnimationFrame(g),w.unobserve(h)}}},[]),b.createElement(vi.div,{ref:gs(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},vh(e,h=>b.createElement("div",{ref:gs(c,m.listInnerRef),"cmdk-list-sizer":""},h)))}),c4=b.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:c,...f}=e;return b.createElement(ZE,{open:n,onOpenChange:a},b.createElement(GE,{container:c},b.createElement(VE,{"cmdk-overlay":"",className:s}),b.createElement(QE,{"aria-label":e.label,"cmdk-dialog":"",className:o},b.createElement(tN,{ref:t,...f}))))}),d4=b.forwardRef((e,t)=>ys(n=>n.filtered.count===0)?b.createElement(vi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),f4=b.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return b.createElement(vi.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},vh(e,c=>b.createElement("div",{"aria-hidden":!0},c)))}),Or=Object.assign(tN,{List:u4,Item:i4,Input:o4,Group:s4,Separator:l4,Dialog:c4,Empty:d4,Loading:f4});function h4(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function m4(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function nN(e){let t=b.useRef(e);return rl(()=>{t.current=e}),t}var rl=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Yl(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function ys(e){let t=Uv(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function rN(e,t,n,a=[]){let s=b.useRef(),o=Pc();return rl(()=>{var c;let f=(()=>{var h;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.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(Kl,f),s.current=f}),s}var p4=()=>{let[e,t]=b.useState(),n=Yl(()=>new Map);return rl(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function g4(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function vh({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(g4(t),{ref:t.ref},n(t.props.children)):n(t)}var y4={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const _n=ZE,v4=GE,aN=b.forwardRef(({className:e,...t},n)=>l.jsx(VE,{ref:n,className:Oe("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}));aN.displayName="DialogOverlay";const bn=b.forwardRef(({className:e,children:t,...n},a)=>l.jsxs(v4,{children:[l.jsx(aN,{}),l.jsxs(QE,{ref:a,className:Oe("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,l.jsxs(VI,{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:[l.jsx(pi,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));bn.displayName="DialogContent";function zn({className:e,...t}){return l.jsx("div",{className:Oe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function ar({className:e,...t}){return l.jsx("div",{className:Oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const Tn=b.forwardRef(({className:e,...t},n)=>l.jsx(ZI,{ref:n,className:Oe("text-subtitle leading-none tracking-tight",e),...t}));Tn.displayName="DialogTitle";const Bv=b.forwardRef(({className:e,...t},n)=>l.jsx(GI,{ref:n,className:Oe("text-body text-muted-foreground",e),...t}));Bv.displayName="DialogDescription";const iN=b.forwardRef(({className:e,...t},n)=>l.jsx(Or,{ref:n,className:Oe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));iN.displayName=Or.displayName;function b4({open:e,onOpenChange:t,children:n}){return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsx(bn,{className:"overflow-hidden p-0 shadow-lg",children:l.jsx(iN,{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 sN=b.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Or.Input,{ref:n,className:Oe("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})]}));sN.displayName=Or.Input.displayName;const lN=b.forwardRef(({className:e,...t},n)=>l.jsx(Or.List,{ref:n,className:Oe("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));lN.displayName=Or.List.displayName;const oN=b.forwardRef((e,t)=>l.jsx(Or.Empty,{ref:t,className:"py-6 text-center text-body",...e}));oN.displayName=Or.Empty.displayName;const Pf=b.forwardRef(({className:e,...t},n)=>l.jsx(Or.Group,{ref:n,className:Oe("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}));Pf.displayName=Or.Group.displayName;const Ay=b.forwardRef(({className:e,...t},n)=>l.jsx(Or.Separator,{ref:n,className:Oe("-mx-1 h-px bg-border",e),...t}));Ay.displayName=Or.Separator.displayName;const Uf=b.forwardRef(({className:e,...t},n)=>l.jsx(Or.Item,{ref:n,className:Oe("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}));Uf.displayName=Or.Item.displayName;function Uc(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 je.get(hn(`/agents${n?`?${n}`:""}`))}function x4(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return je.get(hn(`/agents/all${n?`?${n}`:""}`))}function Fv(){return je.get("/me/managed-agents")}function w4(e){return je.get(`/agents/${encodeURIComponent(e)}`)}function S4(e){return je.post(hn("/agents"),e)}function k4(e){return je.get(hn(`/agents/names/${encodeURIComponent(e)}/availability`))}function Ry(e,t){return je.patch(`/agents/${encodeURIComponent(e)}`,t)}function j4(e,t){return je.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function uN(e){return je.delete(`/agents/${encodeURIComponent(e)}`)}async function C4(e,t){const n=zc(),a={"Content-Type":t.type||"application/octet-stream"};n!=null&&n.accessToken&&(a.Authorization=`Bearer ${n.accessToken}`);const s=await fetch(`/api/v1/agents/${encodeURIComponent(e)}/avatar`,{method:"PUT",headers:a,body:t});if(!s.ok){const o=await s.text();let c=o;try{const f=JSON.parse(o);f.error&&(c=f.error)}catch{}throw new xs(s.status,c)}return await s.json()}function E4(e){return je.delete(`/agents/${encodeURIComponent(e)}/avatar`)}function cN(e){return je.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function dN(e){return je.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function N4(e){return je.post(`/agents/${encodeURIComponent(e)}/test`,{})}function bh(){const{data:e}=Xe({queryKey:["agents","name-map"],queryFn:()=>Uc({limit:100}),staleTime:3e4}),{data:t}=Xe({queryKey:["managed-agents","name-map"],queryFn:Fv,staleTime:3e4});return b.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 $v(){const{data:e}=Xe({queryKey:["agents","name-map"],queryFn:()=>Uc({limit:100}),staleTime:3e4}),{data:t}=Xe({queryKey:["managed-agents","name-map"],queryFn:Fv,staleTime:3e4});return b.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 _4=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function T4({open:e,onOpenChange:t}){const n=Dn(),a=bh(),{data:s}=Xe({queryKey:["activity"],queryFn:Lc,enabled:e,staleTime:3e4}),o=(s==null?void 0:s.agents)??[],f=Xe({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const p of o)try{const g=await fE(p.agentId);for(const w of g)h.push({agentId:p.agentId,session:w})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return l.jsxs(b4,{open:e,onOpenChange:t,children:[l.jsx(sN,{placeholder:"Jump to agent, chat, or page…"}),l.jsxs(lN,{children:[l.jsx(oN,{children:"No results"}),o.length>0&&l.jsx(Pf,{heading:"Agents",children:o.map(h=>{const p=a(h.agentId);return l.jsxs(Uf,{value:`agent ${p} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[l.jsx($C,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:p}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),f.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Ay,{}),l.jsx(Pf,{heading:"Chats",children:f.map(({agentId:h,session:p})=>{const g=a(h);return l.jsxs(Uf,{value:`chat ${g} ${p.chatId}`,onSelect:()=>m(`/?a=${h}&c=${p.chatId}`),children:[l.jsx(Av,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:g}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:p.chatId.slice(0,8)})]},`${h}-${p.chatId}`)})})]}),l.jsx(Ay,{}),l.jsx(Pf,{heading:"Pages",children:_4.map(h=>l.jsxs(Uf,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[l.jsx(TD,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{children:h.label})]},h.path))})]})]})}function A4(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function R4(){var a;const{user:e}=ct(),{data:t}=Xe({queryKey:["clients"],queryFn:gi,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=A4(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const O4=160;function M4(){const e=Dn(),{rows:t,firstHostname:n}=R4();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 l.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:[l.jsx(D4,{}),a?l.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[l.jsx("span",{className:"font-semibold",children:t.length})," computers disconnected"]}):l.jsxs("span",{className:"inline-flex items-center",style:{gap:5,minWidth:0},children:[l.jsx("span",{className:"mono text-label font-medium",style:{maxWidth:O4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"color-mix(in oklch, var(--state-error) 60%, var(--fg))"},children:n??"computer"}),l.jsx("span",{style:{flexShrink:0},children:"disconnected"})]})]})}function D4(){return l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:8,height:8,flexShrink:0,display:"inline-block"},children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-error)"}}),l.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 Bc(e){return l.jsxs("svg",{viewBox:"0 0 9 10",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",shapeRendering:"crispEdges","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"4",y:"0",width:"1",height:"1"}),l.jsx("rect",{x:"3",y:"1",width:"3",height:"1"}),l.jsx("rect",{x:"2",y:"2",width:"5",height:"1"}),l.jsx("rect",{x:"3",y:"3",width:"3",height:"1"}),l.jsx("rect",{x:"2",y:"4",width:"5",height:"1"}),l.jsx("rect",{x:"1",y:"5",width:"7",height:"1"}),l.jsx("rect",{x:"2",y:"6",width:"5",height:"1"}),l.jsx("rect",{x:"1",y:"7",width:"7",height:"1"}),l.jsx("rect",{x:"0",y:"8",width:"9",height:"1"}),l.jsx("rect",{x:"3",y:"9",width:"3",height:"1"})]})}function z4(e){const t=new URLSearchParams;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 je.get(hn(`/notifications${n?`?${n}`:""}`))}function I4(e){return je.post(hn(`/notifications/${e}/read`))}function L4(){return je.post(hn("/notifications/read-all"))}function P4(){return je.get(hn("/notifications/unread-count"))}const U4={agent_error:"Error",agent_blocked:"Blocked",agent_stale:"Stale"};function B4(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function F4({notification:e,onClick:t,clickable:n}){const a=(U4[e.type]??e.type).toString(),s=B4(e.severity),o=n??!0;return l.jsxs("button",{type:"button",onClick:t,className:Oe("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:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:8},children:[l.jsx("span",{className:"mono uppercase text-label",style:{color:e.severity==="high"?"var(--state-error)":"var(--fg-3)"},children:a.replace("_"," ")}),l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)",whiteSpace:"nowrap"},children:uc(e.createdAt)})]}),l.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function $4(){const[e,t]=b.useState(!1),[n,a]=b.useState(null),s=b.useRef(null),o=Dn(),c=vn(),{data:f}=Xe({queryKey:["notifications","bell"],queryFn:()=>z4({limit:8})}),{data:m}=Xe({queryKey:["notifications","unread-count"],queryFn:()=>P4()}),h=(m==null?void 0:m.count)??0,p=h>0,g=b.useCallback(async x=>{x.read||(I4(x.id).catch(()=>{}),c.invalidateQueries({queryKey:["notifications"]})),t(!1),x.chatId?o(`/?c=${x.chatId}`):x.agentId&&o(`/agents/${x.agentId}`)},[o,c]),w=b.useCallback(async()=>{a(null);try{await L4(),await c.invalidateQueries({queryKey:["notifications"]})}catch(x){a(x instanceof Error?x.message:"Failed to mark all as read")}},[c]);return l.jsxs("div",{className:"relative",children:[l.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:[l.jsx(cD,{className:"h-4 w-4"}),p&&l.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&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),l.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:[l.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),p&&l.jsx("button",{type:"button",onClick:w,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&l.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}),l.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?l.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):f.items.map(x=>l.jsx(F4,{notification:x,clickable:!!x.chatId||!!x.agentId,onClick:()=>g(x)},x.id))})]})]})]})}function H4(){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 q4(){const[e,t]=b.useState(H4);return b.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),l.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"?l.jsx(KD,{className:"h-4 w-4"}):l.jsx(LD,{className:"h-4 w-4"})})}function fN(e){var t;return((t=e.trim()[0])==null?void 0:t.toUpperCase())??"?"}const Z4=8,G4="var(--avatar-hue-0)";function V4(e){if(e.length===0)return G4;let t=5381;for(let a=0;a<e.length;a++)t=t*33^e.charCodeAt(a);return`var(--avatar-hue-${Math.abs(t)%Z4})`}function Fc(e,t){return typeof e=="string"&&/^hue-[0-7]$/.test(e)?`var(--avatar-${e})`:V4(t)}function Q4(e){return e<=1?"single":e===2?"n2":e===3?"n3":e===4?"n4":"n5+"}function K4(e){return e<=0?null:e>99?"99+":String(e)}function Y4(e){const t=[];return e.engaged&&t.push("engaged"),e.unread>0&&t.push(`${e.unread} unread`),t.length>0?t.join(", "):null}function X4({title:e,type:t,participants:n,selfAgentId:a,engagedAgentIds:s,unreadCount:o,size:c=36}){const f=t==="direct",m=n.filter(x=>x.agentId!==a),h=m[0],p=m.some(x=>s.includes(x.agentId)),g=Y4({engaged:p,unread:o}),w=g===null?{"aria-hidden":!0}:{role:"img","aria-label":g};return l.jsxs("span",{...w,style:{position:"relative",width:c,height:c,flexShrink:0,display:"inline-block"},children:[f||m.length<=1?l.jsx(W4,{size:c,name:(h==null?void 0:h.displayName)??e,hueSeed:(h==null?void 0:h.agentId)??e,colorToken:(h==null?void 0:h.avatarColorToken)??null,imageUrl:(h==null?void 0:h.avatarImageUrl)??null}):l.jsx(J4,{size:c,peers:m}),p&&l.jsx(t5,{size:c}),o>0&&l.jsx(n5,{count:o})]})}function W4({size:e,name:t,hueSeed:n,colorToken:a,imageUrl:s}){return s?l.jsx("img",{src:s,alt:t,width:e,height:e,style:{width:e,height:e,borderRadius:"50%",objectFit:"cover",display:"block"}}):l.jsx("span",{"aria-hidden":"true",style:{width:e,height:e,borderRadius:"50%",background:Fc(a,n),color:"var(--fg-on-vivid)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:Math.round(e*.42),fontWeight:700,lineHeight:1,letterSpacing:"-0.02em",userSelect:"none"},children:fN(t)})}function J4({size:e,peers:t}){var m,h,p,g,w,x,k,j,C,E,T,O,D,I,R,B,L,ee,z,$,Q,ne,Y,X,G,ie,J,ve,M,P,U,_,V,Z,re,xe;const n=t.length,a=Q4(n),s=Math.round(e*(n===2?.36:.28)),o=Math.round(e*.32),c=Math.round(e*.26),f=a==="n2"?{gridTemplateColumns:"1fr 1fr"}:{gridTemplateColumns:"1fr 1fr",gridTemplateRows:"1fr 1fr"};return l.jsxs("div",{"aria-hidden":"true",style:{width:e,height:e,borderRadius:"50%",overflow:"hidden",display:"grid",gap:"var(--hairline)",background:"var(--bg-raised)",userSelect:"none",...f},children:[a==="n2"&&l.jsxs(l.Fragment,{children:[l.jsx(ia,{name:((m=t[0])==null?void 0:m.displayName)??"?",hueSeed:((h=t[0])==null?void 0:h.agentId)??"0",colorToken:((p=t[0])==null?void 0:p.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((g=t[1])==null?void 0:g.displayName)??"?",hueSeed:((w=t[1])==null?void 0:w.agentId)??"1",colorToken:((x=t[1])==null?void 0:x.avatarColorToken)??null,fontSize:s})]}),a==="n3"&&l.jsxs(l.Fragment,{children:[l.jsx(ia,{name:((k=t[0])==null?void 0:k.displayName)??"?",hueSeed:((j=t[0])==null?void 0:j.agentId)??"0",colorToken:((C=t[0])==null?void 0:C.avatarColorToken)??null,fontSize:o,fullWidth:!0}),l.jsx(ia,{name:((E=t[1])==null?void 0:E.displayName)??"?",hueSeed:((T=t[1])==null?void 0:T.agentId)??"1",colorToken:((O=t[1])==null?void 0:O.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((D=t[2])==null?void 0:D.displayName)??"?",hueSeed:((I=t[2])==null?void 0:I.agentId)??"2",colorToken:((R=t[2])==null?void 0:R.avatarColorToken)??null,fontSize:s})]}),a==="n4"&&l.jsxs(l.Fragment,{children:[l.jsx(ia,{name:((B=t[0])==null?void 0:B.displayName)??"?",hueSeed:((L=t[0])==null?void 0:L.agentId)??"0",colorToken:((ee=t[0])==null?void 0:ee.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((z=t[1])==null?void 0:z.displayName)??"?",hueSeed:(($=t[1])==null?void 0:$.agentId)??"1",colorToken:((Q=t[1])==null?void 0:Q.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((ne=t[2])==null?void 0:ne.displayName)??"?",hueSeed:((Y=t[2])==null?void 0:Y.agentId)??"2",colorToken:((X=t[2])==null?void 0:X.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((G=t[3])==null?void 0:G.displayName)??"?",hueSeed:((ie=t[3])==null?void 0:ie.agentId)??"3",colorToken:((J=t[3])==null?void 0:J.avatarColorToken)??null,fontSize:s})]}),a==="n5+"&&l.jsxs(l.Fragment,{children:[l.jsx(ia,{name:((ve=t[0])==null?void 0:ve.displayName)??"?",hueSeed:((M=t[0])==null?void 0:M.agentId)??"0",colorToken:((P=t[0])==null?void 0:P.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((U=t[1])==null?void 0:U.displayName)??"?",hueSeed:((_=t[1])==null?void 0:_.agentId)??"1",colorToken:((V=t[1])==null?void 0:V.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((Z=t[2])==null?void 0:Z.displayName)??"?",hueSeed:((re=t[2])==null?void 0:re.agentId)??"2",colorToken:((xe=t[2])==null?void 0:xe.avatarColorToken)??null,fontSize:s}),l.jsx(e5,{count:n-3,fontSize:c})]})]})}function ia({name:e,hueSeed:t,colorToken:n,fontSize:a,fullWidth:s}){return l.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",background:Fc(n,t),color:"var(--fg-on-vivid)",fontSize:a,fontWeight:700,lineHeight:1,letterSpacing:"-0.02em",...s?{gridColumn:"1 / -1"}:null},children:fN(e)})}function e5({count:e,fontSize:t}){return l.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-sunken)",color:"var(--fg-3)",fontSize:t,fontWeight:600,lineHeight:1,userSelect:"none"},children:`+${e}`})}function t5({size:e}){return l.jsx("span",{"aria-hidden":"true",className:"chat-row-avatar__working-ring",style:{position:"absolute",inset:-3,width:e+6,height:e+6,borderRadius:"50%",border:"var(--hairline-bold) solid var(--state-working)",pointerEvents:"none",zIndex:1}})}function n5({count:e}){const t=K4(e);return t===null?null:l.jsx("span",{"aria-hidden":"true",style:{position:"absolute",bottom:-3,right:-3,minWidth:"var(--sp-4)",height:"var(--sp-4)",padding:"0 var(--sp-1)",borderRadius:"var(--sp-2)",background:"var(--state-error)",color:"var(--fg-on-vivid)",fontSize:"var(--text-caption)",fontWeight:700,lineHeight:"var(--sp-4)",textAlign:"center",border:"var(--hairline-bold) solid var(--bg-raised)",boxSizing:"content-box",zIndex:3,userSelect:"none"},children:t})}function r5(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function T1({src:e,name:t,size:n=28,className:a,colorToken:s,seed:o}){const c=`${n}px`;if(e)return l.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:c,height:c,borderRadius:"50%",objectFit:"cover",display:"block"}});const f=typeof s=="string"&&s.length>0||o&&o.length>0,m=f?Fc(s,o??""):"var(--accent)",h=f?"var(--fg-on-vivid)":"var(--bg-raised)";return l.jsx("span",{className:a,role:"img","aria-label":t,style:{width:c,height:c,borderRadius:"50%",background:m,color:h,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,userSelect:"none"},children:l.jsx("span",{className:"text-subtitle font-semibold",children:r5(t)})})}const A1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,R1=YC,a5=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return R1(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 p=n==null?void 0:n[h],g=o==null?void 0:o[h];if(p===null)return null;const w=A1(p)||A1(g);return s[h][w]}),f=n&&Object.entries(n).reduce((h,p)=>{let[g,w]=p;return w===void 0||(h[g]=w),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,p)=>{let{class:g,className:w,...x}=p;return Object.entries(x).every(k=>{let[j,C]=k;return Array.isArray(C)?C.includes({...o,...f}[j]):{...o,...f}[j]===C})?[...h,g,w]:h},[]);return R1(e,c,m,n==null?void 0:n.class,n==null?void 0:n.className)},i5=a5("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"}}),be=b.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},o)=>{const c=a?YI:"button";return l.jsx(c,{className:Oe(i5({variant:t,size:n,className:e})),ref:o,...s})});be.displayName="Button";const Kt=b.forwardRef(({className:e,type:t,...n},a)=>l.jsx("input",{type:t,className:Oe("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}));Kt.displayName="Input";function s5({action:e,onClose:t}){const n=e!==null;return l.jsx(_n,{open:n,onOpenChange:a=>!a&&t(),children:l.jsxs(bn,{children:[l.jsxs(zn,{children:[l.jsx(Tn,{children:e==="join"?"Join a team":"Create a new team"}),l.jsx(Bv,{children:e==="join"?"Paste the invite token shared with you.":"You'll be the admin. You can rename or invite teammates afterward."})]}),e==="create"&&l.jsx(o5,{onDone:t}),e==="join"&&l.jsx(u5,{onDone:t})]})})}function l5(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function o5({onDone:e}){const{adoptTokens:t}=ct(),n=Dn(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{p.preventDefault();const g=a.trim();if(g){m(!0),c(null);try{const w=await je.post("/me/organizations",{name:l5(g),displayName:g});await t(w.tokens),e(),n("/",{replace:!0})}catch(w){c(w instanceof Error?w.message:"Failed to create team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Kt,{id:"team-display-name","aria-label":"Team name",value:a,onChange:p=>s(p.target.value),placeholder:"Acme Robotics",autoFocus:!0}),l.jsx(be,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function u5({onDone:e}){const{adoptTokens:t}=ct(),n=Dn(),[a,s]=b.useState(""),[o,c]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),c(null),m(!1)},[]);const h=async p=>{if(p.preventDefault(),!!a.trim()){m(!0),c(null);try{const g=a.trim(),w=/\/invite\/([^/?#]+)/.exec(g),x=(w==null?void 0:w[1])??g,k=await je.post("/me/organizations/join",{token:x});await t(k.tokens),e(),n("/",{replace:!0})}catch(g){c(g instanceof Error?g.message:"Failed to join team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Kt,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:p=>s(p.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),l.jsx(be,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function c5(){var I,R;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=ct(),o=Dn(),[c,f]=b.useState([]),[m,h]=b.useState(!1),[p,g]=b.useState(null),w=b.useRef(null);b.useEffect(()=>{(async()=>{try{const B=await je.get("/me/organizations");f(B)}catch{}})()},[]),b.useEffect(()=>{const B=ee=>{m&&w.current&&!w.current.contains(ee.target)&&h(!1)},L=ee=>{m&&ee.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",B),window.addEventListener("keydown",L),()=>{window.removeEventListener("mousedown",B),window.removeEventListener("keydown",L)}},[m]);const x=(n==null?void 0:n.displayName)??"User",k=(n==null?void 0:n.username)??"",j=(n==null?void 0:n.avatarUrl)??null,C=c.find(B=>B.id===e)??null,E=(C==null?void 0:C.role)??(t==="admin"||t==="member"?t:null),T=async B=>{if(B===e){h(!1);return}try{await a(B),h(!1),o("/",{replace:!0})}catch{}},O=()=>{h(!1),g("create")},D=()=>{h(!1),g("join")};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:w,className:"relative","data-testid":"user-menu",children:[l.jsx("button",{type:"button","aria-label":`User menu, ${x}`,"aria-haspopup":"menu","aria-expanded":m,onClick:()=>h(B=>!B),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:l.jsx(T1,{src:j,name:x,size:28})}),m&&l.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[l.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[l.jsx(T1,{src:j,name:x,size:32}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:x}),k&&k!==x&&l.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",k]})]})]}),c.length>0&&l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Current team"}),c.length===1?l.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:l.jsx(hr,{className:"h-3.5 w-3.5"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:(I=c[0])==null?void 0:I.displayName}),l.jsx(O1,{role:((R=c[0])==null?void 0:R.role)??E})]}):l.jsx("div",{children:c.map(B=>l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void T(B.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:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:B.id===e?l.jsx(hr,{className:"h-3.5 w-3.5"}):null}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:B.displayName}),l.jsx(O1,{role:B.role})]},B.id))})]}),l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.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:[l.jsx(Sa,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Create new team"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:D,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:[l.jsx(VC,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Join with invite link"})]})]}),l.jsx("div",{className:"py-1",children:l.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:[l.jsx(DD,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Sign out"})]})})]})]}),l.jsx(s5,{action:p,onClose:()=>g(null)})]})}function O1({role:e}){return e!=="admin"&&e!=="member"?null:l.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 d5=[{to:"/",label:"Workspace",end:!0},{to:"/context",label:"Context",end:!1},{to:"/team",label:"Team",end:!1},{to:"/settings",label:"Settings",end:!1}];function f5(){const[e,t]=b.useState(!1),n=Rr(),a=n.pathname==="/"||n.search.includes("a=");return l.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[l.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:[l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[l.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[l.jsx(Bc,{width:16,height:18,style:{color:"var(--fg)"}}),l.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),l.jsx(M4,{})]}),l.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:d5.map(s=>l.jsx(kv,{to:s.to,end:s.end,style:{pointerEvents:"auto"},className:({isActive:o})=>Oe("inline-flex items-center transition-colors",o?"":"hover:text-[var(--fg)]"),children:({isActive:o})=>l.jsx("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})},s.to))}),l.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[l.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-3)",minWidth:200,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:[l.jsx(Rv,{className:"h-4 w-4"}),l.jsx("span",{children:"Jump to…"})]}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx($4,{}),l.jsx(q4,{}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(c5,{})]})]}),l.jsx(T4,{open:e,onOpenChange:t}),a?l.jsx(Hf,{}):l.jsx("main",{className:"flex-1 overflow-auto",children:l.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:l.jsx(Hf,{})})})]})}const hN=b.createContext(null),h5=5e3;function m5({children:e}){const[t,n]=b.useState([]),a=b.useCallback(c=>{n(f=>f.filter(m=>m.id!==c))},[]),o={addToast:b.useCallback(c=>{const f=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...c,id:f}])},[])};return l.jsxs(hN.Provider,{value:o,children:[e,l.jsx(p5,{toasts:t,onDismiss:a})]})}function $c(){const e=b.useContext(hN);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function p5({toasts:e,onDismiss:t}){return e.length===0?null:l.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=>l.jsx(g5,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function g5({toast:e,onDismiss:t}){const n=b.useRef(t);return n.current=t,b.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??h5,s=setTimeout(()=>n.current(),a);return()=>clearTimeout(s)},[e.durationMs]),l.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:[l.jsxs("div",{className:"flex-1 min-w-0",style:{display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[l.jsx("p",{className:"text-body font-medium",style:{margin:0,color:"var(--fg)"},children:e.title}),e.description?l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:e.description}):null,e.action?l.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]}),l.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:l.jsx(pi,{className:"h-4 w-4"})})]})}function fe(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,p=Object.keys(h);for(let g=0;g<p.length;g++){const w=p[g];w in f||(f[w]=h[w].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 p of h._zod.deferred)p();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 io extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class mN extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const pN={};function vs(e){return pN}function gN(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 Oy(e,t){return typeof t=="bigint"?t.toString():t}function xh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Hv(e){return e==null}function qv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function y5(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 M1=Symbol("evaluating");function Rt(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==M1)return a===void 0&&(a=M1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function ol(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ss(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function D1(e){return JSON.stringify(e)}function v5(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const yN="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function fc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const b5=xh(()=>{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 jo(e){if(fc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(fc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function vN(e){return jo(e)?{...e}:Array.isArray(e)?[...e]:e}const x5=new Set(["string","number","symbol"]);function Co(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bi(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 Pe(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 w5(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const S5={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 k5(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=Ss(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 ol(this,"shape",c),c},checks:[]});return bi(e,o)}function j5(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=Ss(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 ol(this,"shape",c),c},checks:[]});return bi(e,o)}function C5(e,t){if(!jo(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=Ss(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return ol(this,"shape",o),o}});return bi(e,s)}function E5(e,t){if(!jo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ss(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return ol(this,"shape",a),a}});return bi(e,n)}function N5(e,t){const n=Ss(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return ol(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return bi(e,n)}function _5(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=Ss(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 ol(this,"shape",m),m},checks:[]});return bi(t,c)}function T5(e,t,n){const a=Ss(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 ol(this,"shape",o),o}});return bi(t,a)}function eo(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 to(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function xf(e){return typeof e=="string"?e:e==null?void 0:e.message}function bs(e,t,n){var s,o,c,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const p=xf((c=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:c.call(o,e))??xf((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??xf((m=n.customError)==null?void 0:m.call(n,e))??xf((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=p}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function Zv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function hc(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const bN=(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,Oy,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xN=fe("$ZodError",bN),wN=fe("$ZodError",bN,{Parent:Error});function A5(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 R5(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 Gv=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 io;if(c.issues.length){const f=new((s==null?void 0:s.Err)??e)(c.issues.map(m=>bs(m,o,vs())));throw yN(f,s==null?void 0:s.callee),f}return c.value},Vv=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=>bs(m,o,vs())));throw yN(f,s==null?void 0:s.callee),f}return c.value},wh=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 io;return o.issues.length?{success:!1,error:new(e??xN)(o.issues.map(c=>bs(c,s,vs())))}:{success:!0,data:o.value}},O5=wh(wN),Sh=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=>bs(c,s,vs())))}:{success:!0,data:o.value}},M5=Sh(wN),D5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Gv(e)(t,n,s)},z5=e=>(t,n,a)=>Gv(e)(t,n,a),I5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Vv(e)(t,n,s)},L5=e=>async(t,n,a)=>Vv(e)(t,n,a),P5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return wh(e)(t,n,s)},U5=e=>(t,n,a)=>wh(e)(t,n,a),B5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Sh(e)(t,n,s)},F5=e=>async(t,n,a)=>Sh(e)(t,n,a),$5=/^[cC][^\s-]{8,}$/,H5=/^[0-9a-z]+$/,q5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Z5=/^[0-9a-vA-V]{20}$/,G5=/^[A-Za-z0-9]{27}$/,V5=/^[a-zA-Z0-9_-]{21}$/,Q5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,K5=/^([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})$/,z1=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)$/,Y5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,X5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function W5(){return new RegExp(X5,"u")}const J5=/^(?:(?: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])$/,eL=/^(([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}|:))$/,tL=/^((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])$/,nL=/^(([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])$/,rL=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,SN=/^[A-Za-z0-9_-]*$/,aL=/^\+[1-9]\d{6,14}$/,kN="(?:(?:\\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])))",iL=new RegExp(`^${kN}$`);function jN(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 sL(e){return new RegExp(`^${jN(e)}$`)}function lL(e){const t=jN({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(`^${kN}T(?:${a})$`)}const oL=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}$`)},uL=/^-?\d+$/,CN=/^-?\d+(?:\.\d+)?$/,cL=/^(?:true|false)$/i,dL=/^null$/i,fL=/^[^A-Z]*$/,hL=/^[^a-z]*$/,Mr=fe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),EN={number:"number",bigint:"bigint",object:"date"},NN=fe("$ZodCheckLessThan",(e,t)=>{Mr.init(e,t);const n=EN[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})}}),_N=fe("$ZodCheckGreaterThan",(e,t)=>{Mr.init(e,t);const n=EN[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})}}),mL=fe("$ZodCheckMultipleOf",(e,t)=>{Mr.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):y5(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})}}),pL=fe("$ZodCheckNumberFormat",(e,t)=>{var c;Mr.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]=S5[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=uL)}),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})}}),gL=fe("$ZodCheckMaxLength",(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Hv(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=Zv(s);a.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),yL=fe("$ZodCheckMinLength",(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Hv(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=Zv(s);a.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),vL=fe("$ZodCheckLengthEquals",(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!Hv(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=Zv(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})}}),kh=fe("$ZodCheckStringFormat",(e,t)=>{var n,a;Mr.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=()=>{})}),bL=fe("$ZodCheckRegex",(e,t)=>{kh.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})}}),xL=fe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=fL),kh.init(e,t)}),wL=fe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=hL),kh.init(e,t)}),SL=fe("$ZodCheckIncludes",(e,t)=>{Mr.init(e,t);const n=Co(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})}}),kL=fe("$ZodCheckStartsWith",(e,t)=>{Mr.init(e,t);const n=new RegExp(`^${Co(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})}}),jL=fe("$ZodCheckEndsWith",(e,t)=>{Mr.init(e,t);const n=new RegExp(`.*${Co(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})}}),CL=fe("$ZodCheckOverwrite",(e,t)=>{Mr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class EL{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(`
|
|
345
|
+
`).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(`
|
|
346
|
+
`))}}const NL={major:4,minor:3,patch:6},en=fe("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=NL;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 p=eo(f),g;for(const w of m){if(w._zod.def.when){if(!w._zod.def.when(f))continue}else if(p)continue;const x=f.issues.length,k=w._zod.check(f);if(k instanceof Promise&&(h==null?void 0:h.async)===!1)throw new io;if(g||k instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await k,f.issues.length!==x&&(p||(p=eo(f,x)))});else{if(f.issues.length===x)continue;p||(p=eo(f,x))}}return g?g.then(()=>f):f},c=(f,m,h)=>{if(eo(f))return f.aborted=!0,f;const p=o(m,a,h);if(p instanceof Promise){if(h.async===!1)throw new io;return p.then(g=>e._zod.parse(g,h))}return e._zod.parse(p,h)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const p=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return p instanceof Promise?p.then(g=>c(g,f,m)):c(p,f,m)}const h=e._zod.parse(f,m);if(h instanceof Promise){if(m.async===!1)throw new io;return h.then(p=>o(p,a,m))}return o(h,a,m)}}Rt(e,"~standard",()=>({validate:o=>{var c;try{const f=O5(e,o);return f.success?{value:f.data}:{issues:(c=f.error)==null?void 0:c.issues}}catch{return M5(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}))}),Qv=fe("$ZodString",(e,t)=>{var n;en.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??oL(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}}),tn=fe("$ZodStringFormat",(e,t)=>{kh.init(e,t),Qv.init(e,t)}),_L=fe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=K5),tn.init(e,t)}),TL=fe("$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=z1(a))}else t.pattern??(t.pattern=z1());tn.init(e,t)}),AL=fe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Y5),tn.init(e,t)}),RL=fe("$ZodURL",(e,t)=>{tn.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})}}}),OL=fe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=W5()),tn.init(e,t)}),ML=fe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=V5),tn.init(e,t)}),DL=fe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=$5),tn.init(e,t)}),zL=fe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=H5),tn.init(e,t)}),IL=fe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=q5),tn.init(e,t)}),LL=fe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Z5),tn.init(e,t)}),PL=fe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=G5),tn.init(e,t)}),UL=fe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=lL(t)),tn.init(e,t)}),BL=fe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=iL),tn.init(e,t)}),FL=fe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=sL(t)),tn.init(e,t)}),$L=fe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Q5),tn.init(e,t)}),HL=fe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=J5),tn.init(e,t),e._zod.bag.format="ipv4"}),qL=fe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=eL),tn.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})}}}),ZL=fe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=tL),tn.init(e,t)}),GL=fe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=nL),tn.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 TN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const VL=fe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rL),tn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{TN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function QL(e){if(!SN.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return TN(n)}const KL=fe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=SN),tn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{QL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),YL=fe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=aL),tn.init(e,t)});function XL(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 WL=fe("$ZodJWT",(e,t)=>{tn.init(e,t),e._zod.check=n=>{XL(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),AN=fe("$ZodNumber",(e,t)=>{en.init(e,t),e._zod.pattern=e._zod.bag.pattern??CN,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}}),JL=fe("$ZodNumberFormat",(e,t)=>{pL.init(e,t),AN.init(e,t)}),eP=fe("$ZodBoolean",(e,t)=>{en.init(e,t),e._zod.pattern=cL,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}}),tP=fe("$ZodNull",(e,t)=>{en.init(e,t),e._zod.pattern=dL,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}}),nP=fe("$ZodUnknown",(e,t)=>{en.init(e,t),e._zod.parse=n=>n}),rP=fe("$ZodNever",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function I1(e,t,n){e.issues.length&&t.issues.push(...to(n,e.issues)),t.value[n]=e.value}const aP=fe("$ZodArray",(e,t)=>{en.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=>I1(h,n,c))):I1(m,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function Kf(e,t,n,a,s){if(e.issues.length){if(s&&!(n in a))return;t.issues.push(...to(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function RN(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=w5(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ON(e,t,n,a,s,o){const c=[],f=s.keySet,m=s.catchall._zod,h=m.def.type,p=m.optout==="optional";for(const g in t){if(f.has(g))continue;if(h==="never"){c.push(g);continue}const w=m.run({value:t[g],issues:[]},a);w instanceof Promise?e.push(w.then(x=>Kf(x,n,g,t,p))):Kf(w,n,g,t,p)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const iP=fe("$ZodObject",(e,t)=>{en.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=xh(()=>RN(t));Rt(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const p=f[h]._zod;if(p.values){m[h]??(m[h]=new Set);for(const g of p.values)m[h].add(g)}}return m});const s=fc,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 p=[],g=c.shape;for(const w of c.keys){const x=g[w],k=x._zod.optout==="optional",j=x._zod.run({value:h[w],issues:[]},m);j instanceof Promise?p.push(j.then(C=>Kf(C,f,w,h,k))):Kf(j,f,w,h,k)}return o?ON(p,h,f,m,a.value,e):p.length?Promise.all(p).then(()=>f):f}}),sP=fe("$ZodObjectJIT",(e,t)=>{iP.init(e,t);const n=e._zod.parse,a=xh(()=>RN(t)),s=w=>{var O;const x=new EL(["shape","payload","ctx"]),k=a.value,j=D=>{const I=D1(D);return`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`};x.write("const input = payload.value;");const C=Object.create(null);let E=0;for(const D of k.keys)C[D]=`key_${E++}`;x.write("const newResult = {};");for(const D of k.keys){const I=C[D],R=D1(D),B=w[D],L=((O=B==null?void 0:B._zod)==null?void 0:O.optout)==="optional";x.write(`const ${I} = ${j(D)};`),L?x.write(`
|
|
347
|
+
if (${I}.issues.length) {
|
|
348
|
+
if (${R} in input) {
|
|
349
|
+
payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
|
|
350
|
+
...iss,
|
|
351
|
+
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
352
|
+
})));
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (${I}.value === undefined) {
|
|
357
|
+
if (${R} in input) {
|
|
358
|
+
newResult[${R}] = undefined;
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
newResult[${R}] = ${I}.value;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
`):x.write(`
|
|
365
|
+
if (${I}.issues.length) {
|
|
366
|
+
payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
|
|
367
|
+
...iss,
|
|
368
|
+
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
369
|
+
})));
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (${I}.value === undefined) {
|
|
373
|
+
if (${R} in input) {
|
|
374
|
+
newResult[${R}] = undefined;
|
|
375
|
+
}
|
|
376
|
+
} else {
|
|
377
|
+
newResult[${R}] = ${I}.value;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
`)}x.write("payload.value = newResult;"),x.write("return payload;");const T=x.compile();return(D,I)=>T(w,D,I)};let o;const c=fc,f=!pN.jitless,h=f&&b5.value,p=t.catchall;let g;e._zod.parse=(w,x)=>{g??(g=a.value);const k=w.value;return c(k)?f&&h&&(x==null?void 0:x.async)===!1&&x.jitless!==!0?(o||(o=s(t.shape)),w=o(w,x),p?ON([],k,w,x,g,e):w):n(w,x):(w.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),w)}});function L1(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=>!eo(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=>bs(c,a,vs())))}),t)}const MN=fe("$ZodUnion",(e,t)=>{en.init(e,t),Rt(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Rt(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Rt(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Rt(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=>qv(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=>L1(m,s,e,o)):L1(f,s,e,o)}}),lP=fe("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,MN.init(e,t);const n=e._zod.parse;Rt(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=xh(()=>{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(!fc(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)}}),oP=fe("$ZodIntersection",(e,t)=>{en.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])=>P1(n,m,h)):P1(n,o,c)}});function My(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(jo(e)&&jo(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=My(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=My(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 P1(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}),eo(e))return e;const c=My(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 uP=fe("$ZodRecord",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!jo(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 p=t.valueType._zod.run({value:s[h],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...to(h,g.issues)),n.value[h]=g.value})):(p.issues.length&&n.issues.push(...to(h,p.issues)),n.value[h]=p.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"&&CN.test(f)&&m.issues.length){const g=t.keyType._zod.run({value:Number(f),issues:[]},a);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(m=g)}if(m.issues.length){t.mode==="loose"?n.value[f]=s[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(g=>bs(g,a,vs())),input:f,path:[f],inst:e});continue}const p=t.valueType._zod.run({value:s[f],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...to(f,g.issues)),n.value[m.value]=g.value})):(p.issues.length&&n.issues.push(...to(f,p.issues)),n.value[m.value]=p.value)}}return o.length?Promise.all(o).then(()=>n):n}}),cP=fe("$ZodEnum",(e,t)=>{en.init(e,t);const n=gN(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>x5.has(typeof s)).map(s=>typeof s=="string"?Co(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}}),dP=fe("$ZodLiteral",(e,t)=>{if(en.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"?Co(a):a?Co(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}}),fP=fe("$ZodTransform",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new mN(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 io;return n.value=s,n}});function U1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const DN=fe("$ZodOptional",(e,t)=>{en.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Rt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Rt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qv(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=>U1(o,n.value)):U1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),hP=fe("$ZodExactOptional",(e,t)=>{DN.init(e,t),Rt(e._zod,"values",()=>t.innerType._zod.values),Rt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),mP=fe("$ZodNullable",(e,t)=>{en.init(e,t),Rt(e._zod,"optin",()=>t.innerType._zod.optin),Rt(e._zod,"optout",()=>t.innerType._zod.optout),Rt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qv(n.source)}|null)$`):void 0}),Rt(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)}),pP=fe("$ZodDefault",(e,t)=>{en.init(e,t),e._zod.optin="optional",Rt(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=>B1(o,t)):B1(s,t)}});function B1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const gP=fe("$ZodPrefault",(e,t)=>{en.init(e,t),e._zod.optin="optional",Rt(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))}),yP=fe("$ZodNonOptional",(e,t)=>{en.init(e,t),Rt(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=>F1(o,e)):F1(s,e)}});function F1(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 vP=fe("$ZodCatch",(e,t)=>{en.init(e,t),Rt(e._zod,"optin",()=>t.innerType._zod.optin),Rt(e._zod,"optout",()=>t.innerType._zod.optout),Rt(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=>bs(c,a,vs()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>bs(o,a,vs()))},input:n.value}),n.issues=[]),n)}}),bP=fe("$ZodPipe",(e,t)=>{en.init(e,t),Rt(e._zod,"values",()=>t.in._zod.values),Rt(e._zod,"optin",()=>t.in._zod.optin),Rt(e._zod,"optout",()=>t.out._zod.optout),Rt(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=>wf(c,t.in,a)):wf(o,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(o=>wf(o,t.out,a)):wf(s,t.out,a)}});function wf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const xP=fe("$ZodReadonly",(e,t)=>{en.init(e,t),Rt(e._zod,"propValues",()=>t.innerType._zod.propValues),Rt(e._zod,"values",()=>t.innerType._zod.values),Rt(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),Rt(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($1):$1(s)}});function $1(e){return e.value=Object.freeze(e.value),e}const wP=fe("$ZodCustom",(e,t)=>{Mr.init(e,t),en.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=>H1(o,n,a,e));H1(s,n,a,e)}});function H1(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(hc(s))}}var q1;class SP{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 kP(){return new SP}(q1=globalThis).__zod_globalRegistry??(q1.__zod_globalRegistry=kP());const Xu=globalThis.__zod_globalRegistry;function jP(e,t){return new e({type:"string",...Pe(t)})}function CP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Pe(t)})}function Z1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Pe(t)})}function EP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Pe(t)})}function NP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Pe(t)})}function _P(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Pe(t)})}function TP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Pe(t)})}function AP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Pe(t)})}function RP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Pe(t)})}function OP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Pe(t)})}function MP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Pe(t)})}function DP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Pe(t)})}function zP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Pe(t)})}function IP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Pe(t)})}function LP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Pe(t)})}function PP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Pe(t)})}function UP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Pe(t)})}function BP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Pe(t)})}function FP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Pe(t)})}function $P(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Pe(t)})}function HP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Pe(t)})}function qP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Pe(t)})}function ZP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Pe(t)})}function GP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Pe(t)})}function VP(e,t){return new e({type:"string",format:"date",check:"string_format",...Pe(t)})}function QP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Pe(t)})}function KP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Pe(t)})}function YP(e,t){return new e({type:"number",checks:[],...Pe(t)})}function XP(e,t){return new e({type:"number",coerce:!0,checks:[],...Pe(t)})}function WP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Pe(t)})}function JP(e,t){return new e({type:"boolean",...Pe(t)})}function eU(e,t){return new e({type:"null",...Pe(t)})}function tU(e){return new e({type:"unknown"})}function nU(e,t){return new e({type:"never",...Pe(t)})}function G1(e,t){return new NN({check:"less_than",...Pe(t),value:e,inclusive:!1})}function mg(e,t){return new NN({check:"less_than",...Pe(t),value:e,inclusive:!0})}function V1(e,t){return new _N({check:"greater_than",...Pe(t),value:e,inclusive:!1})}function pg(e,t){return new _N({check:"greater_than",...Pe(t),value:e,inclusive:!0})}function Q1(e,t){return new mL({check:"multiple_of",...Pe(t),value:e})}function zN(e,t){return new gL({check:"max_length",...Pe(t),maximum:e})}function Yf(e,t){return new yL({check:"min_length",...Pe(t),minimum:e})}function IN(e,t){return new vL({check:"length_equals",...Pe(t),length:e})}function rU(e,t){return new bL({check:"string_format",format:"regex",...Pe(t),pattern:e})}function aU(e){return new xL({check:"string_format",format:"lowercase",...Pe(e)})}function iU(e){return new wL({check:"string_format",format:"uppercase",...Pe(e)})}function sU(e,t){return new SL({check:"string_format",format:"includes",...Pe(t),includes:e})}function lU(e,t){return new kL({check:"string_format",format:"starts_with",...Pe(t),prefix:e})}function oU(e,t){return new jL({check:"string_format",format:"ends_with",...Pe(t),suffix:e})}function Mo(e){return new CL({check:"overwrite",tx:e})}function uU(e){return Mo(t=>t.normalize(e))}function cU(){return Mo(e=>e.trim())}function dU(){return Mo(e=>e.toLowerCase())}function fU(){return Mo(e=>e.toUpperCase())}function hU(){return Mo(e=>v5(e))}function mU(e,t,n){return new e({type:"array",element:t,...Pe(n)})}function pU(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Pe(n)})}function gU(e){const t=yU(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(hc(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(hc(s))}},e(n.value,n)));return t}function yU(e,t){const n=new Mr({check:"custom",...Pe(t)});return n._zod.check=e,n}function LN(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)??Xu,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 En(e,t,n={path:[],schemaPath:[]}){var p,g;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=(g=(p=e._zod).toJSONSchema)==null?void 0:g.call(p);if(f)c.schema=f;else{const w={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,w);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,w)}const x=e._zod.parent;x&&(c.ref||(c.ref=x),En(x,t,w),t.seen.get(x).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(c.schema,m),t.io==="input"&&or(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 PN(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 p of e.seen.entries()){const g=(c=e.metadataRegistry.get(p[0]))==null?void 0:c.id;if(g){const w=a.get(g);if(w&&w!==p[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(g,p[0])}}const s=p=>{var j;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const C=(j=e.external.registry.get(p[0]))==null?void 0:j.id,E=e.external.uri??(O=>O);if(C)return{ref:E(C)};const T=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=T,{defId:T,ref:`${E("__shared")}#/${g}/${T}`}}if(p[1]===n)return{ref:"#"};const x=`#/${g}/`,k=p[1].schema.id??`__schema${e.counter++}`;return{defId:k,ref:x+k}},o=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:w,defId:x}=s(p);g.def={...g.schema},x&&(g.defId=x);const k=g.schema;for(const j in k)delete k[j];k.$ref=w};if(e.cycles==="throw")for(const p of e.seen.entries()){const g=p[1];if(g.cycle)throw new Error(`Cycle detected: #/${(f=g.cycle)==null?void 0:f.join("/")}/<root>
|
|
381
|
+
|
|
382
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const g=p[1];if(t===p[0]){o(p);continue}if(e.external){const x=(m=e.external.registry.get(p[0]))==null?void 0:m.id;if(t!==p[0]&&x){o(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){o(p);continue}if(g.cycle){o(p);continue}if(g.count>1&&e.reused==="ref"){o(p);continue}}}function UN(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 p=e.seen.get(h);if(p.ref===null)return;const g=p.def??p.schema,w={...g},x=p.ref;if(p.ref=null,x){a(x);const j=e.seen.get(x),C=j.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(C)):Object.assign(g,C),Object.assign(g,w),h._zod.parent===x)for(const T in g)T==="$ref"||T==="allOf"||T in w||delete g[T];if(C.$ref&&j.def)for(const T in g)T==="$ref"||T==="allOf"||T in j.def&&JSON.stringify(g[T])===JSON.stringify(j.def[T])&&delete g[T]}const k=h._zod.parent;if(k&&k!==x){a(k);const j=e.seen.get(k);if(j!=null&&j.schema.$ref&&(g.$ref=j.schema.$ref,j.def))for(const C in g)C==="$ref"||C==="allOf"||C in j.def&&JSON.stringify(g[C])===JSON.stringify(j.def[C])&&delete g[C]}e.override({zodSchema:h,jsonSchema:g,path:p.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 p=h[1];p.def&&p.defId&&(o[p.defId]=p.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:Xf(t,"input",e.processors),output:Xf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function or(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 or(a.element,n);if(a.type==="set")return or(a.valueType,n);if(a.type==="lazy")return or(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 or(a.innerType,n);if(a.type==="intersection")return or(a.left,n)||or(a.right,n);if(a.type==="record"||a.type==="map")return or(a.keyType,n)||or(a.valueType,n);if(a.type==="pipe")return or(a.in,n)||or(a.out,n);if(a.type==="object"){for(const s in a.shape)if(or(a.shape[s],n))return!0;return!1}if(a.type==="union"){for(const s of a.options)if(or(s,n))return!0;return!1}if(a.type==="tuple"){for(const s of a.items)if(or(s,n))return!0;return!!(a.rest&&or(a.rest,n))}return!1}const vU=(e,t={})=>n=>{const a=LN({...n,processors:t});return En(e,a),PN(a,e),UN(a,e)},Xf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},c=LN({...s??{},target:o,io:t,processors:n});return En(e,c),PN(c,e),UN(c,e)},bU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},xU=(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=bU[f]??f,s.format===""&&delete s.format,f==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const p=[...m];p.length===1?s.pattern=p[0].source:p.length>1&&(s.allOf=[...p.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},wU=(e,t,n,a)=>{const s=n,{minimum:o,maximum:c,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof f=="string"&&f.includes("int")?s.type="integer":s.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p),typeof o=="number"&&(s.minimum=o,typeof p=="number"&&t.target!=="draft-04"&&(p>=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)},SU=(e,t,n,a)=>{n.type="boolean"},kU=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},jU=(e,t,n,a)=>{n.not={}},CU=(e,t,n,a)=>{},EU=(e,t,n,a)=>{const s=e._zod.def,o=gN(s.entries);o.every(c=>typeof c=="number")&&(n.type="number"),o.every(c=>typeof c=="string")&&(n.type="string"),n.enum=o},NU=(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},_U=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},TU=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},AU=(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=En(o.element,t,{...a,path:[...a.path,"items"]})},RU=(e,t,n,a)=>{var h;const s=n,o=e._zod.def;s.type="object",s.properties={};const c=o.shape;for(const p in c)s.properties[p]=En(c[p],t,{...a,path:[...a.path,"properties",p]});const f=new Set(Object.keys(c)),m=new Set([...f].filter(p=>{const g=o.shape[p]._zod;return t.io==="input"?g.optin===void 0:g.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=En(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},OU=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,c=s.options.map((f,m)=>En(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=c:n.anyOf=c},MU=(e,t,n,a)=>{const s=e._zod.def,o=En(s.left,t,{...a,path:[...a.path,"allOf",0]}),c=En(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},DU=(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 p=En(o.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const g of m)s.patternProperties[g.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=En(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=En(o.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=c._zod.values;if(h){const p=[...h].filter(g=>typeof g=="string"||typeof g=="number");p.length>0&&(s.required=p)}},zU=(e,t,n,a)=>{const s=e._zod.def,o=En(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"}]},IU=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},LU=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},PU=(e,t,n,a)=>{const s=e._zod.def;En(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)))},UU=(e,t,n,a)=>{const s=e._zod.def;En(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},BU=(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;En(o,t,a);const c=t.seen.get(e);c.ref=o},FU=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},BN=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},$U=fe("ZodISODateTime",(e,t)=>{UL.init(e,t),ln.init(e,t)});function HU(e){return GP($U,e)}const qU=fe("ZodISODate",(e,t)=>{BL.init(e,t),ln.init(e,t)});function ZU(e){return VP(qU,e)}const GU=fe("ZodISOTime",(e,t)=>{FL.init(e,t),ln.init(e,t)});function VU(e){return QP(GU,e)}const QU=fe("ZodISODuration",(e,t)=>{$L.init(e,t),ln.init(e,t)});function KU(e){return KP(QU,e)}const YU=(e,t)=>{xN.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>R5(e,n)},flatten:{value:n=>A5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Oy,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Oy,2)}},isEmpty:{get(){return e.issues.length===0}}})},ha=fe("ZodError",YU,{Parent:Error}),XU=Gv(ha),WU=Vv(ha),JU=wh(ha),e6=Sh(ha),t6=D5(ha),n6=z5(ha),r6=I5(ha),a6=L5(ha),i6=P5(ha),s6=U5(ha),l6=B5(ha),o6=F5(ha),nn=fe("ZodType",(e,t)=>(en.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Xf(e,"input"),output:Xf(e,"output")}}),e.toJSONSchema=vU(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ss(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)=>bi(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>XU(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>JU(e,n,a),e.parseAsync=async(n,a)=>WU(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>e6(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>t6(e,n,a),e.decode=(n,a)=>n6(e,n,a),e.encodeAsync=async(n,a)=>r6(e,n,a),e.decodeAsync=async(n,a)=>a6(e,n,a),e.safeEncode=(n,a)=>i6(e,n,a),e.safeDecode=(n,a)=>s6(e,n,a),e.safeEncodeAsync=async(n,a)=>l6(e,n,a),e.safeDecodeAsync=async(n,a)=>o6(e,n,a),e.refine=(n,a)=>e.check(nB(n,a)),e.superRefine=n=>e.check(rB(n)),e.overwrite=n=>e.check(Mo(n)),e.optional=()=>X1(e),e.exactOptional=()=>H6(e),e.nullable=()=>W1(e),e.nullish=()=>X1(W1(e)),e.nonoptional=n=>K6(e,n),e.array=()=>dt(e),e.or=n=>jh([e,n]),e.and=n=>P6(e,n),e.transform=n=>zy(e,qN(n)),e.default=n=>G6(e,n),e.prefault=n=>Q6(e,n),e.catch=n=>X6(e,n),e.pipe=n=>zy(e,n),e.readonly=()=>eB(e),e.describe=n=>{const a=e.clone();return Xu.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Xu.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Xu.get(e);const a=e.clone();return Xu.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),FN=fe("_ZodString",(e,t)=>{Qv.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(a,s,o)=>xU(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(rU(...a)),e.includes=(...a)=>e.check(sU(...a)),e.startsWith=(...a)=>e.check(lU(...a)),e.endsWith=(...a)=>e.check(oU(...a)),e.min=(...a)=>e.check(Yf(...a)),e.max=(...a)=>e.check(zN(...a)),e.length=(...a)=>e.check(IN(...a)),e.nonempty=(...a)=>e.check(Yf(1,...a)),e.lowercase=a=>e.check(aU(a)),e.uppercase=a=>e.check(iU(a)),e.trim=()=>e.check(cU()),e.normalize=(...a)=>e.check(uU(...a)),e.toLowerCase=()=>e.check(dU()),e.toUpperCase=()=>e.check(fU()),e.slugify=()=>e.check(hU())}),u6=fe("ZodString",(e,t)=>{Qv.init(e,t),FN.init(e,t),e.email=n=>e.check(CP(c6,n)),e.url=n=>e.check(AP(d6,n)),e.jwt=n=>e.check(ZP(E6,n)),e.emoji=n=>e.check(RP(f6,n)),e.guid=n=>e.check(Z1(K1,n)),e.uuid=n=>e.check(EP(Sf,n)),e.uuidv4=n=>e.check(NP(Sf,n)),e.uuidv6=n=>e.check(_P(Sf,n)),e.uuidv7=n=>e.check(TP(Sf,n)),e.nanoid=n=>e.check(OP(h6,n)),e.guid=n=>e.check(Z1(K1,n)),e.cuid=n=>e.check(MP(m6,n)),e.cuid2=n=>e.check(DP(p6,n)),e.ulid=n=>e.check(zP(g6,n)),e.base64=n=>e.check($P(k6,n)),e.base64url=n=>e.check(HP(j6,n)),e.xid=n=>e.check(IP(y6,n)),e.ksuid=n=>e.check(LP(v6,n)),e.ipv4=n=>e.check(PP(b6,n)),e.ipv6=n=>e.check(UP(x6,n)),e.cidrv4=n=>e.check(BP(w6,n)),e.cidrv6=n=>e.check(FP(S6,n)),e.e164=n=>e.check(qP(C6,n)),e.datetime=n=>e.check(HU(n)),e.date=n=>e.check(ZU(n)),e.time=n=>e.check(VU(n)),e.duration=n=>e.check(KU(n))});function N(e){return jP(u6,e)}const ln=fe("ZodStringFormat",(e,t)=>{tn.init(e,t),FN.init(e,t)}),c6=fe("ZodEmail",(e,t)=>{AL.init(e,t),ln.init(e,t)}),K1=fe("ZodGUID",(e,t)=>{_L.init(e,t),ln.init(e,t)}),Sf=fe("ZodUUID",(e,t)=>{TL.init(e,t),ln.init(e,t)}),d6=fe("ZodURL",(e,t)=>{RL.init(e,t),ln.init(e,t)}),f6=fe("ZodEmoji",(e,t)=>{OL.init(e,t),ln.init(e,t)}),h6=fe("ZodNanoID",(e,t)=>{ML.init(e,t),ln.init(e,t)}),m6=fe("ZodCUID",(e,t)=>{DL.init(e,t),ln.init(e,t)}),p6=fe("ZodCUID2",(e,t)=>{zL.init(e,t),ln.init(e,t)}),g6=fe("ZodULID",(e,t)=>{IL.init(e,t),ln.init(e,t)}),y6=fe("ZodXID",(e,t)=>{LL.init(e,t),ln.init(e,t)}),v6=fe("ZodKSUID",(e,t)=>{PL.init(e,t),ln.init(e,t)}),b6=fe("ZodIPv4",(e,t)=>{HL.init(e,t),ln.init(e,t)}),x6=fe("ZodIPv6",(e,t)=>{qL.init(e,t),ln.init(e,t)}),w6=fe("ZodCIDRv4",(e,t)=>{ZL.init(e,t),ln.init(e,t)}),S6=fe("ZodCIDRv6",(e,t)=>{GL.init(e,t),ln.init(e,t)}),k6=fe("ZodBase64",(e,t)=>{VL.init(e,t),ln.init(e,t)}),j6=fe("ZodBase64URL",(e,t)=>{KL.init(e,t),ln.init(e,t)}),C6=fe("ZodE164",(e,t)=>{YL.init(e,t),ln.init(e,t)}),E6=fe("ZodJWT",(e,t)=>{WL.init(e,t),ln.init(e,t)}),Kv=fe("ZodNumber",(e,t)=>{AN.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(a,s,o)=>wU(e,a,s),e.gt=(a,s)=>e.check(V1(a,s)),e.gte=(a,s)=>e.check(pg(a,s)),e.min=(a,s)=>e.check(pg(a,s)),e.lt=(a,s)=>e.check(G1(a,s)),e.lte=(a,s)=>e.check(mg(a,s)),e.max=(a,s)=>e.check(mg(a,s)),e.int=a=>e.check(Y1(a)),e.safe=a=>e.check(Y1(a)),e.positive=a=>e.check(V1(0,a)),e.nonnegative=a=>e.check(pg(0,a)),e.negative=a=>e.check(G1(0,a)),e.nonpositive=a=>e.check(mg(0,a)),e.multipleOf=(a,s)=>e.check(Q1(a,s)),e.step=(a,s)=>e.check(Q1(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 Ue(e){return YP(Kv,e)}const N6=fe("ZodNumberFormat",(e,t)=>{JL.init(e,t),Kv.init(e,t)});function Y1(e){return WP(N6,e)}const _6=fe("ZodBoolean",(e,t)=>{eP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>SU(e,n,a)});function Mn(e){return JP(_6,e)}const T6=fe("ZodNull",(e,t)=>{tP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>kU(e,n,a)});function A6(e){return eU(T6,e)}const R6=fe("ZodUnknown",(e,t)=>{nP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>CU()});function sn(){return tU(R6)}const O6=fe("ZodNever",(e,t)=>{rP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>jU(e,n,a)});function M6(e){return nU(O6,e)}const D6=fe("ZodArray",(e,t)=>{aP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>AU(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(Yf(n,a)),e.nonempty=n=>e.check(Yf(1,n)),e.max=(n,a)=>e.check(zN(n,a)),e.length=(n,a)=>e.check(IN(n,a)),e.unwrap=()=>e.element});function dt(e,t){return mU(D6,e,t)}const z6=fe("ZodObject",(e,t)=>{sP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>RU(e,n,a,s),Rt(e,"shape",()=>t.shape),e.keyof=()=>ze(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sn()}),e.loose=()=>e.clone({...e._zod.def,catchall:sn()}),e.strict=()=>e.clone({...e._zod.def,catchall:M6()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>C5(e,n),e.safeExtend=n=>E5(e,n),e.merge=n=>N5(e,n),e.pick=n=>k5(e,n),e.omit=n=>j5(e,n),e.partial=(...n)=>_5(ZN,e,n[0]),e.required=(...n)=>T5(GN,e,n[0])});function te(e,t){const n={type:"object",shape:e??{},...Pe(t)};return new z6(n)}const $N=fe("ZodUnion",(e,t)=>{MN.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>OU(e,n,a,s),e.options=t.options});function jh(e,t){return new $N({type:"union",options:e,...Pe(t)})}const I6=fe("ZodDiscriminatedUnion",(e,t)=>{$N.init(e,t),lP.init(e,t)});function Ch(e,t,n){return new I6({type:"union",options:t,discriminator:e,...Pe(n)})}const L6=fe("ZodIntersection",(e,t)=>{oP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>MU(e,n,a,s)});function P6(e,t){return new L6({type:"intersection",left:e,right:t})}const HN=fe("ZodRecord",(e,t)=>{uP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>DU(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function mn(e,t,n){return new HN({type:"record",keyType:e,valueType:t,...Pe(n)})}function U6(e,t,n){const a=bi(e);return a._zod.values=void 0,new HN({type:"record",keyType:a,valueType:t,...Pe(n)})}const Dy=fe("ZodEnum",(e,t)=>{cP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(a,s,o)=>EU(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 Dy({...t,checks:[],...Pe(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 Dy({...t,checks:[],...Pe(s),entries:o})}});function ze(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Dy({type:"enum",entries:n,...Pe(t)})}const B6=fe("ZodLiteral",(e,t)=>{dP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>NU(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 Pt(e,t){return new B6({type:"literal",values:Array.isArray(e)?e:[e],...Pe(t)})}const F6=fe("ZodTransform",(e,t)=>{fP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>TU(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new mN(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(hc(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(hc(c))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function qN(e){return new F6({type:"transform",transform:e})}const ZN=fe("ZodOptional",(e,t)=>{DN.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>BN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function X1(e){return new ZN({type:"optional",innerType:e})}const $6=fe("ZodExactOptional",(e,t)=>{hP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>BN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function H6(e){return new $6({type:"optional",innerType:e})}const q6=fe("ZodNullable",(e,t)=>{mP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>zU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function W1(e){return new q6({type:"nullable",innerType:e})}const Z6=fe("ZodDefault",(e,t)=>{pP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>LU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function G6(e,t){return new Z6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():vN(t)}})}const V6=fe("ZodPrefault",(e,t)=>{gP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>PU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function Q6(e,t){return new V6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():vN(t)}})}const GN=fe("ZodNonOptional",(e,t)=>{yP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>IU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function K6(e,t){return new GN({type:"nonoptional",innerType:e,...Pe(t)})}const Y6=fe("ZodCatch",(e,t)=>{vP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>UU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function X6(e,t){return new Y6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const W6=fe("ZodPipe",(e,t)=>{bP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>BU(e,n,a,s),e.in=t.in,e.out=t.out});function zy(e,t){return new W6({type:"pipe",in:e,out:t})}const J6=fe("ZodReadonly",(e,t)=>{xP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>FU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function eB(e){return new J6({type:"readonly",innerType:e})}const tB=fe("ZodCustom",(e,t)=>{wP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>_U(e,n)});function nB(e,t={}){return pU(tB,e,t)}function rB(e){return gU(e)}function aB(e,t){return zy(qN(e),t)}const hs={custom:"custom"};function Eh(e){return XP(Kv,e)}const iB=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function sB(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function VN(e,t){const n=sB(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(iB)){const c=o[1];if(!c)continue;const f=a.get(c.toLowerCase());f&&s.add(f)}return[...s]}const lB=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,J1="/";function QN(e){return!e||typeof e!="string"||e.length>256||!lB.test(e)?"/":e}const oB={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},KN=ze(["feishu","slack","kael"]),YN=ze(["active","inactive"]);te({platform:KN,agentId:N().min(1),credentials:mn(N(),sn()),status:YN.default("active")});te({agentId:N().min(1).optional(),credentials:mn(N(),sn()).optional(),status:YN.optional()});te({id:Ue(),platform:N(),agentId:N(),hasCredentials:Mn(),status:N(),createdAt:N(),updatedAt:N()});const uB=ze(["code","reverse_token","oauth","manual"]);te({appId:N().min(1),appSecret:N().min(1)});te({platform:KN,externalUserId:N().min(1),agentId:N().min(1),boundVia:uB.default("manual"),displayName:N().max(200).optional()});te({id:Ue(),platform:N(),externalUserId:N(),agentId:N(),boundVia:N().nullable(),displayName:N().nullable(),createdAt:N()});te({feishuUserId:N().min(1),displayName:N().max(200).optional()});te({configId:Ue(),platform:N(),agentId:N(),appId:N(),connected:Mn(),lastActiveAt:N().nullable()});const cB=32e3,Yv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,dB=/^[A-Z][A-Z0-9_]*$/,fB=/^[A-Za-z]:/,XN=te({append:N().max(cB).default("")}),hB=te({name:N().regex(Yv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Pt("stdio"),command:N().min(1),args:dt(N()).optional()}),mB=te({name:N().regex(Yv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Pt("http"),url:N().url(),headers:mn(N(),N()).optional()}),pB=te({name:N().regex(Yv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Pt("sse"),url:N().url(),headers:mn(N(),N()).optional()}),WN=Ch("transport",[hB,mB,pB]),JN=te({key:N().regex(dB,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:N(),sensitive:Mn().default(!1)});function gB(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function yB(e){if(e.length===0)return"Git repo local path must not be empty";if(e.trim()!==e)return"Git repo local path must not have leading or trailing whitespace";if(gB(e))return"Git repo local path must not contain control characters";if(e.includes("\\"))return"Git repo local path must use forward slashes";if(e.startsWith("/")||fB.test(e))return"Git repo local path must be relative";const t=e.split("/");for(const n of t){if(!n)return"Git repo local path must not contain empty path segments";if(n==="."||n==="..")return"Git repo local path must not contain dot segments";if(n.trim()!==n)return"Git repo local path segments must not have leading or trailing whitespace"}return null}const Xv=te({url:N().min(1),ref:N().min(1).optional(),localPath:N().min(1).superRefine((e,t)=>{const n=yB(e);n&&t.addIssue({code:hs.custom,message:n})}).optional()}),e_=te({prompt:XN.default({append:""}),model:N().default("opus"),mcpServers:dt(WN).default([]),env:dt(JN).default([]),gitRepos:dt(Xv).default([])}),vB=e_.extend({kind:Pt("claude-code")}),bB=e_.extend({kind:Pt("codex")}),xB=Ch("kind",[vB,bB]),wB=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,c)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:hs.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:hs.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??Wf(o.url);f&&(s.has(f)&&t.addIssue({code:hs.custom,path:["gitRepos",c,"localPath"],message:`Duplicate git repo local path "${f}"`}),s.add(f))})},t_=aB(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,xB).superRefine((e,t)=>{wB(e,t)}),SB=te({agentId:N(),version:Ue().int().positive(),payload:t_,updatedAt:N(),updatedBy:N()}),n_=te({prompt:XN,model:N(),mcpServers:dt(WN),env:dt(JN),gitRepos:dt(Xv)}).partial();te({expectedVersion:Ue().int().positive(),payload:n_});te({payload:n_});te({current:SB,next:t_,diff:dt(te({path:N(),op:ze(["add","remove","replace"]),before:sn().optional(),after:sn().optional()}))});const mc="***";function Wf(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const r_=ze(["online","offline"]),a_=ze(["idle","working","blocked","error"]);ze(["active","suspended","evicted","errored"]);const kB=ze(["active","suspended","errored"]);te({chatId:N().min(1),state:kB});te({runtimeState:a_});te({agentId:N().min(1),runtimeType:N().max(50),runtimeVersion:N().max(50).optional()});ze(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);te({agentId:N(),status:r_,connectedAt:N().nullable(),lastSeenAt:N(),clientId:N().nullable().optional(),runtimeType:N().nullable().optional(),runtimeVersion:N().nullable().optional(),runtimeState:a_.nullable().optional(),activeSessions:Ue().int().nullable().optional(),totalSessions:Ue().int().nullable().optional(),runtimeUpdatedAt:N().nullable().optional()});te({total:Ue().int(),running:Ue().int(),byState:te({idle:Ue().int(),working:Ue().int(),blocked:Ue().int(),error:Ue().int()}),clients:Ue().int()});const Jf={CLAUDE_CODE:"claude-code",CODEX:"codex"},Nh=ze(["claude-code","codex"]),_h=ze(["human","personal_assistant","autonomous_agent"]),ek={PRIVATE:"private",ORGANIZATION:"organization"},Wv=ze(["private","organization"]),Iy=["hue-0","hue-1","hue-2","hue-3","hue-4","hue-5","hue-6","hue-7"],jB=ze(Iy),CB=ze(["admin-api","portal"]);ze(["active","suspended"]);const Ly=/^[a-z0-9][a-z0-9_-]{0,63}$/,no=64,EB=["admin","agent","first-tree","hub","me","null","system","undefined"],NB=new Set(EB);function Py(e){return NB.has(e)}te({name:N().min(1).max(64).regex(Ly,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Py(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:_h,displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).optional(),organizationId:N().min(1).max(100).optional(),source:CB.optional(),visibility:Wv.optional(),metadata:mn(N(),sn()).optional(),managerId:N().optional(),clientId:N().min(1).max(100).optional(),runtimeProvider:Nh.optional(),gitRepos:dt(Xv).optional()});te({type:_h.optional(),displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).nullable().optional(),visibility:Wv.optional(),metadata:mn(N(),sn()).optional(),managerId:N().nullable().optional(),clientId:N().min(1).max(100).nullable().optional(),avatarColorToken:jB.nullable().optional()});te({clientId:N().min(1).max(100),runtimeProvider:Nh,force:Mn().optional()});te({uuid:N(),name:N().nullable(),organizationId:N(),type:_h,displayName:N(),delegateMention:N().nullable(),inboxId:N(),status:N(),source:N().nullable().optional(),visibility:Wv,metadata:mn(N(),sn()),managerId:N().nullable(),clientId:N().nullable(),runtimeProvider:Nh,avatarColorToken:N().nullable(),avatarImageUrl:N().nullable(),presenceStatus:r_.optional(),createdAt:N(),updatedAt:N()});te({repo:N().nullable(),branch:N().nullable()});te({type:Pt("agent:pinned"),agentId:N(),name:N().nullable(),displayName:N(),agentType:_h,runtimeProvider:Nh});te({username:N().min(1),password:N().min(1)});te({accessToken:N(),refreshToken:N()});te({refreshToken:N().min(1)});te({token:N().min(1)});te({token:N(),expiresIn:Ue(),command:N()});const _B=["issue","pull_request","discussion","commit"],Jv=ze(_B),TB=te({source:Pt("github"),entityType:Jv,entityKey:N().min(1),entityUrl:N().url().optional()}),AB=te({source:Pt("feishu"),externalChannelId:N().min(1)}),RB=Ch("source",[TB,AB]),OB=jh([te({}).strict(),RB]),MB=["manual","github_issue","github_pull_request","github_discussion","github_commit","feishu"],eb=ze(MB),DB=ze(["direct","group"]),Uy={ACTIVE:"active",ARCHIVED:"archived",DELETED:"deleted"},tb=ze(["active","archived","deleted"]);te({status:tb});te({type:DB,topic:N().max(500).optional(),participantIds:dt(N()).min(1),metadata:OB.optional()});const zB=te({agentId:N(),role:N(),mode:N(),joinedAt:N()}),IB=zB.extend({name:N().nullable(),displayName:N(),type:N()}),LB=te({id:N(),organizationId:N(),type:N(),topic:N().nullable(),lifecyclePolicy:N().nullable().optional(),metadata:mn(N(),sn()),createdAt:N(),updatedAt:N()});LB.extend({participants:dt(IB),title:N(),firstMessagePreview:N().nullable(),engagementStatus:tb});te({topic:N().trim().max(500).nullable()});te({agentId:N().min(1)});te({agentId:N().min(1)});const PB=ze(["connected","disconnected"]),UB=ze(["ok","expired"]);te({id:N(),userId:N().nullable(),status:PB,authState:UB,sdkVersion:N().max(50).nullable(),hostname:N().max(100).nullable(),os:N().max(50).nullable(),agentCount:Ue().int().min(0),connectedAt:N().nullable(),lastSeenAt:N(),metadata:mn(N(),sn()).nullable()});const BB=te({wsInboxDeliver:Mn().default(!1)}).partial();te({clientId:N().min(1).max(100),hostname:N().max(100).optional(),os:N().max(50).optional(),sdkVersion:N().max(50).optional(),wireCapabilities:BB.optional()});te({clientId:N(),previousUserId:N().nullable(),unpinnedAgentCount:Ue().int().nonnegative()});const FB=ze(["ok","missing","unauthenticated","error"]),$B=ze(["api_key","oauth","auth_json","none"]),HB=te({state:FB,available:Mn(),authenticated:Mn(),sdkVersion:N().nullable().optional(),authMethod:$B,error:N().nullable().optional(),detectedAt:N()}),qB=mn(N(),HB);te({capabilities:qB});te({limit:Eh().int().min(1).max(100).default(20),cursor:N().optional()});const ZB=ze(["active","stale","unavailable"]),GB=ze(["ok","warning","error"]),VB=te({label:N(),detail:N().nullable(),severity:GB}),QB=ze(["root","domain","subdomain","leaf"]),nb=ze(["added","edited","removed"]),KB=ze(["parent","soft_link","markdown_link"]),YB=ze(["low","medium","high"]),XB=te({id:N(),path:N(),sourcePath:N().nullable(),title:N(),kind:QB,owners:dt(N()),parentId:N().nullable(),preview:N().nullable(),relatedNodeIds:dt(N()),affectedContextArea:N(),changeType:nb.nullable(),changedAtCommit:N().nullable()}),WB=te({source:N(),target:N(),kind:KB}),JB=te({path:N(),nodeId:N().nullable(),type:nb,commit:N().nullable(),changedAt:N().nullable(),changedBy:N().nullable(),summary:N().nullable()}),eF=te({id:N(),nodeId:N().nullable(),path:N(),title:N(),changeType:nb,affectedContextArea:N(),reason:N(),summary:N(),changedBy:N().nullable(),owners:dt(N()),relatedNodeIds:dt(N()),sourceCommit:N().nullable(),riskLevel:YB}),tF=te({addedCount:Ue().int().nonnegative(),editedCount:Ue().int().nonnegative(),removedCount:Ue().int().nonnegative(),changedNodeCount:Ue().int().nonnegative()}),nF=te({windowDays:Ue().int().positive(),agentCount:Ue().int().nonnegative(),usageCount:Ue().int().nonnegative()});te({repo:N().nullable(),branch:N().nullable(),headCommit:N().nullable(),syncedAt:N().nullable(),snapshotStatus:ZB,contextStatus:VB,summary:tF,usage:nF,updates:dt(eF),nodes:dt(XB),edges:dt(WB),changes:dt(JB)});const rF=["User","Organization"],aF=ze(rF),iF=["read","write","admin"],sF=ze(iF),lF=mn(N(),sF),oF=dt(N());te({login:N().optional(),accessToken:N().optional(),accessTokenExpiresAt:N().datetime({offset:!0}).optional(),refreshToken:N().optional(),refreshTokenExpiresAt:N().datetime({offset:!0}).optional()});te({installationId:Ue().int().positive()});te({installationId:Ue().int().positive(),accountType:aF,accountLogin:N(),accountGithubId:Ue().int().positive(),permissions:lF,events:oF,suspended:Mn(),manageUrl:N().url(),createdAt:N().datetime({offset:!0}),updatedAt:N().datetime({offset:!0})});const uF=["image/png","image/jpeg","image/gif","image/webp"],rb=ze(uF);te({data:N().min(1),mimeType:rb,filename:N().min(1),size:Ue().int().nonnegative().optional(),imageId:N().uuid().optional()});te({imageId:N().uuid(),mimeType:rb,filename:N().min(1),size:Ue().int().nonnegative().optional()});te({type:Pt("image_payload"),imageId:N().uuid(),chatId:N(),base64:N().min(1),mimeType:rb,filename:N().min(1),size:Ue().int().nonnegative().optional()});const ab=ze(["hub_ui","cli","feishu","github","api"]),i_=ze(["text","markdown","card","reference","file","question","question_answer"]),cF=ze(["agent-final-text"]);te({format:i_.default("text"),content:sn(),metadata:mn(N(),sn()).optional(),inReplyTo:N().optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:ab.optional(),purpose:cF.optional()});te({format:i_.default("text"),content:sn(),metadata:mn(N(),sn()).optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:ab.optional(),direct:Mn().optional()});const dF=te({id:N(),chatId:N(),senderId:N(),format:N(),content:sn(),metadata:mn(N(),sn()),replyToInbox:N().nullable(),replyToChat:N().nullable(),inReplyTo:N().nullable(),source:ab.nullable(),createdAt:N()}),fF=te({senderId:N(),chatId:N(),replyToChat:N().nullable()}).nullable(),hF=ze(["full","mention_only"]),mF=te({id:N(),senderId:N(),format:N(),content:sn(),metadata:mn(N(),sn()).default({}),createdAt:N()}),s_=dF.extend({configVersion:Ue().int().positive(),recipientMode:hF.default("full"),inReplyToSnapshot:fF.default(null),precedingMessages:dt(mF).default([])});ze(["pending","delivered","acked","failed"]);const pF=te({id:Ue(),inboxId:N(),messageId:N(),chatId:N().nullable(),status:N(),retryCount:Ue(),createdAt:N(),deliveredAt:N().nullable(),ackedAt:N().nullable()});pF.extend({message:s_});te({limit:Eh().int().min(1).max(50).default(10)});te({type:Pt("inbox:deliver"),entryId:Ue().int().nonnegative(),inboxId:N().min(1),chatId:N().nullable(),message:s_}).passthrough();te({type:Pt("inbox:ack"),entryId:Ue().int().nonnegative()});const gF=7;te({organizationId:N(),organizationName:N(),organizationDisplayName:N(),role:N(),expiresAt:N().nullable()});te({id:N(),organizationId:N(),token:N(),inviteUrl:N(),role:N(),createdAt:N(),expiresAt:N().nullable()});te({token:N().min(1)});te({}).optional();const yF=["all","unread","watching"],vF=ze(yF),l_=ze(["participant","watching"]),bF=["active","archived","all"],ib=ze(bF);te({cursor:N().optional(),limit:Eh().int().min(1).max(200).default(50),filter:vF.default("all"),engagement:ib.default("active"),source:eb.optional()});const xF=te({agentId:N(),displayName:N(),type:N(),avatarColorToken:N().nullable(),avatarImageUrl:N().nullable()}),wF=ze(["tool_call","thinking","assistant_text"]),SF=te({agentId:N(),kind:wF,label:N(),startedAt:N()}),kF=te({chatId:N(),type:N(),membershipKind:l_,title:N(),topic:N().nullable(),participants:dt(xF),participantCount:Ue().int(),lastMessageAt:N().nullable(),lastMessagePreview:N().nullable(),unreadMentionCount:Ue().int(),canReply:Mn(),engagementStatus:tb,engagedAgentIds:dt(N()),liveActivity:SF.nullable()});te({rows:dt(kF),nextCursor:N().nullable()});te({participantIds:dt(N().min(1)).min(1),topic:N().trim().max(500).optional().nullable()});te({participantIds:dt(N().min(1)).min(1)});te({chatId:N(),lastReadAt:N(),unreadMentionCount:Ue().int()});te({chatId:N(),unreadMentionCount:Ue().int()});te({chatId:N(),membershipKind:l_.nullable()});te({type:Pt("chat:message"),chatId:N()});const jF=te({chatCount:Ue().int().nonnegative(),unreadChatCount:Ue().int().nonnegative()});te({engagement:ib.default("active")});te({counts:U6(eb,jF)});const CF=te({type:Pt("workspace"),chatId:N().trim().min(1),agentId:N().trim().min(1),basePath:N().trim().optional(),path:N().trim().min(1)}),EF=te({basePath:N().trim().min(1)});te({agentId:N().trim().min(1),basePath:N().trim().optional(),path:N().trim().min(1)});te({ref:CF,path:N(),content:N()});ze(["connect","create_agent","completed"]);te({id:N(),name:N(),displayName:N(),role:ze(["admin","member"])});te({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:N().min(1).max(200)});te({dismissed:Mn().optional()});const NF=ze(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);te({event:NF,attrs:mn(N(),jh([N(),Ue(),Mn(),A6()])).optional()});te({id:N(),organizationId:N(),organizationName:N(),role:ze(["admin","member"]),agentId:N(),orgHasOtherMembers:Mn()});const _F={ADMIN:"admin",MEMBER:"member"},sb=ze(["admin","member"]),TF=te({id:N(),userId:N(),organizationId:N(),agentId:N(),role:sb,createdAt:N()});te({username:N().min(1).max(100),displayName:N().min(1).max(200),role:sb.default("member")});te({role:sb.optional(),displayName:N().min(1).max(200).optional()});TF.extend({username:N(),displayName:N(),password:N()});const AF=te({kind:Pt("github-app-installation"),installationId:Ue().int(),organizationId:N().min(1)}),RF=["mentioned","review_requested","assigned"],OF=ze(RF),MF=["opened","edited","closed","merged","reopened","commented","review_requested","reviewed","review_comment","synchronized","commit_commented","assigned","other"],o_=ze(MF),DF=te({type:Jv,repo:N().min(1),key:N().min(1),title:N().optional(),url:N().optional()}),zF=te({githubLogin:N().min(1),isBot:Mn()}),IF=te({githubLogin:N().min(1),reason:OF}),LF=te({title:N(),body:N(),url:N()}),PF=te({type:Pt("issue"),key:N().min(1)});te({source:AF,deliveryId:N().nullable(),rawEventType:N().min(1),rawAction:N().nullable(),entity:DF,actor:zF,kind:o_,involves:dt(IF),surface:LF,relatedRefs:dt(PF)});const UF=["mentioned","review_requested","assigned","subscribed"],BF=ze(UF);te({type:Pt("github_event"),reason:BF,event:N().min(1),action:N().nullable(),kind:o_,repository:N(),sender:N(),title:N(),body:N(),url:N(),entity:te({type:Jv,key:N().min(1),url:N().nullable()}),mentionedUser:N().optional()});const FF=ze(["agent_error","agent_blocked","agent_stale"]),u_=ze(["high","medium","low"]);te({id:N(),organizationId:N(),type:FF,severity:u_,agentId:N().nullable(),chatId:N().nullable(),message:N(),read:Mn(),createdAt:N()});te({limit:Eh().int().min(1).max(100).default(20),cursor:N().optional(),severity:u_.optional(),read:ze(["true","false"]).transform(e=>e==="true").optional(),agentId:N().optional()});te({next:N().max(256).optional()});te({code:N().min(1),state:N().min(1),installation_id:N().regex(/^\d+$/).optional(),setup_action:ze(["install","update","request"]).optional()});te({githubId:N().min(1),login:N().min(1),email:N().email().optional(),displayName:N().optional(),next:N().max(256).optional(),installationId:N().regex(/^\d+$/).optional(),installationAccountType:ze(["User","Organization"]).optional(),installationAccountLogin:N().min(1).optional(),installationAccountGithubId:N().regex(/^\d+$/).optional()});const $F=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function HF(e){return e.includes("://")?!1:$F.test(e)}const Th=N().min(1).superRefine((e,t)=>{if(HF(e))return;let n;try{n=new URL(e)}catch{t.addIssue({code:hs.custom,message:"Repo URL must be HTTPS, SSH (ssh://...), or scp-like (git@host:path)."});return}if(n.protocol!=="https:"&&n.protocol!=="ssh:"){t.addIssue({code:hs.custom,message:"Repo URL must use HTTPS or SSH."});return}if(n.password.length>0){t.addIssue({code:hs.custom,message:"Repo URL must not include credentials."});return}if(n.protocol==="https:"&&n.username.length>0){t.addIssue({code:hs.custom,message:"Repo URL must not include credentials."});return}}),qF=te({repo:Th.optional(),branch:N().default("main")}),ZF=te({repo:Th.nullish(),branch:N().min(1).nullish()}),GF=te({repo:N().optional(),branch:N().optional()}),VF=te({repos:dt(te({url:Th,defaultBranch:N().optional()})).default([])}),QF=te({repos:dt(te({url:Th,defaultBranch:N().min(1).optional()})).optional()}),KF=te({repos:dt(te({url:N(),defaultBranch:N().optional()}))}),YF={context_tree:{storage:qF,input:ZF,output:GF,readPolicy:"member"},source_repos:{storage:VF,input:QF,output:KF,readPolicy:"member"}},XF=Object.keys(YF);ze(XF);const c_=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;te({name:N().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=>!c_.test(e),"Name must not be a UUID format"),displayName:N().min(1).max(200),maxAgents:Ue().int().min(0).default(0),maxMessagesPerMinute:Ue().int().min(0).default(0),features:mn(N(),sn()).default({})});te({name:N().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=>!c_.test(e),"Name must not be a UUID format").optional(),displayName:N().min(1).max(200).optional(),maxAgents:Ue().int().min(0).optional(),maxMessagesPerMinute:Ue().int().min(0).optional(),features:mn(N(),sn()).optional()});te({id:N(),name:N(),displayName:N(),maxAgents:Ue(),maxMessagesPerMinute:Ue(),features:mn(N(),sn()),createdAt:N(),updatedAt:N()});const WF=te({workingCount:Ue().int().nonnegative(),errorMask:Mn()}),JF=te({type:Pt("pulse:tick"),organizationId:N(),agents:mn(N(),dt(WF).length(32))}),e9=te({label:N().min(1),description:N(),preview:N().nullable().optional()}),t9=te({question:N().min(1),header:N().min(1).max(24),options:dt(e9).min(2).max(4),multiSelect:Mn()}),n9=ze(["html","markdown"]).nullable(),r9=te({correlationId:N().min(1),questions:dt(t9).min(1).max(4),previewFormat:n9,allowFreeText:Mn()}),a9=te({correlationId:N().min(1),answers:mn(N().min(1),N())});te({answers:mn(N().min(1),N())});ze(["pending","answered","superseded"]);const i9=ze(["tool_call","error","assistant_text","thinking","turn_end","context_tree_usage"]),d_=te({toolUseId:N(),name:N(),args:sn(),status:ze(["pending","ok","error"]),durationMs:Ue().int().nonnegative().optional(),resultPreview:N().max(400).optional()}),f_=te({source:ze(["sdk","runtime","tool"]),message:N().max(2e3)}),h_=te({text:N().max(8e3)}),m_=te({}),p_=te({status:ze(["success","error"])}),g_=te({purpose:Pt("design_decision"),treeRepoUrl:N().nullable()}),s9=Ch("kind",[te({kind:Pt("tool_call"),payload:d_}),te({kind:Pt("error"),payload:f_}),te({kind:Pt("assistant_text"),payload:h_}),te({kind:Pt("thinking"),payload:m_}),te({kind:Pt("turn_end"),payload:p_}),te({kind:Pt("context_tree_usage"),payload:g_})]);te({id:N(),agentId:N(),chatId:N(),seq:Ue().int().positive(),kind:i9,payload:jh([d_,f_,h_,m_,p_,g_]),createdAt:N()});te({agentId:N(),chatId:N(),event:s9});te({type:Pt("session:reconcile"),agentId:N().min(1),chatIds:dt(N().min(1)).max(500)});te({type:Pt("session:reconcile:result"),agentId:N().min(1),staleChatIds:dt(N().min(1))});const l9=te({organizationId:N(),agentCount:Ue(),chatCount:Ue(),messageCount:Ue()});te({totalAgents:Ue(),totalChats:Ue(),totalMessages:Ue(),byOrganization:dt(l9)});const o9=ze(["active","suspended"]);te({id:N(),username:N(),displayName:N(),avatarUrl:N().nullable(),status:o9,createdAt:N(),updatedAt:N()});te({username:N().min(1).max(100),displayName:N().min(1).max(200),password:N().min(8).max(200)});te({displayName:N().min(1).max(200).optional(),password:N().min(8).max(200).optional()});te({type:Pt("auth"),token:N().min(1)});const u9=te({wsInboxDeliver:Mn().default(!1)}).partial();te({type:Pt("server:welcome"),serverCommandVersion:N().min(1),serverTimeMs:Ue().int().nonnegative(),capabilities:u9.optional()}).passthrough();const y_=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function c9(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 d9=2e3,f9=3e4;let ns=null,pc=!1,eh=0,ec=null;const By=new Set;let Kn=null,Zs=0;const tk=500;let gg=0,so=null;function nk(e){const t=Date.now(),n=t-gg;if(n>=tk){gg=t,e.invalidateQueries({queryKey:["me","chats"]});return}so===null&&(so=setTimeout(()=>{so=null,gg=Date.now(),Kn&&Kn.invalidateQueries({queryKey:["me","chats"]})},tk-n))}function h9(e){for(const t of By)try{t(e)}catch{}if(Kn){if(e.type==="notification")Kn.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Kn.invalidateQueries({queryKey:["activity"]}),Kn.invalidateQueries({queryKey:["sessions"]}),nk(Kn);else if(e.type==="session:event")nk(Kn);else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;Kn.invalidateQueries({queryKey:["me","chats"]}),t&&(Kn.invalidateQueries({queryKey:["chat-messages",t]}),Kn.invalidateQueries({queryKey:["chat-detail",t]}))}}}function lb(){const e=zc();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);ns=s,s.onmessage=o=>{if(s===ns)try{const c=JSON.parse(o.data);h9(c)}catch{}},s.onopen=()=>{s===ns&&(eh=0,Kn&&(Kn.invalidateQueries({queryKey:["notifications"]}),Kn.invalidateQueries({queryKey:["activity"]}),Kn.invalidateQueries({queryKey:["sessions"]}),Kn.invalidateQueries({queryKey:["me","chats"]})))},s.onclose=o=>{if(s===ns&&(ns=null,!(pc||Zs===0))){if(o.code===4001){OM().then(c=>{pc||Zs===0||(c?(eh=0,lb()):rk())});return}rk()}}}function rk(){eh++;const e=Math.min(d9*2**(eh-1),f9);ec=setTimeout(()=>{ec=null,!pc&&Zs>0&&lb()},e)}function m9(){pc=!0,ec&&(clearTimeout(ec),ec=null),so&&(clearTimeout(so),so=null),ns&&(ns.close(1e3,"unmount"),ns=null)}function v_(e){const{onMessage:t,enabled:n=!0}=e??{},a=vn(),s=b.useRef(t);s.current=t,b.useEffect(()=>{Kn=a},[a]),b.useEffect(()=>{if(!n)return;const o=c=>{var f;return(f=s.current)==null?void 0:f.call(s,c)};return By.add(o),Zs++,Zs===1&&(pc=!1,lb()),()=>{By.delete(o),Zs--,Zs===0&&m9()}},[n])}const p9=b.createContext({aggregated:y_,agents:{},receivedAtMs:null,stale:!0});function g9({children:e}){const[t,n]=b.useState({aggregated:y_,agents:{},receivedAtMs:null}),[a,s]=b.useState(()=>Date.now());v_({onMessage:c=>{const f=JF.safeParse(c);f.success&&n({aggregated:c9(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),b.useEffect(()=>{const c=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(c)},[]);const o=b.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return l.jsx(p9.Provider,{value:o,children:e})}function gc(e){return je.get(`/agents/${e}/config`)}function Ah(e,t){return je.patch(`/agents/${e}/config`,t)}function y9(e,t){return je.post(`/agents/${e}/config/dry-run`,{payload:t})}function v9(e){return je.get(`/agents/${e}/client-status`)}function b9({className:e,style:t,...n}){return l.jsx("div",{className:Oe("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function x9({onClick:e,children:t}){return l.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 w9(){return l.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function S9({children:e,mono:t}){return l.jsx("span",{className:Oe("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const k9={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 fr({tone:e="neutral",className:t,style:n,...a}){const s=k9[e],o={background:s.bg,color:s.fg,border:`var(--hairline) solid ${s.bd}`,...n};return l.jsx("span",{className:Oe("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 Fy({children:e,right:t,className:n,style:a,...s}){return l.jsxs("div",{className:Oe("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:[l.jsx("span",{children:e}),t]})}function ob({className:e,style:t,...n}){return l.jsx("span",{className:Oe("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function tc({state:e,size:t=8,className:n}){const a={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?l.jsxs("span",{className:Oe("shrink-0",n),style:a,role:"img","aria-label":"working",children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),l.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"?l.jsx("span",{className:Oe("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:l.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?l.jsx("span",{className:Oe("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"?l.jsx("span",{className:Oe("shrink-0",n),style:{...a,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):l.jsx("span",{className:Oe("shrink-0",n),style:{...a,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function j9(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function yc({state:e,className:t}){const n=e!==null&&j9(e)?e:"offline",a=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return l.jsxs("span",{className:Oe("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:a},children:[l.jsx(tc,{state:n,size:7}),n]})}function kf({label:e,value:t,accent:n}){return l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",cursor:"default"},children:[l.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),l.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:"var(--sp-px)"},children:t})]})}function C9(e,t,n){return e?n==="admin"||!!t&&e.managerId===t:!1}function E9(e){var t;return e.agentStatus!=="active"?{disabled:!0,title:"Only active agents can be tested."}:e.clientStatusLoading?{disabled:!0,title:"Checking the bound computer before testing."}:(t=e.clientStatus)!=null&&t.clientId?e.clientStatus.online?e.testPending?{disabled:!0,title:"Test in progress."}:{disabled:!1,title:"Send a test message to verify this agent can respond."}:{disabled:!0,title:"The bound computer is offline."}:{disabled:!0,title:"Bind a computer before testing this agent."}}function ak(e){return e.status==="connected"}var N9="Label",b_=b.forwardRef((e,t)=>l.jsx(vi.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())}}));b_.displayName=N9;var _9=b_;const mt=b.forwardRef(({className:e,...t},n)=>l.jsx(_9,{ref:n,className:Oe("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));mt.displayName="Label";const Yn=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:Oe("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));Yn.displayName="Panel";const za=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:Oe("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}));za.displayName="PanelHeader";const Ia=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:Oe("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));Ia.displayName="PanelTitle";const Vr=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:Oe(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));Vr.displayName="PanelBody";const jf=256,T9="image/png,image/jpeg,image/webp";function A9(e){var t;return((t=e.trim()[0])==null?void 0:t.toUpperCase())??"?"}function $y({agent:e,size:t}){return e.avatarImageUrl?l.jsx("img",{src:e.avatarImageUrl,alt:e.displayName,width:t,height:t,style:{width:t,height:t,borderRadius:"50%",objectFit:"cover",display:"block"}}):l.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:t,height:t,borderRadius:"50%",background:Fc(e.avatarColorToken,e.uuid),color:"var(--fg-on-vivid)",fontSize:Math.round(t*.42),fontWeight:700,lineHeight:1,letterSpacing:"-0.02em",userSelect:"none"},children:A9(e.displayName)})}function R9({agent:e,canEdit:t=!0,onSave:n,onRefresh:a}){const[s,o]=b.useState(!1),c=typeof e.avatarColorToken=="string"&&e.avatarColorToken.length>0?e.avatarColorToken:"auto";return l.jsxs(Yn,{children:[l.jsxs(za,{children:[l.jsx(Ia,{children:"Appearance"}),t&&e.status==="active"&&l.jsxs(be,{size:"xs",variant:"outline",onClick:()=>o(!0),children:[l.jsx(hh,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Vr,{className:"text-body",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx($y,{agent:e,size:48}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-body",children:"Color"}),l.jsx("span",{className:"mono text-caption text-muted-foreground",children:c})]}),l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-body",children:"Image"}),l.jsx("span",{className:"mono text-caption text-muted-foreground",children:e.avatarImageUrl?"custom":"none"})]})]})]})}),t&&l.jsx(M9,{agent:e,open:s,onOpenChange:o,onSave:n,onRefresh:a})]})}async function O9(e){const t=URL.createObjectURL(e);try{const n=await new Promise((h,p)=>{const g=new Image;g.onload=()=>h(g),g.onerror=()=>p(new Error("Unable to decode the selected image.")),g.src=t}),a=Math.min(n.naturalWidth,n.naturalHeight),s=Math.max(0,Math.round((n.naturalWidth-a)/2)),o=Math.max(0,Math.round((n.naturalHeight-a)/2)),c=document.createElement("canvas");c.width=jf,c.height=jf;const f=c.getContext("2d");if(!f)throw new Error("Canvas 2D context is unavailable in this browser.");f.drawImage(n,s,o,a,a,0,0,jf,jf);const m=await new Promise(h=>c.toBlob(p=>h(p),"image/webp",.85));if(!m)throw new Error("Failed to encode resized image to WEBP.");return m}finally{URL.revokeObjectURL(t)}}function M9({agent:e,open:t,onOpenChange:n,onSave:a,onRefresh:s}){const o=Iy.find(D=>D===e.avatarColorToken)??null,[c,f]=b.useState(o),[m,h]=b.useState(!1),[p,g]=b.useState(!1),[w,x]=b.useState(null),k=b.useRef(null);b.useEffect(()=>{t&&(f(o),x(null))},[t,o]);async function j(D){D.preventDefault(),x(null),h(!0);try{await a({avatarColorToken:c}),n(!1)}catch(I){x(I instanceof Error?I.message:String(I))}finally{h(!1)}}async function C(D){var R;const I=(R=D.target.files)==null?void 0:R[0];if(k.current&&(k.current.value=""),!!I){x(null),g(!0);try{const B=await O9(I);await C4(e.uuid,B),await(s==null?void 0:s())}catch(B){x(B instanceof Error?B.message:String(B))}finally{g(!1)}}}async function E(){x(null),g(!0);try{await E4(e.uuid),await(s==null?void 0:s())}catch(D){x(D instanceof Error?D.message:String(D))}finally{g(!1)}}const T={...e,avatarColorToken:c},O=!!e.avatarImageUrl;return l.jsx(_n,{open:t,onOpenChange:n,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:"Edit Appearance"})}),l.jsxs("form",{onSubmit:j,className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx($y,{agent:T,size:64}),l.jsx($y,{agent:T,size:32}),l.jsx("span",{className:"text-caption text-muted-foreground",children:"Preview at 64 / 32 px"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Image"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("input",{ref:k,type:"file",accept:T9,onChange:C,style:{display:"none"}}),l.jsx(be,{type:"button",variant:"outline",size:"sm",onClick:()=>{var D;return(D=k.current)==null?void 0:D.click()},disabled:p||m,children:p?"Uploading…":O?"Replace image":"Upload image"}),O&&l.jsx(be,{type:"button",variant:"ghost",size:"sm",onClick:E,disabled:p||m,children:"Remove image"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"PNG / JPEG / WEBP. The browser crops to a square and resizes to 256 × 256 WEBP before upload. An image takes precedence over the color below."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Color"}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(ik,{label:"Auto",selected:c===null,onClick:()=>f(null),background:Fc(null,e.uuid),isAuto:!0}),Iy.map(D=>l.jsx(ik,{label:D,selected:c===D,onClick:()=>f(D),background:`var(--avatar-${D})`},D))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:`"Auto" falls back to a hash of the agent's id, matching the legacy default. The color is used as the background under the initial when no image is set.`})]}),w&&l.jsx("p",{className:"text-body text-destructive",children:w}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:m||p,children:"Cancel"}),l.jsx(be,{type:"submit",disabled:m||p,children:m?"Saving…":"Save"})]})]})]})})}function ik({label:e,selected:t,onClick:n,background:a,isAuto:s}){return l.jsx("button",{type:"button",onClick:n,"aria-pressed":t,title:e,style:{position:"relative",width:32,height:32,borderRadius:"50%",background:a,border:t?"var(--hairline-bold) solid var(--fg)":"var(--hairline) solid var(--border)",cursor:"pointer",padding:0,outline:"none",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:s&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",inset:4,borderRadius:"50%",background:"var(--bg-raised)",color:"var(--fg-3)",fontSize:10,fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:"A"})})}function D9({runtimeLabel:e,computerLabel:t,visible:n=!0}){return n?l.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:l.jsxs("div",{className:"mono text-caption flex items-center gap-2",style:{color:"var(--fg-3)"},children:[l.jsxs("span",{children:["Runs on ",l.jsx("span",{style:{color:"var(--fg-2)"},children:e})]}),t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"@"}),l.jsx("span",{style:{color:"var(--fg-2)"},children:t})]})]})}):null}function z9(e){const{agent:t}=e,[n,a]=b.useState(!1),[s,o]=b.useState(!1),c=t.displayName||t.name||t.uuid,f=t.status==="suspended";return l.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:[l.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[l.jsx(Ic,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),l.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),l.jsxs("div",{children:[t.status==="active"?l.jsx(yg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:l.jsx(be,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):l.jsx(yg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:l.jsx(be,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),l.jsx(yg,{title:"Delete agent",body:f?"Permanent. Configuration, bindings, tokens, and session history are all dropped.":"Suspend this agent before deleting it.",action:l.jsxs(be,{variant:"destructive",size:"xs",onClick:()=>{f&&a(!0)},disabled:e.deletePending||!f,title:f?void 0:"Suspend this agent before deleting it",children:[l.jsx(Zf,{className:"h-3 w-3"}),"Delete"]})})]}),e.errorMessage&&l.jsx("div",{className:"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)",color:"var(--state-error)"},children:e.errorMessage}),l.jsx(I9,{open:s,onOpenChange:o,label:c,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),l.jsx(L9,{open:n,onOpenChange:a,expected:c,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function yg(e){return l.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:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),l.jsx("div",{children:e.action})]})}function I9({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsxs(Tn,{children:['Suspend "',n,'"?']})}),l.jsx("div",{className:"space-y-3",children:l.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."})}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(be,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function L9({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[o,c]=b.useState("");function f(m){m.preventDefault(),o===n&&a()}return l.jsx(_n,{open:e,onOpenChange:m=>{t(m),m||c("")},children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsxs(Tn,{children:['Delete "',n,'"?']})}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",l.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),l.jsx(Kt,{value:o,onChange:m=>c(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(be,{type:"submit",variant:"destructive",disabled:o!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}const P9={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 ub({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const c=P9[e],f=e==="deleted";return l.jsxs("div",{className:Oe("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:[l.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),c.label&&l.jsx("span",{className:Oe("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",c.tone),children:c.label}),!o&&(f?l.jsxs(be,{size:"sm",variant:"ghost",onClick:a,children:[l.jsx(JD,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):l.jsxs("div",{className:"flex gap-1 shrink-0",children:[l.jsxs(be,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[l.jsx(hh,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Edit"})]}),l.jsxs(be,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[l.jsx(Zf,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function U9(e){var f;const[t,n]=b.useState(null),[a,s]=b.useState(()=>new Set),o=m=>s(h=>{const p=new Set(h);return p.has(m)?p.delete(m):p.add(m),p}),c=e.items.filter(m=>m.status!=="deleted").length;return l.jsxs(Yn,{children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["Environment variables (",c,")"]}),!e.disabled&&l.jsxs(be,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(Sa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Vr,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(m=>{const h=m.value.sensitive,p=m.value.value===mc,g=h&&!p&&!!m.value.value,w=a.has(m.key);let x;return h?g&&w?x=m.value.value:x="••••••":x=m.value.value||l.jsx("em",{children:"(empty)"}),l.jsxs(ub,{status:m.status,onEdit:()=>n({mode:"edit",key:m.key,initial:m.value}),onDelete:()=>e.onDelete(m.key),onUndo:()=>e.onUndoDelete(m.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono font-medium",children:m.value.key}),l.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:x}),h&&l.jsx(fh,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),h&&l.jsx("button",{type:"button",onClick:()=>g&&o(m.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:g?w?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":w?"Hide value":"Reveal value",disabled:!g,style:{padding:0,opacity:g?1:.4},children:w?l.jsx(CD,{className:"h-3.5 w-3.5"}):l.jsx(qC,{className:"h-3.5 w-3.5"})})]},m.key)})}),t&&l.jsx($9,{open:!!t,onOpenChange:m=>!m&&n(null),initial:t.mode==="edit"?t.initial:null,allowKeepExisting:t.mode==="edit"&&B9(t.initial,(f=e.items.find(m=>m.key===t.key))==null?void 0:f.status),forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:m=>{t.mode==="edit"?e.onUpdate(t.key,m):e.onAdd(m),n(null)}})]})}function B9(e,t){return e.sensitive&&e.value===mc&&t!==void 0&&t!=="added"}function sk(e,t){return!e||t?"":e.value}function F9(e){return e.sensitive&&e.allowKeepExisting&&!e.value?{ok:!0,value:mc}:e.sensitive&&!e.value?{ok:!1,error:"Value is required for sensitive entries."}:{ok:!0,value:e.value}}function $9({open:e,onOpenChange:t,initial:n,allowKeepExisting:a,forbiddenKeys:s,onSubmit:o}){const[c,f]=b.useState((n==null?void 0:n.key)??""),[m,h]=b.useState(sk(n,a)),[p,g]=b.useState((n==null?void 0:n.sensitive)??!1),[w,x]=b.useState(null);b.useEffect(()=>{e&&(f((n==null?void 0:n.key)??""),h(sk(n,a)),g((n==null?void 0:n.sensitive)??!1),x(null))},[e,n,a]);function k(j){if(j.preventDefault(),!c.match(/^[A-Z][A-Z0-9_]*$/)){x("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(s.has(c)){x(`Another entry already uses key "${c}".`);return}const C=F9({value:m,sensitive:p,allowKeepExisting:a});if(!C.ok){x(C.error);return}if(!p&&!n&&!m){x("Value is required for non-sensitive entries.");return}o({key:c,value:C.value,sensitive:p})}return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:n?"Edit environment variable":"Add environment variable"})}),l.jsxs("form",{onSubmit:k,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"env-key",children:"Key"}),l.jsx(Kt,{id:"env-key",value:c,onChange:j=>f(j.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&l.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"env-value",children:"Value"}),l.jsx(Kt,{id:"env-value",type:p?"password":"text",autoComplete:"new-password",value:m,onChange:j=>h(j.target.value),placeholder:a?"Leave empty to keep existing value":p?"new secret":"value",className:"font-mono"})]}),l.jsxs("label",{className:"flex items-center gap-2 text-body",children:[l.jsx("input",{type:"checkbox",checked:p,onChange:j=>g(j.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),l.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."}),w&&l.jsx("p",{className:"text-body text-destructive",children:w}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(be,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function H9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(Yn,{children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["Git repositories (",a,")"]}),!e.disabled&&l.jsxs(be,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(Sa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Vr,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(s=>{const o=s.value.localPath??Wf(s.value.url);return l.jsxs(ub,{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:[l.jsx("span",{className:"font-mono text-caption",children:s.value.url}),s.value.ref&&l.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",s.value.ref]}),l.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",o||"./"]})]},s.key)})}),t&&l.jsx(q9,{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 q9({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.url)??""),[f,m]=b.useState((n==null?void 0:n.ref)??""),[h,p]=b.useState((n==null?void 0:n.localPath)??""),[g,w]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),p((n==null?void 0:n.localPath)??""),w(null))},[e,n]);function x(k){k.preventDefault();const j=o.trim();if(!j){w("URL is required.");return}const C=h.trim()||Wf(j);if(C&&a.has(C)){w(`Another repo already occupies local path "${C}".`);return}const E={url:j,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(E)}return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:n?"Edit Git repository":"Add Git repository"})}),l.jsxs("form",{onSubmit:x,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"git-url",children:"URL"}),l.jsx(Kt,{id:"git-url",value:o,onChange:k=>c(k.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),l.jsx(Kt,{id:"git-ref",value:f,onChange:k=>m(k.target.value),placeholder:"main",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"git-path",children:"Local path (optional)"}),l.jsx(Kt,{id:"git-path",value:h,onChange:k=>p(k.target.value),placeholder:Wf(o)||"repo-name",className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(be,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function x_({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 l.jsx("span",{className:Oe("mono text-label",o),style:{color:"var(--fg-4)",...c},title:f,children:s});const p=f??(m&&h?`${t} (@${e})`:h?t:`@${e}`),g=a==="accent"?"var(--accent-dim)":void 0,w=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?l.jsxs("span",{className:Oe("inline-flex flex-col leading-tight",o),style:{gap:1,...c},title:p??void 0,children:[h&&l.jsx("span",{className:"text-body",style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:w},children:["@",e]})]}):l.jsxs("span",{className:Oe("inline-flex items-baseline gap-1.5",o),style:c,title:p??void 0,children:[h&&l.jsx("span",{style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:w},children:["@",e]})]})}function cb(){return je.get(hn("/members"))}function Z9(e,t){return je.patch(hn(`/members/${encodeURIComponent(e)}`),t)}function G9(e){return je.delete(hn(`/members/${encodeURIComponent(e)}`))}function w_(){const{data:e}=Xe({queryKey:["members","name-map"],queryFn:cb,staleTime:3e4});return b.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 V9({agent:e,canEdit:t=!0,onSave:n}){const[a,s]=b.useState(!1),o=$v(),c=w_(),f=e.metadata,m=f==null?void 0:f.tree,h=typeof(m==null?void 0:m.role)=="string"?m.role:null,p=Array.isArray(m==null?void 0:m.domains)?(m==null?void 0:m.domains).filter(x=>typeof x=="string"):[],g=e.managerId?c(e.managerId):null,w=e.delegateMention?o(e.delegateMention):null;return l.jsxs(Yn,{children:[l.jsxs(za,{children:[l.jsx(Ia,{children:"Profile"}),t&&e.status==="active"&&l.jsxs(be,{size:"xs",variant:"outline",onClick:()=>s(!0),children:[l.jsx(hh,{className:"h-3 w-3"})," Edit"]})]}),l.jsxs(Vr,{className:"text-body space-y-1",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&l.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),w&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),l.jsxs("span",{className:"text-muted-foreground",children:["delegate ",l.jsx(x_,{name:w.name,displayName:w.displayName})]})]})]}),l.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[l.jsxs("span",{children:["owner ",l.jsx("span",{className:"text-foreground",children:g??"—"})]}),h&&l.jsxs("span",{children:["role ",l.jsx("span",{className:"text-foreground",children:h})]}),l.jsxs("span",{children:["type ",l.jsx(fr,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),l.jsxs("span",{children:["visibility"," ",l.jsx(fr,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),p.length>0&&l.jsxs("span",{children:["domains"," ",l.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:p.map(x=>l.jsx(fr,{tone:"outline",children:x},x))})]})]})]}),t&&l.jsx(Q9,{agent:e,open:a,onOpenChange:s,onSave:n})]})}function Q9({agent:e,open:t,onOpenChange:n,onSave:a}){var D;const{memberId:s,role:o}=ct(),[c,f]=b.useState(e.displayName),[m,h]=b.useState(e.delegateMention??""),[p,g]=b.useState(e.visibility),[w,x]=b.useState(!1),[k,j]=b.useState(null);b.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),g(e.visibility),j(null))},[t,e]);const C=e.type==="human",E=o==="admin"||e.managerId===s,T=Xe({queryKey:["agents-for-delegate"],queryFn:async()=>(await Uc({limit:100})).items.filter(R=>R.type==="personal_assistant"&&R.status==="active"),enabled:t&&C});async function O(I){I.preventDefault(),j(null);const R=c.trim();if(!R){j("Display name is required.");return}x(!0);try{const B={displayName:R,delegateMention:m||null};p!==e.visibility&&(B.visibility=p),await a(B),n(!1)}catch(B){j(B instanceof Error?B.message:String(B))}finally{x(!1)}}return l.jsx(_n,{open:t,onOpenChange:n,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:"Edit Identity"})}),l.jsxs("form",{onSubmit:O,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Agent name"}),l.jsx(Kt,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"id-display",children:"Display Name"}),l.jsx(Kt,{id:"id-display",value:c,onChange:I=>f(I.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"id-visibility",children:"Visibility"}),l.jsxs("select",{id:"id-visibility",value:p,onChange:I=>g(I.target.value),disabled:!E,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:[l.jsx("option",{value:ek.PRIVATE,children:"Private — only the manager"}),l.jsx("option",{value:ek.ORGANIZATION,children:"Organization — all members"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:E?"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."})]}),C&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"id-delegate",children:"Delegate Mention"}),l.jsxs("select",{id:"id-delegate",value:m,onChange:I=>h(I.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:[l.jsx("option",{value:"",children:"None"}),(D=T.data)==null?void 0:D.map(I=>l.jsx("option",{value:I.uuid,children:I.displayName?`${I.displayName} (@${I.name??I.uuid})`:I.name?`@${I.name}`:I.uuid},I.uuid))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),k&&l.jsx("p",{className:"text-body text-destructive",children:k}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:w,children:"Cancel"}),l.jsx(be,{type:"submit",disabled:w,children:w?"Saving…":"Save"})]})]})]})})}function K9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function Y9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(Yn,{children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["MCP servers (",a,")"]}),!e.disabled&&l.jsxs(be,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(Sa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Vr,{className:"space-y-2",children:e.items.length===0?l.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=e.toolHealth?s.status==="deleted"?"unknown":e.toolHealth(s.value.name):null;return l.jsxs(ub,{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:[l.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:s.value.transport}),l.jsx("span",{className:"font-medium font-mono",children:s.value.name}),o&&l.jsx(fr,{tone:K9(o),children:o}),l.jsx("span",{className:"text-caption text-muted-foreground truncate",children:X9(s.value)})]},s.key)})}),t&&l.jsx(e$,{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 X9(e){var t;if(e.transport==="stdio"){const n=(t=e.args)!=null&&t.length?` ${e.args.map(a=>/[\s"']/.test(a)?JSON.stringify(a):a).join(" ")}`:"";return`${e.command}${n}`}return e.url}function lk(e){return e!=null&&e.length?JSON.stringify(e,null,2):""}function W9(e){const t=e.trim();if(!t)return{ok:!0,value:void 0};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:"Args must be a JSON array of strings."}}return!Array.isArray(n)||n.some(a=>typeof a!="string")?{ok:!1,error:"Args must be a JSON array of strings."}:{ok:!0,value:n}}function ok(e){return e&&Object.keys(e).length>0?JSON.stringify(e,null,2):""}function J9(e){const t=e.trim();if(!t)return{ok:!0,value:void 0};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:"Headers must be a JSON object with string values."}}if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1,error:"Headers must be a JSON object with string values."};const a=Object.entries(n);return a.some(([s,o])=>!s||typeof o!="string")?{ok:!1,error:"Headers must be a JSON object with string values."}:{ok:!0,value:a.length>0?Object.fromEntries(a):void 0}}function e$({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[o,c]=b.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=b.useState((n==null?void 0:n.name)??""),[h,p]=b.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,w]=b.useState(lk((n==null?void 0:n.transport)==="stdio"?n.args:void 0)),[x,k]=b.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[j,C]=b.useState(ok(n&&(n.transport==="http"||n.transport==="sse")?n.headers:void 0)),[E,T]=b.useState(null);b.useEffect(()=>{e&&(c((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),p((n==null?void 0:n.transport)==="stdio"?n.command:""),w(lk((n==null?void 0:n.transport)==="stdio"?n.args:void 0)),k(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),C(ok(n&&(n.transport==="http"||n.transport==="sse")?n.headers:void 0)),T(null))},[e,n]);function O(D){if(D.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){T("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){T(`Another MCP server is already named "${f}".`);return}let I;if(o==="stdio"){if(!h.trim()){T("stdio transport requires a command.");return}const R=W9(g);if(!R.ok){T(R.error);return}I={name:f,transport:"stdio",command:h.trim(),...R.value?{args:R.value}:{}}}else{const R=x.trim();try{new URL(R)}catch{T("URL is not valid.");return}const B=J9(j);if(!B.ok){T(B.error);return}I={name:f,transport:o,url:R,...B.value?{headers:B.value}:{}}}s(I)}return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:n?"Edit MCP server":"Add MCP server"})}),l.jsxs("form",{onSubmit:O,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-transport",children:"Transport"}),l.jsxs("select",{id:"mcp-transport",value:o,onChange:D=>c(D.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:[l.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),l.jsx("option",{value:"http",children:"http"}),l.jsx("option",{value:"sse",children:"sse"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-name",children:"Name"}),l.jsx(Kt,{id:"mcp-name",value:f,onChange:D=>m(D.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-command",children:"Command"}),l.jsx(Kt,{id:"mcp-command",value:h,onChange:D=>p(D.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-args",children:"Args (JSON array, optional)"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Each arg as a separate JSON string. Use this when an arg contains spaces or quotes."}),l.jsx("textarea",{id:"mcp-args",value:g,onChange:D=>w(D.target.value),placeholder:'["--port", "3000"]',className:"flex min-h-24 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body font-mono shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-url",children:"URL"}),l.jsx(Kt,{id:"mcp-url",value:x,onChange:D=>k(D.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-headers",children:"Headers (JSON object, optional)"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"JSON object of request headers, for example auth headers required by the MCP server."}),l.jsx("textarea",{id:"mcp-headers",value:j,onChange:D=>C(D.target.value),placeholder:'{"Authorization": "Bearer ..."}',className:"flex min-h-24 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body font-mono shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"})]})]}),E&&l.jsx("p",{className:"text-body text-destructive",children:E}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(be,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const t$=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],n$=[{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"}],r$={"claude-code":t$,codex:n$},a$={"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."},i$={value:"",label:"(unset — inherits local)"};function s$({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const c=e!==t,f=r$[o],m=b.useMemo(()=>{const h=[i$,...f];return e!==""&&!f.some(p=>p.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return l.jsxs(Yn,{style:{borderColor:c?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["Model",c&&l.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&&l.jsx(be,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),l.jsxs(Vr,{className:"space-y-2",children:[l.jsx(l$,{items:m,value:e,onChange:n,disabled:s}),l.jsx("p",{className:"text-caption text-muted-foreground",children:a$[o]})]})]})}function l$({items:e,value:t,onChange:n,disabled:a}){const[s,o]=b.useState(!1),[c,f]=b.useState(null),m=b.useRef(null),h=b.useRef(null),p=e.find(w=>w.value===t)??e[0],g=b.useCallback(()=>{const w=m.current;if(!w)return;const x=w.getBoundingClientRect();f({top:x.bottom+4,left:x.left,width:x.width})},[]);return b.useLayoutEffect(()=>{s&&g()},[s,g]),b.useEffect(()=>{if(!s)return;const w=j=>{var E,T;const C=j.target;(E=m.current)!=null&&E.contains(C)||(T=h.current)!=null&&T.contains(C)||o(!1)},x=j=>{var C;j.key==="Escape"&&(o(!1),(C=m.current)==null||C.focus())},k=()=>g();return document.addEventListener("pointerdown",w),document.addEventListener("keydown",x),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{document.removeEventListener("pointerdown",w),document.removeEventListener("keydown",x),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[s,g]),l.jsxs("div",{className:"max-w-md",children:[l.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(w=>!w),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:[l.jsx("span",{className:"truncate",style:{color:(p==null?void 0:p.value)===""?"var(--fg-3)":void 0},children:(p==null?void 0:p.label)??t}),l.jsx(_v,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&c&&zv.createPortal(l.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(w=>{const x=w.value===t;return l.jsxs("button",{type:"button",onClick:()=>{n(w.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:x?"var(--bg-hover)":void 0,color:w.value===""?"var(--fg-3)":void 0},children:[l.jsx(hr,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:x?"visible":"hidden",color:"var(--state-idle)"}}),l.jsx("span",{className:"flex-1 truncate",children:w.label}),w.hint&&l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:w.hint})]},w.value||"__unset")})}),document.body)]})}function o$(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const u$=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c$=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,d$={};function uk(e,t){return(d$.jsx?c$:u$).test(e)}const f$=/[ \t\n\f\r]/g;function h$(e){return typeof e=="object"?e.type==="text"?ck(e.value):!1:ck(e)}function ck(e){return e.replace(f$,"")===""}class Hc{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}Hc.prototype.normal={};Hc.prototype.property={};Hc.prototype.space=void 0;function S_(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new Hc(n,a,t)}function Hy(e){return e.toLowerCase()}class Dr{constructor(t,n){this.attribute=n,this.property=t}}Dr.prototype.attribute="";Dr.prototype.booleanish=!1;Dr.prototype.boolean=!1;Dr.prototype.commaOrSpaceSeparated=!1;Dr.prototype.commaSeparated=!1;Dr.prototype.defined=!1;Dr.prototype.mustUseProperty=!1;Dr.prototype.number=!1;Dr.prototype.overloadedBoolean=!1;Dr.prototype.property="";Dr.prototype.spaceSeparated=!1;Dr.prototype.space=void 0;let m$=0;const at=ul(),Cn=ul(),qy=ul(),we=ul(),Zt=ul(),lo=ul(),$r=ul();function ul(){return 2**++m$}const Zy=Object.freeze(Object.defineProperty({__proto__:null,boolean:at,booleanish:Cn,commaOrSpaceSeparated:$r,commaSeparated:lo,number:we,overloadedBoolean:qy,spaceSeparated:Zt},Symbol.toStringTag,{value:"Module"})),vg=Object.keys(Zy);class db extends Dr{constructor(t,n,a,s){let o=-1;if(super(t,n),dk(this,"space",s),typeof a=="number")for(;++o<vg.length;){const c=vg[o];dk(this,vg[o],(a&Zy[c])===Zy[c])}}}db.prototype.defined=!0;function dk(e,t,n){n&&(e[t]=n)}function Do(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new db(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[Hy(a)]=a,n[Hy(o.attribute)]=a}return new Hc(t,n,e.space)}const k_=Do({properties:{ariaActiveDescendant:null,ariaAtomic:Cn,ariaAutoComplete:null,ariaBusy:Cn,ariaChecked:Cn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Zt,ariaCurrent:null,ariaDescribedBy:Zt,ariaDetails:null,ariaDisabled:Cn,ariaDropEffect:Zt,ariaErrorMessage:null,ariaExpanded:Cn,ariaFlowTo:Zt,ariaGrabbed:Cn,ariaHasPopup:null,ariaHidden:Cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Zt,ariaLevel:we,ariaLive:null,ariaModal:Cn,ariaMultiLine:Cn,ariaMultiSelectable:Cn,ariaOrientation:null,ariaOwns:Zt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:Cn,ariaReadOnly:Cn,ariaRelevant:null,ariaRequired:Cn,ariaRoleDescription:Zt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:Cn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function j_(e,t){return t in e?e[t]:t}function C_(e,t){return j_(e,t.toLowerCase())}const p$=Do({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:lo,acceptCharset:Zt,accessKey:Zt,action:null,allow:null,allowFullScreen:at,allowPaymentRequest:at,allowUserMedia:at,alt:null,as:null,async:at,autoCapitalize:null,autoComplete:Zt,autoFocus:at,autoPlay:at,blocking:Zt,capture:null,charSet:null,checked:at,cite:null,className:Zt,cols:we,colSpan:null,content:null,contentEditable:Cn,controls:at,controlsList:Zt,coords:we|lo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:at,defer:at,dir:null,dirName:null,disabled:at,download:qy,draggable:Cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:at,formTarget:null,headers:Zt,height:we,hidden:qy,high:we,href:null,hrefLang:null,htmlFor:Zt,httpEquiv:Zt,id:null,imageSizes:null,imageSrcSet:null,inert:at,inputMode:null,integrity:null,is:null,isMap:at,itemId:null,itemProp:Zt,itemRef:Zt,itemScope:at,itemType:Zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:at,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:at,muted:at,name:null,nonce:null,noModule:at,noValidate:at,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:at,optimum:we,pattern:null,ping:Zt,placeholder:null,playsInline:at,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:at,referrerPolicy:null,rel:Zt,required:at,reversed:at,rows:we,rowSpan:we,sandbox:Zt,scope:null,scoped:at,seamless:at,selected:at,shadowRootClonable:at,shadowRootDelegatesFocus:at,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:Cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:at,useMap:null,value:Cn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Zt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:at,declare:at,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:at,noHref:at,noShade:at,noWrap:at,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:Cn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:at,disableRemotePlayback:at,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:C_}),g$=Do({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:$r,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Zt,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:at,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:lo,g2:lo,glyphName:lo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:$r,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$r,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$r,rev:$r,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$r,requiredFeatures:$r,requiredFonts:$r,requiredFormats:$r,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:$r,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$r,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$r,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:j_}),E_=Do({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_=Do({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:C_}),__=Do({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),y$={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"},v$=/[A-Z]/g,fk=/-[a-z]/g,b$=/^data[-\w.:]+$/i;function x$(e,t){const n=Hy(t);let a=t,s=Dr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&b$.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(fk,S$);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!fk.test(o)){let c=o.replace(v$,w$);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}s=db}return new s(a,t)}function w$(e){return"-"+e.toLowerCase()}function S$(e){return e.charAt(1).toUpperCase()}const k$=S_([k_,p$,E_,N_,__],"html"),fb=S_([k_,g$,E_,N_,__],"svg");function j$(e){return e.join(" ").trim()}var Gl={},bg,hk;function C$(){if(hk)return bg;hk=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=`
|
|
383
|
+
`,h="/",p="*",g="",w="comment",x="declaration";function k(C,E){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];E=E||{};var T=1,O=1;function D(Y){var X=Y.match(t);X&&(T+=X.length);var G=Y.lastIndexOf(m);O=~G?Y.length-G:O+Y.length}function I(){var Y={line:T,column:O};return function(X){return X.position=new R(Y),ee(),X}}function R(Y){this.start=Y,this.end={line:T,column:O},this.source=E.source}R.prototype.content=C;function B(Y){var X=new Error(E.source+":"+T+":"+O+": "+Y);if(X.reason=Y,X.filename=E.source,X.line=T,X.column=O,X.source=C,!E.silent)throw X}function L(Y){var X=Y.exec(C);if(X){var G=X[0];return D(G),C=C.slice(G.length),X}}function ee(){L(n)}function z(Y){var X;for(Y=Y||[];X=$();)X!==!1&&Y.push(X);return Y}function $(){var Y=I();if(!(h!=C.charAt(0)||p!=C.charAt(1))){for(var X=2;g!=C.charAt(X)&&(p!=C.charAt(X)||h!=C.charAt(X+1));)++X;if(X+=2,g===C.charAt(X-1))return B("End of comment missing");var G=C.slice(2,X-2);return O+=2,D(G),C=C.slice(X),O+=2,Y({type:w,comment:G})}}function Q(){var Y=I(),X=L(a);if(X){if($(),!L(s))return B("property missing ':'");var G=L(o),ie=Y({type:x,property:j(X[0].replace(e,g)),value:G?j(G[0].replace(e,g)):g});return L(c),ie}}function ne(){var Y=[];z(Y);for(var X;X=Q();)X!==!1&&(Y.push(X),z(Y));return Y}return ee(),ne()}function j(C){return C?C.replace(f,g):g}return bg=k,bg}var mk;function E$(){if(mk)return Gl;mk=1;var e=Gl&&Gl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.default=n;const t=e(C$());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:p}=m;f?s(h,p,m):p&&(o=o||{},o[h]=p)}),o}return Gl}var Bu={},pk;function N$(){if(pk)return Bu;pk=1,Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.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,p){return p.toUpperCase()},f=function(h,p){return"".concat(p,"-")},m=function(h,p){return p===void 0&&(p={}),o(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(s,f):h=h.replace(a,f),h.replace(t,c))};return Bu.camelCase=m,Bu}var Fu,gk;function _$(){if(gk)return Fu;gk=1;var e=Fu&&Fu.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(E$()),n=N$();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,Fu=a,Fu}var T$=_$();const A$=oh(T$),T_=A_("end"),hb=A_("start");function A_(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 R$(e){const t=hb(e),n=T_(e);if(t&&n)return{start:t,end:n}}function nc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yk(e.position):"start"in e||"end"in e?yk(e):"line"in e||"column"in e?Gy(e):""}function Gy(e){return vk(e&&e.line)+":"+vk(e&&e.column)}function yk(e){return Gy(e&&e.start)+"-"+Gy(e&&e.end)}function vk(e){return e&&typeof e=="number"?e:1}class ir 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=nc(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}}ir.prototype.file="";ir.prototype.name="";ir.prototype.reason="";ir.prototype.message="";ir.prototype.stack="";ir.prototype.column=void 0;ir.prototype.line=void 0;ir.prototype.ancestors=void 0;ir.prototype.cause=void 0;ir.prototype.fatal=void 0;ir.prototype.place=void 0;ir.prototype.ruleId=void 0;ir.prototype.source=void 0;const mb={}.hasOwnProperty,O$=new Map,M$=/[A-Z]/g,D$=new Set(["table","tbody","thead","tfoot","tr"]),z$=new Set(["td","th"]),R_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function I$(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=q$(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=H$(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"?fb:k$,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=O_(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function O_(e,t,n){if(t.type==="element")return L$(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return P$(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return B$(e,t,n);if(t.type==="mdxjsEsm")return U$(e,t);if(t.type==="root")return F$(e,t,n);if(t.type==="text")return $$(e,t)}function L$(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=fb,e.schema=s),e.ancestors.push(t);const o=D_(e,t.tagName,!1),c=Z$(e,t);let f=gb(e,t);return D$.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!h$(m):!0})),M_(e,c,o,t),pb(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function P$(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)}vc(e,t.position)}function U$(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vc(e,t.position)}function B$(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=fb,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:D_(e,t.name,!0),c=G$(e,t),f=gb(e,t);return M_(e,c,o,t),pb(c,f),e.ancestors.pop(),e.schema=a,e.create(t,o,c,n)}function F$(e,t,n){const a={};return pb(a,gb(e,t)),e.create(t,e.Fragment,a,n)}function $$(e,t){return t.value}function M_(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function pb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function H$(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 q$(e,t){return n;function n(a,s,o,c){const f=Array.isArray(o.children),m=hb(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 Z$(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&mb.call(t.properties,s)){const o=V$(e,s,t.properties[s]);if(o){const[c,f]=o;e.tableCellAlignToStyle&&c==="align"&&typeof f=="string"&&z$.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 G$(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 vc(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 vc(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function gb(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:O$;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=O_(e,o,c);f!==void 0&&n.push(f)}return n}function V$(e,t,n){const a=x$(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?o$(n):j$(n)),a.property==="style"){let s=typeof n=="object"?n:Q$(e,String(n));return e.stylePropertyNameCase==="css"&&(s=K$(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?y$[a.property]||a.property:a.attribute,n]}}function Q$(e,t){try{return A$(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new ir("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=R_+"#cannot-parse-style-attribute",s}}function D_(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=uk(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=uk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return mb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);vc(e)}function vc(e,t){const n=new ir("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=R_+"#cannot-handle-mdx-estrees-without-createevaluater",n}function K$(e){const t={};let n;for(n in e)mb.call(e,n)&&(t[Y$(n)]=e[n]);return t}function Y$(e){let t=e.replace(M$,X$);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function X$(e){return"-"+e.toLowerCase()}const xg={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"]},W$={};function yb(e,t){const n=W$,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return z_(e,a,s)}function z_(e,t,n){if(J$(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 bk(e.children,t,n)}return Array.isArray(e)?bk(e,t,n):""}function bk(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=z_(e[s],t,n);return a.join("")}function J$(e){return!!(e&&typeof e=="object")}const xk=document.createElement("i");function vb(e){const t="&"+e+";";xk.innerHTML=t;const n=xk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Zr(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 ua(e,t){return e.length>0?(Zr(e,e.length,0,t),e):t}const wk={}.hasOwnProperty;function I_(e){const t={};let n=-1;for(;++n<e.length;)e8(t,e[n]);return t}function e8(e,t){let n;for(n in t){const s=(wk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){wk.call(s,c)||(s[c]=[]);const f=o[c];t8(s[c],Array.isArray(f)?f:f?[f]:[])}}}function t8(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);Zr(e,0,0,a)}function L_(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 wa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const dr=ks(/[A-Za-z]/),rr=ks(/[\dA-Za-z]/),n8=ks(/[#-'*+\--9=?A-Z^-~]/);function th(e){return e!==null&&(e<32||e===127)}const Vy=ks(/\d/),r8=ks(/[\dA-Fa-f]/),a8=ks(/[!-/:-@[-`{-~]/);function Ge(e){return e!==null&&e<-2}function Ht(e){return e!==null&&(e<0||e===32)}function gt(e){return e===-2||e===-1||e===32}const Rh=ks(new RegExp("\\p{P}|\\p{S}","u")),al=ks(/\s/);function ks(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function zo(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&rr(e.charCodeAt(n+1))&&rr(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 Et(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(m){return gt(m)?(e.enter(n),f(m)):t(m)}function f(m){return gt(m)&&o++<s?(e.consume(m),f):(e.exit(n),t(m))}}const i8={tokenize:s8};function s8(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"),Et(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 Ge(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),c)}}const l8={tokenize:o8},Sk={tokenize:u8};function o8(e){const t=this,n=[];let a=0,s,o,c;return f;function f(O){if(a<n.length){const D=n[a];return t.containerState=D[1],e.attempt(D[0].continuation,m,h)(O)}return h(O)}function m(O){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const D=t.events.length;let I=D,R;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){R=t.events[I][1].end;break}E(a);let B=D;for(;B<t.events.length;)t.events[B][1].end={...R},B++;return Zr(t.events,I+1,0,t.events.slice(D)),t.events.length=B,h(O)}return f(O)}function h(O){if(a===n.length){if(!s)return w(O);if(s.currentConstruct&&s.currentConstruct.concrete)return k(O);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Sk,p,g)(O)}function p(O){return s&&T(),E(a),w(O)}function g(O){return t.parser.lazy[t.now().line]=a!==n.length,c=t.now().offset,k(O)}function w(O){return t.containerState={},e.attempt(Sk,x,k)(O)}function x(O){return a++,n.push([t.currentConstruct,t.containerState]),w(O)}function k(O){if(O===null){s&&T(),E(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){C(e.exit("chunkFlow"),!0),E(0),e.consume(O);return}return Ge(O)?(e.consume(O),C(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(O),j)}function C(O,D){const I=t.sliceStream(O);if(D&&I.push(null),O.previous=o,o&&(o.next=O),o=O,s.defineSkip(O.start),s.write(I),t.parser.lazy[O.start.line]){let R=s.events.length;for(;R--;)if(s.events[R][1].start.offset<c&&(!s.events[R][1].end||s.events[R][1].end.offset>c))return;const B=t.events.length;let L=B,ee,z;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(ee){z=t.events[L][1].end;break}ee=!0}for(E(a),R=B;R<t.events.length;)t.events[R][1].end={...z},R++;Zr(t.events,L+1,0,t.events.slice(B)),t.events.length=R}}function E(O){let D=n.length;for(;D-- >O;){const I=n[D];t.containerState=I[1],I[0].exit.call(t,e)}n.length=O}function T(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function u8(e,t,n){return Et(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Eo(e){if(e===null||Ht(e)||al(e))return 1;if(Rh(e))return 2}function Oh(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 Qy={name:"attention",resolveAll:c8,tokenize:d8};function c8(e,t){let n=-1,a,s,o,c,f,m,h,p;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 g={...e[a][1].end},w={...e[n][1].start};kk(g,-m),kk(w,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:w},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=ua(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=ua(h,[["enter",s,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=ua(h,Oh(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=ua(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,h=ua(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Zr(e,a-1,n-a+3,h),n=a+h.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function d8(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=Eo(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"),p=Eo(m),g=!p||p===2&&s||n.includes(m),w=!s||s===2&&p||n.includes(a);return h._open=!!(o===42?g:g&&(s||!w)),h._close=!!(o===42?w:w&&(p||!g)),t(m)}}function kk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const f8={name:"autolink",tokenize:h8};function h8(e,t,n){let a=0;return s;function s(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(x){return dr(x)?(e.consume(x),c):x===64?n(x):h(x)}function c(x){return x===43||x===45||x===46||rr(x)?(a=1,f(x)):h(x)}function f(x){return x===58?(e.consume(x),a=0,m):(x===43||x===45||x===46||rr(x))&&a++<32?(e.consume(x),f):(a=0,h(x))}function m(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||th(x)?n(x):(e.consume(x),m)}function h(x){return x===64?(e.consume(x),p):n8(x)?(e.consume(x),h):n(x)}function p(x){return rr(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),a=0,p):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):w(x)}function w(x){if((x===45||rr(x))&&a++<63){const k=x===45?w:g;return e.consume(x),k}return n(x)}}const qc={partial:!0,tokenize:m8};function m8(e,t,n){return a;function a(o){return gt(o)?Et(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Ge(o)?t(o):n(o)}}const P_={continuation:{tokenize:g8},exit:y8,name:"blockQuote",tokenize:p8};function p8(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 gt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function g8(e,t,n){const a=this;return s;function s(c){return gt(c)?Et(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(P_,t,n)(c)}}function y8(e){e.exit("blockQuote")}const U_={name:"characterEscape",tokenize:v8};function v8(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 a8(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const B_={name:"characterReference",tokenize:b8};function b8(e,t,n){const a=this;let s=0,o,c;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=rr,p(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=r8,p):(e.enter("characterReferenceValue"),o=7,c=Vy,p(g))}function p(g){if(g===59&&s){const w=e.exit("characterReferenceValue");return c===rr&&!vb(a.sliceSerialize(w))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&s++<o?(e.consume(g),p):n(g)}}const jk={partial:!0,tokenize:w8},Ck={concrete:!0,name:"codeFenced",tokenize:x8};function x8(e,t,n){const a=this,s={partial:!0,tokenize:I};let o=0,c=0,f;return m;function m(R){return h(R)}function h(R){const B=a.events[a.events.length-1];return o=B&&B[1].type==="linePrefix"?B[2].sliceSerialize(B[1],!0).length:0,f=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(R)}function p(R){return R===f?(c++,e.consume(R),p):c<3?n(R):(e.exit("codeFencedFenceSequence"),gt(R)?Et(e,g,"whitespace")(R):g(R))}function g(R){return R===null||Ge(R)?(e.exit("codeFencedFence"),a.interrupt?t(R):e.check(jk,j,D)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),w(R))}function w(R){return R===null||Ge(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):gt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Et(e,x,"whitespace")(R)):R===96&&R===f?n(R):(e.consume(R),w)}function x(R){return R===null||Ge(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(R))}function k(R){return R===null||Ge(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===f?n(R):(e.consume(R),k)}function j(R){return e.attempt(s,D,C)(R)}function C(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),E}function E(R){return o>0&>(R)?Et(e,T,"linePrefix",o+1)(R):T(R)}function T(R){return R===null||Ge(R)?e.check(jk,j,D)(R):(e.enter("codeFlowValue"),O(R))}function O(R){return R===null||Ge(R)?(e.exit("codeFlowValue"),T(R)):(e.consume(R),O)}function D(R){return e.exit("codeFenced"),t(R)}function I(R,B,L){let ee=0;return z;function z(X){return R.enter("lineEnding"),R.consume(X),R.exit("lineEnding"),$}function $(X){return R.enter("codeFencedFence"),gt(X)?Et(R,Q,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):Q(X)}function Q(X){return X===f?(R.enter("codeFencedFenceSequence"),ne(X)):L(X)}function ne(X){return X===f?(ee++,R.consume(X),ne):ee>=c?(R.exit("codeFencedFenceSequence"),gt(X)?Et(R,Y,"whitespace")(X):Y(X)):L(X)}function Y(X){return X===null||Ge(X)?(R.exit("codeFencedFence"),B(X)):L(X)}}}function w8(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 wg={name:"codeIndented",tokenize:k8},S8={partial:!0,tokenize:j8};function k8(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),Et(e,o,"linePrefix",5)(h)}function o(h){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?m(h):Ge(h)?e.attempt(S8,c,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Ge(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function j8(e,t,n){const a=this;return s;function s(c){return a.parser.lazy[a.now().line]?n(c):Ge(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),s):Et(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):Ge(c)?s(c):n(c)}}const C8={name:"codeText",previous:N8,resolve:E8,tokenize:_8};function E8(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 N8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _8(e,t,n){let a=0,s,o;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(o=e.enter("codeTextSequence"),s=0,p(g)):Ge(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Ge(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function p(g){return g===96?(e.consume(g),s++,p):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",h(g))}}class T8{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&&$u(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),$u(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),$u(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);$u(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);$u(this.left,n.reverse())}}}function $u(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 F_(e){const t={};let n=-1,a,s,o,c,f,m,h;const p=new T8(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(a=p.get(n),n&&a[1].type==="chunkFlow"&&p.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,A8(p,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(c=p.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(s&&(p.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={...p.get(s)[1].start},f=p.slice(s,n),f.unshift(a),p.splice(s,n-s+1,f))}}return Zr(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function A8(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 p,g,w=-1,x=n,k=0,j=0;const C=[j];for(;x;){for(;e.get(++s)[1]!==x;);o.push(s),x._tokenizer||(p=a.sliceStream(x),x.next||p.push(null),g&&c.defineSkip(x.start),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(p),x._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++w<f.length;)f[w][0]==="exit"&&f[w-1][0]==="enter"&&f[w][1].type===f[w-1][1].type&&f[w][1].start.line!==f[w][1].end.line&&(j=w+1,C.push(j),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(c.events=[],x?(x._tokenizer=void 0,x.previous=void 0):C.pop(),w=C.length;w--;){const E=f.slice(C[w],C[w+1]),T=o.pop();m.push([T,T+E.length-1]),e.splice(T,2,E)}for(m.reverse(),w=-1;++w<m.length;)h[k+m[w][0]]=k+m[w][1],k+=m[w][1]-m[w][0]-1;return h}const R8={resolve:M8,tokenize:D8},O8={partial:!0,tokenize:z8};function M8(e){return F_(e),e}function D8(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):Ge(f)?e.check(O8,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 z8(e,t,n){const a=this;return s;function s(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Et(e,o,"linePrefix")}function o(c){if(c===null||Ge(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 $_(e,t,n,a,s,o,c,f,m){const h=m||Number.POSITIVE_INFINITY;let p=0;return g;function g(E){return E===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(E),e.exit(o),w):E===null||E===32||E===41||th(E)?n(E):(e.enter(a),e.enter(c),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(E))}function w(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===62?(e.exit("chunkString"),e.exit(f),w(E)):E===null||E===60||Ge(E)?n(E):(e.consume(E),E===92?k:x)}function k(E){return E===60||E===62||E===92?(e.consume(E),x):x(E)}function j(E){return!p&&(E===null||E===41||Ht(E))?(e.exit("chunkString"),e.exit(f),e.exit(c),e.exit(a),t(E)):p<h&&E===40?(e.consume(E),p++,j):E===41?(e.consume(E),p--,j):E===null||E===32||E===40||th(E)?n(E):(e.consume(E),E===92?C:j)}function C(E){return E===40||E===41||E===92?(e.consume(E),j):j(E)}}function H_(e,t,n,a,s,o){const c=this;let f=0,m;return h;function h(x){return e.enter(a),e.enter(s),e.consume(x),e.exit(s),e.enter(o),p}function p(x){return f>999||x===null||x===91||x===93&&!m||x===94&&!f&&"_hiddenFootnoteSupport"in c.parser.constructs?n(x):x===93?(e.exit(o),e.enter(s),e.consume(x),e.exit(s),e.exit(a),t):Ge(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Ge(x)||f++>999?(e.exit("chunkString"),p(x)):(e.consume(x),m||(m=!gt(x)),x===92?w:g)}function w(x){return x===91||x===92||x===93?(e.consume(x),f++,g):g(x)}}function q_(e,t,n,a,s,o){let c;return f;function f(w){return w===34||w===39||w===40?(e.enter(a),e.enter(s),e.consume(w),e.exit(s),c=w===40?41:w,m):n(w)}function m(w){return w===c?(e.enter(s),e.consume(w),e.exit(s),e.exit(a),t):(e.enter(o),h(w))}function h(w){return w===c?(e.exit(o),m(c)):w===null?n(w):Ge(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),Et(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===c||w===null||Ge(w)?(e.exit("chunkString"),h(w)):(e.consume(w),w===92?g:p)}function g(w){return w===c||w===92?(e.consume(w),p):p(w)}}function rc(e,t){let n;return a;function a(s){return Ge(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):gt(s)?Et(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const I8={name:"definition",tokenize:P8},L8={partial:!0,tokenize:U8};function P8(e,t,n){const a=this;let s;return o;function o(x){return e.enter("definition"),c(x)}function c(x){return H_.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function f(x){return s=wa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),m):n(x)}function m(x){return Ht(x)?rc(e,h)(x):h(x)}function h(x){return $_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function p(x){return e.attempt(L8,g,g)(x)}function g(x){return gt(x)?Et(e,w,"whitespace")(x):w(x)}function w(x){return x===null||Ge(x)?(e.exit("definition"),a.parser.defined.push(s),t(x)):n(x)}}function U8(e,t,n){return a;function a(f){return Ht(f)?rc(e,s)(f):n(f)}function s(f){return q_(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return gt(f)?Et(e,c,"whitespace")(f):c(f)}function c(f){return f===null||Ge(f)?t(f):n(f)}}const B8={name:"hardBreakEscape",tokenize:F8};function F8(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Ge(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const $8={name:"headingAtx",resolve:H8,tokenize:q8};function H8(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"},Zr(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function q8(e,t,n){let a=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),c(p)}function c(p){return p===35&&a++<6?(e.consume(p),c):p===null||Ht(p)?(e.exit("atxHeadingSequence"),f(p)):n(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||Ge(p)?(e.exit("atxHeading"),t(p)):gt(p)?Et(e,f,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),f(p))}function h(p){return p===null||p===35||Ht(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const Z8=["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"],Ek=["pre","script","style","textarea"],G8={concrete:!0,name:"htmlFlow",resolveTo:K8,tokenize:Y8},V8={partial:!0,tokenize:W8},Q8={partial:!0,tokenize:X8};function K8(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 Y8(e,t,n){const a=this;let s,o,c,f,m;return h;function h(_){return p(_)}function p(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),w):_===47?(e.consume(_),o=!0,j):_===63?(e.consume(_),s=3,a.interrupt?t:M):dr(_)?(e.consume(_),c=String.fromCharCode(_),C):n(_)}function w(_){return _===45?(e.consume(_),s=2,x):_===91?(e.consume(_),s=5,f=0,k):dr(_)?(e.consume(_),s=4,a.interrupt?t:M):n(_)}function x(_){return _===45?(e.consume(_),a.interrupt?t:M):n(_)}function k(_){const V="CDATA[";return _===V.charCodeAt(f++)?(e.consume(_),f===V.length?a.interrupt?t:Q:k):n(_)}function j(_){return dr(_)?(e.consume(_),c=String.fromCharCode(_),C):n(_)}function C(_){if(_===null||_===47||_===62||Ht(_)){const V=_===47,Z=c.toLowerCase();return!V&&!o&&Ek.includes(Z)?(s=1,a.interrupt?t(_):Q(_)):Z8.includes(c.toLowerCase())?(s=6,V?(e.consume(_),E):a.interrupt?t(_):Q(_)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(_):o?T(_):O(_))}return _===45||rr(_)?(e.consume(_),c+=String.fromCharCode(_),C):n(_)}function E(_){return _===62?(e.consume(_),a.interrupt?t:Q):n(_)}function T(_){return gt(_)?(e.consume(_),T):z(_)}function O(_){return _===47?(e.consume(_),z):_===58||_===95||dr(_)?(e.consume(_),D):gt(_)?(e.consume(_),O):z(_)}function D(_){return _===45||_===46||_===58||_===95||rr(_)?(e.consume(_),D):I(_)}function I(_){return _===61?(e.consume(_),R):gt(_)?(e.consume(_),I):O(_)}function R(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),m=_,B):gt(_)?(e.consume(_),R):L(_)}function B(_){return _===m?(e.consume(_),m=null,ee):_===null||Ge(_)?n(_):(e.consume(_),B)}function L(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Ht(_)?I(_):(e.consume(_),L)}function ee(_){return _===47||_===62||gt(_)?O(_):n(_)}function z(_){return _===62?(e.consume(_),$):n(_)}function $(_){return _===null||Ge(_)?Q(_):gt(_)?(e.consume(_),$):n(_)}function Q(_){return _===45&&s===2?(e.consume(_),G):_===60&&s===1?(e.consume(_),ie):_===62&&s===4?(e.consume(_),P):_===63&&s===3?(e.consume(_),M):_===93&&s===5?(e.consume(_),ve):Ge(_)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(V8,U,ne)(_)):_===null||Ge(_)?(e.exit("htmlFlowData"),ne(_)):(e.consume(_),Q)}function ne(_){return e.check(Q8,Y,U)(_)}function Y(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),X}function X(_){return _===null||Ge(_)?ne(_):(e.enter("htmlFlowData"),Q(_))}function G(_){return _===45?(e.consume(_),M):Q(_)}function ie(_){return _===47?(e.consume(_),c="",J):Q(_)}function J(_){if(_===62){const V=c.toLowerCase();return Ek.includes(V)?(e.consume(_),P):Q(_)}return dr(_)&&c.length<8?(e.consume(_),c+=String.fromCharCode(_),J):Q(_)}function ve(_){return _===93?(e.consume(_),M):Q(_)}function M(_){return _===62?(e.consume(_),P):_===45&&s===2?(e.consume(_),M):Q(_)}function P(_){return _===null||Ge(_)?(e.exit("htmlFlowData"),U(_)):(e.consume(_),P)}function U(_){return e.exit("htmlFlow"),t(_)}}function X8(e,t,n){const a=this;return s;function s(c){return Ge(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 W8(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(qc,t,n)}}const J8={name:"htmlText",tokenize:eH};function eH(e,t,n){const a=this;let s,o,c;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),I):M===63?(e.consume(M),O):dr(M)?(e.consume(M),L):n(M)}function h(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),o=0,k):dr(M)?(e.consume(M),T):n(M)}function p(M){return M===45?(e.consume(M),x):n(M)}function g(M){return M===null?n(M):M===45?(e.consume(M),w):Ge(M)?(c=g,ie(M)):(e.consume(M),g)}function w(M){return M===45?(e.consume(M),x):g(M)}function x(M){return M===62?G(M):M===45?w(M):g(M)}function k(M){const P="CDATA[";return M===P.charCodeAt(o++)?(e.consume(M),o===P.length?j:k):n(M)}function j(M){return M===null?n(M):M===93?(e.consume(M),C):Ge(M)?(c=j,ie(M)):(e.consume(M),j)}function C(M){return M===93?(e.consume(M),E):j(M)}function E(M){return M===62?G(M):M===93?(e.consume(M),E):j(M)}function T(M){return M===null||M===62?G(M):Ge(M)?(c=T,ie(M)):(e.consume(M),T)}function O(M){return M===null?n(M):M===63?(e.consume(M),D):Ge(M)?(c=O,ie(M)):(e.consume(M),O)}function D(M){return M===62?G(M):O(M)}function I(M){return dr(M)?(e.consume(M),R):n(M)}function R(M){return M===45||rr(M)?(e.consume(M),R):B(M)}function B(M){return Ge(M)?(c=B,ie(M)):gt(M)?(e.consume(M),B):G(M)}function L(M){return M===45||rr(M)?(e.consume(M),L):M===47||M===62||Ht(M)?ee(M):n(M)}function ee(M){return M===47?(e.consume(M),G):M===58||M===95||dr(M)?(e.consume(M),z):Ge(M)?(c=ee,ie(M)):gt(M)?(e.consume(M),ee):G(M)}function z(M){return M===45||M===46||M===58||M===95||rr(M)?(e.consume(M),z):$(M)}function $(M){return M===61?(e.consume(M),Q):Ge(M)?(c=$,ie(M)):gt(M)?(e.consume(M),$):ee(M)}function Q(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,ne):Ge(M)?(c=Q,ie(M)):gt(M)?(e.consume(M),Q):(e.consume(M),Y)}function ne(M){return M===s?(e.consume(M),s=void 0,X):M===null?n(M):Ge(M)?(c=ne,ie(M)):(e.consume(M),ne)}function Y(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Ht(M)?ee(M):(e.consume(M),Y)}function X(M){return M===47||M===62||Ht(M)?ee(M):n(M)}function G(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function ie(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),J}function J(M){return gt(M)?Et(e,ve,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ve(M)}function ve(M){return e.enter("htmlTextData"),c(M)}}const bb={name:"labelEnd",resolveAll:aH,resolveTo:iH,tokenize:sH},tH={tokenize:lH},nH={tokenize:oH},rH={tokenize:uH};function aH(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&&Zr(e,0,e.length,n),e}function iH(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}},p={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[c-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=ua(f,e.slice(o+1,o+a+3)),f=ua(f,[["enter",p,t]]),f=ua(f,Oh(t.parser.constructs.insideSpan.null,e.slice(o+a+4,c-3),t)),f=ua(f,[["exit",p,t],e[c-2],e[c-1],["exit",h,t]]),f=ua(f,e.slice(c+1)),f=ua(f,[["exit",m,t]]),Zr(e,o,e.length,f),e}function sH(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(w){return o?o._inactive?g(w):(c=a.parser.defined.includes(wa(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(w),e.exit("labelMarker"),e.exit("labelEnd"),m):n(w)}function m(w){return w===40?e.attempt(tH,p,c?p:g)(w):w===91?e.attempt(nH,p,c?h:g)(w):c?p(w):g(w)}function h(w){return e.attempt(rH,p,g)(w)}function p(w){return t(w)}function g(w){return o._balanced=!0,n(w)}}function lH(e,t,n){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return Ht(g)?rc(e,o)(g):o(g)}function o(g){return g===41?p(g):$_(e,c,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return Ht(g)?rc(e,m)(g):p(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?q_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function h(g){return Ht(g)?rc(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function oH(e,t,n){const a=this;return s;function s(f){return H_.call(a,e,o,c,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(wa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function c(f){return n(f)}}function uH(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 cH={name:"labelStartImage",resolveAll:bb.resolveAll,tokenize:dH};function dH(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 fH={name:"labelStartLink",resolveAll:bb.resolveAll,tokenize:hH};function hH(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 Sg={name:"lineEnding",tokenize:mH};function mH(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Et(e,t,"linePrefix")}}const Bf={name:"thematicBreak",tokenize:pH};function pH(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||Ge(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),gt(h)?Et(e,f,"whitespace")(h):f(h))}}const Cr={continuation:{tokenize:bH},exit:wH,name:"list",tokenize:vH},gH={partial:!0,tokenize:SH},yH={partial:!0,tokenize:xH};function vH(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(x){const k=a.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||x===a.containerState.marker:Vy(x)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(Bf,n,h)(x):h(x);if(!a.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(x)}return n(x)}function m(x){return Vy(x)&&++c<10?(e.consume(x),m):(!a.interrupt||c<2)&&(a.containerState.marker?x===a.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),h(x)):n(x)}function h(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||x,e.check(qc,a.interrupt?n:p,e.attempt(gH,w,g))}function p(x){return a.containerState.initialBlankLine=!0,o++,w(x)}function g(x){return gt(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),w):n(x)}function w(x){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function bH(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(qc,s,o);function s(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,Et(e,t,"listItemIndent",a.containerState.size+1)(f)}function o(f){return a.containerState.furtherBlankLines||!gt(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(yH,t,c)(f))}function c(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,Et(e,e.attempt(Cr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function xH(e,t,n){const a=this;return Et(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 wH(e){e.exit(this.containerState.type)}function SH(e,t,n){const a=this;return Et(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!gt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Nk={name:"setextUnderline",resolveTo:kH,tokenize:jH};function kH(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 jH(e,t,n){const a=this;let s;return o;function o(h){let p=a.events.length,g;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){g=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(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"),gt(h)?Et(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Ge(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const CH={tokenize:EH};function EH(e){const t=this,n=e.attempt(qc,a,e.attempt(this.parser.constructs.flowInitial,s,Et(e,e.attempt(this.parser.constructs.flow,s,e.attempt(R8,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 NH={resolveAll:G_()},_H=Z_("string"),TH=Z_("text");function Z_(e){return{resolveAll:G_(e==="text"?AH: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(p){return h(p)?o(p):f(p)}function f(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return h(p)?(n.exit("data"),o(p)):(n.consume(p),m)}function h(p){if(p===null)return!0;const g=s[p];let w=-1;if(g)for(;++w<g.length;){const x=g[w];if(!x.previous||x.previous.call(a,a.previous))return!0}return!1}}}function G_(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 AH(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 RH={42:Cr,43:Cr,45:Cr,48:Cr,49:Cr,50:Cr,51:Cr,52:Cr,53:Cr,54:Cr,55:Cr,56:Cr,57:Cr,62:P_},OH={91:I8},MH={[-2]:wg,[-1]:wg,32:wg},DH={35:$8,42:Bf,45:[Nk,Bf],60:G8,61:Nk,95:Bf,96:Ck,126:Ck},zH={38:B_,92:U_},IH={[-5]:Sg,[-4]:Sg,[-3]:Sg,33:cH,38:B_,42:Qy,60:[f8,J8],91:fH,92:[B8,U_],93:bb,95:Qy,96:C8},LH={null:[Qy,NH]},PH={null:[42,95]},UH={null:[]},BH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:PH,contentInitial:OH,disable:UH,document:RH,flow:DH,flowInitial:MH,insideSpan:LH,string:zH,text:IH},Symbol.toStringTag,{value:"Module"}));function FH(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:B(I),check:B(R),consume:T,enter:O,exit:D,interrupt:B(R,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:w,sliceStream:x,write:g};let p=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g($){return c=ua(c,$),C(),c[c.length-1]!==null?[]:(L(t,0),h.events=Oh(o,h.events,h),h.events)}function w($,Q){return HH(x($),Q)}function x($){return $H(c,$)}function k(){const{_bufferIndex:$,_index:Q,line:ne,column:Y,offset:X}=a;return{_bufferIndex:$,_index:Q,line:ne,column:Y,offset:X}}function j($){s[$.line]=$.column,z()}function C(){let $;for(;a._index<c.length;){const Q=c[a._index];if(typeof Q=="string")for($=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===$&&a._bufferIndex<Q.length;)E(Q.charCodeAt(a._bufferIndex));else E(Q)}}function E($){p=p($)}function T($){Ge($)?(a.line++,a.column=1,a.offset+=$===-3?2:1,z()):$!==-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=$}function O($,Q){const ne=Q||{};return ne.type=$,ne.start=k(),h.events.push(["enter",ne,h]),f.push(ne),ne}function D($){const Q=f.pop();return Q.end=k(),h.events.push(["exit",Q,h]),Q}function I($,Q){L($,Q.from)}function R($,Q){Q.restore()}function B($,Q){return ne;function ne(Y,X,G){let ie,J,ve,M;return Array.isArray(Y)?U(Y):"tokenize"in Y?U([Y]):P(Y);function P(re){return xe;function xe(Ae){const Ce=Ae!==null&&re[Ae],Ye=Ae!==null&&re.null,Be=[...Array.isArray(Ce)?Ce:Ce?[Ce]:[],...Array.isArray(Ye)?Ye:Ye?[Ye]:[]];return U(Be)(Ae)}}function U(re){return ie=re,J=0,re.length===0?G:_(re[J])}function _(re){return xe;function xe(Ae){return M=ee(),ve=re,re.partial||(h.currentConstruct=re),re.name&&h.parser.constructs.disable.null.includes(re.name)?Z():re.tokenize.call(Q?Object.assign(Object.create(h),Q):h,m,V,Z)(Ae)}}function V(re){return $(ve,M),X}function Z(re){return M.restore(),++J<ie.length?_(ie[J]):G}}}function L($,Q){$.resolveAll&&!o.includes($)&&o.push($),$.resolve&&Zr(h.events,Q,h.events.length-Q,$.resolve(h.events.slice(Q),h)),$.resolveTo&&(h.events=$.resolveTo(h.events,h))}function ee(){const $=k(),Q=h.previous,ne=h.currentConstruct,Y=h.events.length,X=Array.from(f);return{from:Y,restore:G};function G(){a=$,h.previous=Q,h.currentConstruct=ne,h.events.length=Y,f=X,z()}}function z(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function $H(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 HH(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=`
|
|
384
|
+
`;break}case-3:{c=`\r
|
|
385
|
+
`;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 qH(e){const a={constructs:I_([BH,...(e||{}).extensions||[]]),content:s(i8),defined:[],document:s(l8),flow:s(CH),lazy:{},string:s(_H),text:s(TH)};return a;function s(o){return c;function c(f){return FH(a,o,f)}}}function ZH(e){for(;!F_(e););return e}const _k=/[\0\t\n\r]/g;function GH(){let e=1,t="",n=!0,a;return s;function s(o,c,f){const m=[];let h,p,g,w,x;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(_k.lastIndex=g,h=_k.exec(o),w=h&&h.index!==void 0?h.index:o.length,x=o.charCodeAt(w),!h){t=o.slice(g);break}if(x===10&&g===w&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<w&&(m.push(o.slice(g,w)),e+=w-g),x){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=w+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const VH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function QH(e){return e.replace(VH,KH)}function KH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return L_(n.slice(o?2:1),o?16:10)}return vb(n)||e}const V_={}.hasOwnProperty;function YH(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),XH(n)(ZH(qH(n).document().write(GH()(e,t,!0))))}function XH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(Ee),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:o(Se),blockQuote:o(Ye),characterEscape:ee,characterReference:ee,codeFenced:o(Be),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(Be,c),codeText:o(qe,c),codeTextData:ee,data:ee,codeFlowValue:ee,definition:o(We),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(it),hardBreakEscape:o(Ie),hardBreakTrailing:o(Ie),htmlFlow:o(ot,c),htmlFlowData:ee,htmlText:o(ot,c),htmlTextData:ee,image:o(se),label:c,link:o(Ee),listItem:o(Ze),listItemValue:w,listOrdered:o(Ne,g),listUnordered:o(Ne),paragraph:o(wt),reference:_,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(Se),strong:o(Gt),thematicBreak:o(pr)},exit:{atxHeading:m(),atxHeadingSequence:I,autolink:m(),autolinkEmail:Ce,autolinkProtocol:Ae,blockQuote:m(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:Z,characterReferenceMarkerNumeric:Z,characterReferenceValue:re,characterReference:xe,codeFenced:m(C),codeFencedFence:j,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:z,codeIndented:m(E),codeText:m(X),codeTextData:z,data:z,definition:m(),definitionDestinationString:D,definitionLabelString:T,definitionTitleString:O,emphasis:m(),hardBreakEscape:m(Q),hardBreakTrailing:m(Q),htmlFlow:m(ne),htmlFlowData:z,htmlText:m(Y),htmlTextData:z,image:m(ie),label:ve,labelText:J,lineEnding:$,link:m(G),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:V,resourceDestinationString:M,resourceTitleString:P,resource:U,setextHeading:m(L),setextHeadingLineSequence:B,setextHeadingText:R,strong:m(),thematicBreak:m()}};Q_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(ce){let me={type:"root",children:[]};const Fe={stack:[me],tokenStack:[],config:t,enter:f,exit:h,buffer:c,resume:p,data:n},Je=[];let St=-1;for(;++St<ce.length;)if(ce[St][1].type==="listOrdered"||ce[St][1].type==="listUnordered")if(ce[St][0]==="enter")Je.push(St);else{const An=Je.pop();St=s(ce,An,St)}for(St=-1;++St<ce.length;){const An=t[ce[St][0]];V_.call(An,ce[St][1].type)&&An[ce[St][1].type].call(Object.assign({sliceSerialize:ce[St][2].sliceSerialize},Fe),ce[St][1])}if(Fe.tokenStack.length>0){const An=Fe.tokenStack[Fe.tokenStack.length-1];(An[1]||Tk).call(Fe,void 0,An[0])}for(me.position={start:Ji(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Ji(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},St=-1;++St<t.transforms.length;)me=t.transforms[St](me)||me;return me}function s(ce,me,Fe){let Je=me-1,St=-1,An=!1,gr,Yt,qt,Bt;for(;++Je<=Fe;){const yt=ce[Je];switch(yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{yt[0]==="enter"?St++:St--,Bt=void 0;break}case"lineEndingBlank":{yt[0]==="enter"&&(gr&&!Bt&&!St&&!qt&&(qt=Je),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!St&&yt[0]==="enter"&&yt[1].type==="listItemPrefix"||St===-1&&yt[0]==="exit"&&(yt[1].type==="listUnordered"||yt[1].type==="listOrdered")){if(gr){let yr=Je;for(Yt=void 0;yr--;){const Bn=ce[yr];if(Bn[1].type==="lineEnding"||Bn[1].type==="lineEndingBlank"){if(Bn[0]==="exit")continue;Yt&&(ce[Yt][1].type="lineEndingBlank",An=!0),Bn[1].type="lineEnding",Yt=yr}else if(!(Bn[1].type==="linePrefix"||Bn[1].type==="blockQuotePrefix"||Bn[1].type==="blockQuotePrefixWhitespace"||Bn[1].type==="blockQuoteMarker"||Bn[1].type==="listItemIndent"))break}qt&&(!Yt||qt<Yt)&&(gr._spread=!0),gr.end=Object.assign({},Yt?ce[Yt][1].start:yt[1].end),ce.splice(Yt||Je,0,["exit",gr,yt[2]]),Je++,Fe++}if(yt[1].type==="listItemPrefix"){const yr={type:"listItem",_spread:!1,start:Object.assign({},yt[1].start),end:void 0};gr=yr,ce.splice(Je,0,["enter",yr,yt[2]]),Je++,Fe++,qt=void 0,Bt=!0}}}return ce[me][1]._spread=An,Fe}function o(ce,me){return Fe;function Fe(Je){f.call(this,ce(Je),Je),me&&me.call(this,Je)}}function c(){this.stack.push({type:"fragment",children:[]})}function f(ce,me,Fe){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([me,Fe||void 0]),ce.position={start:Ji(me.start),end:void 0}}function m(ce){return me;function me(Fe){ce&&ce.call(this,Fe),h.call(this,Fe)}}function h(ce,me){const Fe=this.stack.pop(),Je=this.tokenStack.pop();if(Je)Je[0].type!==ce.type&&(me?me.call(this,ce,Je[0]):(Je[1]||Tk).call(this,ce,Je[0]));else throw new Error("Cannot close `"+ce.type+"` ("+nc({start:ce.start,end:ce.end})+"): it’s not open");Fe.position.end=Ji(ce.end)}function p(){return yb(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function w(ce){if(this.data.expectingFirstListItemValue){const me=this.stack[this.stack.length-2];me.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function x(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.lang=ce}function k(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.meta=ce}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce.replace(/(\r?\n|\r)$/g,"")}function T(ce){const me=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=me,Fe.identifier=wa(this.sliceSerialize(ce)).toLowerCase()}function O(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.title=ce}function D(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.url=ce}function I(ce){const me=this.stack[this.stack.length-1];if(!me.depth){const Fe=this.sliceSerialize(ce).length;me.depth=Fe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function B(ce){const me=this.stack[this.stack.length-1];me.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(ce){const Fe=this.stack[this.stack.length-1].children;let Je=Fe[Fe.length-1];(!Je||Je.type!=="text")&&(Je=Ut(),Je.position={start:Ji(ce.start),end:void 0},Fe.push(Je)),this.stack.push(Je)}function z(ce){const me=this.stack.pop();me.value+=this.sliceSerialize(ce),me.position.end=Ji(ce.end)}function $(ce){const me=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Fe=me.children[me.children.length-1];Fe.position.end=Ji(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(me.type)&&(ee.call(this,ce),z.call(this,ce))}function Q(){this.data.atHardBreak=!0}function ne(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function Y(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function X(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.value=ce}function G(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=me,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function ie(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const me=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=me,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function J(ce){const me=this.sliceSerialize(ce),Fe=this.stack[this.stack.length-2];Fe.label=QH(me),Fe.identifier=wa(me).toLowerCase()}function ve(){const ce=this.stack[this.stack.length-1],me=this.resume(),Fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Fe.type==="link"){const Je=ce.children;Fe.children=Je}else Fe.alt=me}function M(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.url=ce}function P(){const ce=this.resume(),me=this.stack[this.stack.length-1];me.title=ce}function U(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function V(ce){const me=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=me,Fe.identifier=wa(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function Z(ce){this.data.characterReferenceType=ce.type}function re(ce){const me=this.sliceSerialize(ce),Fe=this.data.characterReferenceType;let Je;Fe?(Je=L_(me,Fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Je=vb(me);const St=this.stack[this.stack.length-1];St.value+=Je}function xe(ce){const me=this.stack.pop();me.position.end=Ji(ce.end)}function Ae(ce){z.call(this,ce);const me=this.stack[this.stack.length-1];me.url=this.sliceSerialize(ce)}function Ce(ce){z.call(this,ce);const me=this.stack[this.stack.length-1];me.url="mailto:"+this.sliceSerialize(ce)}function Ye(){return{type:"blockquote",children:[]}}function Be(){return{type:"code",lang:null,meta:null,value:""}}function qe(){return{type:"inlineCode",value:""}}function We(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function it(){return{type:"emphasis",children:[]}}function Se(){return{type:"heading",depth:0,children:[]}}function Ie(){return{type:"break"}}function ot(){return{type:"html",value:""}}function se(){return{type:"image",title:null,url:"",alt:null}}function Ee(){return{type:"link",title:null,url:"",children:[]}}function Ne(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function Ze(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function wt(){return{type:"paragraph",children:[]}}function Gt(){return{type:"strong",children:[]}}function Ut(){return{type:"text",value:""}}function pr(){return{type:"thematicBreak"}}}function Ji(e){return{line:e.line,column:e.column,offset:e.offset}}function Q_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?Q_(e,a):WH(e,a)}}function WH(e,t){let n;for(n in t)if(V_.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 Tk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+nc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+nc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+nc({start:t.start,end:t.end})+") is still open")}function JH(e){const t=this;t.parser=n;function n(a){return YH(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function eq(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 tq(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
386
|
+
`}]}function nq(e,t){const n=t.value?t.value+`
|
|
387
|
+
`:"",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 rq(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aq(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iq(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=zo(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 sq(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 lq(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function K_(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 oq(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return K_(e,t);const s={src:zo(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 uq(e,t){const n={src:zo(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 cq(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 dq(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return K_(e,t);const s={href:zo(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 fq(e,t){const n={href:zo(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 hq(e,t,n){const a=e.all(t),s=n?mq(n):Y_(t),o={},c=[];if(typeof t.checked=="boolean"){const p=a[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.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 p=a[f];(s||f!==0||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
|
|
388
|
+
`}),p.type==="element"&&p.tagName==="p"&&!s?c.push(...p.children):c.push(p)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
389
|
+
`});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function mq(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=Y_(n[a])}return t}function Y_(e){const t=e.spread;return t??e.children.length>1}function pq(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 gq(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yq(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function vq(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bq(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=hb(t.children[1]),m=T_(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 xq(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 g=t.children[m],w={},x=c?c[m]:void 0;x&&(w.align=x);let k={type:"element",tagName:o,properties:w,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),h.push(k)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,p),e.applyData(t,p)}function wq(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ak=9,Rk=32;function Sq(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(Ok(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(Ok(t.slice(s),s>0,!1)),o.join("")}function Ok(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===Ak||o===Rk;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===Ak||o===Rk;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function kq(e,t){const n={type:"text",value:Sq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function jq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Cq={blockquote:eq,break:tq,code:nq,delete:rq,emphasis:aq,footnoteReference:iq,heading:sq,html:lq,imageReference:oq,image:uq,inlineCode:cq,linkReference:dq,link:fq,listItem:hq,list:pq,paragraph:gq,root:yq,strong:vq,table:bq,tableCell:wq,tableRow:xq,text:kq,thematicBreak:jq,toml:Cf,yaml:Cf,definition:Cf,footnoteDefinition:Cf};function Cf(){}const X_=-1,Mh=0,ac=1,nh=2,xb=3,wb=4,Sb=5,kb=6,W_=7,J_=8,Mk=typeof self=="object"?self:globalThis,Eq=(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 Mh:case X_:return n(c,s);case ac:{const f=n([],s);for(const m of c)f.push(a(m));return f}case nh:{const f=n({},s);for(const[m,h]of c)f[a(m)]=a(h);return f}case xb:return n(new Date(c),s);case wb:{const{source:f,flags:m}=c;return n(new RegExp(f,m),s)}case Sb:{const f=n(new Map,s);for(const[m,h]of c)f.set(a(m),a(h));return f}case kb:{const f=n(new Set,s);for(const m of c)f.add(a(m));return f}case W_:{const{name:f,message:m}=c;return n(new Mk[f](m),s)}case J_: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 Mk[o](c),s)};return a},Dk=e=>Eq(new Map,e)(0),Vl="",{toString:Nq}={},{keys:_q}=Object,Hu=e=>{const t=typeof e;if(t!=="object"||!e)return[Mh,t];const n=Nq.call(e).slice(8,-1);switch(n){case"Array":return[ac,Vl];case"Object":return[nh,Vl];case"Date":return[xb,Vl];case"RegExp":return[wb,Vl];case"Map":return[Sb,Vl];case"Set":return[kb,Vl];case"DataView":return[ac,n]}return n.includes("Array")?[ac,n]:n.includes("Error")?[W_,n]:[nh,n]},Ef=([e,t])=>e===Mh&&(t==="function"||t==="symbol"),Tq=(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]=Hu(c);switch(f){case Mh:{let p=c;switch(m){case"bigint":f=J_,p=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return s([X_],c)}return s([f,p],c)}case ac:{if(m){let w=c;return m==="DataView"?w=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(w=new Uint8Array(c)),s([m,[...w]],c)}const p=[],g=s([f,p],c);for(const w of c)p.push(o(w));return g}case nh:{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 p=[],g=s([f,p],c);for(const w of _q(c))(e||!Ef(Hu(c[w])))&&p.push([o(w),o(c[w])]);return g}case xb:return s([f,c.toISOString()],c);case wb:{const{source:p,flags:g}=c;return s([f,{source:p,flags:g}],c)}case Sb:{const p=[],g=s([f,p],c);for(const[w,x]of c)(e||!(Ef(Hu(w))||Ef(Hu(x))))&&p.push([o(w),o(x)]);return g}case kb:{const p=[],g=s([f,p],c);for(const w of c)(e||!Ef(Hu(w)))&&p.push(o(w));return g}}const{message:h}=c;return s([f,{name:m,message:h}],c)};return o},zk=(e,{json:t,lossy:n}={})=>{const a=[];return Tq(!(t||n),!!t,new Map,a)(e),a},rh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Dk(zk(e,t)):structuredClone(e):(e,t)=>Dk(zk(e,t));function Aq(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 Rq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Oq(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Aq,a=e.options.footnoteBackLabel||Rq,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 p=e.all(h),g=String(h.identifier).toUpperCase(),w=zo(g.toLowerCase());let x=0;const k=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++x<=j;){k.length>0&&k.push({type:"text",value:" "});let T=typeof n=="string"?n:n(m,x);typeof T=="string"&&(T={type:"text",value:T}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+w+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,x),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const C=p[p.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const T=C.children[C.children.length-1];T&&T.type==="text"?T.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...k)}else p.push(...k);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+w},children:e.wrap(p,!0)};e.patch(h,E),f.push(E)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...rh(c),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
390
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
391
|
+
`}]}}const Dh=(function(e){if(e==null)return Iq;if(typeof e=="function")return zh(e);if(typeof e=="object")return Array.isArray(e)?Mq(e):Dq(e);if(typeof e=="string")return zq(e);throw new Error("Expected function, string, or object as test")});function Mq(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Dh(e[n]);return zh(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function Dq(e){const t=e;return zh(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function zq(e){return zh(t);function t(n){return n&&n.type===e}}function zh(e){return t;function t(n,a,s){return!!(Lq(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function Iq(){return!0}function Lq(e){return e!==null&&typeof e=="object"&&"type"in e}const eT=[],Pq=!0,Ky=!1,Uq="skip";function tT(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Dh(s),c=a?-1:1;f(e,void 0,[])();function f(m,h,p){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(m.type+(x?"<"+x+">":""))+")"})}return w;function w(){let x=eT,k,j,C;if((!t||o(m,h,p[p.length-1]||void 0))&&(x=Bq(n(m,p)),x[0]===Ky))return x;if("children"in m&&m.children){const E=m;if(E.children&&x[0]!==Uq)for(j=(a?E.children.length:-1)+c,C=p.concat(E);j>-1&&j<E.children.length;){const T=E.children[j];if(k=f(T,j,C)(),k[0]===Ky)return k;j=typeof k[1]=="number"?k[1]:j+c}}return x}}}function Bq(e){return Array.isArray(e)?e:typeof e=="number"?[Pq,e]:e==null?eT:[e]}function jb(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),tT(e,o,f,s);function f(m,h){const p=h[h.length-1],g=p?p.children.indexOf(m):void 0;return c(m,g,p)}}const Yy={}.hasOwnProperty,Fq={};function $q(e,t){const n=t||Fq,a=new Map,s=new Map,o=new Map,c={...Cq,...n.handlers},f={all:h,applyData:qq,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:c,one:m,options:n,patch:Hq,wrap:Gq};return jb(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?a:s,w=String(p.identifier).toUpperCase();g.has(w)||g.set(w,p)}}),f;function m(p,g){const w=p.type,x=f.handlers[w];if(Yy.call(f.handlers,w)&&x)return x(f,p,g);if(f.options.passThrough&&f.options.passThrough.includes(w)){if("children"in p){const{children:j,...C}=p,E=rh(C);return E.children=f.all(p),E}return rh(p)}return(f.options.unknownHandler||Zq)(f,p,g)}function h(p){const g=[];if("children"in p){const w=p.children;let x=-1;for(;++x<w.length;){const k=f.one(w[x],p);if(k){if(x&&w[x-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=Ik(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=Ik(j.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function Hq(e,t){e.position&&(t.position=R$(e))}function qq(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,rh(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Zq(e,t){const n=t.data||{},a="value"in t&&!(Yy.call(n,"hProperties")||Yy.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 Gq(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
|
|
392
|
+
`});++a<e.length;)a&&n.push({type:"text",value:`
|
|
393
|
+
`}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
394
|
+
`}),n}function Ik(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Lk(e,t){const n=$q(e,t),a=n.one(e,void 0),s=Oq(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
|
|
395
|
+
`},s),o}function Vq(e,t){return e&&"run"in e?async function(n,a){const s=Lk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return Lk(n,{file:a,...e||t})}}function Pk(e){if(e)throw e}var kg,Uk;function Qq(){if(Uk)return kg;Uk=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 p=e.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!g)return!1;var w;for(w in h);return typeof w>"u"||e.call(h,w)},c=function(h,p){n&&p.name==="__proto__"?n(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},f=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(a)return a(h,p).value}else return;return h[p]};return kg=function m(){var h,p,g,w,x,k,j=arguments[0],C=1,E=arguments.length,T=!1;for(typeof j=="boolean"&&(T=j,j=arguments[1]||{},C=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});C<E;++C)if(h=arguments[C],h!=null)for(p in h)g=f(j,p),w=f(h,p),j!==w&&(T&&w&&(o(w)||(x=s(w)))?(x?(x=!1,k=g&&s(g)?g:[]):k=g&&o(g)?g:{},c(j,{name:p,newValue:m(T,k,w)})):typeof w<"u"&&c(j,{name:p,newValue:w}));return j},kg}var Kq=Qq();const jg=oh(Kq);function Xy(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 Yq(){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 p=e[++o];let g=-1;if(m){c(m);return}for(;++g<s.length;)(h[g]===null||h[g]===void 0)&&(h[g]=s[g]);s=h,p?Xq(p,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 Xq(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 p=h;if(f&&n)throw p;return s(p)}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 Ta={basename:Wq,dirname:Jq,extname:e7,join:t7,sep:"/"};function Wq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Zc(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 Jq(e){if(Zc(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 e7(e){Zc(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 t7(...e){let t=-1,n;for(;++t<e.length;)Zc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":n7(n)}function n7(e){Zc(e);const t=e.codePointAt(0)===47;let n=r7(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function r7(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 Zc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const a7={cwd:i7};function i7(){return"/"}function Wy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function s7(e){if(typeof e=="string")e=new URL(e);else if(!Wy(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 l7(e)}function l7(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 Cg=["history","path","basename","stem","extname","dirname"];class nT{constructor(t){let n;t?Wy(t)?n={path:t}:typeof t=="string"||o7(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":a7.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Cg.length;){const o=Cg[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)Cg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ta.basename(this.path):void 0}set basename(t){Ng(t,"basename"),Eg(t,"basename"),this.path=Ta.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ta.dirname(this.path):void 0}set dirname(t){Bk(this.basename,"dirname"),this.path=Ta.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ta.extname(this.path):void 0}set extname(t){if(Eg(t,"extname"),Bk(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=Ta.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Wy(t)&&(t=s7(t)),Ng(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ta.basename(this.path,this.extname):void 0}set stem(t){Ng(t,"stem"),Eg(t,"stem"),this.path=Ta.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 ir(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 Eg(e,t){if(e&&e.includes(Ta.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ta.sep+"`")}function Ng(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Bk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function o7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const u7=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),c7={}.hasOwnProperty;class Cb extends u7{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=Yq()}copy(){const t=new Cb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(jg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ag("data",this.frozen),this.namespace[t]=n,this):c7.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ag("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=Nf(t),a=this.parser||this.Parser;return _g("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),_g("process",this.parser||this.Parser),Tg("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,c){const f=Nf(t),m=a.parse(f);a.run(m,f,function(p,g,w){if(p||!g||!w)return h(p);const x=g,k=a.stringify(x,w);h7(k)?w.value=k:w.result=k,h(p,w)});function h(p,g){p||!g?c(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,a;return this.freeze(),_g("processSync",this.parser||this.Parser),Tg("processSync",this.compiler||this.Compiler),this.process(t,s),$k("processSync","process",n),a;function s(o,c){n=!0,Pk(o),a=c}}run(t,n,a){Fk(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=Nf(n);s.run(t,m,h);function h(p,g,w){const x=g||t;p?f(p):c?c(x):a(void 0,x,w)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),$k("runSync","run",a),s;function o(c,f){Pk(c),s=f,a=!0}}stringify(t,n){this.freeze();const a=Nf(n),s=this.compiler||this.Compiler;return Tg("stringify",s),Fk(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(Ag("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[p,...g]=h;m(p,g)}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=jg(!0,s.settings,h.settings))}function f(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const g=h[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,p){let g=-1,w=-1;for(;++g<a.length;)if(a[g][0]===h){w=g;break}if(w===-1)a.push([h,...p]);else if(p.length>0){let[x,...k]=p;const j=a[w][1];Xy(j)&&Xy(x)&&(x=jg(!0,j,x)),a[w]=[h,x,...k]}}}}const d7=new Cb().freeze();function _g(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Tg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ag(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 Fk(e){if(!Xy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $k(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Nf(e){return f7(e)?e:new nT(e)}function f7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function h7(e){return typeof e=="string"||m7(e)}function m7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const p7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hk=[],qk={allowDangerousHtml:!0},g7=/^(https?|ircs?|mailto|xmpp)$/i,y7=[{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 v7(e){const t=b7(e),n=x7(e);return w7(t.runSync(t.parse(n),n),e)}function b7(e){const t=e.rehypePlugins||Hk,n=e.remarkPlugins||Hk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...qk}:qk;return d7().use(JH).use(n).use(Vq,a).use(t)}function x7(e){const t=e.children||"",n=new nT;return typeof t=="string"&&(n.value=t),n}function w7(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,c=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||S7;for(const p of y7)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+p7+p.id,void 0);return jb(e,h),I$(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(p,g,w){if(p.type==="raw"&&w&&typeof g=="number")return c?w.children.splice(g,1):w.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let x;for(x in xg)if(Object.hasOwn(xg,x)&&Object.hasOwn(p.properties,x)){const k=p.properties[x],j=xg[x];(j===null||j.includes(p.tagName))&&(p.properties[x]=m(String(k||""),x,p))}}if(p.type==="element"){let x=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!x&&a&&typeof g=="number"&&(x=!a(p,g,w)),x&&w&&typeof g=="number")return f&&p.children?w.children.splice(g,1,...p.children):w.children.splice(g,1),g}}}function S7(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||g7.test(e.slice(0,t))?e:""}function k7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function rT(e,t,n){const s=Dh((n||{}).ignore||[]),o=j7(t);let c=-1;for(;++c<o.length;)tT(e,"text",f);function f(h,p){let g=-1,w;for(;++g<p.length;){const x=p[g],k=w?w.children:void 0;if(s(x,k?k.indexOf(x):void 0,w))return;w=x}if(w)return m(h,p)}function m(h,p){const g=p[p.length-1],w=o[c][0],x=o[c][1];let k=0;const C=g.children.indexOf(h);let E=!1,T=[];w.lastIndex=0;let O=w.exec(h.value);for(;O;){const D=O.index,I={index:O.index,input:O.input,stack:[...p,h]};let R=x(...O,I);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?w.lastIndex=D+1:(k!==D&&T.push({type:"text",value:h.value.slice(k,D)}),Array.isArray(R)?T.push(...R):R&&T.push(R),k=D+O[0].length,E=!0),!w.global)break;O=w.exec(h.value)}return E?(k<h.value.length&&T.push({type:"text",value:h.value.slice(k)}),g.children.splice(C,1,...T)):T=[h],C+T.length}}function j7(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([C7(s[0]),E7(s[1])])}return t}function C7(e){return typeof e=="string"?new RegExp(k7(e),"g"):e}function E7(e){return typeof e=="function"?e:function(){return e}}function N7(e){rT(e,[/\r?\n|\r/g,_7])}function _7(){return{type:"break"}}function T7(){return function(e){N7(e)}}function Zk(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 Rg="phrasing",Og=["autolink","link","image","label"];function A7(){return{transforms:[L7],enter:{literalAutolink:O7,literalAutolinkEmail:Mg,literalAutolinkHttp:Mg,literalAutolinkWww:Mg},exit:{literalAutolink:I7,literalAutolinkEmail:z7,literalAutolinkHttp:M7,literalAutolinkWww:D7}}}function R7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Rg,notInConstruct:Og},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Rg,notInConstruct:Og},{character:":",before:"[ps]",after:"\\/",inConstruct:Rg,notInConstruct:Og}]}}function O7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Mg(e){this.config.enter.autolinkProtocol.call(this,e)}function M7(e){this.config.exit.autolinkProtocol.call(this,e)}function D7(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 z7(e){this.config.exit.autolinkEmail.call(this,e)}function I7(e){this.exit(e)}function L7(e){rT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,P7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),U7]],{ignore:["link","linkReference"]})}function P7(e,t,n,a,s){let o="";if(!aT(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!B7(n)))return!1;const c=F7(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 U7(e,t,n,a){return!aT(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function B7(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 F7(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=Zk(e,"(");let o=Zk(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 aT(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||al(n)||Rh(n))&&(!t||n!==47)}iT.peek=Y7;function $7(){this.buffer()}function H7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function q7(){this.buffer()}function Z7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function G7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function V7(e){this.exit(e)}function Q7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function K7(e){this.exit(e)}function Y7(){return"["}function iT(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 X7(){return{enter:{gfmFootnoteCallString:$7,gfmFootnoteCall:H7,gfmFootnoteDefinitionLabelString:q7,gfmFootnoteDefinition:Z7},exit:{gfmFootnoteCallString:G7,gfmFootnoteCall:V7,gfmFootnoteDefinitionLabelString:Q7,gfmFootnoteDefinition:K7}}}function W7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:iT},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"),p=o.enter("label");return m+=f.move(o.safe(o.associationId(a),{before:m,after:"]"})),p(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((t?`
|
|
396
|
+
`:" ")+o.indentLines(o.containerFlow(a,f.current()),t?sT:J7))),h(),m}}function J7(e,t,n){return t===0?e:sT(e,t,n)}function sT(e,t,n){return(n?"":" ")+e}const eZ=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];lT.peek=iZ;function tZ(){return{canContainEols:["delete"],enter:{strikethrough:rZ},exit:{strikethrough:aZ}}}function nZ(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:eZ}],handlers:{delete:lT}}}function rZ(e){this.enter({type:"delete",children:[]},e)}function aZ(e){this.exit(e)}function lT(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 iZ(){return"~"}function sZ(e){return e.length}function lZ(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||sZ,o=[],c=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const j=[],C=[];let E=-1;for(e[p].length>h&&(h=e[p].length);++E<e[p].length;){const T=oZ(e[p][E]);if(n.alignDelimiters!==!1){const O=s(T);C[E]=O,(m[E]===void 0||O>m[E])&&(m[E]=O)}j.push(T)}c[p]=j,f[p]=C}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<h;)o[g]=Gk(a[g]);else{const j=Gk(a);for(;++g<h;)o[g]=j}g=-1;const w=[],x=[];for(;++g<h;){const j=o[g];let C="",E="";j===99?(C=":",E=":"):j===108?C=":":j===114&&(E=":");let T=n.alignDelimiters===!1?1:Math.max(1,m[g]-C.length-E.length);const O=C+"-".repeat(T)+E;n.alignDelimiters!==!1&&(T=C.length+T+E.length,T>m[g]&&(m[g]=T),x[g]=T),w[g]=O}c.splice(1,0,w),f.splice(1,0,x),p=-1;const k=[];for(;++p<c.length;){const j=c[p],C=f[p];g=-1;const E=[];for(;++g<h;){const T=j[g]||"";let O="",D="";if(n.alignDelimiters!==!1){const I=m[g]-(C[g]||0),R=o[g];R===114?O=" ".repeat(I):R===99?I%2?(O=" ".repeat(I/2+.5),D=" ".repeat(I/2-.5)):(O=" ".repeat(I/2),D=O):D=" ".repeat(I)}n.delimiterStart!==!1&&!g&&E.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||g)&&E.push(" "),n.alignDelimiters!==!1&&E.push(O),E.push(T),n.alignDelimiters!==!1&&E.push(D),n.padding!==!1&&E.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&E.push("|")}k.push(n.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return k.join(`
|
|
397
|
+
`)}function oZ(e){return e==null?"":String(e)}function Gk(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 uZ(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()),cZ);return s(),c}function cZ(e,t,n){return">"+(n?"":" ")+e}function dZ(e,t){return Vk(e,t.inConstruct,!0)&&!Vk(e,t.notInConstruct,!1)}function Vk(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 Qk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
398
|
+
`&&dZ(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
399
|
+
`}function fZ(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 hZ(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 mZ(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 pZ(e,t,n,a){const s=mZ(n),o=e.value||"",c=s==="`"?"GraveAccent":"Tilde";if(hZ(e,n)){const g=n.enter("codeIndented"),w=n.indentLines(o,gZ);return g(),w}const f=n.createTracker(a),m=s.repeat(Math.max(fZ(o,s)+1,3)),h=n.enter("codeFenced");let p=f.move(m);if(e.lang){const g=n.enter(`codeFencedLang${c}`);p+=f.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${c}`);p+=f.move(" "),p+=f.move(n.safe(e.meta,{before:p,after:`
|
|
400
|
+
`,encode:["`"],...f.current()})),g()}return p+=f.move(`
|
|
401
|
+
`),o&&(p+=f.move(o+`
|
|
402
|
+
`)),p+=f.move(m),h(),p}function gZ(e,t,n){return(n?"":" ")+e}function Eb(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 yZ(e,t,n,a){const s=Eb(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?" ":`
|
|
403
|
+
`,...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 vZ(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 bc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ah(e,t,n){const a=Eo(e),s=Eo(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}}oT.peek=bZ;function oT(e,t,n,a){const s=vZ(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),p=ah(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=bc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),w=ah(a.after.charCodeAt(0),g,s);w.inside&&(m=m.slice(0,-1)+bc(g));const x=c.move(s);return o(),n.attentionEncodeSurroundingInfo={after:w.outside,before:p.outside},f+m+x}function bZ(e,t,n){return n.options.emphasis||"*"}function xZ(e,t){let n=!1;return jb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Ky}),!!((!e.depth||e.depth<3)&&yb(e)&&(t.options.setext||n))}function wZ(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(xZ(e,n)){const p=n.enter("headingSetext"),g=n.enter("phrasing"),w=n.containerPhrasing(e,{...o.current(),before:`
|
|
404
|
+
`,after:`
|
|
405
|
+
`});return g(),p(),w+`
|
|
406
|
+
`+(s===1?"=":"-").repeat(w.length-(Math.max(w.lastIndexOf("\r"),w.lastIndexOf(`
|
|
407
|
+
`))+1))}const c="#".repeat(s),f=n.enter("headingAtx"),m=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
|
|
408
|
+
`,...o.current()});return/^[\t ]/.test(h)&&(h=bc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),m(),f(),h}uT.peek=SZ;function uT(e){return e.value||""}function SZ(){return"<"}cT.peek=kZ;function cT(e,t,n,a){const s=Eb(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 kZ(){return"!"}dT.peek=jZ;function dT(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 p=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function jZ(){return"!"}fT.peek=CZ;function fT(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 CZ(){return"`"}function hT(e,t){const n=yb(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))}mT.peek=EZ;function mT(e,t,n,a){const s=Eb(n),o=s==='"'?"Quote":"Apostrophe",c=n.createTracker(a);let f,m;if(hT(e,n)){const p=n.stack;n.stack=[],f=n.enter("autolink");let g=c.move("<");return g+=c.move(n.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),f(),n.stack=p,g}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 EZ(e,t,n){return hT(e,n)?"<":"["}pT.peek=NZ;function pT(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 p=n.stack;n.stack=[],c=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return c(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function NZ(){return"["}function Nb(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 _Z(e){const t=Nb(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 TZ(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 gT(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 AZ(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?TZ(n):Nb(n);const f=e.ordered?c==="."?")":".":_Z(n);let m=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&p&&(!p.children||!p.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),gT(n)===c&&p){let g=-1;for(;++g<e.children.length;){const w=e.children[g];if(w&&w.type==="listItem"&&w.children&&w.children[0]&&w.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 RZ(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 OZ(e,t,n,a){const s=RZ(n);let o=n.bulletCurrent||Nb(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()),p);return m(),h;function p(g,w,x){return w?(x?"":" ".repeat(c))+g:(x?o:o+" ".repeat(c-o.length))+g}}function MZ(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,a);return o(),s(),c}const DZ=Dh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function zZ(e,t,n,a){return(e.children.some(function(c){return DZ(c)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function IZ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}yT.peek=LZ;function yT(e,t,n,a){const s=IZ(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),p=ah(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=bc(h)+m.slice(1));const g=m.charCodeAt(m.length-1),w=ah(a.after.charCodeAt(0),g,s);w.inside&&(m=m.slice(0,-1)+bc(g));const x=c.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:w.outside,before:p.outside},f+m+x}function LZ(e,t,n){return n.options.strong||"*"}function PZ(e,t,n,a){return n.safe(e.value,a)}function UZ(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 BZ(e,t,n){const a=(gT(n)+(n.options.ruleSpaces?" ":"")).repeat(UZ(n));return n.options.ruleSpaces?a.slice(0,-1):a}const vT={blockquote:uZ,break:Qk,code:pZ,definition:yZ,emphasis:oT,hardBreak:Qk,heading:wZ,html:uT,image:cT,imageReference:dT,inlineCode:fT,link:mT,linkReference:pT,list:AZ,listItem:OZ,paragraph:MZ,root:zZ,strong:yT,text:PZ,thematicBreak:BZ};function FZ(){return{enter:{table:$Z,tableData:Kk,tableHeader:Kk,tableRow:qZ},exit:{codeText:ZZ,table:HZ,tableData:Dg,tableHeader:Dg,tableRow:Dg}}}function $Z(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 HZ(e){this.exit(e),this.data.inTable=void 0}function qZ(e){this.enter({type:"tableRow",children:[]},e)}function Dg(e){this.exit(e)}function Kk(e){this.enter({type:"tableCell",children:[]},e)}function ZZ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,GZ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function GZ(e,t){return t==="|"?t:e}function VZ(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
409
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:w,table:c,tableCell:m,tableRow:f}};function c(x,k,j,C){return h(p(x,j,C),x.align)}function f(x,k,j,C){const E=g(x,j,C),T=h([E]);return T.slice(0,T.indexOf(`
|
|
410
|
+
`))}function m(x,k,j,C){const E=j.enter("tableCell"),T=j.enter("phrasing"),O=j.containerPhrasing(x,{...C,before:o,after:o});return T(),E(),O}function h(x,k){return lZ(x,{align:k,alignDelimiters:a,padding:n,stringLength:s})}function p(x,k,j){const C=x.children;let E=-1;const T=[],O=k.enter("table");for(;++E<C.length;)T[E]=g(C[E],k,j);return O(),T}function g(x,k,j){const C=x.children;let E=-1;const T=[],O=k.enter("tableRow");for(;++E<C.length;)T[E]=m(C[E],x,k,j);return O(),T}function w(x,k,j){let C=vT.inlineCode(x,k,j);return j.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function QZ(){return{exit:{taskListCheckValueChecked:Yk,taskListCheckValueUnchecked:Yk,paragraph:YZ}}}function KZ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:XZ}}}function Yk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function YZ(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 XZ(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=vT.listItem(e,t,n,{...a,...f.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(p){return p+c}}function WZ(){return[A7(),X7(),tZ(),FZ(),QZ()]}function JZ(e){return{extensions:[R7(),W7(e),nZ(),VZ(e),KZ()]}}const eG={tokenize:sG,partial:!0},bT={tokenize:lG,partial:!0},xT={tokenize:oG,partial:!0},wT={tokenize:uG,partial:!0},tG={tokenize:cG,partial:!0},ST={name:"wwwAutolink",tokenize:aG,previous:jT},kT={name:"protocolAutolink",tokenize:iG,previous:CT},xi={name:"emailAutolink",tokenize:rG,previous:ET},La={};function nG(){return{text:La}}let $s=48;for(;$s<123;)La[$s]=xi,$s++,$s===58?$s=65:$s===91&&($s=97);La[43]=xi;La[45]=xi;La[46]=xi;La[95]=xi;La[72]=[xi,kT];La[104]=[xi,kT];La[87]=[xi,ST];La[119]=[xi,ST];function rG(e,t,n){const a=this;let s,o;return c;function c(g){return!Jy(g)||!ET.call(a,a.previous)||_b(a.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return Jy(g)?(e.consume(g),f):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(tG,p,h)(g):g===45||g===95||rr(g)?(o=!0,e.consume(g),m):p(g)}function h(g){return e.consume(g),s=!0,m}function p(g){return o&&s&&dr(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function aG(e,t,n){const a=this;return s;function s(c){return c!==87&&c!==119||!jT.call(a,a.previous)||_b(a.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(eG,e.attempt(bT,e.attempt(xT,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function iG(e,t,n){const a=this;let s="",o=!1;return c;function c(g){return(g===72||g===104)&&CT.call(a,a.previous)&&!_b(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),f):n(g)}function f(g){if(dr(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const w=s.toLowerCase();if(w==="http"||w==="https")return e.consume(g),m}return n(g)}function m(g){return g===47?(e.consume(g),o?h:(o=!0,m)):n(g)}function h(g){return g===null||th(g)||Ht(g)||al(g)||Rh(g)?n(g):e.attempt(bT,e.attempt(xT,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function sG(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 lG(e,t,n){let a,s,o;return c;function c(h){return h===46||h===95?e.check(wT,m,f)(h):h===null||Ht(h)||al(h)||h!==45&&Rh(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 oG(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(wT,t,o)(c):c===null||Ht(c)||al(c)?t(c):(e.consume(c),s)}function o(c){return c===41&&a++,e.consume(c),s}}function uG(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||Ht(f)||al(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||Ht(f)||al(f)?t(f):a(f)}function o(f){return dr(f)?c(f):n(f)}function c(f){return f===59?(e.consume(f),a):dr(f)?(e.consume(f),c):n(f)}}function cG(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return rr(o)?n(o):t(o)}}function jT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ht(e)}function CT(e){return!dr(e)}function ET(e){return!(e===47||Jy(e))}function Jy(e){return e===43||e===45||e===46||e===95||rr(e)}function _b(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 dG={tokenize:bG,partial:!0};function fG(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:gG,continuation:{tokenize:yG},exit:vG}},text:{91:{name:"gfmFootnoteCall",tokenize:pG},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:hG,resolveTo:mG}}}}function hG(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=wa(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 mG(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 pG(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,c;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(o>999||g===93&&!c||g===null||g===91||Ht(g))return n(g);if(g===93){e.exit("chunkString");const w=e.exit("gfmFootnoteCallString");return s.includes(wa(a.sliceSerialize(w)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Ht(g)||(c=!0),o++,e.consume(g),g===92?p:h}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function gG(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",p):n(k)}function p(k){if(c>999||k===93&&!f||k===null||k===91||Ht(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=wa(a.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),w}return Ht(k)||(f=!0),c++,e.consume(k),k===92?g:p}function g(k){return k===91||k===92||k===93?(e.consume(k),c++,p):p(k)}function w(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(o)||s.push(o),Et(e,x,"gfmFootnoteDefinitionWhitespace")):n(k)}function x(k){return t(k)}}function yG(e,t,n){return e.check(qc,t,e.attempt(dG,t,n))}function vG(e){e.exit("gfmFootnoteDefinition")}function bG(e,t,n){const a=this;return Et(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 xG(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 p={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[m][1].start)},w=[["enter",p,f],["enter",c[h][1],f],["exit",c[h][1],f],["enter",g,f]],x=f.parser.constructs.insideSpan.null;x&&Zr(w,w.length,0,Oh(x,c.slice(h+1,m),f)),Zr(w,w.length,0,[["exit",g,f],["enter",c[m][1],f],["exit",c[m][1],f],["exit",p,f]]),Zr(c,h-1,m-h+3,w),m=h+w.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,p=this.events;let g=0;return w;function w(k){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(k):(c.enter("strikethroughSequenceTemporary"),x(k))}function x(k){const j=Eo(h);if(k===126)return g>1?m(k):(c.consume(k),g++,x);if(g<2&&!n)return m(k);const C=c.exit("strikethroughSequenceTemporary"),E=Eo(k);return C._open=!E||E===2&&!!j,C._close=!j||j===2&&!!E,f(k)}}}class wG{constructor(){this.map=[]}add(t,n,a){SG(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 SG(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 kG(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 jG(){return{flow:{null:{name:"table",tokenize:CG,resolveAll:EG}}}}function CG(e,t,n){const a=this;let s=0,o=0,c;return f;function f(z){let $=a.events.length-1;for(;$>-1;){const Y=a.events[$][1].type;if(Y==="lineEnding"||Y==="linePrefix")$--;else break}const Q=$>-1?a.events[$][1].type:null,ne=Q==="tableHead"||Q==="tableRow"?R:m;return ne===R&&a.parser.lazy[a.now().line]?n(z):ne(z)}function m(z){return e.enter("tableHead"),e.enter("tableRow"),h(z)}function h(z){return z===124||(c=!0,o+=1),p(z)}function p(z){return z===null?n(z):Ge(z)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),x):n(z):gt(z)?Et(e,p,"whitespace")(z):(o+=1,c&&(c=!1,s+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),c=!0,p):(e.enter("data"),g(z)))}function g(z){return z===null||z===124||Ht(z)?(e.exit("data"),p(z)):(e.consume(z),z===92?w:g)}function w(z){return z===92||z===124?(e.consume(z),g):g(z)}function x(z){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(z):(e.enter("tableDelimiterRow"),c=!1,gt(z)?Et(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):k(z))}function k(z){return z===45||z===58?C(z):z===124?(c=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),j):I(z)}function j(z){return gt(z)?Et(e,C,"whitespace")(z):C(z)}function C(z){return z===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),E):z===45?(o+=1,E(z)):z===null||Ge(z)?D(z):I(z)}function E(z){return z===45?(e.enter("tableDelimiterFiller"),T(z)):I(z)}function T(z){return z===45?(e.consume(z),T):z===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),O):(e.exit("tableDelimiterFiller"),O(z))}function O(z){return gt(z)?Et(e,D,"whitespace")(z):D(z)}function D(z){return z===124?k(z):z===null||Ge(z)?!c||s!==o?I(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):I(z)}function I(z){return n(z)}function R(z){return e.enter("tableRow"),B(z)}function B(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),B):z===null||Ge(z)?(e.exit("tableRow"),t(z)):gt(z)?Et(e,B,"whitespace")(z):(e.enter("data"),L(z))}function L(z){return z===null||z===124||Ht(z)?(e.exit("data"),B(z)):(e.consume(z),z===92?ee:L)}function ee(z){return z===92||z===124?(e.consume(z),L):L(z)}}function EG(e,t){let n=-1,a=!0,s=0,o=[0,0,0,0],c=[0,0,0,0],f=!1,m=0,h,p,g;const w=new wG;for(;++n<e.length;){const x=e[n],k=x[1];x[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Xk(w,t,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},w.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,g=void 0,o=[0,0,0,0],c=[0,n+1,0,0],f&&(f=!1,p={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},w.add(n,0,[["enter",p,t]])),s=k.type==="tableDelimiterRow"?2:p?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],g=_f(w,t,o,s,void 0,g),o=[0,0,0,0]),c[2]=n)):k.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(c[0]=c[1],g=_f(w,t,o,s,void 0,g)),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],g=_f(w,t,o,s,n,g)):c[1]!==0&&(g=_f(w,t,c,s,n,g)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=n)}for(m!==0&&Xk(w,t,m,h,p),w.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=kG(t.events,n))}return e}function _f(e,t,n,a,s,o){const c=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const m=Xl(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=Xl(t.events,n[2]),p=Xl(t.events,n[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),a!==2){const w=t.events[n[2]],x=t.events[n[3]];if(w[1].end=Object.assign({},x[1].end),w[1].type="chunkText",w[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",g,t]])}return s!==void 0&&(o.end=Object.assign({},Xl(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function Xk(e,t,n,a,s){const o=[],c=Xl(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 Xl(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const NG={name:"tasklistCheck",tokenize:TG};function _G(){return{text:{91:NG}}}function TG(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 Ht(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 Ge(m)?t(m):gt(m)?e.check({tokenize:AG},t,n)(m):n(m)}}function AG(e,t,n){return Et(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function RG(e){return I_([nG(),fG(),xG(e),jG(),_G()])}const OG={};function MG(e){const t=this,n=e||OG,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),c=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(RG(n)),o.push(WZ()),c.push(JZ(n))}function Ih({children:e,className:t,components:n}){return l.jsx("div",{className:Oe("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:l.jsx(v7,{remarkPlugins:[MG,T7],components:{a:({node:a,...s})=>l.jsx("a",{...s,target:"_blank",rel:"noopener noreferrer"}),...n},children:e})})}function DG({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[o,c]=b.useState(!1),f=b.useRef(null),m=e!==t;return b.useEffect(()=>{var h;o&&((h=f.current)==null||h.focus())},[o]),l.jsxs(Yn,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["System prompt append",m&&l.jsx(zG,{})]}),!o&&!s&&l.jsxs(be,{size:"xs",variant:"outline",onClick:()=>c(!0),children:[l.jsx(hh,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Vr,{children:o?l.jsxs("div",{className:"space-y-2",children:[l.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}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(be,{size:"xs",variant:"ghost",onClick:()=>{a(),c(!1)},disabled:!m,children:"Revert"}),l.jsx(be,{size:"xs",onClick:()=>c(!1),children:"Done"})]}),l.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."})]}):l.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?l.jsx(Ih,{children:e}):l.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function zG(){return l.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 NT={"claude-code":"Claude Code",codex:"Codex"},IG=[Jf.CLAUDE_CODE,Jf.CODEX];function LG({open:e,onOpenChange:t,agent:n}){const a=vn(),s=n.clientId,o=n.runtimeProvider,[c,f]=b.useState(s),[m,h]=b.useState(o),[p,g]=b.useState(!1),x=Xe({queryKey:["clients-rebind"],queryFn:gi,enabled:e}).data??[],k=YR({queries:x.map(L=>({queryKey:["client-capabilities",L.id],queryFn:()=>mh(L.id),enabled:e}))}),j=b.useMemo(()=>{const L=new Map;return k.forEach((ee,z)=>{const $=x[z];if(!$)return;const Q=ee.data;Q!=null&&Q.capabilities&&L.set($.id,Q.capabilities)}),L},[k,x]);b.useEffect(()=>{e||(f(s),h(o),g(!1))},[e,s,o]);const C=c?j.get(c)??null:null,E=(C==null?void 0:C[m])??null,T=!E||E.state==="missing"||E.state==="error",O=!!c&&(c!==s||m!==o)&&(!T||p),D=m!==o,I=c!==s,R=pt({mutationFn:()=>{if(!c)throw new Error("clientId required");return j4(n.uuid,{clientId:c,runtimeProvider:m,force:T&&p?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),B=R.error instanceof xs||R.error instanceof Error?R.error.message:null;return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{className:"max-w-lg",children:[l.jsx(zn,{children:l.jsx(Tn,{children:"Re-bind agent"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",l.jsx("span",{className:"mono",children:UG(s,x,o)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Computer"}),l.jsx("select",{value:c??"",onChange:L=>f(L.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:x.map(L=>l.jsx("option",{value:L.id,children:PG(L)},L.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Runtime"}),l.jsx("div",{className:"space-y-2",children:IG.map(L=>{const ee=(C==null?void 0:C[L])??null,z=!!ee&&ee.state!=="missing",$=m===L;return l.jsxs("label",{className:$?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":z?"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:[l.jsx("input",{type:"radio",name:"rebind-runtime",checked:$,onChange:()=>h(L),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:NT[L]}),l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:FG(ee,L)})]})]},L)})})]}),(I||D)&&l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),D&&l.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),T&&l.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[l.jsx("input",{type:"checkbox",checked:p,onChange:L=>g(L.target.checked),className:"mt-0.5"}),l.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."})]}),B&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:B})]}),l.jsxs(ar,{children:[l.jsx(be,{variant:"outline",onClick:()=>t(!1),disabled:R.isPending,children:"Cancel"}),l.jsx(be,{onClick:()=>R.mutate(),disabled:!O||R.isPending,children:R.isPending?"Re-binding…":"Re-bind"})]})]})})}function PG(e){return`${e.hostname??e.id} · ${e.status}`}function UG(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${NT[n]}`}const BG={"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 FG(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. ${BG[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const $G={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function HG(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length,n=e.summary.anyDirty||e.saving;return l.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:l.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[l.jsxs("div",{className:"flex flex-col gap-1 text-body min-w-0",children:[e.summary.anyDirty&&l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx(tc,{state:"blocked",size:8}),l.jsxs("span",{className:"font-medium",children:[t," section",t===1?"":"s"," with unsaved changes"]}),l.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"·"}),l.jsx("span",{className:"flex flex-wrap gap-1",children:e.summary.dirtySections.map(a=>l.jsx("button",{type:"button",onClick:()=>e.onJumpTo(a),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:$G[a]},a))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&l.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[l.jsx(hr,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),l.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&l.jsx(be,{variant:"outline",size:"sm",onClick:e.onReloadRemote,disabled:!!e.reloadingRemote,children:e.reloadingRemote?l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx(qf,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Loading latest…"]}):"Discard mine, load latest"}),n&&l.jsxs(l.Fragment,{children:[l.jsx(be,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),l.jsx(be,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx(qf,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})]})})}function ih(e){return`agent-cfg-${e}`}function Hs({anchorId:e,title:t,caption:n,right:a,children:s,className:o,sectionProps:c}){return l.jsxs("section",{id:e,className:Oe("space-y-3",o),...c,children:[l.jsxs("div",{className:"flex items-end justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-subtitle",style:{color:"var(--fg)"},children:t}),n&&l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:n})]}),a]}),l.jsx("div",{className:"space-y-3",children:s})]})}function qG(){return l.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const ZG={"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 GG(e){const t=ZG[e.runtimeProvider];return l.jsxs("div",{className:"space-y-3",children:[l.jsx(VG,{name:t.name,caption:t.caption,locked:!0}),l.jsx(QG,{computerLabel:e.computerLabel,statusLoading:e.computerStatusLoading??!1,statusError:e.computerStatusError??null,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function VG({name:e,caption:t,locked:n}){return l.jsxs(Yn,{children:[l.jsx(za,{children:l.jsxs(Ia,{children:["Where it runs",n&&l.jsxs("span",{className:"mono uppercase text-caption inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(fh,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),l.jsxs(Vr,{className:"space-y-1 text-body",children:[l.jsxs("div",{className:"inline-flex items-center gap-2",children:[l.jsx(GC,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--accent)"}}),l.jsx("span",{className:"font-medium",children:e})]}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:t})]})]})}function QG(e){const t=!!e.computerLabel,n=!e.statusLoading&&!e.statusError;return l.jsxs(Yn,{children:[l.jsxs(za,{children:[l.jsx(Ia,{children:"Bound computer"}),n&&e.canBindComputer&&e.onBindComputer&&!t&&l.jsxs(be,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,title:e.bindPending?"Binding computer…":"Pick a connected computer for this agent",children:[l.jsx(jy,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),n&&t&&e.onRebind&&l.jsxs(be,{size:"xs",variant:"outline",onClick:e.onRebind,title:"Move this agent to another computer",children:[l.jsx(jy,{className:"h-3 w-3"}),"Re-bind"]})]}),l.jsx(Vr,{className:"text-body",children:e.statusLoading?l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Checking computer binding…"}):e.statusError?l.jsxs("p",{className:"text-caption",style:{color:"var(--state-error)"},children:["Could not verify computer binding: ",e.statusError]}):t?l.jsx("div",{className:"mono",style:{color:"var(--fg-2)"},children:e.computerLabel}):l.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 KG(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 YG(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function XG(e,t){return JSON.stringify(e)===JSON.stringify(t)}function zg(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function Wk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:XG(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Ig(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],c=new Set(o.map(h=>h.key)),f=YG(n,c),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:Wk(m)}}),update:(a,s)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:Wk(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 Jk(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:zg(e.payload.mcpServers,"mcp"),env:zg(e.payload.env,"env"),git:zg(e.payload.gitRepos,"git")}}function WG(e){const[t,n]=b.useState(null),[a,s]=b.useState(null);b.useEffect(()=>{e&&a===null&&(n(e),s(Jk(e)))},[e,a]);const o=a??{promptAppend:"",model:"",mcp:[],env:[],git:[]},c=(t==null?void 0:t.payload.prompt.append)??"",f=(t==null?void 0:t.payload.model)??"",m=o.promptAppend!==c,h=o.model!==f,p=b.useMemo(()=>{const R=[],B=$=>$.reduce((Q,ne)=>ne.status==="unchanged"?Q:Q+1,0),L=B(o.mcp),ee=B(o.env),z=B(o.git);return m&&R.push("prompt"),h&&R.push("model"),L>0&&R.push("mcp"),ee>0&&R.push("env"),z>0&&R.push("git"),{anyDirty:R.length>0,dirtySections:R,counts:{prompt:m?1:0,model:h?1:0,mcp:L,env:ee,git:z}}},[o,m,h]),g=b.useCallback(R=>{s(B=>B&&R(B))},[]),w=b.useCallback(R=>g(B=>({...B,promptAppend:R})),[g]),x=b.useCallback(()=>g(R=>({...R,promptAppend:c})),[g,c]),k=b.useCallback(R=>g(B=>({...B,model:R})),[g]),j=b.useCallback(()=>g(R=>({...R,model:f})),[g,f]),C=b.useMemo(()=>Ig("mcp",g),[g]),E=b.useMemo(()=>Ig("env",g),[g]),T=b.useMemo(()=>Ig("git",g),[g]),O=b.useCallback(()=>{n(null),s(null)},[]),D=b.useCallback(R=>{n(R),s(Jk(R))},[]),I=b.useCallback(()=>{if(!a||!t)return{};const R={};m&&(R.prompt={append:a.promptAppend}),h&&(R.model=a.model);const B=p.counts.mcp>0,L=p.counts.env>0,ee=p.counts.git>0;return B&&(R.mcpServers=a.mcp.filter(z=>z.status!=="deleted").map(z=>z.value)),L&&(R.env=a.env.filter(z=>z.status!=="deleted").map(z=>{const $=z.value;return $.sensitive&&$.value===mc?{key:$.key,value:mc,sensitive:!0}:$})),ee&&(R.gitRepos=a.git.filter(z=>z.status!=="deleted").map(z=>z.value)),R},[a,t,m,h,p]);return{draft:o,summary:p,promptDirty:m,modelDirty:h,setPromptAppend:w,revertPrompt:x,setModel:k,revertModel:j,addMcp:C.add,updateMcp:C.update,deleteMcp:C.remove,undoDeleteMcp:C.undo,addEnv:E.add,updateEnv:E.update,deleteEnv:E.remove,undoDeleteEnv:E.undo,addGit:T.add,updateGit:T.update,deleteGit:T.remove,undoDeleteGit:T.undo,resetAll:O,resetToConfig:D,buildPayloadPatch:I}}const nr={overview:"ad-overview",setup:"ad-setup",prompt:ih("prompt"),tools:ih("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function ej(e){return e==="model"?nr.setup:e==="mcp"?nr.tools:e==="env"||e==="git"?nr.advanced:nr.prompt}function JG(e,t){const n=[{key:"overview",label:"Profile",anchor:nr.overview}];return!e&&t&&n.push({key:"setup",label:"Setup",anchor:nr.setup},{key:"prompt",label:"Prompt",anchor:nr.prompt},{key:"tools",label:"Tools",anchor:nr.tools},{key:"advanced",label:"Advanced",anchor:nr.advanced}),t&&n.push({key:"danger",label:"Danger zone",anchor:nr.danger,divider:!0,danger:!0}),n}function eV(){var Qr,wi,ga,Si,ki,ji,js,In,vr,Ci,Ei;const t=CC().uuid??"",n=Dn(),a=vn(),{memberId:s,role:o}=ct(),c=Xe({queryKey:["agent",t],queryFn:()=>w4(t),enabled:!!t}),f=C9(c.data,s,o),m=((Qr=c.data)==null?void 0:Qr.type)!=="human"&&f,h=Xe({queryKey:["agent-config",t],queryFn:()=>gc(t),enabled:!!t&&m}),p=Xe({queryKey:["agent-client-status",t],queryFn:()=>v9(t),enabled:!!t&&((wi=c.data)==null?void 0:wi.type)!=="human"}),g=Xe({queryKey:["agent-sessions-active",t],queryFn:()=>fE(t,{state:"active"}),enabled:!!t&&((ga=c.data)==null?void 0:ga.type)!=="human"}),w=Xe({queryKey:["clients"],queryFn:gi,enabled:!!t&&m,refetchInterval:3e4}),x=WG(h.data),[k,j]=b.useState(null),[C,E]=b.useState(null),[T,O]=b.useState(null),[D,I]=b.useState(!1),[R,B]=b.useState(!1),L=pt({mutationFn:async()=>{if(!h.data)throw new Error("config not loaded");const ye=x.buildPayloadPatch();return Ah(t,{expectedVersion:h.data.version,payload:ye})},onSuccess:ye=>{a.setQueryData(["agent-config",t],ye),x.resetToConfig(ye),j(null),E(null),B(!0)},onError:ye=>{if(B(!1),ye instanceof xs&&ye.status===409){E("Someone else saved a newer version while you were editing."),j(null);return}j(ye instanceof Error?ye.message:String(ye))}});b.useEffect(()=>{if(!R)return;const ye=setTimeout(()=>B(!1),2500);return()=>clearTimeout(ye)},[R]),b.useEffect(()=>{x.summary.anyDirty&&B(!1)},[x.summary.anyDirty]);const ee=x.resetToConfig,z=b.useCallback(async()=>{j(null),I(!0);try{const ye=await a.fetchQuery({queryKey:["agent-config",t],queryFn:()=>gc(t),staleTime:0});ee(ye)}catch(ye){j(ye instanceof Error?ye.message:String(ye))}finally{I(!1),E(null)}},[a,t,ee]),$=b.useCallback(ye=>{const Ve=document.getElementById(ye);Ve&&Ve.scrollIntoView({behavior:"smooth",block:"start"})},[]),Q=pt({mutationFn:ye=>Ry(t,ye),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),ne=pt({mutationFn:()=>cN(t),onMutate:()=>O(null),onSuccess:()=>{O(null),a.invalidateQueries({queryKey:["agent",t]})},onError:ye=>O(ye instanceof Error?ye.message:String(ye))}),Y=pt({mutationFn:()=>dN(t),onMutate:()=>O(null),onSuccess:()=>{O(null),a.invalidateQueries({queryKey:["agent",t]})},onError:ye=>O(ye instanceof Error?ye.message:String(ye))}),X=pt({mutationFn:()=>uN(t),onMutate:()=>O(null),onSuccess:()=>n("/team"),onError:ye=>O(ye instanceof Error?ye.message:String(ye))}),G=pt({mutationFn:()=>N4(t)}),[ie,J]=b.useState(!1),[ve,M]=b.useState(""),[P,U]=b.useState(null),[_,V]=b.useState(!1),Z=Xe({queryKey:["clients"],queryFn:gi,enabled:ie}),re=pt({mutationFn:ye=>Ry(t,{clientId:ye}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),J(!1),M(""),U(null)},onError:ye=>U(ye instanceof Error?ye.message:String(ye))}),[xe,Ae]=b.useState(!1),[Ce,Ye]=b.useState(null),Be=pt({mutationFn:()=>y9(t,x.buildPayloadPatch()),onSuccess:ye=>{const Ve=ye.diff.length?ye.diff.map(vt=>`${vt.op} ${vt.path}`).join(`
|
|
411
|
+
`):"(no changes)";Ye(Ve)},onError:ye=>Ye(`Dry run failed: ${ye instanceof Error?ye.message:String(ye)}`)});b.useEffect(()=>{if(!x.summary.anyDirty)return;const ye=Ve=>{Ve.preventDefault(),Ve.returnValue=""};return window.addEventListener("beforeunload",ye),()=>window.removeEventListener("beforeunload",ye)},[x.summary.anyDirty]);const qe=((Si=c.data)==null?void 0:Si.type)==="human",We=b.useMemo(()=>JG(qe,f),[qe,f]),it=b.useRef(null),[Se,Ie]=b.useState(!1);b.useEffect(()=>{if(qe)return;const ye=it.current;if(!ye||typeof IntersectionObserver>"u")return;const Ve=new IntersectionObserver(vt=>{const $n=vt[0];$n&&Ie(!$n.isIntersecting&&$n.boundingClientRect.top<0)},{threshold:0});return Ve.observe(ye),()=>Ve.disconnect()},[qe]);const[ot,se]=b.useState(nr.overview);b.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const ye=[];for(const Ve of We){const vt=document.getElementById(Ve.anchor);if(!vt)continue;const $n=new IntersectionObserver(Ua=>{for(const Fo of Ua)Fo.isIntersecting&&se(Ve.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});$n.observe(vt),ye.push($n)}return()=>{for(const Ve of ye)Ve.disconnect()}},[We]);const Ee=b.useMemo(()=>{const ye=new Set;for(const Ve of x.summary.dirtySections)ye.add(ej(Ve));return ye},[x.summary.dirtySections]);if(c.isLoading)return l.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:l.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(c.error)return l.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",c.error instanceof Error?c.error.message:"Unknown error"]});const Ne=c.data;if(!Ne)return l.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const Ze=Ne.type==="human",wt=p.data,Gt=((ki=g.data)==null?void 0:ki.length)??0,Ut=!Ze&&!wt&&p.isLoading,pr=p.error instanceof Error?p.error.message:p.error?"Unknown":null,ce=!Ze&&p.isSuccess&&!(wt!=null&&wt.clientId),me=!Ze&&wt?!wt.online&&!!wt.clientId:!1,Fe=E9({agentStatus:Ne.status,clientStatus:wt,clientStatusLoading:Ut,testPending:G.isPending}),Je=Ne,St=Je.runtimeState??null,An=Je.runtimeType??null,gr=Je.totalSessions??null,Yt=Ne.uuid.slice(0,8),qt=KG({activeSessions:Gt,isUnclaimed:ce,isOffline:me}),Bt=x.draft.mcp.filter(ye=>ye.status!=="deleted"),yt=x.draft.env.filter(ye=>ye.status!=="deleted"),yr=x.draft.git.filter(ye=>ye.status!=="deleted"),Bn=ye=>new Set(Bt.filter(Ve=>Ve.key!==ye).map(Ve=>Ve.value.name.toLowerCase())),Bo=ye=>new Set(yt.filter(Ve=>Ve.key!==ye).map(Ve=>Ve.value.key)),ja=ye=>new Set(yr.filter(Ve=>Ve.key!==ye).map(Ve=>{const{value:vt}=Ve;return vt.localPath?vt.localPath:((vt.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),sr={sessions:gr??"—",active:Gt,runtime:An??(Ze?"human":"—"),model:((js=(ji=h.data)==null?void 0:ji.payload.model)==null?void 0:js.trim())||"—"},ma=(wt==null?void 0:wt.clientId)??null,Fn=ma?((In=w.data)==null?void 0:In.find(ye=>ye.id===ma))??null:null,Pa=ma&&m?(Fn==null?void 0:Fn.hostname)??ma:null,pa=Ne.runtimeProvider??"claude-code",rn=pa==="codex"?"Codex":"Claude Code";return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.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:[l.jsx(ob,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),We.map(ye=>l.jsxs("div",{children:[ye.divider&&l.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),l.jsx(nV,{label:ye.label,active:ot===ye.anchor,danger:ye.danger??!1,dirty:Ee.has(ye.anchor),onClick:()=>$(ye.anchor)})]},ye.key))]}),l.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",style:{background:"var(--bg)"},children:[l.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)"},children:[l.jsxs(b9,{style:{marginBottom:"var(--sp-2)"},children:[l.jsx(x9,{onClick:()=>n("/team"),children:"Agents"}),l.jsx(w9,{}),l.jsx(S9,{mono:!0,children:Ne.name??Yt})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.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:l.jsx(Bc,{width:18,height:20,style:{color:"var(--accent)"}})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-title",title:`agt_${Yt}`,children:Ne.displayName}),l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",Ne.name??Yt]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[l.jsx(fr,{tone:Ne.type==="autonomous_agent"?"accent":"neutral",children:Ne.type}),Ne.visibility&&l.jsx(fr,{tone:Ne.visibility==="organization"?"accent":"outline",children:Ne.visibility}),(wt==null?void 0:wt.offlineSince)&&l.jsxs("span",{className:"mono",children:["offline since ",uc(wt.offlineSince)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(yc,{state:St}),l.jsxs(be,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${Ne.uuid}`),children:[l.jsx(Av,{className:"h-3 w-3"})," Open chat"]}),!Ze&&f&&Ne.status==="active"&&l.jsxs(be,{variant:"outline",size:"xs",onClick:()=>{G.reset(),G.mutate()},disabled:Fe.disabled,title:Fe.title,children:[l.jsx(GC,{className:"h-3 w-3"}),G.isPending?"Testing…":"Test"]})]})]}),l.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[l.jsx(kf,{label:"sessions",value:sr.sessions}),l.jsx(kf,{label:"active",value:sr.active,accent:typeof sr.active=="number"&&sr.active>0?"var(--accent)":void 0}),l.jsx(kf,{label:"runtime",value:sr.runtime}),l.jsx(kf,{label:"model",value:sr.model})]})]}),l.jsx("div",{ref:it,"aria-hidden":!0,style:{height:0}}),!Ze&&l.jsx(D9,{runtimeLabel:rn,computerLabel:Pa,visible:Se}),l.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:[(G.data||G.error)&&l.jsx(oV,{result:G.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>G.reset()}),l.jsx(Hs,{anchorId:nr.overview,title:"Profile",right:f?l.jsxs(be,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${Ne.uuid}`),title:"Manage platform bindings in Integrations",children:[l.jsx(jy,{className:"h-3 w-3"}),"Manage bindings"]}):null,children:l.jsx(V9,{agent:Ne,canEdit:f,onSave:async ye=>{await Q.mutateAsync(ye)}})}),l.jsx(Hs,{anchorId:"ad-appearance",title:"Appearance",children:l.jsx(R9,{agent:Ne,canEdit:f,onSave:async ye=>{await Q.mutateAsync(ye)},onRefresh:async()=>{await a.invalidateQueries({queryKey:["agent",t]}),await a.invalidateQueries({queryKey:["agents"]}),await a.invalidateQueries({queryKey:["me","chats"]})}})}),!Ze&&!f&&l.jsx(tV,{}),m&&l.jsxs(l.Fragment,{children:[l.jsxs(Hs,{anchorId:nr.setup,title:"Setup",caption:((vr=h.data)==null?void 0:vr.version)!=null?l.jsxs("span",{className:"mono",children:["config v",h.data.version,x.summary.anyDirty&&l.jsxs(l.Fragment,{children:[" · ",l.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[h.isLoading&&l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),h.error&&l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(h.error)]}),h.data&&l.jsx(GG,{runtimeProvider:pa,computerLabel:Pa,computerStatusLoading:Ut,computerStatusError:pr,canBindComputer:ce&&Ne.status==="active",bindComputerPending:re.isPending,onBindComputer:()=>J(!0),onRebind:Ne.clientId?()=>V(!0):void 0,modelSlot:l.jsx(s$,{value:x.draft.model,baseline:((Ci=h.data)==null?void 0:Ci.payload.model)??"",onChange:x.setModel,onRevert:x.revertModel,disabled:Ne.status!=="active",provider:pa})})]}),l.jsx(Hs,{anchorId:nr.prompt,title:"Prompt",children:h.data?l.jsx(DG,{value:x.draft.promptAppend,baseline:((Ei=h.data)==null?void 0:Ei.payload.prompt.append)??"",onChange:x.setPromptAppend,onRevert:x.revertPrompt,disabled:Ne.status!=="active"}):null}),l.jsx(Hs,{anchorId:nr.tools,title:"Tools",caption:"MCP servers available to this agent",children:h.data?l.jsx(Y9,{items:x.draft.mcp,otherNames:Bn,onAdd:x.addMcp,onUpdate:x.updateMcp,onDelete:x.deleteMcp,onUndoDelete:x.undoDeleteMcp,disabled:Ne.status!=="active"}):null}),l.jsx(Hs,{anchorId:nr.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:h.data&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{id:ih("env"),children:l.jsx(U9,{items:x.draft.env,otherKeys:Bo,onAdd:x.addEnv,onUpdate:x.updateEnv,onDelete:x.deleteEnv,onUndoDelete:x.undoDeleteEnv,disabled:Ne.status!=="active"})}),l.jsx("div",{id:ih("git"),children:l.jsx(H9,{items:x.draft.git,otherPaths:ja,onAdd:x.addGit,onUpdate:x.updateGit,onDelete:x.deleteGit,onUndoDelete:x.undoDeleteGit,disabled:Ne.status!=="active"})}),Ce&&l.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:Ce}),x.summary.anyDirty&&l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:l.jsx("button",{type:"button",onClick:()=>Be.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:Be.isPending,children:Be.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),f&&l.jsxs(l.Fragment,{children:[l.jsx(qG,{}),l.jsx(z9,{agent:Ne,suspendPending:ne.isPending,reactivatePending:Y.isPending,deletePending:X.isPending,errorMessage:T,onSuspend:()=>ne.mutate(),onReactivate:()=>Y.mutate(),onDelete:()=>X.mutate()})]})]}),m&&l.jsx(HG,{summary:x.summary,saveHint:qt,conflictMessage:C,errorMessage:k,saving:L.isPending,reloadingRemote:D,justSaved:R,onSave:()=>L.mutate(),onDiscard:()=>{x.summary.anyDirty&&Ae(!0)},onReloadRemote:()=>{z()},onJumpTo:ye=>$(ej(ye))})]}),l.jsx(rV,{open:xe,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:()=>{x.resetAll(),j(null),E(null),Ae(!1)}}),l.jsx(_n,{open:ie,onOpenChange:ye=>{J(ye),ye||(M(""),U(null),re.reset())},children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:"Bind computer"})}),l.jsxs("div",{className:"space-y-4",children:[l.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."}),Z.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):Z.error?l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",Z.error instanceof Error?Z.error.message:"Unknown"]}):l.jsx(aV,{clients:Z.data??[],selected:ve,onSelect:M}),P&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:P})]}),l.jsxs(ar,{children:[l.jsx(be,{variant:"outline",onClick:()=>J(!1),children:"Cancel"}),l.jsx(be,{disabled:!ve||re.isPending,onClick:()=>{U(null),re.mutate(ve)},children:re.isPending?"Binding…":"Bind"})]})]})}),l.jsx(LG,{open:_,onOpenChange:V,agent:Ne})]})}function tV(){return l.jsx(Hs,{anchorId:"ad-runtime-readonly",title:"Runtime configuration",children:l.jsx("div",{className:"text-body",style:{padding:"var(--sp-3)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-panel)",background:"var(--bg-raised)",color:"var(--fg-3)"},children:"You can view this shared agent profile. Runtime configuration, bindings, testing, and lifecycle controls are limited to the agent manager or an organization admin."})})}function nV({label:e,active:t,danger:n,dirty:a,onClick:s}){return l.jsx("button",{type:"button",onClick:s,className:Oe("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:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"flex-1 truncate",children:e}),a&&l.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&&l.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 rV(e){return l.jsx(_n,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(be,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function aV({clients:e,selected:t,onSelect:n}){const a=e.filter(ak);return a.length===0?l.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"," ",l.jsx("code",{className:"mono text-label",children:"first-tree-hub connect <token>"})," on the computer that should run this agent, then reopen this dialog."]}):l.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;return l.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("button",{type:"button",onClick:()=>n(s.id),className:Oe("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:[l.jsx("span",{className:Oe("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:ak(s)?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),l.jsxs("span",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"block text-body truncate font-medium",children:s.hostname??s.id}),l.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}`:""]})]}),l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:s.status})]})},s.id)})})}const iV={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},sV={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},lV={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function oV({result:e,onDismiss:t}){const n=sV[e.status],a=lV[e.status],s=e.connection;return l.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:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fr,{tone:a,children:iV[e.status]}),e.responseTime!=null&&l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),s&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[l.jsx("div",{children:s.runtimeState&&l.jsxs("span",{className:"mono",children:["runtime: ",s.runtimeState]})}),s.client?l.jsxs("div",{children:["Computer: ",s.client.hostname??s.client.id,s.client.os&&` (${s.client.os})`,s.client.sdkVersion&&` · SDK ${s.client.sdkVersion}`]}):l.jsx("div",{children:"No computer bound"}),s.lastSeenAt&&l.jsxs("div",{children:["Last seen: ",new Date(s.lastSeenAt).toLocaleString()]})]}),e.responseContent&&l.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})]}),l.jsx(be,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function uV(e,t){const n=`?window=${encodeURIComponent(t)}`;return je.get(by(e,`/context-tree/snapshot${n}`))}const tj="7d";function cV({previewSnapshot:e}={}){const{organizationId:t}=ct(),[n,a]=b.useState(null),s=e!==void 0,o=Xe({queryKey:["context-tree-snapshot",t,tj,s],queryFn:()=>{if(!t)throw new Error("No organization selected");return uV(t,tj)},enabled:!s&&!!t}),c=e??o.data,f=b.useMemo(()=>c?c.updates.find(h=>h.id===n)??c.updates[0]??null:null,[n,c]),m=(f==null?void 0:f.nodeId)??null;return b.useEffect(()=>{var h;c&&(n&&c.updates.some(p=>p.id===n)||a(((h=c.updates[0])==null?void 0:h.id)??null))},[n,c]),l.jsxs("div",{className:"context-live-page",style:{display:"flex",flexDirection:"column",gap:"var(--sp-10)"},children:[!s&&o.isLoading?l.jsx(mV,{}):null,!s&&o.error?l.jsx(pV,{message:o.error instanceof Error?o.error.message:"Failed to load"}):null,c&&(s||!o.isLoading)?c.snapshotStatus==="unavailable"?l.jsx(gV,{snapshot:c}):l.jsxs(l.Fragment,{children:[l.jsx(dV,{snapshot:c}),l.jsx(fV,{snapshot:c,selectedNodeId:m,onSelectNode:h=>{const p=c.updates.find(g=>g.nodeId===h);a((p==null?void 0:p.id)??null)}}),l.jsx(hV,{snapshot:c})]}):null]})}function dV({snapshot:e}){const t=_V(e.syncedAt)??"sync time unknown",n=EV(e.contextStatus.severity),a=e.contextStatus.severity==="ok"?null:e.contextStatus.detail??e.contextStatus.label;return l.jsxs("section",{className:"context-live-hero","aria-label":e.contextStatus.label,children:[l.jsxs("div",{className:"context-live-title-row",children:[l.jsx("span",{"aria-hidden":"true",className:"context-live-dot",style:{background:n,"--context-live-dot-color":n}}),l.jsx("h2",{className:"m-0 context-live-title",children:"Context tree is live"})]}),l.jsxs("div",{className:"text-lead context-live-subtitle",children:["Last updated at ",l.jsx("strong",{children:t})]}),a?l.jsx("div",{className:"text-body context-live-status-detail",children:a}):null]})}function fV({snapshot:e,selectedNodeId:t,onSelectNode:n}){const a=b.useMemo(()=>bV(e.nodes),[e.nodes]),s=b.useMemo(()=>SV(e.nodes,t),[e.nodes,t]),o=b.useMemo(()=>kV(a,s),[a,s]),c=Math.max(e.summary.changedNodeCount,e.updates.length);return l.jsxs("section",{className:"context-map-section","aria-label":"Context Tree update change map",children:[l.jsx("div",{className:"text-label context-map-kicker",children:"Past 7 days · Top updated domains"}),l.jsx("div",{className:"context-map-frame",children:o.length===0?l.jsx(yV,{}):l.jsxs("svg",{viewBox:"0 0 920 420",role:"img","aria-label":"Recent Context Tree update branches",preserveAspectRatio:"xMidYMid meet",className:"context-network-svg",children:[l.jsx("title",{children:"Update Change Map"}),l.jsx("circle",{className:"context-network-live-halo",cx:"460",cy:"210",r:"104"}),o.map(f=>l.jsx("path",{d:jV(f),fill:"none",stroke:f.selected?"var(--ok)":"var(--border-strong)",strokeDasharray:"5 8",strokeLinecap:"round",strokeOpacity:f.selected?.7:.36,strokeWidth:f.selected?2:1.4},`path:${f.id}`)),l.jsx("foreignObject",{x:"338",y:"122",width:"244",height:"176",className:"context-network-card-wrap",children:l.jsxs("div",{className:"context-network-summary-card",children:[l.jsx("span",{className:"context-network-summary-icon","aria-hidden":"true",children:l.jsx(UD,{size:30,strokeWidth:2.3})}),l.jsx("span",{className:"context-network-summary-title",children:"Context Tree"}),l.jsxs("span",{className:"context-network-summary-scale",children:[Lg(e.nodes.length),l.jsx("span",{children:"total nodes"})]}),l.jsxs("span",{className:"text-body context-network-summary-badge",children:["+",Lg(c)," updates"]})]})}),o.map(f=>l.jsx("foreignObject",{x:f.x,y:f.y,width:f.width,height:f.height,className:"context-network-card-wrap",children:l.jsxs("button",{type:"button",className:f.selected?"context-network-card is-live":"context-network-card",onClick:()=>n(f.representativeNodeId),children:[l.jsx("span",{className:"context-network-pin","aria-hidden":"true"}),l.jsx("span",{className:"text-subtitle context-network-title",children:f.title}),l.jsx("span",{className:"context-change-breakdown",children:wV(f.changeCounts).map(m=>l.jsxs("span",{"data-change-type":m.type,children:[Lg(m.count)," ",m.label]},m.type))})]})},f.id))]})})]})}function hV({snapshot:e}){const t=e.usage.windowDays===1?"1 day":`${e.usage.windowDays} days`,n=e.usage.agentCount===1?"1 agent":`${e.usage.agentCount} agents`,a=e.usage.usageCount===1?"1 time":`${e.usage.usageCount} times`;return l.jsxs("div",{className:"text-lead context-signal",style:{color:"var(--fg-3)"},children:[l.jsxs("span",{children:["In the last ",t,", ",l.jsx("mark",{children:n})]}),l.jsxs("span",{children:["used the tree ",l.jsx("mark",{children:a})," to make design decisions."]})]})}function mV(){return l.jsx(Yn,{children:l.jsx(Vr,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(GD,{size:17}),"Loading team context..."]})})})}function pV({message:e}){return l.jsx(Yn,{children:l.jsx(Vr,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--danger)",gap:"var(--sp-2)"},children:[l.jsx(Ic,{size:17}),e]})})})}function gV({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.contextStatus.detail,s=e.repo?NV(e.repo):null;return l.jsx(Yn,{children:l.jsx(Vr,{children:l.jsxs("div",{className:"flex items-start text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(Ic,{size:18,style:{color:"var(--warn)"}}),l.jsxs("div",{children:[l.jsx("div",{className:"font-semibold",style:{color:"var(--fg)"},children:t}),l.jsx("div",{style:{marginTop:"var(--sp-1)"},children:n}),a?l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:a}):null,e.repo||e.branch?l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[s?`Repo: ${s}`:null,e.repo&&e.branch?" · ":null,e.branch?`Branch: ${e.branch}`:null]}):null]})]})})})}function yV(){return l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in the past 7 days."})}function vV(e){const t=new Map(e.map(a=>[a.id,a])),n=new Set;for(const a of e)a.changeType&&CV(a.id,t,n);return e.filter(a=>n.has(a.id))}function bV(e){const t=vV(e).filter(s=>s.changeType);if(t.length===0)return[];const n=new Map(e.map(s=>[s.id,s])),a=new Map;for(const s of t){const o=_T(s,n),c=a.get(o.id);if(c){a.set(o.id,{...c,updateCount:c.updateCount+1,changeCounts:nj(c.changeCounts,s.changeType),representativeNodeId:c.representativeNodeId===o.id?s.id:c.representativeNodeId});continue}a.set(o.id,{id:o.id,title:o.title,path:o.path,representativeNodeId:s.id,updateCount:1,changeCounts:nj(xV(),s.changeType)})}return[...a.values()].sort((s,o)=>o.updateCount-s.updateCount||s.path.localeCompare(o.path)).slice(0,4)}function xV(){return{added:0,edited:0,removed:0}}function nj(e,t){return t==="added"?{...e,added:e.added+1}:t==="edited"?{...e,edited:e.edited+1}:t==="removed"?{...e,removed:e.removed+1}:e}function wV(e){const t=[];return e.added>0&&t.push({type:"added",label:"added",count:e.added}),e.edited>0&&t.push({type:"edited",label:"edited",count:e.edited}),e.removed>0&&t.push({type:"removed",label:"removed",count:e.removed}),t}function SV(e,t){if(!t)return null;const n=new Map(e.map(s=>[s.id,s])),a=n.get(t);return a?_T(a,n).id:null}function kV(e,t){const n=[{x:96,y:34,width:196,height:98,anchorX:292,anchorY:83},{x:628,y:34,width:196,height:98,anchorX:628,anchorY:83},{x:96,y:286,width:196,height:98,anchorX:292,anchorY:335},{x:628,y:286,width:196,height:98,anchorX:628,anchorY:335}],a=n[n.length-1];return a?e.map((s,o)=>{const c=n[o]??a;return{...s,...c,selected:s.id===t||t===null&&o===0}}):[]}function jV(e){const s=460+(e.anchorX<460?-1:1)*124,o=210+(e.anchorY>210?48:-48),c=(s+e.anchorX)/2,f=e.anchorY>210?o+62:o-62;return`M ${s} ${o} Q ${c} ${f} ${e.anchorX} ${e.anchorY}`}function _T(e,t){let n=e,a=n.parentId?t.get(n.parentId):void 0;for(;a&&a.parentId!==null;)n=a,a=n.parentId?t.get(n.parentId):void 0;return n}function CV(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function EV(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function NV(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function Lg(e){return new Intl.NumberFormat("en-US").format(e)}function _V(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(e)):null}const Io=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));Io.displayName="Card";const Lo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("flex flex-col space-y-1.5 p-6",e),...t}));Lo.displayName="CardHeader";const Gc=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("text-subtitle leading-none",e),...t}));Gc.displayName="CardTitle";const TT=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("text-body text-muted-foreground",e),...t}));TT.displayName="CardDescription";const Po=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("p-6 pt-0",e),...t}));Po.displayName="CardContent";const TV=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("flex items-center p-6 pt-0",e),...t}));TV.displayName="CardFooter";function AV(){const{token:e}=CC(),t=Dn(),{isAuthenticated:n,adoptTokens:a}=ct(),[s,o]=b.useState(null),[c,f]=b.useState(null),[m,h]=b.useState(!1),[p,g]=b.useState(null);if(b.useEffect(()=>{e&&(async()=>{try{const C=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!C.ok){f("This invitation is no longer valid");return}o(await C.json())}catch{f("Network error while loading invitation")}})()},[e]),b.useEffect(()=>{n&&(async()=>{try{const C=await je.get("/me/organizations"),E=await je.get("/me"),T=C.find(O=>O.id===E.member.organizationId);g((T==null?void 0:T.displayName)??null)}catch{}})()},[n]),!e)return l.jsx(rj,{message:"Bad invitation URL"});if(c)return l.jsx(rj,{message:"This invitation is no longer valid"});if(!s)return l.jsx(RV,{});const w=async()=>{h(!0);try{const C=await je.post("/me/organizations/join",{token:e});await a(C.tokens),LC("invite"),t("/",{replace:!0})}catch(C){f(C instanceof Error?C.message:"Failed to join team")}finally{h(!1)}},x=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,k=n&&p&&p!==s.organizationDisplayName,j=OV(s.expiresAt);return l.jsx(Tb,{children:l.jsxs(Io,{className:"w-full max-w-sm",children:[l.jsx(Lo,{className:"text-center",children:l.jsxs(Gc,{className:"text-title",children:["You're invited to join",l.jsx("br",{}),s.organizationDisplayName]})}),l.jsxs(Po,{className:"space-y-4",children:[k&&l.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[l.jsx(Ic,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),l.jsxs("span",{children:["You'll switch from ",l.jsx("span",{className:"font-medium",children:p})," to"," ",l.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?l.jsx(be,{className:"w-full",disabled:m,onClick:w,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):l.jsx(be,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:x,children:[l.jsx(ZC,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),j&&l.jsx("p",{className:"text-center text-label",style:{color:j.urgent?"var(--destructive)":"var(--fg-3)"},children:j.text}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function Tb({children:e}){return l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Dc,{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:[l.jsx(Nv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function RV(){return l.jsx(Tb,{children:l.jsxs(Io,{className:"w-full max-w-sm",children:[l.jsxs(Lo,{className:"text-center",children:[l.jsx("div",{className:"mx-auto h-5 w-2/3 rounded-md",style:{background:"var(--bg-sunken)"}}),l.jsx("div",{className:"mx-auto mt-2 h-5 w-1/2 rounded-md",style:{background:"var(--bg-sunken)"}})]}),l.jsxs(Po,{className:"space-y-4",children:[l.jsx("div",{className:"h-9 w-full rounded-md",style:{background:"var(--bg-sunken)"}}),l.jsx("div",{className:"mx-auto h-3 w-1/3 rounded-md",style:{background:"var(--bg-sunken)"}})]})]})})}function rj({message:e}){return l.jsx(Tb,{children:l.jsxs(Io,{className:"w-full max-w-sm",children:[l.jsxs(Lo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:l.jsx(Ic,{className:"h-6 w-6"})}),l.jsx(Gc,{className:"text-title",children:e})]}),l.jsxs(Po,{className:"space-y-4",children:[l.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."}),l.jsx(be,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs(Dc,{to:"/",children:[l.jsx(Nv,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function OV(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 MV(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=QN(s);return o===J1&&s!==J1?null:o}function DV(){const{isAuthenticated:e}=ct(),t=Rr(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=MV(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?l.jsx(er,{to:a,replace:!0}):l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(Dc,{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:[l.jsx(Nv,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:l.jsxs(Io,{className:"w-full max-w-sm",children:[l.jsxs(Lo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:l.jsx(Bc,{width:28,height:32})}),l.jsxs(Gc,{className:"text-title",children:["First Tree ",l.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),l.jsxs(Po,{className:"space-y-4",children:[l.jsx(be,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:s,children:[l.jsx(ZC,{className:"h-4 w-4"}),"Continue with GitHub"]})}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[l.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),l.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),l.jsx(be,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs("a",{href:o,children:[l.jsx(i3,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function zV(){const e=Dn(),{adoptTokens:t}=ct(),[n,a]=b.useState(null);return b.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=QN(o.get("next")),h=o.get("joinPath");if(!c||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&LC(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:c,refreshToken:f}),e(m,{replace:!0})))()},[t,e]),l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}const xc=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("table",{ref:a,className:Oe("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));xc.displayName="DenseTable";const wc=b.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:e,...t}));wc.displayName="DenseTableHeader";const Sc=b.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:e,...t}));Sc.displayName="DenseTableBody";const Ar=b.forwardRef(({className:e,interactive:t,selected:n,style:a,...s},o)=>l.jsx("tr",{ref:o,className:Oe("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}));Ar.displayName="DenseTableRow";const Wt=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("th",{ref:a,className:Oe("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}));Wt.displayName="DenseTableHead";const st=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("td",{ref:a,className:Oe("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));st.displayName="DenseTableCell";function Uo({title:e,subtitle:t,right:n,className:a,style:s,...o}){return l.jsxs("div",{className:Oe("flex items-baseline gap-3 shrink-0",a),style:{padding:"var(--sp-4) var(--sp-5) var(--sp-3)",...s},...o,children:[l.jsx("h1",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t&&l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),l.jsx("div",{style:{flex:1}}),n]})}const IV=1500;function LV({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,p]=b.useState(!1),g=async()=>{e&&(await navigator.clipboard.writeText(e),p(!0),setTimeout(()=>p(!1),IV))},w=t!==void 0?Math.max(1,Math.round(t/60)):null,x=l.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?l.jsxs(l.Fragment,{children:[e,w!==null&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",w,"m"]})]}):"Generating token…"}),k=l.jsxs(be,{type:"button",variant:"outline",size:"sm",onClick:g,disabled:!e,style:{alignSelf:"flex-start"},children:[h?l.jsx(hr,{className:"h-3.5 w-3.5"}):l.jsx(HC,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[x,k]}):l.jsxs(l.Fragment,{children:[x,k]}),f&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&l.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:[l.jsx(PV,{}),s]}),n==="success"&&o&&l.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:[l.jsx(hr,{className:"h-3.5 w-3.5",style:{flexShrink:0}}),l.jsx("span",{style:{minWidth:0},children:o})]}),n==="error"&&c&&l.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 PV(){return l.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 UV=3e3,BV=1200;function FV({open:e,onOpenChange:t}){const n=vn(),{user:a}=ct(),[s,o]=b.useState("loading"),[c,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),w=b.useRef(new Set);return b.useEffect(()=>{if(!e){o("loading"),f(null),h(null),g(null),w.current=new Set;return}let x=!1;const k=(n.getQueryData(["clients"])??[]).map(j=>j.id);return w.current=new Set(k),(async()=>{try{const j=await W3();if(x)return;f(j),o("waiting")}catch(j){if(x)return;h(j instanceof Error?j.message:"Failed to generate connect token"),o("error")}})(),()=>{x=!0}},[e,n]),b.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const k=setInterval(async()=>{try{const j=await n.fetchQuery({queryKey:["clients"],queryFn:gi}),C=w.current,E=j.find(T=>!C.has(T.id)&&T.status==="connected"&&T.userId===a.id);E&&(g(E.hostname??null),o("success"))}catch{}},UV);return()=>clearInterval(k)},[e,s,n,a]),b.useEffect(()=>{if(s!=="success")return;const x=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},BV);return()=>clearTimeout(x)},[s,t,n]),l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsxs(zn,{children:[l.jsx(Tn,{children:"Connect computer"}),l.jsx(Bv,{children:"Run this command on the machine you want to pair with this Hub."})]}),l.jsx(LV,{command:(c==null?void 0:c.command)??null,expiresInSeconds:c==null?void 0:c.expiresIn,phase:s,successContent:l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-semibold",children:p??"Computer"})," connected. Closing…"]}),errorContent:m}),l.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:l.jsx(be,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function $V({embedded:e=!1}={}){const t=vn(),n=bh(),{role:a,user:s}=ct(),o=a==="admin",[c,f]=b.useState(()=>new Set),[m,h]=b.useState(null),[p,g]=b.useState(null),[w,x]=b.useState(null),[k,j]=b.useState(!1),C=Xe({queryKey:["clients","org"],queryFn:Y3,enabled:o,refetchInterval:1e4}),E=Xe({queryKey:["clients","me"],queryFn:gi,enabled:!o||C.isError,refetchInterval:1e4}),T=Xe({queryKey:["members"],queryFn:cb,enabled:o,staleTime:6e4}),O=o&&!C.isError,D=o&&C.isError,I=O?C.data:E.data,{data:R}=Xe({queryKey:["activity"],queryFn:Lc,refetchInterval:1e4}),B=pt({mutationFn:X3,onSuccess:()=>{h(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),L=pt({mutationFn:K3,onSuccess:()=>{g(null),x(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:J=>{J instanceof xs?x(J.message):x(J instanceof Error?J.message:String(J))}}),ee=b.useMemo(()=>{const J=new Map;for(const ve of(R==null?void 0:R.agents)??[]){if(!ve.clientId)continue;const M=J.get(ve.clientId)??[];M.push(ve),J.set(ve.clientId,M)}return J},[R==null?void 0:R.agents]),z=J=>ee.get(J)??[],$=b.useMemo(()=>!O||!C.data||!s?[]:[...C.data].filter(J=>J.userId===s.id).sort((J,ve)=>J.lastSeenAt>ve.lastSeenAt?-1:J.lastSeenAt<ve.lastSeenAt?1:0),[O,C.data,s]),Q=b.useMemo(()=>!O||!C.data||!s?[]:[...C.data].filter(J=>J.userId!==s.id).sort((J,ve)=>J.lastSeenAt>ve.lastSeenAt?-1:J.lastSeenAt<ve.lastSeenAt?1:0),[O,C.data,s]),ne=b.useMemo(()=>{const J=new Map;for(const ve of T.data??[])J.set(ve.userId,ve.displayName);return J},[T.data]),Y=J=>{if(J.userId===null)return{text:"—"};if(J.userId===(s==null?void 0:s.id)){const M=ne.get(J.userId);return{text:M?`${M} (you)`:"you"}}const ve=ne.get(J.userId);return ve?{text:ve}:{text:J.userId.slice(0,8),title:J.userId}},X=(I??[]).filter(J=>J.status==="connected").length,G=(I??[]).reduce((J,ve)=>J+ve.agentCount,0),ie=(I??[]).filter(J=>J.authState!=="ok").length;return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(Uo,{title:"Computers",subtitle:I&&I.length>0?l.jsxs(l.Fragment,{children:[I.length," total · ",X," connected · ",G," agents bound",ie>0&&l.jsxs(l.Fragment,{children:[" · ",l.jsxs("span",{style:{color:"var(--state-error)"},children:[ie," need re-auth"]})]})]}):null,right:l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs(be,{size:"xs",onClick:()=>j(!0),children:[l.jsx(Sa,{className:"h-3 w-3"}),"Connect computer"]})})}),l.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[l.jsx(FV,{open:k,onOpenChange:j}),p&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.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:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:p.hostname??p.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)."]}),z(p.id).length>0&&l.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:[l.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),l.jsx("ul",{className:"text-body space-y-0.5",children:z(p.id).map(J=>l.jsx("li",{className:"font-medium",children:n(J.agentId)},J.agentId))})]}),w&&l.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:w}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(be,{variant:"outline",size:"sm",onClick:()=>{g(null),x(null)},children:"Cancel"}),l.jsx(be,{variant:"destructive",size:"sm",onClick:()=>L.mutate(p.id),disabled:L.isPending,children:L.isPending?"Retiring…":"Retire"})]})]})}),m&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.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:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:m.hostname??m.id.slice(0,8)})," ","and affect all bound agents:"]}),l.jsx("ul",{className:"mb-4 space-y-1",children:z(m.id).length===0?l.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):z(m.id).map(J=>l.jsxs("li",{className:"text-body flex items-center gap-2",children:[l.jsx("span",{className:"font-medium",children:n(J.agentId)}),l.jsx(yc,{state:J.runtimeState})]},J.agentId))}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(be,{variant:"outline",size:"sm",onClick:()=>h(null),children:"Cancel"}),l.jsx(be,{variant:"destructive",size:"sm",onClick:()=>B.mutate(m.id),disabled:B.isPending,children:B.isPending?"Disconnecting…":"Disconnect"})]})]})}),!I||I.length===0?l.jsxs(Yn,{children:[D&&l.jsx(ij,{}),l.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."})]}):l.jsxs(Yn,{children:[D&&l.jsx(ij,{}),l.jsxs(Fy,{children:["Registered · ",I.length]}),l.jsxs(xc,{children:[l.jsx(wc,{children:l.jsxs(Ar,{children:[l.jsx(Wt,{style:{width:16}}),l.jsx(Wt,{children:"Hostname"}),O&&l.jsx(Wt,{children:"Owner"}),l.jsx(Wt,{children:"OS"}),l.jsx(Wt,{children:"SDK"}),l.jsx(Wt,{children:"Agents"}),l.jsx(Wt,{children:"Connected"}),l.jsx(Wt,{children:"Status"}),l.jsx(Wt,{"aria-hidden":!0})]})}),l.jsx(Sc,{children:O?l.jsxs(l.Fragment,{children:[l.jsx(sj,{icon:Ov,title:"Your computers",count:$.length,colSpan:Wu}),$.length===0?l.jsx(lj,{colSpan:Wu,message:"No computers of your own."}):$.map(J=>{const ve=!c.has(J.id),M=z(J.id);return l.jsx(Pg,{client:J,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(P=>{const U=new Set(P);return U.has(J.id)?U.delete(J.id):U.add(J.id),U}),onDisconnect:()=>h(J),onRetire:()=>{x(null),g(J)},onReconnect:()=>j(!0),showOwner:!0,ownerLabel:Y(J)},J.id)}),l.jsx(sj,{icon:QC,title:"Team computers",count:Q.length,colSpan:Wu}),Q.length===0?l.jsx(lj,{colSpan:Wu,message:"No other team computers."}):Q.map(J=>{const ve=!c.has(J.id),M=z(J.id);return l.jsx(Pg,{client:J,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(P=>{const U=new Set(P);return U.has(J.id)?U.delete(J.id):U.add(J.id),U}),onDisconnect:()=>{},onRetire:()=>{},onReconnect:()=>{},showOwner:!0,ownerLabel:Y(J),restricted:!0},J.id)})]}):I.map(J=>{const ve=!c.has(J.id),M=z(J.id);return l.jsx(Pg,{client:J,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(P=>{const U=new Set(P);return U.has(J.id)?U.delete(J.id):U.add(J.id),U}),onDisconnect:()=>h(J),onRetire:()=>{x(null),g(J)},onReconnect:()=>j(!0)},J.id)})})]})]})]})]})}const HV={"claude-code":"Claude Code",codex:"Codex"},qV=[Jf.CLAUDE_CODE,Jf.CODEX],aj={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},ZV={"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 GV({clientId:e,enabled:t}){const{data:n,isLoading:a}=Xe({queryKey:["client-capabilities",e],queryFn:()=>mh(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return l.jsxs(l.Fragment,{children:[l.jsx(ob,{style:{display:"block",marginBottom:6},children:"Runtimes"}),a&&!s?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):s&&Object.keys(s).length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Capabilities not yet reported. Reconnect this computer to refresh."}):l.jsx("div",{className:"flex flex-col gap-1",children:qV.map(o=>l.jsx(VV,{provider:o,entry:s?s[o]??null:null},o))})]})}function VV({provider:e,entry:t}){const n=HV[e];if(!t)return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",aj[e]]})]});switch(t.state){case"ok":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",ZV[e]]})]});case"missing":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",aj[e]]})]});case"error":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function QV(){return l.jsxs("span",{className:"mono inline-flex items-center gap-1.5 uppercase text-caption",style:{color:"var(--state-error)"},children:[l.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--state-error)",display:"inline-block"}}),"AUTH EXPIRED"]})}const AT=8,Wu=AT+1;function ij(){return l.jsx("div",{className:"text-body",style:{margin:"var(--sp-3) var(--sp-3) 0",padding:"var(--sp-2_5) var(--sp-3)",borderRadius:"var(--radius-panel)",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:"Failed to load team computers. Showing only your computers."})}function sj({icon:e,title:t,count:n,colSpan:a}){return l.jsx(Ar,{children:l.jsx("td",{colSpan:a,style:{padding:"var(--sp-6) var(--sp-3_5) var(--sp-2) 0"},children:l.jsxs("span",{className:"inline-flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(e,{className:"h-4 w-4","aria-hidden":!0,style:{color:"var(--fg-3)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:t}),l.jsx(fr,{tone:"outline",children:n})]})})})}function lj({colSpan:e,message:t}){return l.jsx(Ar,{children:l.jsx("td",{colSpan:e,className:"text-body",style:{padding:"var(--sp-3) var(--sp-3_5)",color:"var(--fg-4)"},children:t})})}function Pg({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:o,onRetire:c,onReconnect:f,showOwner:m=!1,ownerLabel:h,restricted:p=!1}){const g=m?Wu:AT,w=e.status!=="connected",x=p?!1:n,k=e.authState!=="ok",j=e.status==="connected"?"idle":"offline";return l.jsxs(l.Fragment,{children:[l.jsxs(Ar,{interactive:!p,selected:x,onClick:p?void 0:s,children:[l.jsx(st,{style:{width:16},children:p?null:l.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:x?l.jsx(_v,{className:"h-3.5 w-3.5"}):l.jsx(yD,{className:"h-3.5 w-3.5"})})}),l.jsx(st,{className:"font-medium",children:e.hostname??"—"}),m&&l.jsx(st,{style:{color:"var(--fg-3)"},title:h==null?void 0:h.title,children:(h==null?void 0:h.text)??"—"}),l.jsx(st,{style:{color:"var(--fg-3)"},children:e.os??"—"}),l.jsx(st,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),l.jsx(st,{children:l.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),l.jsx(st,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?uc(e.connectedAt):"—"}),l.jsx(st,{children:k?l.jsx(QV,{}):l.jsx(yc,{state:j})}),l.jsx(st,{style:{width:1,whiteSpace:"nowrap"},children:p?null:l.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[w&&l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:k?"var(--state-error)":"var(--fg-2)"},onClick:C=>{C.stopPropagation(),f()},children:"Reconnect"}),l.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:C=>{C.stopPropagation(),o()},children:"Disconnect"}),l.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:C=>{C.stopPropagation(),c()},children:"Retire"})]})})]}),x&&l.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[l.jsx(st,{}),l.jsxs(st,{colSpan:g-1,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[l.jsx(GV,{clientId:e.id,enabled:x}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(ob,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),l.jsx("div",{className:"flex flex-col gap-1",children:t.map(C=>l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(C.agentId)}),l.jsx(yc,{state:C.runtimeState}),C.activeSessions!==null&&l.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[C.activeSessions," / ",C.totalSessions??0," sessions"]})]},C.agentId))})]})]})]})]})}function KV(){return l.jsx($V,{embedded:!0})}async function YV(e){try{return await je.get(`/orgs/${e}/github-app-installation`)}catch(t){if(t instanceof xs&&t.status===404)return null;throw t}}async function XV(e){const{installUrl:t}=await je.get(`/orgs/${e}/github-app-installation/install-url`);return t}function Vc({title:e,description:t,right:n,children:a,isFirst:s=!1}){return l.jsxs("section",{style:{padding:"var(--sp-6) 0",borderTop:s?void 0:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{style:{minWidth:0},children:[l.jsx("h2",{className:"text-subtitle font-medium m-0",style:{color:"var(--fg)"},children:e}),t&&l.jsx("p",{className:"text-label m-0",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)"},children:t})]}),n]}),l.jsx("div",{style:{marginTop:"var(--sp-4)"},children:a})]})}function WV({isFirst:e=!1}){const{organizationId:t}=ct(),n=Xe({queryKey:["github-app-installation",t],queryFn:()=>t?YV(t):Promise.reject(new Error("no org")),enabled:!!t});return l.jsx(Vc,{title:"GitHub App",description:"One installation unlocks user sign-in, webhook ingestion, and (later) server-side write access.",isFirst:e,children:n.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):n.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:n.error instanceof Error?n.error.message:"Failed to load installation"}):n.data==null?l.jsx(JV,{organizationId:t}):l.jsx(eQ,{data:n.data})})}function JV({organizationId:e}){const t=pt({mutationFn:()=>{if(!e)throw new Error("No organization selected");return XV(e)},onSuccess:o=>{window.location.assign(o)}}),n=t.error instanceof xs&&t.error.status===503,a=t.isPending,s=!e||a;return l.jsxs("div",{children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-2)",marginBottom:"var(--sp-3)"},children:"Install the GitHub App on your personal account or organization to start receiving issues, pull requests, and reviews as routed messages."}),n?l.jsxs("p",{className:"text-body",style:{color:"var(--state-error)"},children:["The GitHub App slug isn't configured on this hub. Ask your operator to set"," ",l.jsx("code",{className:"mono",children:"FIRST_TREE_HUB_GITHUB_APP_SLUG"}),"."]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>t.mutate(),disabled:s,className:"inline-flex items-center justify-center font-medium",style:{gap:"var(--sp-1)",padding:"var(--sp-2) var(--sp-3)",background:"var(--accent)",color:"var(--accent-fg, white)",border:"none",borderRadius:"var(--radius-input)",cursor:s?"default":"pointer",opacity:s?.6:1},children:[a?"Opening GitHub…":"Install on GitHub",l.jsx(Tv,{className:"h-3 w-3"})]}),t.error&&!n&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:t.error instanceof Error?t.error.message:"Failed to build the install URL"})]})]})}function eQ({data:e}){const t=e.accountType==="Organization"?hD:Ov,n=Object.entries(e.permissions);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[e.suspended&&l.jsx(tQ,{}),l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Connected as"}),l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(t,{className:"h-4 w-4",style:{color:"var(--fg-2)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.accountLogin}),l.jsx("span",{className:"text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--fg-3)"},children:e.accountType})]})]}),n.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Permissions granted"}),l.jsx("ul",{className:"text-body",style:{listStyle:"none",padding:0,margin:0,display:"grid",gridTemplateColumns:"1fr 1fr",gap:"var(--sp-1)",color:"var(--fg-2)"},children:n.map(([a,s])=>l.jsxs("li",{className:"mono",children:[a,": ",l.jsx("strong",{style:{color:"var(--fg)"},children:s})]},a))})]}),e.events.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Subscribed events"}),l.jsx("div",{className:"text-body mono",style:{color:"var(--fg-2)"},children:e.events.join(", ")})]}),l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs("a",{href:e.manageUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center text-body",style:{gap:"var(--sp-1)",padding:"var(--sp-1_5) var(--sp-2_5)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",textDecoration:"none"},children:["Manage on GitHub",l.jsx(Tv,{className:"h-3 w-3"})]}),l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)"},children:["Installation #",e.installationId]})]})]})}function tQ(){return l.jsxs("div",{className:"flex items-start text-body",style:{gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--state-warning, var(--fg-3))"},children:[l.jsx(bD,{className:"h-4 w-4 shrink-0",style:{marginTop:"var(--sp-0_5)"}}),l.jsx("span",{children:"This installation is suspended upstream. GitHub is not delivering webhooks and Hub can't act as the App on this account. Unsuspend it from the GitHub side to restore service."})]})}function nQ(){const{role:e}=ct();return e===null?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."}):e!=="admin"?l.jsx(er,{to:"/settings/computers",replace:!0}):l.jsxs(l.Fragment,{children:[l.jsx(Uo,{title:"GitHub",subtitle:"Connected GitHub App and granted permissions"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(WV,{isFirst:!0})})]})}function rQ(){return je.get(hn("/adapter-mappings"))}function aQ(e){return je.post(hn("/adapter-mappings"),e)}function iQ(e){return je.delete(`/adapter-mappings/${e}`)}function sQ(){return je.get(hn("/adapters/status"))}function lQ(){return je.get(hn("/adapters"))}function oQ(e){return je.post(hn("/adapters"),e)}function uQ(e,t){return je.patch(`/adapters/${e}`,t)}function cQ(e){return je.delete(`/adapters/${e}`)}const dQ=Object.values(oB),oj={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function uj(e){const[t,n]=b.useState(oj),[a,s]=b.useState("");b.useEffect(()=>{e.open&&(n({...oj,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=fQ(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 l.jsx(_n,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:c})}),l.jsxs("form",{onSubmit:o,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"binding-platform",children:"Platform"}),l.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:dQ.map(f=>l.jsx("option",{value:f,children:f},f))})]}),e.kind==="user"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"binding-ext-id",children:"External user ID"}),l.jsx(Kt,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"binding-name",children:"Display name (optional)"}),l.jsx(Kt,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):l.jsxs(l.Fragment,{children:[t.platform==="feishu"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Kt,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Kt,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Kt,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Kt,{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&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),l.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&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"binding-status",children:"Status"}),l.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:[l.jsx("option",{value:"active",children:"active"}),l.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(be,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function fQ(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 hQ(){var _;const e=Dn(),t=vn(),[n,a]=Oo(),s=n.get("agent"),o=bh(),c=Xe({queryKey:["adapters"],queryFn:lQ}),f=Xe({queryKey:["adapter-mappings"],queryFn:rQ}),m=Xe({queryKey:["adapter-statuses"],queryFn:sQ,refetchInterval:15e3}),p=((_=Xe({queryKey:["agents","name-map"],queryFn:()=>Uc({limit:100}),staleTime:3e4}).data)==null?void 0:_.items)??[],g=b.useMemo(()=>{const V=new Map;for(const Z of m.data??[])V.set(Z.configId,Z);return V},[m.data]),w=b.useMemo(()=>{const V=c.data??[];return s?V.filter(Z=>Z.agentId===s):V},[c.data,s]),x=b.useMemo(()=>{const V=f.data??[];return s?V.filter(Z=>Z.agentId===s):V},[f.data,s]),k=w.reduce((V,Z)=>{var re;return V+((re=g.get(Z.id))!=null&&re.connected?1:0)},0),j=w.length-k,C=c.isLoading||f.isLoading,[E,T]=b.useState(null),[O,D]=b.useState(""),[I,R]=b.useState(null),[B,L]=b.useState(null),[ee,z]=b.useState(null),[$,Q]=b.useState(null),ne=pt({mutationFn:V=>oQ({platform:V.platform,agentId:V.agentId,credentials:V.credentials,status:V.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),R(null)}}),Y=pt({mutationFn:V=>{const Z={status:V.status};return V.credentials&&(Z.credentials=V.credentials),uQ(V.id,Z)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),R(null)}}),X=pt({mutationFn:cQ,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),G=pt({mutationFn:V=>aQ({platform:V.platform,externalUserId:V.externalUserId,agentId:V.agentId,boundVia:"manual",displayName:V.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),L(null)}}),ie=pt({mutationFn:iQ,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function J(V){if(s){V==="bot"?R({agentId:s,editingId:null}):L({agentId:s});return}D(""),T({kind:V})}function ve(){!E||!O||(E.kind==="bot"?R({agentId:O,editingId:null}):L({agentId:O}),T(null))}function M(V){if(I){if(V.kind==="bot-create")ne.mutate({agentId:I.agentId,platform:V.draft.platform,status:V.draft.status,credentials:V.draft.credentials});else if(V.kind==="bot-update"){if(!I.editingId)return;Y.mutate({id:I.editingId,status:V.status,credentials:V.credentials})}}}function P(V){!B||V.kind!=="user-create"||G.mutate({agentId:B.agentId,platform:V.draft.platform,externalUserId:V.draft.externalUserId,displayName:V.draft.displayName})}const U=s?p.find(V=>V.uuid===s):null;return l.jsxs(l.Fragment,{children:[l.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&&l.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 var(--sp-0_5) var(--sp-3)"},children:[l.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Filtered to"}),l.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:[(U==null?void 0:U.displayName)??s,l.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:l.jsx(pi,{className:"h-3 w-3"})})]})]}),l.jsxs(Yn,{className:"mb-3.5",children:[l.jsxs(Fy,{right:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsxs("span",{className:"inline-flex items-center gap-3 text-caption",children:[l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--state-idle)"},children:[l.jsx(tc,{state:"idle",size:6})," ",k," online"]}),l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(tc,{state:"offline",size:6})," ",j," offline"]})]}),l.jsxs(be,{size:"xs",variant:"outline",onClick:()=>J("bot"),children:[l.jsx(Sa,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",w.length]}),C?l.jsx(Tf,{children:"Loading…"}):w.length?l.jsxs(xc,{children:[l.jsx(wc,{children:l.jsxs(Ar,{children:[l.jsx(Wt,{children:"Agent"}),l.jsx(Wt,{children:"Platform"}),l.jsx(Wt,{children:"Status"}),l.jsx(Wt,{children:"Connection"}),l.jsx(Wt,{children:"Created"}),l.jsx(Wt,{style:{width:96,textAlign:"right"}})]})}),l.jsx(Sc,{children:w.map(V=>{var re;const Z=((re=g.get(V.id))==null?void 0:re.connected)??!1;return l.jsxs(Ar,{interactive:!0,onClick:()=>e(`/agents/${V.agentId}`),children:[l.jsx(st,{children:l.jsx("span",{className:"mono font-medium",children:o(V.agentId)})}),l.jsx(st,{children:l.jsx(fr,{children:V.platform})}),l.jsx(st,{children:l.jsx(fr,{tone:V.status==="active"?"accent":"outline",children:V.status})}),l.jsx(st,{children:l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[l.jsx(tc,{state:Z?"idle":"offline",size:7}),l.jsx("span",{style:{color:"var(--fg-3)"},children:Z?"Online":"Offline"})]})}),l.jsx(st,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:uc(V.createdAt)}),l.jsxs(st,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:xe=>xe.stopPropagation(),children:[l.jsx(be,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>R({agentId:V.agentId,editingId:V.id,initialPlatform:mQ(V.platform),initialStatus:pQ(V.status)}),children:"Edit"}),l.jsx(be,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>z(V.id),disabled:X.isPending,title:"Delete",children:l.jsx(Zf,{className:"h-3.5 w-3.5"})})]})]},V.id)})})]}):l.jsx(Tf,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),l.jsxs(Yn,{children:[l.jsxs(Fy,{right:l.jsxs(be,{size:"xs",variant:"outline",onClick:()=>J("user"),children:[l.jsx(Sa,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",x.length]}),C?l.jsx(Tf,{children:"Loading…"}):x.length?l.jsxs(xc,{children:[l.jsx(wc,{children:l.jsxs(Ar,{children:[l.jsx(Wt,{children:"Agent"}),l.jsx(Wt,{children:"Platform"}),l.jsx(Wt,{children:"External user ID"}),l.jsx(Wt,{children:"Display name"}),l.jsx(Wt,{children:"Bound via"}),l.jsx(Wt,{children:"Created"}),l.jsx(Wt,{style:{width:32}})]})}),l.jsx(Sc,{children:x.map(V=>l.jsxs(Ar,{interactive:!0,onClick:()=>e(`/agents/${V.agentId}`),children:[l.jsx(st,{children:l.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(V.agentId)})}),l.jsx(st,{children:l.jsx(fr,{children:V.platform})}),l.jsx(st,{children:l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:V.externalUserId})}),l.jsx(st,{style:{color:"var(--fg-2)"},children:V.displayName??"—"}),l.jsx(st,{children:l.jsx(fr,{tone:"outline",children:V.boundVia??"—"})}),l.jsx(st,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:uc(V.createdAt)}),l.jsx(st,{onClick:Z=>Z.stopPropagation(),children:l.jsx(be,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>Q(V.id),disabled:ie.isPending,title:"Delete",children:l.jsx(Zf,{className:"h-3.5 w-3.5"})})})]},V.id))})]}):l.jsx(Tf,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),l.jsx(gQ,{open:E!=null,kind:(E==null?void 0:E.kind)??"bot",agents:p,agentId:O,onAgentChange:D,onCancel:()=>T(null),onConfirm:ve}),l.jsx(uj,{open:I!=null,kind:"bot",editingId:(I==null?void 0:I.editingId)??null,initialPlatform:I==null?void 0:I.initialPlatform,initialStatus:I==null?void 0:I.initialStatus,agentLabel:I?o(I.agentId):"",pending:ne.isPending||Y.isPending,errorMessage:(ne.error??Y.error)instanceof Error?(ne.error??Y.error).message:null,onOpenChange:V=>{V||(R(null),ne.reset(),Y.reset())},onSubmit:M}),l.jsx(uj,{open:B!=null,kind:"user",editingId:null,agentLabel:B?o(B.agentId):"",pending:G.isPending,errorMessage:G.error instanceof Error?G.error.message:null,onOpenChange:V=>{V||(L(null),G.reset())},onSubmit:P}),l.jsx(cj,{open:ee!=null,onOpenChange:V=>!V&&z(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:()=>{ee!=null&&(X.mutate(ee),z(null))}}),l.jsx(cj,{open:$!=null,onOpenChange:V=>!V&&Q(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:ie.isPending,onConfirm:()=>{$!=null&&(ie.mutate($),Q(null))}})]})}function mQ(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function pQ(e){return e==="inactive"?"inactive":"active"}function Tf({children:e}){return l.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function gQ(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 l.jsx(_n,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),l.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:[l.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>l.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),l.jsxs(ar,{children:[l.jsx(be,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),l.jsx(be,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function cj(e){return l.jsx(_n,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(be,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function yQ({embedded:e=!1}={}){return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(Uo,{title:"Messaging",subtitle:"Feishu / Slack bridges to your team's agents"}),l.jsx("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:l.jsx(hQ,{})})]})}function vQ(){return l.jsx(yQ,{embedded:!0})}function bQ(){const{onboardingStep:e,onboardingDismissedAt:t,onboardingCompletedAt:n,dismissOnboarding:a,restoreOnboarding:s}=ct();if(n)return l.jsx(er,{to:"/settings/team",replace:!0});const o=!!t,c=e==="completed";return l.jsxs(l.Fragment,{children:[l.jsx(Uo,{title:"Onboarding",subtitle:"Guided setup controls"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(Vc,{title:"Onboarding guide",description:o?"The stepper is hidden. Bring it back if you want to walk through Step 3 (build your context-tree).":"The stepper is shown above your workspace. You can hide it any time once your agent is set up.",right:o?null:l.jsx(xQ,{}),isFirst:!0,children:o?l.jsx(be,{type:"button",size:"sm",onClick:()=>void s(),children:"Resume onboarding"}):l.jsx(be,{type:"button",size:"sm",variant:"outline",onClick:()=>void a(),disabled:!c,title:c?void 0:"Finish setting up your agent first",children:"Hide onboarding guide"})})})]})}function xQ(){return l.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[l.jsx(hr,{className:"h-3 w-3"}),"Active"]})}function wQ(){const{role:e,onboardingCompletedAt:t}=ct(),n=e==="admin",a=t!==null;return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:200,padding:"var(--sp-4) var(--sp-2)"},children:[l.jsx(qu,{to:"/settings/team",label:"Team"}),l.jsx(qu,{to:"/settings/computers",label:"Computers"}),n&&l.jsx(qu,{to:"/settings/github",label:"GitHub"}),l.jsx(qu,{to:"/settings/integrations",label:"Messaging"}),!a&&l.jsx(qu,{to:"/settings/onboarding",label:"Onboarding"})]}),l.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:l.jsx(Hf,{})})]})}function qu({to:e,label:t}){return l.jsx(kv,{to:e,className:({isActive:n})=>Oe("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})=>l.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:l.jsx("span",{className:"flex-1 truncate",children:t})})})}function ev(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,no)}const Ug=200;function SQ(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 kQ(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,no)}function RT(e){return e==="claude-code"||e==="codex"?e:null}function jQ(e){var t,n;if(((t=e["claude-code"])==null?void 0:t.state)==="ok")return"claude-code";if(((n=e.codex)==null?void 0:n.state)==="ok")return"codex";for(const[a,s]of Object.entries(e))if(s.state==="ok"){const o=RT(a);if(o)return o}return null}function CQ(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function EQ(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 NQ({open:e,onOpenChange:t,onCreated:n}){const a=vn(),{refreshMe:s,organizationId:o}=ct(),[c,f]=b.useState(""),[m,h]=b.useState(""),[p,g]=b.useState(!1),[w,x]=b.useState("private"),[k,j]=b.useState("claude-code"),[C,E]=b.useState(!1),[T,O]=b.useState([]),[D,I]=b.useState(!1),[R,B]=b.useState(null),[L,ee]=b.useState(null),[z,$]=b.useState(null),[Q,ne]=b.useState(null),[Y,X]=b.useState(null),[G,ie]=b.useState(null),[J,ve]=b.useState(!1),[M,P]=b.useState({}),[U,_]=b.useState({status:"idle"});b.useEffect(()=>{e&&(f(""),h(""),g(!1),x("private"),j("claude-code"),E(!1),O([]),I(!1),B(null),ee(null),$(null),ne(null),X(null),ie(null),ve(!1),P({}),_({status:"idle"}))},[e]),b.useEffect(()=>{p||h(ev(c))},[c,p]);const V=b.useRef(0);b.useEffect(()=>{if(!e||!m){_({status:"idle"});return}if(!Ly.test(m)){_({status:"bad",reason:"invalid"});return}if(Py(m)){_({status:"bad",reason:"reserved"});return}const Se=++V.current;_({status:"checking"});const Ie=window.setTimeout(()=>{k4(m).then(ot=>{Se===V.current&&(ot.available?_({status:"ok"}):_({status:"bad",reason:ot.reason}))}).catch(()=>{Se===V.current&&_({status:"idle"})})},300);return()=>window.clearTimeout(Ie)},[m,e]),b.useEffect(()=>{if(!e)return;let Se=!1;const Ie=async()=>{try{const se=await gi();if(Se)return;const Ee=se.filter(Ne=>Ne.status==="connected").sort((Ne,Ze)=>Ze.lastSeenAt.localeCompare(Ne.lastSeenAt));O(Ee),I(!0)}catch{Se||I(!0)}};Ie();const ot=window.setInterval(Ie,3e3);return()=>{Se=!0,window.clearInterval(ot)}},[e]),b.useEffect(()=>{if(T.length===0){B(null);return}B(Se=>{var Ie;return Se&&T.some(ot=>ot.id===Se)?Se:((Ie=T[0])==null?void 0:Ie.id)??null})},[T]),b.useEffect(()=>{if(!R){ee(null),$(null);return}let Se=!1;const Ie=async()=>{try{const se=await mh(R);if(Se)return;ee(se.capabilities),$(R)}catch{}};Ie();const ot=window.setInterval(Ie,3e3);return()=>{Se=!0,window.clearInterval(ot)}},[R]),b.useEffect(()=>{if(!e||T.length>0)return;if(Q&&G&&G>Date.now()){const Ie=Math.max(G-Date.now(),0),ot=window.setTimeout(()=>{ne(null),ie(null)},Ie);return()=>window.clearTimeout(ot)}Q&&(ne(null),X(null),ie(null));let Se=!1;return(async()=>{try{const Ie=await je.post("/me/connect-tokens",{});if(Se)return;ne(Ie.token),X(Ie.command),ie(Date.now()+Ie.expiresIn*1e3)}catch{}})(),()=>{Se=!0}},[e,T.length,Q,G]);const Z=R&&z===R?L:null,re=b.useMemo(()=>{if(!Z)return[];const Se=[];for(const[Ie,ot]of Object.entries(Z)){if(ot.state!=="ok")continue;const se=RT(Ie);se&&Se.push(se)}return Se},[Z]);b.useEffect(()=>{Z&&j(Se=>{var Ie;return((Ie=Z[Se])==null?void 0:Ie.state)==="ok"?Se:jQ(Z)??Se})},[Z]);const xe=pt({mutationFn:async Se=>{const Ie=c.trim()||m.trim()||"Untitled assistant";return S4({name:m||void 0,type:"personal_assistant",displayName:Ie,clientId:Se.clientId,runtimeProvider:k,visibility:w,...o?{organizationId:o}:{}})},onSuccess:Se=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(Se,k)}}),Ae=b.useMemo(()=>{const Se=xe.error;if(!Se)return{};if(Se instanceof xs){const Ie=SQ(Se.issues);return Object.keys(Ie).length>0?Ie:Se.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:Se.message}}return Se instanceof Error?{_root:Se.message}:{}},[xe.error]),Ce=U.status==="bad"?EQ(U.reason):void 0,Ye={...Ce?{name:Ce}:{},...Ae,...M};function Be(){const Se={};return m?m.length>no?Se.name=`Agent name must be at most ${no} characters (got ${m.length}).`:Ly.test(m)?Py(m)&&(Se.name="That agent name is reserved — pick a different one."):Se.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":c.trim().length>0&&(Se.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),c.length>Ug&&(Se.displayName=`Display name must be at most ${Ug} characters (got ${c.length}).`),Se}function qe(Se){Se.preventDefault();const Ie=Be();P(Ie),!(Object.keys(Ie).length>0)&&U.status!=="bad"&&R&&(re.length===0||!re.includes(k)||xe.mutate({clientId:R}))}const We=U.status==="bad",it=c.trim().length>0&&!We&&!xe.isPending&&!!R&&re.length>0&&re.includes(k);return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{className:"max-w-lg",children:[l.jsx(zn,{children:l.jsx(Tn,{children:"New Agent"})}),l.jsxs("form",{onSubmit:qe,className:"space-y-5 min-w-0",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"new-agent-display-name",children:"Display name"}),l.jsx(Kt,{id:"new-agent-display-name",value:c,onChange:Se=>{f(Se.target.value),M.displayName&&P(Ie=>({...Ie,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Ug,"aria-invalid":Ye.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),l.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."}),Ye.displayName&&l.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:Ye.displayName}),!C&&(c.trim()||m)&&l.jsxs("div",{className:"flex items-baseline gap-2 text-caption text-muted-foreground",children:[m?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"font-mono",children:["@",m]}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("span",{children:"permanent"})]}):l.jsx("span",{className:"italic",children:"No @handle from this display name"}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("button",{type:"button",onClick:()=>E(!0),className:"text-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Edit"})]}),!C&&Ye.name&&l.jsx("p",{className:"text-caption text-destructive",children:Ye.name})]}),C&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx(mt,{htmlFor:"new-agent-name",children:"Agent name"}),l.jsx("button",{type:"button",onClick:()=>E(!1),className:"text-caption text-muted-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Done"})]}),l.jsxs("div",{className:"flex items-stretch",children:[l.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:"@"}),l.jsx(Kt,{id:"new-agent-name",value:m,autoFocus:!0,onChange:Se=>{const Ie=kQ(Se.target.value);h(Ie),g(!0),M.name&&P(ot=>({...ot,name:void 0}))},onBlur:Se=>{const Ie=ev(Se.target.value);Ie!==m&&h(Ie)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:no,"aria-invalid":Ye.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),l.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"," ",no," characters. Permanent after creation."]}),m&&!Ye.name&&U.status!=="idle"&&l.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:U.status==="ok"?"var(--state-idle)":U.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[U.status==="checking"&&"Checking availability…",U.status==="ok"&&"Available."]}),Ye.name&&l.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:Ye.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Visibility"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:w==="organization"?"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:[l.jsx("input",{type:"radio",name:"visibility",checked:w==="organization",onChange:()=>x("organization"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Shared with team"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Anyone in your org can @mention and chat with this agent."})]})]}),l.jsxs("label",{className:w==="private"?"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:[l.jsx("input",{type:"radio",name:"visibility",checked:w==="private",onChange:()=>x("private"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Private to you"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Only you can see this agent and chat with it. Others on the team won't see it listed. (default)"})]})]})]})]}),l.jsxs("div",{className:"space-y-3",style:{minHeight:168},children:[l.jsx(mt,{children:"Where it runs"}),D?T.length===0?l.jsx(_Q,{command:Y,copied:J,onCopy:async()=>{Y&&(await navigator.clipboard.writeText(Y),ve(!0),window.setTimeout(()=>ve(!1),1500))}}):T.length===1?l.jsx(TQ,{client:T[0]}):l.jsx("div",{className:"space-y-2",children:T.map(Se=>{const Ie=R===Se.id;return l.jsxs("label",{className:Ie?"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:[l.jsx("input",{type:"radio",name:"picked-client",checked:Ie,onChange:()=>B(Se.id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body font-medium truncate",children:Se.hostname??Se.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[Se.os??"unknown OS"," · last seen ",new Date(Se.lastSeenAt).toLocaleString()]})]})]},Se.id)})}):l.jsx(AQ,{label:"Detecting connected computers…"}),(R||!D)&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("div",{className:"text-caption text-muted-foreground",children:"Powered by"}),!R||Z===null?l.jsx(RQ,{}):re.length===0?l.jsx("p",{className:"text-caption text-destructive",children:"No runtime ready on this computer. Install Claude Code or Codex on it (and sign in), then come back."}):l.jsx("div",{className:"flex flex-wrap gap-2",children:re.map(Se=>{const Ie=k===Se;return l.jsxs("label",{className:Ie?"inline-flex items-center gap-2 rounded-md border border-primary bg-primary/5 px-3 py-1.5 cursor-pointer":"inline-flex items-center gap-2 rounded-md border border-border px-3 py-1.5 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"runtime",checked:Ie,onChange:()=>j(Se)}),l.jsx("span",{className:"text-body",children:CQ(Se)})]},Se)})})]}),Ye.clientId&&l.jsx("p",{className:"text-caption text-destructive",children:Ye.clientId})]}),Ye._root&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:Ye._root}),l.jsx(ar,{children:l.jsx(be,{type:"submit",disabled:!it,children:xe.isPending?"Creating…":"Create"})})]})]})})}function _Q({command:e,copied:t,onCopy:n}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 space-y-2",children:[l.jsx("div",{className:"text-body font-medium",children:"No computer connected yet."}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Run this on the machine where this agent should live. We'll pick it up here automatically."}),l.jsxs("div",{className:"flex items-stretch gap-2 min-w-0",children:[l.jsx("code",{className:"block flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-caption px-2 py-1.5 bg-muted/50 border border-border rounded",title:e??void 0,children:e??"Generating token…"}),l.jsx("button",{type:"button",onClick:n,disabled:!e,className:"shrink-0 px-3 py-1.5 text-caption font-medium border border-border rounded hover:bg-accent/30 disabled:opacity-50",children:t?"Copied":"Copy"})]})]})}function TQ({client:e}){return e?l.jsxs("div",{className:"rounded-md border border-primary bg-primary/5 p-3",children:[l.jsx("div",{className:"text-body font-medium truncate",children:e.hostname??e.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[e.os??"unknown OS"," · last seen ",new Date(e.lastSeenAt).toLocaleString()]})]}):null}function AQ({label:e}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",role:"status","aria-live":"polite","aria-label":e,children:[l.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg-3)"},children:e}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Looking for a machine running the Hub client…"})]})}function RQ(){return l.jsx("div",{className:"flex flex-wrap gap-2",role:"status","aria-live":"polite","aria-label":"Detecting installed runtimes",children:l.jsx("span",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 px-3 py-1.5 text-body",style:{color:"var(--fg-4)"},children:"Detecting installed runtimes…"})})}function tv({active:e,count:t,warn:n,className:a,children:s,style:o,...c}){return l.jsxs("button",{type:"button",className:Oe("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&&l.jsx("span",{className:"mono",style:{color:n&&typeof t=="number"&&t>0?"var(--state-error)":"var(--fg-4)"},children:t})]})}function OQ(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 MQ(){const{organizationId:e}=ct(),[t,n]=b.useState(null),[a,s]=b.useState(null),[o,c]=b.useState(!1),[f,m]=b.useState(!1);b.useEffect(()=>{e&&(async()=>{try{const p=await je.get(by(e,"/invitations"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){c(!0),s(null);try{const p=await je.post(by(e,"/invitations/rotate"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to rotate invite link")}finally{c(!1)}}};return l.jsxs(Io,{children:[l.jsxs(Lo,{children:[l.jsx(Gc,{children:"Invite link"}),l.jsxs(TT,{children:["Anyone with this link can join your team as a member. Links expire after ",gF," days; rotating revokes the old link instantly and resets the timer."]})]}),l.jsxs(Po,{className:"space-y-3",children:[a&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:a}),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{readOnly:!0,className:"flex-1 rounded-md border bg-muted px-2 py-1 text-label font-mono",value:t.inviteUrl}),l.jsx(be,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),l.jsx(be,{size:"sm",onClick:h,disabled:o,children:o?"Rotating…":"Rotate"})]}),l.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${OQ(t.expiresAt)}`:" · no expiry"]})]}):l.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}function Ab({actions:e,ariaLabel:t,triggerClassName:n,icon:a=SD}){const[s,o]=b.useState(!1),[c,f]=b.useState("down"),m=b.useRef(null),h=b.useRef(null);return b.useEffect(()=>{if(!s)return;const p=w=>{m.current&&!m.current.contains(w.target)&&o(!1)},g=w=>{w.key==="Escape"&&o(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[s]),b.useEffect(()=>{if(!s||!h.current)return;const p=32,g=8,w=h.current.getBoundingClientRect(),x=window.innerHeight-w.bottom,k=e.length*p+g;f(x>=k?"down":"up")},[s,e.length]),e.length===0?null:l.jsxs("div",{ref:m,className:"relative inline-flex",children:[l.jsx("button",{ref:h,type:"button","aria-label":t,"aria-haspopup":"menu","aria-expanded":s,onClick:p=>{p.stopPropagation(),o(g=>!g)},className:Oe("inline-flex items-center justify-center",n),style:{width:28,height:28,borderRadius:4,background:"transparent",color:"var(--fg-3)",cursor:"pointer",border:0},children:l.jsx(a,{className:"h-3.5 w-3.5"})}),s&&l.jsx("div",{role:"menu",className:"absolute right-0 z-30 rounded-md border bg-popover shadow-md",onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),style:{minWidth:180,borderColor:"var(--border)",...c==="up"?{bottom:"100%",marginBottom:4}:{top:"100%",marginTop:4}},children:e.map(p=>l.jsx("button",{type:"button",role:"menuitem",disabled:p.disabled,onClick:g=>{g.stopPropagation(),o(!1),p.onSelect()},className:"flex w-full items-center px-3 py-1.5 text-left text-body hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed",style:{color:p.destructive?"var(--state-error)":"var(--fg)",background:"transparent",border:0,cursor:p.disabled?"not-allowed":"pointer"},children:p.label},p.key))})]})}const Rb=[{key:"name",label:"Name",width:220},{key:"delegate",label:"Delegate",width:180},{key:"manager",label:"Manager",width:180},{key:"runtime",label:"Runs on",width:220},{key:"status",label:"Status",width:160},{key:"created",label:"Created",width:160},{key:"actions",label:"",width:44}];function Tr(e,t){return e?{...t,borderBottom:0}:t}function DQ({groups:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){return l.jsxs(xc,{className:"table-fixed",children:[l.jsx(wc,{children:l.jsx(Ar,{children:Rb.map(c=>l.jsx(Wt,{style:{width:c.width,...c.key==="name"?{paddingLeft:"var(--sp-6)"}:null},"aria-hidden":c.key==="actions",children:c.label},c.key))})}),e.map(c=>l.jsx(zQ,{group:c,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o},c.key))]})}function zQ({group:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){const[c,f]=b.useState(!e.collapsible);return l.jsxs(Sc,{children:[l.jsx(LQ,{group:e,open:c,onToggle:()=>f(m=>!m)}),c&&e.rows.length===0&&e.emptyMessage&&l.jsx(Ar,{children:l.jsx(st,{colSpan:Rb.length,style:{color:"var(--fg-4)",textAlign:"left",padding:"0 var(--sp-3_5) var(--sp-3) var(--sp-6)",borderBottom:0},children:e.emptyMessage})}),c&&e.rows.map((m,h)=>{const p=h===e.rows.length-1;return m.kind==="human"?l.jsx(PQ,{row:m,actions:s(m),isLast:p},`h:${m.id}`):l.jsx(BQ,{row:m,runtime:t.get(m.agent.uuid)??null,clientHost:m.agent.clientId?n.get(m.agent.clientId)??null:null,actions:o(m),onClick:()=>a(m.agent.uuid),isLast:p},`a:${m.agent.uuid}`)})]})}function IQ(e){switch(e){case"humans":return Ov;case"yours":case"team":return $C;case"other-private":return fh;default:return null}}function LQ({group:e,open:t,onToggle:n}){const a=IQ(e.key),s=l.jsxs("span",{className:"inline-flex items-center relative",style:{gap:"var(--sp-2)"},children:[e.collapsible&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:"calc(-1 * var(--sp-3))",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)",lineHeight:1},children:t?"▾":"▸"}),a&&l.jsx(a,{className:"h-4 w-4","aria-hidden":!0,style:{color:"var(--fg-3)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx(fr,{tone:"outline",children:e.count})]});return l.jsx(Ar,{children:l.jsx("td",{colSpan:Rb.length,style:{padding:"var(--sp-6) var(--sp-3_5) var(--sp-2) 0"},children:e.collapsible?l.jsx("button",{type:"button",onClick:n,"aria-expanded":t,style:{background:"transparent",border:0,cursor:"pointer",color:"inherit",padding:"0 0 0 var(--sp-3)",marginLeft:"calc(-1 * var(--sp-3))"},children:s}):s})})}function PQ({row:e,actions:t,isLast:n}){return l.jsxs(Ar,{children:[l.jsx(st,{style:Tr(n,{paddingLeft:"var(--sp-6)"}),children:l.jsx(OT,{displayName:e.displayName,handle:`@${e.username}`,selfTag:e.isSelf})}),l.jsx(st,{style:Tr(n),children:l.jsx(UQ,{row:e})}),l.jsx(st,{className:"text-label",style:Tr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(st,{className:"text-label",style:Tr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(st,{className:"text-label",style:Tr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(st,{className:"mono text-caption",style:Tr(n,{color:"var(--fg-4)"}),children:dE(e.createdAt)}),l.jsx(st,{style:Tr(n,{padding:0,textAlign:"right"}),children:l.jsx(Ab,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function UQ({row:e}){if(!e.delegate&&!e.canEditDelegate)return l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"—"});const t=e.delegate?e.delegate.name?`${e.delegate.displayName} (@${e.delegate.name})`:e.delegate.displayName:"Set delegate",n=e.delegate?l.jsx("span",{className:"block max-w-full overflow-hidden text-ellipsis whitespace-nowrap",children:l.jsx(x_,{name:e.delegate.name,displayName:e.delegate.displayName})}):l.jsx("span",{style:{color:"var(--accent-dim)"},children:"Set delegate →"}),a=e.delegate?e.canEditDelegate?`Change delegate · ${t}`:t:"Set delegate";return e.canEditDelegate?l.jsx("button",{type:"button",onClick:e.onEditDelegate,className:"text-label hover:underline block max-w-full overflow-hidden",style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"inherit",textAlign:"left"},title:a,children:n}):l.jsx("span",{className:"text-label block max-w-full overflow-hidden",title:a,children:n})}function BQ({row:e,runtime:t,clientHost:n,actions:a,onClick:s,isLast:o}){const{agent:c,managerLabel:f,isOwnedBySelf:m,showVisibilityChip:h}=e;return l.jsxs(Ar,{interactive:!0,onClick:s,children:[l.jsx(st,{style:Tr(o,{paddingLeft:"var(--sp-6)"}),children:l.jsx(OT,{displayName:c.displayName,handle:c.name?`@${c.name}`:null,visibility:h?c.visibility:null})}),l.jsx(st,{className:"text-label",style:Tr(o,{color:"var(--fg-4)"}),children:"—"}),l.jsx(st,{className:"text-label",style:Tr(o,{color:"var(--fg-2)"}),children:f?l.jsxs("span",{className:"truncate inline-block max-w-full",title:f,children:[f,m&&l.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}):l.jsx("span",{style:{color:"var(--fg-4)"},children:"—"})}),l.jsx(st,{className:"mono text-caption",style:Tr(o,{color:"var(--fg-3)"}),children:l.jsxs("div",{className:"truncate",title:n?`${c.runtimeProvider} @ ${n}`:c.runtimeProvider,children:[c.runtimeProvider,n&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" @ ",n]})]})}),l.jsx(st,{style:Tr(o),children:l.jsx(yc,{state:(t==null?void 0:t.runtimeState)??null})}),l.jsx(st,{className:"mono text-caption",style:Tr(o,{color:"var(--fg-4)"}),children:dE(c.createdAt)}),l.jsx(st,{style:Tr(o,{padding:0,textAlign:"right"}),onClick:p=>p.stopPropagation(),children:l.jsx(Ab,{actions:a,ariaLabel:`Actions for ${c.displayName}`})})]})}function OT({displayName:e,handle:t,selfTag:n,visibility:a}){return l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline gap-1.5 min-w-0",children:[l.jsx("span",{className:"font-medium text-body truncate",style:{color:"var(--fg)"},title:e,children:e}),n&&l.jsx("span",{className:"text-label italic shrink-0",style:{color:"var(--fg-3)"},children:"(you)"}),a&&l.jsx(FQ,{visibility:a})]}),t&&l.jsx("div",{className:"mono text-caption truncate",style:{color:"var(--fg-4)"},title:t,children:t})]})}function FQ({visibility:e}){return e==="private"?l.jsxs(fr,{tone:"outline",title:"Private — only you can see this agent",className:"shrink-0",children:[l.jsx(fh,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Private"]}):l.jsxs(fr,{tone:"accent",title:"Shared — anyone in the team can @mention this agent",className:"shrink-0",children:[l.jsx(QC,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Shared"]})}const dj=100,fj=100;async function $Q(e){const t=[];let n;for(let a=0;a<fj;a++){const s=await e(n?{limit:dj,cursor:n}:{limit:dj});if(t.push(...s.items),!s.nextCursor)return t;n=s.nextCursor}throw new Error(`fetchAllAgents exceeded ${fj} pages; server cursor pagination may be broken`)}function HQ(){const{role:e,memberId:t}=ct(),n=e==="admin",a=Dn(),s=vn(),o=w_(),[c,f]=b.useState(!1),[m,h]=b.useState(!1),[p,g]=b.useState(null),[w,x]=b.useState(null),[k,j]=b.useState("all"),[C,E]=b.useState(""),T=Xe({queryKey:["members"],queryFn:cb}),O=Xe({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>$Q(Z=>n?x4(Z):Uc(Z))}),{data:D}=Xe({queryKey:["activity"],queryFn:Lc,refetchInterval:1e4}),I=b.useMemo(()=>{const Z=new Map;for(const re of(D==null?void 0:D.agents)??[])Z.set(re.agentId,re);return Z},[D==null?void 0:D.agents]),{data:R}=Xe({queryKey:["clients","team-page"],queryFn:gi,staleTime:3e4}),B=b.useMemo(()=>{const Z=new Map;for(const re of R??[])re.hostname&&Z.set(re.id,re.hostname);return Z},[R]),L=b.useMemo(()=>T.data??[],[T.data]),ee=b.useMemo(()=>O.data??[],[O.data]),z=b.useMemo(()=>{const Z=new Map;for(const re of ee)Z.set(re.uuid,re);return Z},[ee]),$=b.useMemo(()=>ee.filter(Z=>Z.type!=="human"),[ee]),Q=b.useMemo(()=>$.filter(Z=>Z.managerId===t),[$,t]),ne=b.useMemo(()=>$.filter(Z=>Z.visibility==="organization"&&Z.managerId!==t),[$,t]),Y=b.useMemo(()=>$.filter(Z=>Z.visibility==="private"&&Z.managerId!==t),[$,t]),X=pt({mutationFn:async Z=>Z9(Z.id,Z.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),G=pt({mutationFn:G9,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),ie=pt({mutationFn:uN,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),J=pt({mutationFn:cN,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),ve=pt({mutationFn:dN,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),M=pt({mutationFn:async Z=>Ry(Z.humanAgentId,{delegateMention:Z.delegateMention}),onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),P=C.trim().toLowerCase(),U=b.useMemo(()=>GQ({filter:k,search:P,isAdmin:n,selfMemberId:t,members:L,yourAgents:Q,teamAgents:ne,otherPrivateAgents:Y,resolveMember:o,agentByUuid:z,openDelegate:(Z,re)=>{var xe;return x({humanAgentId:Z,humanDisplayName:re,currentDelegate:((xe=z.get(Z))==null?void 0:xe.delegateMention)??null})}}),[k,P,n,t,L,Q,ne,Y,o,z]);function _(Z){const re=[];return n&&re.push({key:"edit",label:"Edit profile",onSelect:()=>g({id:Z.id,username:Z.username,displayName:Z.displayName,role:Z.role})}),n&&!Z.isSelf&&re.push({key:"remove",label:"Remove from org",destructive:!0,onSelect:()=>{window.confirm(`Remove ${Z.displayName} from the org? The human agent will be deactivated.`)&&G.mutate(Z.id)}}),re}function V(Z){const{agent:re,isOwnedBySelf:xe}=Z,Ae=n||xe,Ce=[{key:"open",label:"Open",onSelect:()=>a(`/agents/${encodeURIComponent(re.uuid)}`)}];return Ae&&(re.status==="suspended"?Ce.push({key:"reactivate",label:"Reactivate",onSelect:()=>ve.mutate(re.uuid)}):Ce.push({key:"suspend",label:"Suspend",onSelect:()=>J.mutate(re.uuid)}),Ce.push({key:"delete",label:"Delete",destructive:!0,onSelect:()=>{window.confirm(`Delete agent ${re.displayName}? This cannot be undone.`)&&ie.mutate(re.uuid)}})),Ce}return l.jsxs(l.Fragment,{children:[l.jsx(Uo,{title:"Team",right:l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs(be,{size:"xs",onClick:()=>h(!0),children:[l.jsx(Sa,{className:"h-3 w-3"}),"New agent"]}),n&&l.jsxs(be,{size:"xs",variant:"ghost",onClick:()=>f(!0),children:[l.jsx(VC,{className:"h-3 w-3"}),"Invite link"]})]})}),l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsx(ZQ,{filter:k,onFilter:j,query:C,onQuery:E,counts:{yours:Q.length,humans:L.length,team:ne.length}}),O.isLoading||T.isLoading?l.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):O.error||T.error?l.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load: ",qQ(O.error??T.error)]}):l.jsx(DQ,{groups:U,runtimeMap:I,clientHostMap:B,onAgentClick:Z=>a(`/agents/${encodeURIComponent(Z)}`),getHumanActions:_,getAgentActions:V})]}),l.jsx(_n,{open:c,onOpenChange:f,children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:"Invite link"})}),l.jsx(MQ,{})]})}),l.jsx(NQ,{open:m,onOpenChange:h,onCreated:(Z,re)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),l.jsx(KQ,{target:p,isAdmin:n,isSaving:X.isPending,onClose:()=>g(null),onSave:async Z=>{p&&(await X.mutateAsync({id:p.id,patch:Z}),g(null))}}),l.jsx(YQ,{target:w,candidates:VQ(ee),isSaving:M.isPending,onClose:()=>x(null),onSave:async Z=>{w&&(await M.mutateAsync({humanAgentId:w.humanAgentId,delegateMention:Z}),x(null))}})]})}function qQ(e){return e instanceof Error?e.message:String(e)}function ZQ({filter:e,onFilter:t,query:n,onQuery:a,counts:s}){const o=[{key:"all",label:"All"},{key:"yours",label:"Your agents",count:s.yours},{key:"humans",label:"Humans",count:s.humans},{key:"team",label:"Team agents",count:s.team}];return l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-1)"},children:o.map(c=>l.jsx(tv,{active:e===c.key,count:c.count,onClick:()=>t(c.key),children:c.label},c.key))}),l.jsxs("div",{className:"relative",style:{width:220},children:[l.jsx(Rv,{"aria-hidden":!0,className:"h-3.5 w-3.5",style:{position:"absolute",left:"var(--sp-1_5)",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),l.jsx(Kt,{value:n,onChange:c=>a(c.target.value),placeholder:"Search name or @handle","aria-label":"Search team",className:"h-7 text-caption",style:{paddingLeft:"var(--sp-5)",borderRadius:3}})]})]})}function GQ(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:o,yourAgents:c,teamAgents:f,otherPrivateAgents:m,agentByUuid:h,openDelegate:p}=e,g=L=>{const ee=h.get(L);if(!(ee!=null&&ee.delegateMention))return null;const z=h.get(ee.delegateMention);return z?{name:z.name,displayName:z.displayName}:null},w=L=>!n||L.displayName.toLowerCase().includes(n)||L.username.toLowerCase().includes(n),x=L=>!n||L.displayName.toLowerCase().includes(n)||(L.name??"").toLowerCase().includes(n),k=t==="all"||t==="yours",j=t==="all"||t==="humans",C=t==="all"||t==="team",E=a&&t==="all",T=o.filter(w).map(L=>{const ee=s===L.id;return{kind:"human",id:L.id,agentId:L.agentId,username:L.username,displayName:L.displayName,role:L.role,createdAt:L.createdAt,isSelf:ee,delegate:g(L.agentId),canEditDelegate:ee||a,onEditDelegate:()=>p(L.agentId,L.displayName)}}).sort((L,ee)=>Number(ee.isSelf)-Number(L.isSelf)),O=(L,ee)=>({kind:"agent",agent:L,managerLabel:L.managerId?e.resolveMember(L.managerId):null,isOwnedBySelf:L.managerId===s,showVisibilityChip:(ee==null?void 0:ee.showVisibilityChip)??!1}),D=c.filter(x).map(L=>O(L,{showVisibilityChip:!0})).sort((L,ee)=>{const z=L.agent.visibility==="private"?0:1,$=ee.agent.visibility==="private"?0:1;return z!==$?z-$:L.agent.displayName.localeCompare(ee.agent.displayName,void 0,{sensitivity:"base"})}),I=f.filter(x).map(L=>O(L)),R=m.filter(x).map(L=>O(L)),B=[];return k&&B.push({key:"yours",title:"Your agents",count:D.length,rows:D,emptyMessage:n?"No agents match this search.":"You haven't created any agents yet. Click New agent above to add one."}),j&&B.push({key:"humans",title:"Humans",count:T.length,rows:T,emptyMessage:n?"No humans match this search.":void 0}),C&&B.push({key:"team",title:"Team agents",count:I.length,rows:I,emptyMessage:n?"No team agents match this search.":"No shared agents from other team members yet."}),E&&R.length>0&&B.push({key:"other-private",title:"Other members' private agents",count:R.length,rows:R,collapsible:!0}),B}function VQ(e){return e.filter(t=>t.type==="personal_assistant"&&t.status==="active")}const QQ=Object.values(_F);function KQ({target:e,isAdmin:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=b.useState(""),[f,m]=b.useState("member"),[h,p]=b.useState(null);b.useEffect(()=>{e&&(c(e.displayName),m(e.role),p(null))},[e]);async function g(x){if(x.preventDefault(),!e)return;const k={};if(o.trim()&&o!==e.displayName&&(k.displayName=o.trim()),t&&f!==e.role&&(k.role=f),Object.keys(k).length===0){a();return}try{await s(k)}catch(j){p(j instanceof Error?j.message:String(j))}}const w=e!==null;return l.jsx(_n,{open:w,onOpenChange:x=>x?void 0:a(),children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:"Edit profile"})}),e&&l.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Username"}),l.jsx(Kt,{value:e.username,disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"edit-member-display",children:"Display name"}),l.jsx(Kt,{id:"edit-member-display",value:o,onChange:x=>c(x.target.value),required:!0,maxLength:200})]}),t&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"edit-member-role",children:"Role"}),l.jsx("select",{id:"edit-member-role",value:f,onChange:x=>m(x.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:QQ.map(x=>l.jsx("option",{value:x,children:x},x))}),l.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."})]}),h&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:h}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(be,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function YQ({target:e,candidates:t,isSaving:n,onClose:a,onSave:s}){const[o,c]=b.useState(""),[f,m]=b.useState(null);b.useEffect(()=>{e&&(c(e.currentDelegate??""),m(null))},[e]);async function h(g){if(g.preventDefault(),!!e){m(null);try{await s(o||null)}catch(w){m(w instanceof Error?w.message:String(w))}}}const p=e!==null;return l.jsx(_n,{open:p,onOpenChange:g=>g?void 0:a(),children:l.jsxs(bn,{children:[l.jsx(zn,{children:l.jsx(Tn,{children:"Set delegate"})}),e&&l.jsxs("form",{onSubmit:h,className:"space-y-4",children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-2)"},children:["Pick a personal assistant to act on behalf of ",l.jsx("strong",{children:e.humanDisplayName}),". When teammates @mention this human, the assistant receives the message and can reply in their place."]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"set-delegate-pick",children:"Delegate"}),l.jsxs("select",{id:"set-delegate-pick",value:o,onChange:g=>c(g.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:[l.jsx("option",{value:"",children:"None — no delegate"}),t.map(g=>l.jsx("option",{value:g.uuid,children:g.displayName?`${g.displayName} (@${g.name??g.uuid})`:g.name?`@${g.name}`:g.uuid},g.uuid))]}),t.length===0&&l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["No personal assistants available. Create one from the ",l.jsx("em",{children:"New agent"})," button above first."]})]}),f&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),l.jsxs(ar,{children:[l.jsx(be,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(be,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function Lh(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function Ob(e){return je.get(Lh(e,"context_tree"))}function MT(e,t){return je.put(Lh(e,"context_tree"),t)}function DT(e){return je.get(Lh(e,"source_repos"))}function zT(e,t){return je.put(Lh(e,"source_repos"),t)}function nv({label:e,hint:t,value:n,onChange:a,saved:s=!1,mono:o=!1,type:c="text",placeholder:f,rightSlot:m,readOnly:h=!1,pattern:p}){const g=b.useId(),w=`flex-1 min-w-0 outline-none text-body focus-visible:ring-1 focus-visible:ring-ring ${o?"mono":""}`,x={padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid transparent",borderRadius:"var(--radius-input)",color:"var(--fg)"};return l.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:g,className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),s&&l.jsx(XQ,{})]}),t&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:t}),l.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[h?l.jsx("input",{id:g,value:n,readOnly:!0,className:w,style:{...x,color:"var(--fg-2)"}}):l.jsx("input",{id:g,value:n,onChange:k=>a==null?void 0:a(k.target.value),type:c,placeholder:f,pattern:p,className:w,style:x}),m]})]})}function XQ(){return l.jsxs("span",{className:"text-label inline-flex items-center fade-in",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[l.jsx(hr,{className:"h-3 w-3"}),"Saved"]})}function IT({pending:e,disabled:t=!1}){const n=e||t;return l.jsx("button",{type:"submit",disabled:n,"aria-label":"Save",title:"Save",className:"settings-save-button",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:"var(--sp-8)",background:"transparent",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:0,cursor:n?"default":"pointer",color:"var(--fg-3)",opacity:n?.5:1,transition:"color 0.15s, background 0.15s, border-color 0.15s"},children:e?l.jsx(qf,{className:"h-4 w-4 animate-spin"}):l.jsx(hr,{className:"h-4 w-4"})})}function WQ({isFirst:e=!1}){const{organizationId:t}=ct(),n=vn(),a=Xe({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?Ob(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1);b.useEffect(()=>{a.data&&(o(a.data.repo??""),f(a.data.branch??"main"))},[a.data]);const p=pt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return MT(t,{repo:s.trim()?s.trim():null,branch:c.trim()?c.trim():null})},onSuccess:w=>{n.setQueryData(["org-setting",t,"context_tree"],w),h(!0),setTimeout(()=>h(!1),2e3)}}),g=w=>{w.preventDefault(),p.mutate()};return l.jsx(Vc,{title:"Context tree",description:"Changes apply to new agent sessions. Members should restart agents to pick up updated tree contents.",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):l.jsxs("form",{onSubmit:g,children:[l.jsx(nv,{label:"Repo URL",hint:"HTTPS URL of the Context Tree git repository for this team.",value:s,onChange:o,mono:!0,placeholder:"https://github.com/your-org/first-tree-context"}),l.jsx(nv,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:c,onChange:f,mono:!0,placeholder:"main",saved:m,rightSlot:l.jsx(IT,{pending:p.isPending,disabled:!a.data})}),p.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:p.error.message})]})})}function JQ({isFirst:e=!1}){var h;const{organizationId:t,role:n}=ct(),a=n==="admin",s=vn(),o=Xe({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?DT(t):Promise.reject(new Error("no org")),enabled:!!t}),c=pt({mutationFn:async p=>{var x;if(!t)throw new Error("organization not loaded");const w=(((x=o.data)==null?void 0:x.repos)??[]).filter(k=>k.url!==p);return zT(t,{repos:w})},onSuccess:p=>{s.setQueryData(["org-setting",t,"source_repos"],p)}}),f=((h=o.data)==null?void 0:h.repos)??[],m=f.length>0?l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:f.length}):null;return l.jsxs(Vc,{title:"Source repos",description:a?"Repos your team's agents are bound to. New repos are added during agent onboarding.":"Repos your team's agents are bound to. Read-only — only admins can edit.",right:m,isFirst:e,children:[o.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):o.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:o.error instanceof Error?o.error.message:"Failed to load setting"}):f.length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)"},children:"No source repos bound yet."}):l.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.map(p=>l.jsx(eK,{url:p.url,defaultBranch:p.defaultBranch,isAdmin:a,isRemoving:c.isPending,onRemove:()=>c.mutate(p.url)},p.url))}),c.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:c.error.message})]})}function eK({url:e,defaultBranch:t,isAdmin:n,isRemoving:a,onRemove:s}){return l.jsxs("li",{className:"group flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-2_5)",borderRadius:"var(--radius-input)"},children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body mono",style:{color:"var(--fg)",overflowWrap:"anywhere"},children:e}),t&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)"},children:["branch: ",t]})]}),n&&l.jsx("button",{type:"button","aria-label":`Remove ${e}`,disabled:a,onClick:s,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,border:0,borderRadius:"var(--radius-input)",background:"transparent",color:"var(--fg-3)",cursor:a?"not-allowed":"pointer",flexShrink:0},onMouseEnter:o=>{o.currentTarget.style.background="var(--surface-2)",o.currentTarget.style.color="var(--fg)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent",o.currentTarget.style.color="var(--fg-3)"},children:l.jsx(pi,{className:"h-3.5 w-3.5"})})]})}function tK(e){return je.get(`/orgs/${encodeURIComponent(e)}`)}function nK(e,t){return je.patch(`/orgs/${encodeURIComponent(e)}`,t)}function rK({isFirst:e=!1}){const{organizationId:t}=ct(),n=vn(),a=Xe({queryKey:["organization",t],queryFn:()=>t?tK(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[c,f]=b.useState(!1);b.useEffect(()=>{a.data&&o(a.data.displayName)},[a.data]);const m=pt({mutationFn:()=>{if(!t||!a.data)throw new Error("organization not loaded");const p=s.trim();return!p||p===a.data.displayName?Promise.resolve(a.data):nK(t,{displayName:p})},onSuccess:p=>{n.setQueryData(["organization",t],p),n.invalidateQueries({queryKey:["me-organizations"]}),f(!0),setTimeout(()=>f(!1),2e3)}}),h=p=>{p.preventDefault(),m.mutate()};return l.jsx(Vc,{title:"Identity",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load team"}):l.jsxs("form",{onSubmit:h,children:[l.jsx(nv,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:o,saved:c,rightSlot:l.jsx(IT,{pending:m.isPending,disabled:!a.data})}),m.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:m.error.message})]})})}function aK(){const{role:e}=ct(),t=e==="admin";return l.jsxs("div",{children:[t&&l.jsx(rK,{isFirst:!0}),t&&l.jsx(WQ,{}),l.jsx(JQ,{isFirst:!t})]})}function iK(){const{role:e}=ct();if(e===null)return l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."});const t=e==="admin"?"Identity, Context Tree, source repos":"Repos your team's agents are bound to";return l.jsxs(l.Fragment,{children:[l.jsx(Uo,{title:"Team settings",subtitle:t}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(aK,{})})]})}function sK(e,t){const n=new URLSearchParams({agentId:t.agentId,path:t.path});return t.basePath&&n.set("basePath",t.basePath),je.get(`/chats/${encodeURIComponent(e)}/docs/preview?${n.toString()}`)}const lK=/^[a-z][a-z0-9+.-]*:/i;function LT(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||lK.test(n))return null;const a=n.split(/[?#]/,1).at(0)??"";if(!a.toLowerCase().endsWith(".md"))return null;let s=a.startsWith("/")?a.slice(1):a;if(t&&!a.startsWith("/")){const o=t.lastIndexOf("/");s=`${o>=0?t.slice(0,o+1):""}${a}`}return oK(s)}function oK(e){const t=[];for(const n of e.split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.length>0?t.join("/"):null}const hj=720,uK=.45,rv=360,cK=320,mj=24;function dK(){return typeof window>"u"?hj:Math.max(rv,Math.min(hj,Math.round(window.innerWidth*uK)))}function Bg(e){const t=Math.max(rv,window.innerWidth-cK);return Math.min(Math.max(e,rv),t)}function fK(){const[e,t]=b.useState(()=>typeof window>"u"?!1:window.matchMedia("(max-width: 47.999rem)").matches);return b.useEffect(()=>{const n=window.matchMedia("(max-width: 47.999rem)"),a=()=>t(n.matches);return a(),n.addEventListener("change",a),()=>n.removeEventListener("change",a)},[]),e}function hK(){var L,ee;const[e,t]=Oo(),n=e.get("docChat"),a=e.get("docAgent"),s=e.get("docPath"),o=e.get("docBase")??void 0,c=!!(n&&a&&s),f=fK(),[m,h]=b.useState(dK),p=b.useRef(null),g=b.useRef(null),w=b.useRef(null),x=b.useCallback(()=>{const z=new URLSearchParams(e);z.delete("docChat"),z.delete("docAgent"),z.delete("docPath"),z.delete("docBase"),t(z,{replace:!0})},[e,t]);b.useEffect(()=>{if(!c)return;const z=$=>{$.key==="Escape"&&x()};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[x,c]),b.useEffect(()=>{if(!c||!f)return;w.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const z=window.setTimeout(()=>{var $;return($=g.current)==null?void 0:$.focus()},0);return()=>{window.clearTimeout(z);const $=w.current;w.current=null,$&&document.contains($)&&$.focus()}},[c,f]);const k=Xe({queryKey:["me","docs","preview",n,a,o,s],queryFn:()=>sK(n??"",{agentId:a??"",basePath:o,path:s??""}),enabled:c}),j=((L=k.data)==null?void 0:L.ref.path)??s,C=((ee=k.data)==null?void 0:ee.path)??s,E=b.useMemo(()=>{const z=C??"";return z.split("/").filter(Boolean).at(-1)??z},[C]),T=C&&C!==E?C:null,O=b.useCallback(z=>{const $=new URLSearchParams(e);$.set("docPath",z),t($)},[e,t]),D=b.useMemo(()=>({a({href:z,children:$,...Q}){const ne=Y=>{if(!z||Y.defaultPrevented||Y.button!==0||Y.metaKey||Y.altKey||Y.ctrlKey||Y.shiftKey)return;const X=LT(z,j);X&&(Y.preventDefault(),O(X))};return l.jsx("a",{...Q,href:z,onClick:ne,target:"_blank",rel:"noopener noreferrer",children:$})}}),[O,j]),I=b.useCallback(z=>{z.preventDefault();const $=document.body.style.cursor,Q=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const ne=X=>{h(Bg(window.innerWidth-X.clientX))},Y=()=>{document.body.style.cursor=$,document.body.style.userSelect=Q,window.removeEventListener("mousemove",ne),window.removeEventListener("mouseup",Y)};window.addEventListener("mousemove",ne),window.addEventListener("mouseup",Y)},[]),R=b.useCallback(z=>{z.key==="ArrowLeft"&&(z.preventDefault(),h($=>Bg($+mj))),z.key==="ArrowRight"&&(z.preventDefault(),h($=>Bg($-mj)))},[]),B=b.useCallback(z=>{var Y;if(!f||z.key!=="Tab")return;const $=Array.from(((Y=p.current)==null?void 0:Y.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]).filter(X=>!X.hasAttribute("disabled")&&X.getAttribute("aria-hidden")!=="true"),Q=$.at(0),ne=$.at(-1);if(!Q||!ne){z.preventDefault();return}z.shiftKey&&document.activeElement===Q?(z.preventDefault(),ne.focus()):!z.shiftKey&&document.activeElement===ne&&(z.preventDefault(),Q.focus())},[f]);return c?l.jsxs("aside",{"aria-label":"Document preview","aria-modal":f,"data-doc-preview-drawer":"",className:Oe("z-40 flex flex-col bg-surface-raised text-text-primary shadow-2xl","animate-in slide-in-from-right duration-200",f?"fixed inset-0 w-full border-l border-border":"relative my-3 mr-3 h-auto shrink-0 overflow-hidden rounded-[var(--radius-panel)] border border-border-faint max-w-[calc(100vw-var(--sp-8))]"),onKeyDown:B,ref:p,role:"dialog",style:f?void 0:{width:m},children:[f?null:l.jsx("button",{"aria-label":"Resize document preview",className:"group absolute top-0 left-0 h-full w-3 -translate-x-1/2 cursor-col-resize",onMouseDown:I,onKeyDown:R,type:"button",children:l.jsx("div",{className:"mx-auto h-full w-1 bg-accent opacity-0 transition-opacity group-hover:opacity-100"})}),l.jsxs("header",{className:"flex min-h-12 items-center gap-3 px-4 pt-3 pb-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"truncate text-body font-medium",children:E}),T?l.jsx("div",{className:"truncate text-caption text-text-tertiary",children:T}):null]}),l.jsx(be,{"aria-label":"Close document preview",onClick:x,ref:g,size:"icon",type:"button",variant:"ghost",children:l.jsx(pi,{className:"h-4 w-4","aria-hidden":"true"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[k.isLoading?l.jsxs("div",{className:"flex h-full items-center justify-center text-body text-text-secondary",children:[l.jsx(qf,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":"true"}),"Loading preview"]}):null,k.isError?l.jsx("div",{className:"rounded-[var(--radius-panel)] border border-error bg-error-soft p-4 text-body text-error",children:k.error instanceof Error?k.error.message:"Unable to load document"}):null,k.data?l.jsx(Ih,{components:D,children:k.data.content}):null]})]}):null}function sh(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),e!=null&&e.engagement&&t.set("engagement",e.engagement),e!=null&&e.source&&t.set("source",e.source);const n=t.toString();return je.get(hn(`/chats${n?`?${n}`:""}`))}function mK(e){const t=new URLSearchParams;e!=null&&e.engagement&&t.set("engagement",e.engagement);const n=t.toString();return je.get(hn(`/chats/source-counts${n?`?${n}`:""}`))}function pK(e){return je.post(hn("/chats"),e)}function gK(e){return je.post(`/chats/${encodeURIComponent(e)}/read`)}function yK(e){return je.post(`/chats/${encodeURIComponent(e)}/unread`)}function PT(e,t){return je.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function vK(e){return je.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}const bK=1e3;function xK(e){if(e<0)return"0s";if(e<1e3)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),a=t%60;return`${n}m${a.toString().padStart(2,"0")}s`}function wK({activity:e}){const t=new Date(e.startedAt).getTime(),[n,a]=b.useState(()=>Date.now());b.useEffect(()=>{const o=setInterval(()=>a(Date.now()),bK);return()=>clearInterval(o)},[]);const s=xK(n-t);return l.jsxs("span",{role:"status","aria-label":`${e.label}, ${s}`,className:"mono text-caption shrink-0 inline-flex items-center",style:{gap:6,color:"var(--state-working)"},children:[l.jsx("span",{"aria-hidden":"true",className:"chat-row-live-chip__dot",style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:"var(--state-working)"}}),l.jsx("span",{className:"truncate",style:{maxWidth:96},children:e.label}),l.jsx("span",{style:{color:"var(--fg-4)"},children:s})]})}function UT(e){return je.get(`/chats/${encodeURIComponent(e)}`)}function SK(e,t){return je.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function BT(e,t){return je.post(`/chats/${encodeURIComponent(e)}/engagement`,{status:t})}function No(e,t){return je.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function kK(e,t,n){const a=n==null?void 0:n.mentions,s=Array.isArray(a)&&a.length>0;return je.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t,...s?{metadata:{mentions:a}}:{}})}function jK(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 Mb(e){return je.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function CK(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 je.get(`/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}const{ACTIVE:pj,ARCHIVED:gj,DELETED:yj}=Uy;function EK({status:e,hasUnread:t,runEngagement:n,runMarkUnread:a}){return e===pj?[{key:"mark-unread",label:"Mark as unread",disabled:t,onSelect:a},{key:"archive",label:"Archive",onSelect:()=>n(gj)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>n(yj)}]:e===gj?[{key:"unarchive",label:"Unarchive",onSelect:()=>n(pj)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>n(yj)}]:[]}const NK="opacity-0 group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100";function _K({chatId:e,status:t,hasUnread:n}){const a=vn(),s=()=>{a.invalidateQueries({queryKey:["me","chats"]}),a.invalidateQueries({queryKey:["chat-detail",e]})},o=pt({mutationFn:m=>BT(e,m),onSuccess:s}),c=pt({mutationFn:()=>yK(e),onSuccess:s}),f=EK({status:t,hasUnread:n,runEngagement:m=>o.mutate(m),runMarkUnread:()=>c.mutate()});return l.jsx(Ab,{actions:f,ariaLabel:"Manage chat",triggerClassName:NK})}const Db="draft",TK=[{value:"active",label:"Active"},{value:"archived",label:"Archived"},{value:"all",label:"All"}],AK=[{value:"manual",label:"Manual"},{value:"github_pull_request",label:"PR"},{value:"github_issue",label:"Issue"},{value:"github_discussion",label:"Discussion"},{value:"github_commit",label:"Commit"},{value:"feishu",label:"Feishu"}];function RK(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 OK(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function MK({selectedChatId:e,onSelectChat:t,onNewChat:n,engagement:a,onEngagementChange:s,source:o,onSourceChange:c}){const{agentId:f}=ct(),[m,h]=b.useState("all"),[p,g]=b.useState([]),[w,x]=b.useState(!1),[k,j]=b.useState(null),{data:C,isLoading:E}=Xe({queryKey:["me","chats",m,a,o],queryFn:()=>sh({filter:m,engagement:a,source:o}),refetchInterval:15e3}),{data:T}=Xe({queryKey:["me","chats","source-counts",a],queryFn:()=>mK({engagement:a}),refetchInterval:15e3}),O=()=>{p.length>0&&g([]),j(null)};b.useEffect(()=>{g(ne=>ne.length>0?[]:ne),j(null)},[o,a]);const D=(C==null?void 0:C.rows)??[],I=b.useMemo(()=>[...D,...p],[D,p]),R=async()=>{if(w)return;const ne=C==null?void 0:C.nextCursor;if(ne){x(!0),j(null);try{const Y=await sh({filter:m,engagement:a,cursor:ne,source:o});g(X=>[...X,...Y.rows]),L(Y.nextCursor)}catch(Y){j(Y instanceof Error?Y.message:"Failed to load more")}finally{x(!1)}}},[B,L]=b.useState(null),ee=(C==null?void 0:C.nextCursor)??null;b.useEffect(()=>{L(ee)},[ee]);const z=b.useMemo(()=>I.reduce((ne,Y)=>ne+(Y.unreadMentionCount>0?1:0),0),[I]),$=e===Db,Q=m==="unread";return b.useEffect(()=>{Q&&z===0&&h("all")},[Q,z]),l.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[l.jsxs("div",{className:"shrink-0 flex flex-col",style:{gap:"var(--sp-2)",padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"radial-gradient(140% 80% at 0% 0%, var(--accent-bg) 0%, transparent 60%)"},children:[l.jsxs("button",{type:"button",onClick:n,"aria-current":$?"page":void 0,className:Oe("group relative w-full inline-flex items-center transition-colors text-body cursor-pointer font-semibold",!$&&"hover:bg-[var(--bg-hover)] hover:border-[var(--border-strong)]","focus-visible:outline-none focus-visible:border-[var(--accent-dim)]"),style:{gap:"var(--sp-2)",padding:"var(--sp-1_75) var(--sp-2) var(--sp-1_75) var(--sp-2_5)",borderWidth:"var(--hairline)",borderStyle:"solid",borderColor:$?"var(--accent-dim)":"var(--border)",borderRadius:"var(--radius-panel)",background:$?"var(--accent-bg)":"var(--bg-raised)",color:$?"var(--accent)":"var(--fg)"},title:"New chat",children:[l.jsx("span",{"aria-hidden":!0,className:"absolute pointer-events-none",style:{left:-1,top:-1,bottom:-1,width:3,background:"var(--accent)",borderRadius:"var(--radius-panel) 0 0 var(--radius-panel)"}}),l.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center justify-center shrink-0 transition-colors group-hover:bg-[var(--accent)] group-hover:text-[var(--fg-on-vivid)]",style:{width:20,height:20,borderRadius:"var(--radius-chip)",background:$?"var(--accent)":"var(--accent-bg)",color:$?"var(--fg-on-vivid)":"var(--accent)"},children:l.jsx(Sa,{className:"h-3 w-3",strokeWidth:2})}),l.jsx("span",{className:"flex-1 text-left",children:"New chat"})]}),l.jsx("div",{className:"flex items-center flex-wrap",style:{gap:4},children:AK.map(ne=>{const Y=T==null?void 0:T.counts[ne.value];if(ne.value!=="manual"&&(!Y||Y.chatCount===0))return null;const X=(Y==null?void 0:Y.unreadChatCount)??0;return l.jsx(tv,{active:o===ne.value,count:X>0?X:void 0,warn:X>0,onClick:()=>{o!==ne.value&&(c(ne.value),O())},children:ne.label},ne.value)})}),l.jsx("div",{className:"flex items-center",style:{gap:4},children:TK.map(ne=>l.jsx(tv,{active:a===ne.value,onClick:()=>{a!==ne.value&&(s(ne.value),O())},children:ne.label},ne.value))}),z>0&&l.jsxs("div",{className:"mono flex items-center justify-between text-caption",style:{padding:"0 var(--sp-0_5)",color:"var(--fg-4)"},children:[l.jsxs("button",{type:"button",onClick:()=>{h(Q?"all":"unread"),O()},"aria-pressed":Q,className:"mono cursor-pointer bg-transparent border-0 p-0 text-caption transition-opacity hover:opacity-80",style:{color:"var(--state-unread)",textDecoration:Q?"underline":"none",textUnderlineOffset:2},title:Q?"Show all chats":"Filter to unread only",children:[z," unread"]}),!Q&&l.jsxs("span",{children:[I.length," ",I.length===1?"chat":"chats"," · workspace"]})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[E&&I.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!E&&I.length===0&&l.jsxs("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:[l.jsx("p",{style:{margin:0},children:"No conversations yet."}),l.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Start with New chat."})]}),I.map(ne=>{const Y=e===ne.chatId,X=OK(ne),G=X&&X!==ne.title?X:"",ie=ne.unreadMentionCount>0;return l.jsxs("div",{className:"group relative",style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("button",{type:"button",onClick:()=>t(ne.chatId),className:Oe("w-full text-left transition-colors flex items-center","hover:bg-[var(--bg-hover)]"),style:{padding:"var(--sp-2) var(--sp-3)",gap:"var(--sp-2_5)",background:Y?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${Y?"var(--accent)":"transparent"}`},children:[l.jsx(X4,{title:ne.title,type:ne.type,participants:ne.participants,selfAgentId:f??"",engagedAgentIds:ne.engagedAgentIds,unreadCount:ne.unreadMentionCount}),l.jsxs("div",{className:"flex flex-col",style:{flex:1,minWidth:0},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[l.jsx("span",{className:"truncate text-subtitle",style:{color:ie?"var(--fg)":"var(--fg-2)",fontWeight:ie?700:500,flex:1,minWidth:0},children:ne.title}),(()=>{const J=ne.liveActivity?l.jsx(wK,{activity:ne.liveActivity}):ne.lastMessageAt?l.jsx("span",{className:"mono text-caption shrink-0",style:{color:"var(--fg-4)"},children:RK(ne.lastMessageAt)}):null;return J?l.jsx("span",{className:"shrink-0 transition-opacity group-hover:opacity-0 group-has-aria-expanded:opacity-0",children:J}):null})()]}),l.jsx("div",{className:"truncate text-body",style:{color:ie?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:G||"—"})]})]}),l.jsx("div",{className:"absolute",style:{top:"var(--sp-2)",right:"var(--sp-3)"},children:l.jsx(_K,{chatId:ne.chatId,status:ne.engagementStatus,hasUnread:ie})})]},ne.chatId)}),B&&I.length>0&&l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[l.jsx("button",{type:"button",onClick:R,disabled:w,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:w?"default":"pointer",opacity:w?.6:1},children:w?"Loading…":"Load more"}),k&&l.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:k})]})]})]})}function zb(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 DK(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function Ib({candidate:e,ambiguous:t}){const n=e.name?`@${e.name}`:"—";return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-medium",children:e.displayName??n}),DK(e,t)&&l.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function zK(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 vj(e,t){return(e.displayName??e.name??"").localeCompare(t.displayName??t.name??"")}function Lb(e){const t=e.filter(a=>a.managedByMe).sort(vj),n=e.filter(a=>!a.managedByMe).sort(vj);return t.length>0&&n.length>0?[...t,{divider:!0},...n]:[...t,...n]}function IK(e,t){if(!t)return Lb(e).filter(a=>!("divider"in a)).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 LK(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}`,p=s.length+c.length+(f?1:0);return{text:h,cursor:p}}function FT({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[o,c]=b.useState(0),[f,m]=b.useState(null),h=b.useMemo(()=>s?null:zK(e,t),[e,t,s]),p=b.useMemo(()=>h?IK(n,h.query):[],[h,n]),g=h?`${h.triggerIndex}:${h.query}`:"";b.useEffect(()=>{c(0)},[g]),b.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const w=f!==null&&h!==null&&f===h.triggerIndex,x=h!==null&&p.length>0&&!w;function k(){m((h==null?void 0:h.triggerIndex)??null)}function j(E){if(!h)return;const T=LK(e,h,t,E);T&&a(T)}return{trigger:x?h:null,results:x?p:[],highlightIndex:o,handleKey:E=>{if(!x||!h)return!1;if(E.key==="ArrowDown")return E.preventDefault(),c(T=>p.length===0?0:(T+1)%p.length),!0;if(E.key==="ArrowUp")return E.preventDefault(),c(T=>p.length===0?0:(T-1+p.length)%p.length),!0;if(E.key==="Enter"||E.key==="Tab"){const T=p[o]??p[0];return T?(E.preventDefault(),j(T),!0):!1}return E.key==="Escape"?(E.preventDefault(),k(),!0):!1},pick:j,dismiss:k}}function $T({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const o=b.useRef(null);return b.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:l.jsx("div",{ref:o,role:"listbox","aria-label":"Mention suggestions",className:Oe("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=zb(t);return t.map((m,h)=>{const p=h===n;return l.jsx("button",{type:"button",role:"option","aria-selected":p,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:g=>{g.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:p?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(Ib,{candidate:m,ambiguous:f})},m.agentId)})})()})}function HT(e,t){b.useLayoutEffect(()=>{const n=e.current;n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)},[e,t])}function PK({onCreated:e}){const t=vn(),{agentId:n}=ct(),a=$v(),[s,o]=b.useState([]),[c,f]=b.useState(""),[m,h]=b.useState(0),[p,g]=b.useState(null),[w,x]=b.useState(!1),[k,j]=b.useState(!1),C=b.useRef(null),E=b.useRef(!1),T=b.useRef(null);HT(C,c);const{data:O}=Xe({queryKey:["activity"],queryFn:Lc,refetchInterval:15e3}),D=b.useMemo(()=>{const Y=(O==null?void 0:O.agents)??[],X=[];for(const G of Y){if(n&&G.agentId===n)continue;const ie=a(G.agentId);!ie||!ie.name||X.push({agentId:G.agentId,name:ie.name,displayName:ie.displayName,managedByMe:G.managedByMe})}return X},[O,a,n]);b.useEffect(()=>{if(E.current||s.length>0||D.length===0)return;const Y=BK(D,(O==null?void 0:O.agents)??[]);Y&&(o([Y]),E.current=!0)},[D,O,s.length]);const I=b.useMemo(()=>{const Y=D.map(X=>({agentId:X.agentId,name:X.name}));return VN(c,Y)},[c,D]),R=FT({value:c,cursor:m,candidates:D,disabled:w,onSelect:Y=>{f(Y.text),h(Y.cursor),requestAnimationFrame(()=>{const X=C.current;X&&(X.focus(),X.setSelectionRange(Y.cursor,Y.cursor))})}});b.useEffect(()=>{I.length!==0&&o(Y=>{const X=new Set(Y);let G=!1;for(const ie of I)X.has(ie)||(X.add(ie),G=!0);return G?[...X]:Y})},[I]),b.useEffect(()=>{if(!k)return;const Y=X=>{T.current&&(T.current.contains(X.target)||j(!1))};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[k]);const B=pt({mutationFn:async({participantIds:Y,text:X})=>{const G=await pK({participantIds:Y}),ie=X.trim();return ie.length>0&&await No(G.chatId,ie),G.chatId},onSuccess:Y=>{f(""),o([]),E.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(Y)},onError:Y=>{g(Y instanceof Error?Y.message:"Failed to create chat")}}),L=b.useMemo(()=>!(w||B.isPending||s.length===0||c.trim().length===0||s.length>=2&&I.length===0),[w,B.isPending,s.length,c,I.length]),ee=b.useMemo(()=>s.length===0?"Add at least one participant":c.trim().length===0?null:s.length>=2&&I.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,c,I.length]),z=async()=>{if(!L)return;const Y=Array.from(new Set([...s,...I]));g(null),x(!0);try{await B.mutateAsync({participantIds:Y,text:c})}finally{x(!1)}},$=Y=>{o(X=>X.filter(G=>G!==Y))},Q=Y=>{o(X=>X.includes(Y)?X:[...X,Y]),j(!1)},ne=b.useMemo(()=>D.filter(Y=>!s.includes(Y.agentId)),[D,s]);return l.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:l.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[l.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),l.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[l.jsx(UK,{chips:s,candidates:D,chipCandidates:ne,pickerOpen:k,setPickerOpen:j,pickerContainerRef:T,onAdd:Q,onRemove:$}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx($T,{trigger:R.trigger,results:R.results,highlightIndex:R.highlightIndex,anchorRef:C,onPick:R.pick}),l.jsx("textarea",{ref:C,value:c,onChange:Y=>{f(Y.target.value),h(Y.target.selectionStart??Y.target.value.length)},onSelect:Y=>{h(Y.currentTarget.selectionStart??c.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:Y=>{Y.nativeEvent.isComposing||R.handleKey(Y)||Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),z())},disabled:w||B.isPending,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2) var(--sp-3)",background:"transparent",border:"none",maxHeight:"10.5rem",overflowY:"auto",resize:"none",color:"var(--fg)"}}),s.length>=2&&I.length===0&&c.trim().length>0&&l.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,l.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),l.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:l.jsx("button",{type:"button",onClick:()=>void z(),disabled:!L,title:ee??"Send (Enter)","aria-label":"Send",className:Oe("inline-flex items-center justify-center transition-opacity",!L&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:l.jsx(FC,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),p&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:p})]})})})}function UK({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:o,onAdd:c,onRemove:f}){return l.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(g=>g.agentId===m),p=(h==null?void 0:h.displayName)??(h==null?void 0:h.name)??m;return l.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:[l.jsx("span",{children:p}),l.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:l.jsx(pi,{className:"h-3 w-3"})})]},m)}),l.jsxs("div",{ref:o,style:{position:"relative"},children:[l.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:l.jsx(Sa,{className:"h-3 w-3"})}),a&&n.length>0&&l.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=zb(n);return Lb(n).map(h=>"divider"in h?l.jsx("div",{role:"presentation",style:{height:"var(--hairline)",background:"var(--border-faint)",margin:"var(--sp-0_5) var(--sp-3)"}},"__divider"):l.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:l.jsx(Ib,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function BK(e,t){var c;const n=new Set(e.map(f=>f.agentId)),a=t.filter(f=>n.has(f.agentId)&&f.managedByMe);if(a.length===0)return null;const s=[...a].filter(f=>f.runtimeUpdatedAt).sort((f,m)=>(m.runtimeUpdatedAt??"").localeCompare(f.runtimeUpdatedAt??""))[0];if(s)return s.agentId;const o=a.find(f=>f.type==="personal_assistant");return o?o.agentId:((c=a[0])==null?void 0:c.agentId)??null}const FK="first-tree-hub-images",$K=1,_o="images";let Af=null;function qT(){return Af||(Af=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(FK,$K);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(_o)||n.createObjectStore(_o,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Af)}async function HK(e){const t=await qT();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(_o,"readwrite"),o=s.objectStore(_o),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 qK(e){const t=await qT();return t?new Promise(n=>{const o=t.transaction(_o,"readonly").objectStore(_o).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 ZK(e,t,n){return je.post(`/chats/${encodeURIComponent(e)}/questions/${encodeURIComponent(t)}/answer`,{answers:n})}/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */const{entries:ZT,setPrototypeOf:bj,isFrozen:GK,getPrototypeOf:VK,getOwnPropertyDescriptor:QK}=Object;let{freeze:mr,seal:da,create:Wl}=Object,{apply:av,construct:iv}=typeof Reflect<"u"&&Reflect;mr||(mr=function(t){return t});da||(da=function(t){return t});av||(av=function(t,n){for(var a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];return t.apply(n,s)});iv||(iv=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return new t(...a)});const Zu=Nn(Array.prototype.forEach),KK=Nn(Array.prototype.lastIndexOf),xj=Nn(Array.prototype.pop),Gu=Nn(Array.prototype.push),YK=Nn(Array.prototype.splice),ur=Array.isArray,Ju=Nn(String.prototype.toLowerCase),Fg=Nn(String.prototype.toString),wj=Nn(String.prototype.match),Ql=Nn(String.prototype.replace),Sj=Nn(String.prototype.indexOf),XK=Nn(String.prototype.trim),WK=Nn(Number.prototype.toString),JK=Nn(Boolean.prototype.toString),kj=typeof BigInt>"u"?null:Nn(BigInt.prototype.toString),jj=typeof Symbol>"u"?null:Nn(Symbol.prototype.toString),cn=Nn(Object.prototype.hasOwnProperty),Vu=Nn(Object.prototype.toString),Qn=Nn(RegExp.prototype.test),Rf=eY(TypeError);function Nn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return av(e,t,a)}}function eY(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return iv(e,n)}}function rt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ju;if(bj&&bj(e,null),!ur(t))return e;let a=t.length;for(;a--;){let s=t[a];if(typeof s=="string"){const o=n(s);o!==s&&(GK(t)||(t[a]=o),s=o)}e[s]=!0}return e}function tY(e){for(let t=0;t<e.length;t++)cn(e,t)||(e[t]=null);return e}function Er(e){const t=Wl(null);for(const[n,a]of ZT(e))cn(e,n)&&(ur(a)?t[n]=tY(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=Er(a):t[n]=a);return t}function nY(e){switch(typeof e){case"string":return e;case"number":return WK(e);case"boolean":return JK(e);case"bigint":return kj?kj(e):"0";case"symbol":return jj?jj(e):"Symbol()";case"undefined":return Vu(e);case"function":case"object":{if(e===null)return Vu(e);const t=e,n=Jl(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:Vu(a)}return Vu(e)}default:return Vu(e)}}function Jl(e,t){for(;e!==null;){const a=QK(e,t);if(a){if(a.get)return Nn(a.get);if(typeof a.value=="function")return Nn(a.value)}e=VK(e)}function n(){return null}return n}function rY(e){try{return Qn(e,""),!0}catch{return!1}}const Cj=mr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$g=mr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Hg=mr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),aY=mr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),qg=mr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),iY=mr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ej=mr(["#text"]),Nj=mr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Zg=mr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),_j=mr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Of=mr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sY=da(/\{\{[\w\W]*|[\w\W]*\}\}/gm),lY=da(/<%[\w\W]*|[\w\W]*%>/gm),oY=da(/\$\{[\w\W]*/gm),uY=da(/^data-[\-\w.\u00B7-\uFFFF]+$/),cY=da(/^aria-[\-\w]+$/),GT=da(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),dY=da(/^(?:\w+script|data):/i),fY=da(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),VT=da(/^html$/i),hY=da(/^[a-z][.\w]*(-[.\w]+)+$/i);var Tj=Object.freeze({__proto__:null,ARIA_ATTR:cY,ATTR_WHITESPACE:fY,CUSTOM_ELEMENT:hY,DATA_ATTR:uY,DOCTYPE_NAME:VT,ERB_EXPR:lY,IS_ALLOWED_URI:GT,IS_SCRIPT_OR_DATA:dY,MUSTACHE_EXPR:sY,TMPLIT_EXPR:oY});const Qu={element:1,text:3,progressingInstruction:7,comment:8,document:9},mY=function(){return typeof window>"u"?null:window},pY=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(a=n.getAttribute(s));const o="dompurify"+(a?"#"+a:"");try{return t.createPolicy(o,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Aj=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function QT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mY();const t=$e=>QT($e);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Qu.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,s=a.currentScript,{DocumentFragment:o,HTMLTemplateElement:c,Node:f,Element:m,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:w,trustedTypes:x}=e,k=m.prototype,j=Jl(k,"cloneNode"),C=Jl(k,"remove"),E=Jl(k,"nextSibling"),T=Jl(k,"childNodes"),O=Jl(k,"parentNode");if(typeof c=="function"){const $e=n.createElement("template");$e.content&&$e.content.ownerDocument&&(n=$e.content.ownerDocument)}let D,I="";const{implementation:R,createNodeIterator:B,createDocumentFragment:L,getElementsByTagName:ee}=n,{importNode:z}=a;let $=Aj();t.isSupported=typeof ZT=="function"&&typeof O=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Q,ERB_EXPR:ne,TMPLIT_EXPR:Y,DATA_ATTR:X,ARIA_ATTR:G,IS_SCRIPT_OR_DATA:ie,ATTR_WHITESPACE:J,CUSTOM_ELEMENT:ve}=Tj;let{IS_ALLOWED_URI:M}=Tj,P=null;const U=rt({},[...Cj,...$g,...Hg,...qg,...Ej]);let _=null;const V=rt({},[...Nj,...Zg,..._j,...Of]);let Z=Object.seal(Wl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),re=null,xe=null;const Ae=Object.seal(Wl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ce=!0,Ye=!0,Be=!1,qe=!0,We=!1,it=!0,Se=!1,Ie=!1,ot=!1,se=!1,Ee=!1,Ne=!1,Ze=!0,wt=!1;const Gt="user-content-";let Ut=!0,pr=!1,ce={},me=null;const Fe=rt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Je=null;const St=rt({},["audio","video","img","source","image","track"]);let An=null;const gr=rt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Yt="http://www.w3.org/1998/Math/MathML",qt="http://www.w3.org/2000/svg",Bt="http://www.w3.org/1999/xhtml";let yt=Bt,yr=!1,Bn=null;const Bo=rt({},[Yt,qt,Bt],Fg);let ja=rt({},["mi","mo","mn","ms","mtext"]),sr=rt({},["annotation-xml"]);const ma=rt({},["title","style","font","a","script"]);let Fn=null;const Pa=["application/xhtml+xml","text/html"],pa="text/html";let rn=null,Qr=null;const wi=n.createElement("form"),ga=function(H){return H instanceof RegExp||H instanceof Function},Si=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Qr&&Qr===H)return;(!H||typeof H!="object")&&(H={}),H=Er(H),Fn=Pa.indexOf(H.PARSER_MEDIA_TYPE)===-1?pa:H.PARSER_MEDIA_TYPE,rn=Fn==="application/xhtml+xml"?Fg:Ju,P=cn(H,"ALLOWED_TAGS")&&ur(H.ALLOWED_TAGS)?rt({},H.ALLOWED_TAGS,rn):U,_=cn(H,"ALLOWED_ATTR")&&ur(H.ALLOWED_ATTR)?rt({},H.ALLOWED_ATTR,rn):V,Bn=cn(H,"ALLOWED_NAMESPACES")&&ur(H.ALLOWED_NAMESPACES)?rt({},H.ALLOWED_NAMESPACES,Fg):Bo,An=cn(H,"ADD_URI_SAFE_ATTR")&&ur(H.ADD_URI_SAFE_ATTR)?rt(Er(gr),H.ADD_URI_SAFE_ATTR,rn):gr,Je=cn(H,"ADD_DATA_URI_TAGS")&&ur(H.ADD_DATA_URI_TAGS)?rt(Er(St),H.ADD_DATA_URI_TAGS,rn):St,me=cn(H,"FORBID_CONTENTS")&&ur(H.FORBID_CONTENTS)?rt({},H.FORBID_CONTENTS,rn):Fe,re=cn(H,"FORBID_TAGS")&&ur(H.FORBID_TAGS)?rt({},H.FORBID_TAGS,rn):Er({}),xe=cn(H,"FORBID_ATTR")&&ur(H.FORBID_ATTR)?rt({},H.FORBID_ATTR,rn):Er({}),ce=cn(H,"USE_PROFILES")?H.USE_PROFILES&&typeof H.USE_PROFILES=="object"?Er(H.USE_PROFILES):H.USE_PROFILES:!1,Ce=H.ALLOW_ARIA_ATTR!==!1,Ye=H.ALLOW_DATA_ATTR!==!1,Be=H.ALLOW_UNKNOWN_PROTOCOLS||!1,qe=H.ALLOW_SELF_CLOSE_IN_ATTR!==!1,We=H.SAFE_FOR_TEMPLATES||!1,it=H.SAFE_FOR_XML!==!1,Se=H.WHOLE_DOCUMENT||!1,se=H.RETURN_DOM||!1,Ee=H.RETURN_DOM_FRAGMENT||!1,Ne=H.RETURN_TRUSTED_TYPE||!1,ot=H.FORCE_BODY||!1,Ze=H.SANITIZE_DOM!==!1,wt=H.SANITIZE_NAMED_PROPS||!1,Ut=H.KEEP_CONTENT!==!1,pr=H.IN_PLACE||!1,M=rY(H.ALLOWED_URI_REGEXP)?H.ALLOWED_URI_REGEXP:GT,yt=typeof H.NAMESPACE=="string"?H.NAMESPACE:Bt,ja=cn(H,"MATHML_TEXT_INTEGRATION_POINTS")&&H.MATHML_TEXT_INTEGRATION_POINTS&&typeof H.MATHML_TEXT_INTEGRATION_POINTS=="object"?Er(H.MATHML_TEXT_INTEGRATION_POINTS):rt({},["mi","mo","mn","ms","mtext"]),sr=cn(H,"HTML_INTEGRATION_POINTS")&&H.HTML_INTEGRATION_POINTS&&typeof H.HTML_INTEGRATION_POINTS=="object"?Er(H.HTML_INTEGRATION_POINTS):rt({},["annotation-xml"]);const ge=cn(H,"CUSTOM_ELEMENT_HANDLING")&&H.CUSTOM_ELEMENT_HANDLING&&typeof H.CUSTOM_ELEMENT_HANDLING=="object"?Er(H.CUSTOM_ELEMENT_HANDLING):Wl(null);if(Z=Wl(null),cn(ge,"tagNameCheck")&&ga(ge.tagNameCheck)&&(Z.tagNameCheck=ge.tagNameCheck),cn(ge,"attributeNameCheck")&&ga(ge.attributeNameCheck)&&(Z.attributeNameCheck=ge.attributeNameCheck),cn(ge,"allowCustomizedBuiltInElements")&&typeof ge.allowCustomizedBuiltInElements=="boolean"&&(Z.allowCustomizedBuiltInElements=ge.allowCustomizedBuiltInElements),We&&(Ye=!1),Ee&&(se=!0),ce&&(P=rt({},Ej),_=Wl(null),ce.html===!0&&(rt(P,Cj),rt(_,Nj)),ce.svg===!0&&(rt(P,$g),rt(_,Zg),rt(_,Of)),ce.svgFilters===!0&&(rt(P,Hg),rt(_,Zg),rt(_,Of)),ce.mathMl===!0&&(rt(P,qg),rt(_,_j),rt(_,Of))),Ae.tagCheck=null,Ae.attributeCheck=null,cn(H,"ADD_TAGS")&&(typeof H.ADD_TAGS=="function"?Ae.tagCheck=H.ADD_TAGS:ur(H.ADD_TAGS)&&(P===U&&(P=Er(P)),rt(P,H.ADD_TAGS,rn))),cn(H,"ADD_ATTR")&&(typeof H.ADD_ATTR=="function"?Ae.attributeCheck=H.ADD_ATTR:ur(H.ADD_ATTR)&&(_===V&&(_=Er(_)),rt(_,H.ADD_ATTR,rn))),cn(H,"ADD_URI_SAFE_ATTR")&&ur(H.ADD_URI_SAFE_ATTR)&&rt(An,H.ADD_URI_SAFE_ATTR,rn),cn(H,"FORBID_CONTENTS")&&ur(H.FORBID_CONTENTS)&&(me===Fe&&(me=Er(me)),rt(me,H.FORBID_CONTENTS,rn)),cn(H,"ADD_FORBID_CONTENTS")&&ur(H.ADD_FORBID_CONTENTS)&&(me===Fe&&(me=Er(me)),rt(me,H.ADD_FORBID_CONTENTS,rn)),Ut&&(P["#text"]=!0),Se&&rt(P,["html","head","body"]),P.table&&(rt(P,["tbody"]),delete re.tbody),H.TRUSTED_TYPES_POLICY){if(typeof H.TRUSTED_TYPES_POLICY.createHTML!="function")throw Rf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof H.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Rf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');D=H.TRUSTED_TYPES_POLICY,I=D.createHTML("")}else D===void 0&&(D=pY(x,s)),D!==null&&typeof I=="string"&&(I=D.createHTML(""));mr&&mr(H),Qr=H},ki=rt({},[...$g,...Hg,...aY]),ji=rt({},[...qg,...iY]),js=function(H){let ge=O(H);(!ge||!ge.tagName)&&(ge={namespaceURI:yt,tagName:"template"});const _e=Ju(H.tagName),Nt=Ju(ge.tagName);return Bn[H.namespaceURI]?H.namespaceURI===qt?ge.namespaceURI===Bt?_e==="svg":ge.namespaceURI===Yt?_e==="svg"&&(Nt==="annotation-xml"||ja[Nt]):!!ki[_e]:H.namespaceURI===Yt?ge.namespaceURI===Bt?_e==="math":ge.namespaceURI===qt?_e==="math"&&sr[Nt]:!!ji[_e]:H.namespaceURI===Bt?ge.namespaceURI===qt&&!sr[Nt]||ge.namespaceURI===Yt&&!ja[Nt]?!1:!ji[_e]&&(ma[_e]||!ki[_e]):!!(Fn==="application/xhtml+xml"&&Bn[H.namespaceURI]):!1},In=function(H){Gu(t.removed,{element:H});try{O(H).removeChild(H)}catch{C(H)}},vr=function(H,ge){try{Gu(t.removed,{attribute:ge.getAttributeNode(H),from:ge})}catch{Gu(t.removed,{attribute:null,from:ge})}if(ge.removeAttribute(H),H==="is")if(se||Ee)try{In(ge)}catch{}else try{ge.setAttribute(H,"")}catch{}},Ci=function(H){let ge=null,_e=null;if(ot)H="<remove></remove>"+H;else{const an=wj(H,/^[\r\n\t ]+/);_e=an&&an[0]}Fn==="application/xhtml+xml"&&yt===Bt&&(H='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+H+"</body></html>");const Nt=D?D.createHTML(H):H;if(yt===Bt)try{ge=new w().parseFromString(Nt,Fn)}catch{}if(!ge||!ge.documentElement){ge=R.createDocument(yt,"template",null);try{ge.documentElement.innerHTML=yr?I:Nt}catch{}}const kt=ge.body||ge.documentElement;return H&&_e&&kt.insertBefore(n.createTextNode(_e),kt.childNodes[0]||null),yt===Bt?ee.call(ge,Se?"html":"body")[0]:Se?ge.documentElement:kt},Ei=function(H){return B.call(H.ownerDocument||H,H,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},ye=function(H){return H instanceof g&&(typeof H.nodeName!="string"||typeof H.textContent!="string"||typeof H.removeChild!="function"||!(H.attributes instanceof p)||typeof H.removeAttribute!="function"||typeof H.setAttribute!="function"||typeof H.namespaceURI!="string"||typeof H.insertBefore!="function"||typeof H.hasChildNodes!="function")},Ve=function(H){return typeof f=="function"&&H instanceof f};function vt($e,H,ge){Zu($e,_e=>{_e.call(t,H,ge,Qr)})}const $n=function(H){let ge=null;if(vt($.beforeSanitizeElements,H,null),ye(H))return In(H),!0;const _e=rn(H.nodeName);if(vt($.uponSanitizeElement,H,{tagName:_e,allowedTags:P}),it&&H.hasChildNodes()&&!Ve(H.firstElementChild)&&Qn(/<[/\w!]/g,H.innerHTML)&&Qn(/<[/\w!]/g,H.textContent)||it&&H.namespaceURI===Bt&&_e==="style"&&Ve(H.firstElementChild)||H.nodeType===Qu.progressingInstruction||it&&H.nodeType===Qu.comment&&Qn(/<[/\w]/g,H.data))return In(H),!0;if(re[_e]||!(Ae.tagCheck instanceof Function&&Ae.tagCheck(_e))&&!P[_e]){if(!re[_e]&&Kc(_e)&&(Z.tagNameCheck instanceof RegExp&&Qn(Z.tagNameCheck,_e)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(_e)))return!1;if(Ut&&!me[_e]){const Nt=O(H)||H.parentNode,kt=T(H)||H.childNodes;if(kt&&Nt){const an=kt.length;for(let Hn=an-1;Hn>=0;--Hn){const xn=j(kt[Hn],!0);Nt.insertBefore(xn,E(H))}}}return In(H),!0}return H instanceof m&&!js(H)||(_e==="noscript"||_e==="noembed"||_e==="noframes")&&Qn(/<\/no(script|embed|frames)/i,H.innerHTML)?(In(H),!0):(We&&H.nodeType===Qu.text&&(ge=H.textContent,Zu([Q,ne,Y],Nt=>{ge=Ql(ge,Nt," ")}),H.textContent!==ge&&(Gu(t.removed,{element:H.cloneNode()}),H.textContent=ge)),vt($.afterSanitizeElements,H,null),!1)},Ua=function(H,ge,_e){if(xe[ge]||Ze&&(ge==="id"||ge==="name")&&(_e in n||_e in wi))return!1;const Nt=_[ge]||Ae.attributeCheck instanceof Function&&Ae.attributeCheck(ge,H);if(!(Ye&&!xe[ge]&&Qn(X,ge))){if(!(Ce&&Qn(G,ge))){if(!Nt||xe[ge]){if(!(Kc(H)&&(Z.tagNameCheck instanceof RegExp&&Qn(Z.tagNameCheck,H)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(H))&&(Z.attributeNameCheck instanceof RegExp&&Qn(Z.attributeNameCheck,ge)||Z.attributeNameCheck instanceof Function&&Z.attributeNameCheck(ge,H))||ge==="is"&&Z.allowCustomizedBuiltInElements&&(Z.tagNameCheck instanceof RegExp&&Qn(Z.tagNameCheck,_e)||Z.tagNameCheck instanceof Function&&Z.tagNameCheck(_e))))return!1}else if(!An[ge]){if(!Qn(M,Ql(_e,J,""))){if(!((ge==="src"||ge==="xlink:href"||ge==="href")&&H!=="script"&&Sj(_e,"data:")===0&&Je[H])){if(!(Be&&!Qn(ie,Ql(_e,J,"")))){if(_e)return!1}}}}}}return!0},Fo=rt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Kc=function(H){return!Fo[Ju(H)]&&Qn(ve,H)},$o=function(H){vt($.beforeSanitizeAttributes,H,null);const{attributes:ge}=H;if(!ge||ye(H))return;const _e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let Nt=ge.length;for(;Nt--;){const kt=ge[Nt],{name:an,namespaceURI:Hn,value:xn}=kt,Ln=rn(an),Ho=xn;let pn=an==="value"?Ho:XK(Ho);if(_e.attrName=Ln,_e.attrValue=pn,_e.keepAttr=!0,_e.forceKeepAttr=void 0,vt($.uponSanitizeAttribute,H,_e),pn=_e.attrValue,wt&&(Ln==="id"||Ln==="name")&&Sj(pn,Gt)!==0&&(vr(an,H),pn=Gt+pn),it&&Qn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,pn)){vr(an,H);continue}if(Ln==="attributename"&&wj(pn,"href")){vr(an,H);continue}if(_e.forceKeepAttr)continue;if(!_e.keepAttr){vr(an,H);continue}if(!qe&&Qn(/\/>/i,pn)){vr(an,H);continue}We&&Zu([Q,ne,Y],Yc=>{pn=Ql(pn,Yc," ")});const qo=rn(H.nodeName);if(!Ua(qo,Ln,pn)){vr(an,H);continue}if(D&&typeof x=="object"&&typeof x.getAttributeType=="function"&&!Hn)switch(x.getAttributeType(qo,Ln)){case"TrustedHTML":{pn=D.createHTML(pn);break}case"TrustedScriptURL":{pn=D.createScriptURL(pn);break}}if(pn!==Ho)try{Hn?H.setAttributeNS(Hn,an,pn):H.setAttribute(an,pn),ye(H)?In(H):xj(t.removed)}catch{vr(an,H)}}vt($.afterSanitizeAttributes,H,null)},Ni=function(H){let ge=null;const _e=Ei(H);for(vt($.beforeSanitizeShadowDOM,H,null);ge=_e.nextNode();)vt($.uponSanitizeShadowNode,ge,null),$n(ge),$o(ge),ge.content instanceof o&&Ni(ge.content);vt($.afterSanitizeShadowDOM,H,null)};return t.sanitize=function($e){let H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ge=null,_e=null,Nt=null,kt=null;if(yr=!$e,yr&&($e="<!-->"),typeof $e!="string"&&!Ve($e)&&($e=nY($e),typeof $e!="string"))throw Rf("dirty is not a string, aborting");if(!t.isSupported)return $e;if(Ie||Si(H),t.removed=[],typeof $e=="string"&&(pr=!1),pr){const xn=$e.nodeName;if(typeof xn=="string"){const Ln=rn(xn);if(!P[Ln]||re[Ln])throw Rf("root node is forbidden and cannot be sanitized in-place")}}else if($e instanceof f)ge=Ci("<!---->"),_e=ge.ownerDocument.importNode($e,!0),_e.nodeType===Qu.element&&_e.nodeName==="BODY"||_e.nodeName==="HTML"?ge=_e:ge.appendChild(_e);else{if(!se&&!We&&!Se&&$e.indexOf("<")===-1)return D&&Ne?D.createHTML($e):$e;if(ge=Ci($e),!ge)return se?null:Ne?I:""}ge&&ot&&In(ge.firstChild);const an=Ei(pr?$e:ge);for(;Nt=an.nextNode();)$n(Nt),$o(Nt),Nt.content instanceof o&&Ni(Nt.content);if(pr)return $e;if(se){if(We){ge.normalize();let xn=ge.innerHTML;Zu([Q,ne,Y],Ln=>{xn=Ql(xn,Ln," ")}),ge.innerHTML=xn}if(Ee)for(kt=L.call(ge.ownerDocument);ge.firstChild;)kt.appendChild(ge.firstChild);else kt=ge;return(_.shadowroot||_.shadowrootmode)&&(kt=z.call(a,kt,!0)),kt}let Hn=Se?ge.outerHTML:ge.innerHTML;return Se&&P["!doctype"]&&ge.ownerDocument&&ge.ownerDocument.doctype&&ge.ownerDocument.doctype.name&&Qn(VT,ge.ownerDocument.doctype.name)&&(Hn="<!DOCTYPE "+ge.ownerDocument.doctype.name+`>
|
|
412
|
+
`+Hn),We&&Zu([Q,ne,Y],xn=>{Hn=Ql(Hn,xn," ")}),D&&Ne?D.createHTML(Hn):Hn},t.setConfig=function(){let $e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Si($e),Ie=!0},t.clearConfig=function(){Qr=null,Ie=!1},t.isValidAttribute=function($e,H,ge){Qr||Si({});const _e=rn($e),Nt=rn(H);return Ua(_e,Nt,ge)},t.addHook=function($e,H){typeof H=="function"&&Gu($[$e],H)},t.removeHook=function($e,H){if(H!==void 0){const ge=KK($[$e],H);return ge===-1?void 0:YK($[$e],ge,1)[0]}return xj($[$e])},t.removeHooks=function($e){$[$e]=[]},t.removeAllHooks=function(){$=Aj()},t}var KT=QT();let Rj=!1;function gY(){Rj||(Rj=!0,KT.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"))}))}function yY({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:o}){const c=b.useMemo(()=>!e.preview||t!=="html"?null:(gY(),KT.sanitize(e.preview,{USE_PROFILES:{html:!0}})),[e.preview,t]);return l.jsxs("button",{type:"button",disabled:a,onClick:a?void 0:o,className:Oe("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",a?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:n?"var(--accent)":"var(--border)",background:n?"var(--bg-active)":"var(--bg-raised)"},children:[e.preview?t==="html"&&c?l.jsx("div",{dangerouslySetInnerHTML:{__html:c},className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"}}):t==="markdown"?l.jsx("div",{className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"},children:l.jsx(Ih,{children:e.preview})}):null:null,l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:n?"var(--accent)":"var(--fg)"},children:e.label}),s&&n?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Selected",children:"✓"}):null]}),e.description?l.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.description}):null]})}const ro="__free_text__";function Ku(){return{picked:[],freeText:""}}function Oj(e,t){if(t.picked.includes(ro)){const n=t.freeText.trim();return n.length===0?null:n}return t.picked.length===0?null:e.multiSelect?t.picked.join(", "):t.picked[0]??null}function vY({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const o=s==="pending",c=s==="answered",f=s==="superseded",[m,h]=b.useState(()=>{const C={};for(const E of n.questions)C[E.question]=Ku();return C});b.useEffect(()=>{if(!a)return;const C={};for(const E of n.questions){const T=a.answers[E.question];if(!T){C[E.question]=Ku();continue}const O=new Set(E.options.map(R=>R.label)),D=E.multiSelect?T.split(/,\s*/u):[T],I=D.filter(R=>O.has(R));I.length===D.length&&I.length>0?C[E.question]={picked:I,freeText:""}:C[E.question]={picked:[ro],freeText:T}}h(C)},[a,n.questions]);const p=vn(),[g,w]=b.useState(null),x=pt({mutationFn:async C=>ZK(e,n.correlationId,C),onSuccess:()=>{w(null),p.invalidateQueries({queryKey:["chat-messages",e]})},onError:C=>{w(C instanceof Error?C.message:String(C))}}),k=b.useCallback(()=>{w(null);const C={};for(const E of n.questions){const T=m[E.question]??Ku(),O=Oj(E,T);if(O===null){w(`Please answer "${E.question}" before submitting.`);return}C[E.question]=O}x.mutate(C)},[n.questions,m,x]),j=b.useMemo(()=>n.questions.every(C=>{const E=m[C.question]??Ku();return Oj(C,E)!==null}),[n.questions,m]);return l.jsxs("div",{className:Oe("rounded-[var(--radius-panel)] border flex flex-col",o?"":"opacity-80"),style:{padding:"var(--sp-3)",gap:"var(--sp-3)",borderColor:o?"var(--accent)":"var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:o?"var(--accent)":"var(--fg-3)"},children:"AGENT QUESTION"}),c?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"• Answered"}):null,f?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"• Superseded"}):null]}),l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:n.questions.map(C=>l.jsx(bY,{question:C,previewFormat:n.previewFormat,selection:m[C.question]??Ku(),allowFreeText:n.allowFreeText,disabled:!o,showAnsweredCheck:c||f,onChange:E=>h(T=>({...T,[C.question]:E}))},C.question))}),o?l.jsxs("div",{className:"flex items-center justify-end",style:{gap:"var(--sp-2)"},children:[g?l.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:g}):null,l.jsx(be,{type:"button",disabled:!j||x.isPending,onClick:k,children:x.isPending?"Submitting…":"Submit answer"})]}):null]})}function bY({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:o,onChange:c}){const f=b.useRef(null),m=n.picked.includes(ro);b.useEffect(()=>{var p;m&&!s&&((p=f.current)==null||p.focus())},[m,s]);const h=b.useCallback(p=>{const g=n.picked.includes(p);let w;e.multiSelect?w=g?n.picked.filter(x=>x!==p):[...n.picked,p]:w=g?[]:[p],c({...n,picked:w})},[e.multiSelect,n,c]);return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:"var(--fg-2)"},children:e.header}),e.multiSelect?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"(pick any)"}):null]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)"},children:e.question}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)"},children:[e.options.map(p=>l.jsx(yY,{option:p,previewFormat:t,selected:n.picked.includes(p.label),disabled:s,showCheckmark:o,onToggle:()=>h(p.label)},p.label)),a?l.jsxs("button",{type:"button",disabled:s,onClick:s?void 0:()=>c({picked:e.multiSelect?m?n.picked.filter(p=>p!==ro):[...n.picked,ro]:m?[]:[ro],freeText:n.freeText}),className:Oe("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",s?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:m?"var(--accent)":"var(--border)",background:m?"var(--bg-active)":"var(--bg-raised)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:m?"var(--accent)":"var(--fg-3)"},children:"Other…"}),l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:"Type a free-text answer."}),m?l.jsx("textarea",{ref:f,value:n.freeText,disabled:s,onChange:p=>c({...n,freeText:p.target.value}),onClick:p=>p.stopPropagation(),onKeyDown:p=>{p.key==="Enter"&&!p.metaKey&&!p.ctrlKey&&p.stopPropagation()},rows:2,className:"rounded-[var(--radius-input)] border text-body",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)",color:"var(--fg)",resize:"vertical"}}):null]}):null]})]})}function xY(e){return r9.safeParse(e).success}function YT(e){return a9.safeParse(e).success}function wY(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function SY(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),n=e%60;return`${t}m${n.toString().padStart(2,"0")}s`}function Mj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function kY({event:e}){const t=J3(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 l.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?l.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}}):l.jsx("span",{"aria-hidden":!0,style:{color:s,flexShrink:0},children:n?"⚠":"↳"}),l.jsxs("span",{className:"flex items-baseline",style:{color:"var(--fg-3)",minWidth:0,flex:1},title:t.args!==void 0&&t.args!==null?Mj(t.args):void 0,children:[l.jsxs("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:[o," ",l.jsx("span",{style:{color:"var(--fg-2)"},children:t.name})]}),t.args!==void 0&&t.args!==null?l.jsxs("span",{className:"truncate",style:{color:"var(--fg-4)",minWidth:0,flex:1},children:["(",Mj(t.args),")"]}):null,t.durationMs!==void 0&&!a?l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:["· ",wY(t.durationMs)]}):null]})]})}function jY(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 CY({event:e}){return l.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:[l.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}}),l.jsx("span",{style:{color:"var(--fg-3)"},children:"thinking…"}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:jY(e.createdAt)})]})}function Dj(e){return e.kind==="tool_call"?l.jsx(kY,{event:e}):e.kind==="thinking"?l.jsx(CY,{event:e}):null}function EY(e){let t=0,n=0;for(const o of e)o.kind==="tool_call"&&(t+=1),o.kind==="thinking"&&(n+=1);const a=e[0],s=a?Math.max(0,Math.round((Date.now()-new Date(a.createdAt).getTime())/1e3)):0;return{toolCalls:t,thinkings:n,elapsedSec:s}}function NY({events:e,defaultOpen:t}){const[n,a]=b.useState(t),s=e[e.length-1];if(!s)return null;const{toolCalls:o,thinkings:c,elapsedSec:f}=EY(e);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>a(m=>!m),className:"w-full text-left",style:{display:"flex",alignItems:"center",gap:4,background:"transparent",border:0,padding:0,cursor:"pointer",minWidth:0},"aria-expanded":n,"aria-label":n?"Collapse working details":"Expand working details",children:[l.jsx("span",{style:{flex:1,minWidth:0},children:Dj(s)}),l.jsx("span",{"aria-hidden":!0,className:"text-caption",style:{color:"var(--fg-4)",transform:n?"rotate(180deg)":"none",transition:"transform 150ms ease",marginRight:"var(--sp-1_5)",flexShrink:0,lineHeight:1},children:"▾"})]}),n?l.jsxs("div",{children:[e.map(m=>l.jsx("div",{children:Dj(m)},m.id)),l.jsxs("div",{className:"mono text-caption",style:{color:"var(--fg-4)",padding:"var(--sp-0_5) var(--sp-2) 0 var(--sp-4)"},children:[o," ",o===1?"tool":"tools"," · ",c," thinking · ",SY(f)]})]}):null]})}function _Y(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"||s.kind==="context_tree_usage"?!1:s.kind==="error"?!0:s.seq>t),a=new Map;for(const s of n){if(s.kind!=="tool_call")continue;const o=zj(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=zj(s.payload);return o?a.get(o)===s.seq:!0})}function zj(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Qc(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 TY({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function AY({event:e,agentNameFn:t,agentId:n}){const a=tz(e.payload);if(!a||a.text.length===0)return null;const s=t(n);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[l.jsx(Ph,{name:s,isSelf:!1}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:s}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Qc(e.createdAt)}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"· streaming"})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",whiteSpace:"pre-wrap",marginTop:2},children:a.text})]})]})}function RY({event:e}){const t=ez(e.payload),n=Qc(e.createdAt);return l.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:[l.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),l.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 Ph({name:e,isSelf:t}){const n=e.slice(0,2).toUpperCase();return l.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:l.jsx(Bc,{width:9,height:10,style:{color:"var(--accent)"}})})}function OY({msg:e,myAgentId:t,agentNameFn:n}){const[a,s]=Oo(),o=n(e.senderId),c=t===e.senderId,f=MY(e.metadata),m=b.useMemo(()=>({a({href:h,children:p,...g}){const w=x=>{if(!h||x.defaultPrevented||x.button!==0||x.metaKey||x.altKey||x.ctrlKey||x.shiftKey)return;const k=LT(h);if(!k)return;x.preventDefault();const j=new URLSearchParams(a);j.set("docChat",e.chatId),j.set("docAgent",e.senderId),j.set("docPath",k),f?j.set("docBase",f):j.delete("docBase"),s(j)};return l.jsx("a",{...g,href:h,onClick:w,target:"_blank",rel:"noopener noreferrer",children:p})}}),[f,e.chatId,e.senderId,a,s]);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ph,{name:o,isSelf:c}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:c?"var(--fg)":"var(--accent)"},children:o}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Qc(e.createdAt)}),l.jsx("span",{style:{marginLeft:"auto"},children:l.jsx(TY,{msg:e,myAgentId:t})})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&DY(e.content)?l.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"&&zY(e.content)?l.jsx(IY,{content:e.content}):e.format==="text"||e.format==="markdown"?l.jsx(Ih,{components:m,children:typeof e.content=="string"?e.content:JSON.stringify(e.content)}):l.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 MY(e){const t=EF.safeParse(e==null?void 0:e.documentContext);return t.success?t.data.basePath:void 0}function DY(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 zY(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 IY({content:e}){const[t,n]=b.useState({kind:"loading"});return b.useEffect(()=>{let a=!1;return qK(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"?l.jsx("img",{src:t.src,alt:e.filename,style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):t.kind==="miss"?l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",fontStyle:"italic"},children:['[Image "',e.filename,'" not available on this device]']}):l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"…"})}function LY({msg:e,chatId:t,content:n,answer:a,status:s,agentNameFn:o}){const c=o(e.senderId);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ph,{name:c,isSelf:!1}),l.jsxs("div",{className:"min-w-0 flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--accent)"},children:c}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Qc(e.createdAt)})]}),l.jsx(vY,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function PY({msg:e,agentNameFn:t}){const n=YT(e.content)?e.content:null,a=t(e.senderId),s=n?Object.entries(n.answers).map(([o,c])=>`${o.replace(/\s+\?$/u,"?")}: ${c}`).join(" · "):"(answer)";return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ph,{name:a,isSelf:!0}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--fg)"},children:a}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Qc(e.createdAt)}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"answered question"})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",marginTop:2},children:s})]})]})}function UY({metadata:e}){if(!e||e.source!=="github")return null;const t=typeof e.entityUrl=="string"?e.entityUrl:null;return t?l.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:"View on GitHub",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:"0 var(--sp-1)",textDecoration:"none"},children:l.jsx(Tv,{className:"h-3.5 w-3.5"})}):null}function Ij({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var ot;const o=vn(),c=bh(),f=$v(),{agentId:m}=ct(),[h,p]=b.useState(""),[g,w]=b.useState(0),[x,k]=b.useState([]),[j,C]=b.useState(!1),[E,T]=b.useState(null),O=b.useRef(null),D=b.useRef(null),I=b.useRef(null);HT(D,h);const R=b.useRef(!1),B=b.useRef(new Set);b.useEffect(()=>{R.current=!1},[t]);const{data:L}=Xe({queryKey:["chat-messages",t],queryFn:()=>CK(t,{limit:50}),refetchInterval:5e3}),{data:ee}=Xe({queryKey:["session-events",e,t],queryFn:()=>nz(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:z}=Xe({queryKey:["chat-detail",t],queryFn:()=>UT(t),enabled:!!t}),{data:$}=Xe({queryKey:["activity"],queryFn:Lc,refetchInterval:15e3}),Q=pt({mutationFn:se=>No(t,se),onSuccess:()=>{p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:f1(e)})}}),ne=b.useCallback(se=>{const Ne=se.filter(Gt=>Gt.type.startsWith("image/"));if(Ne.length===0)return;const Ze=Ne.find(Gt=>Gt.size>5242880);if(Ze){T(`Image too large (${(Ze.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const wt=Ne.map(Gt=>({id:crypto.randomUUID(),file:Gt,previewUrl:URL.createObjectURL(Gt)}));k(Gt=>[...Gt,...wt]),T(null)},[]),Y=b.useCallback(se=>{k(Ee=>{const Ne=Ee.find(Ze=>Ze.id===se);return Ne&&URL.revokeObjectURL(Ne.previewUrl),Ee.filter(Ze=>Ze.id!==se)}),T(null)},[]),X=async()=>{const se=h.trim(),Ee=x;if(!(!se&&Ee.length===0)&&!j){if(We&&it.length===0){Ee.length>0&&T("@mention a group member in the text — images will be addressed to the same recipient(s).");return}if(Se.length>0)try{await PT(t,{participantIds:Se}),await o.invalidateQueries({queryKey:["chat-detail",t]})}catch(Ne){T(Ne instanceof Error?Ne.message:"Failed to add participants");return}if(Ee.length>0){C(!0),T(null);try{const Ne=it.length>0?{mentions:it}:void 0;for(const Ze of Ee){const wt=await jK(Ze.file),Gt=crypto.randomUUID();await HK({imageId:Gt,base64:wt,mimeType:Ze.file.type}),await kK(t,{data:wt,mimeType:Ze.file.type,filename:Ze.file.name,size:Ze.file.size,imageId:Gt},Ne),URL.revokeObjectURL(Ze.previewUrl)}k([]),se&&await No(t,se),p(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:f1(e)})}catch(Ne){T(Ne instanceof Error?Ne.message:"Failed to send image")}finally{C(!1)}return}Q.mutate(se)}},[G,ie]=b.useState(!1),[J,ve]=b.useState(""),M=b.useRef(null);b.useEffect(()=>{var se;G&&((se=M.current)==null||se.focus())},[G]);const P=pt({mutationFn:se=>SK(t,se),onSuccess:()=>{ie(!1),o.invalidateQueries({queryKey:["chat-detail",t]}),o.invalidateQueries({queryKey:["agent-sessions",e]}),o.invalidateQueries({queryKey:["session",e,t]})}}),U=()=>{const se=J.trim();P.mutate(se.length>0?se:null)},_=pt({mutationFn:()=>BT(t,Uy.ACTIVE),onSuccess:()=>{o.invalidateQueries({queryKey:["me","chats"]}),o.invalidateQueries({queryKey:["chat-detail",t]})}}),V=b.useMemo(()=>{const se=(L==null?void 0:L.items)??[],Ee=(ee==null?void 0:ee.items)??[],Ne=_Y(Ee);let Ze=-1;for(const me of Ee)me.kind==="turn_end"&&me.seq>Ze&&(Ze=me.seq);const wt=[...se.map(me=>({kind:"message",at:me.createdAt,key:`m-${me.id}`,data:me})),...Ne.map(me=>({kind:"event",at:me.createdAt,key:`e-${me.id}`,data:me}))];wt.sort((me,Fe)=>me.at.localeCompare(Fe.at));const Gt=[];let Ut=[],pr=0;const ce=()=>{const me=Ut[0];me&&(Gt.push({kind:"workgroup",at:me.createdAt,key:`wg-${Ze}-${pr}`,events:Ut}),pr+=1,Ut=[])};for(const me of wt){if(me.kind==="event"&&(me.data.kind==="tool_call"||me.data.kind==="thinking")){Ut.push(me.data);continue}ce(),Gt.push(me)}return ce(),Gt},[L,ee]),Z=b.useMemo(()=>{const se=new Map;for(const Ee of(L==null?void 0:L.items)??[])Ee.format==="question_answer"&&YT(Ee.content)&&se.set(Ee.content.correlationId,Ee.content);return se},[L]),re=V.length;b.useEffect(()=>{var se;re>0&&((se=I.current)==null||se.scrollIntoView({behavior:"smooth"}))},[re]);const xe=b.useMemo(()=>{const se=new Map;for(const Ee of(z==null?void 0:z.participants)??[])se.set(Ee.agentId,{name:Ee.name,displayName:Ee.displayName});return se},[z==null?void 0:z.participants]),Ae=b.useCallback(se=>{if(!se)return"—";const Ee=xe.get(se);return Ee?Ee.displayName:c(se)},[xe,c]),Ce=b.useCallback(se=>{if(!se)return null;const Ee=xe.get(se);return Ee?{name:Ee.name,displayName:Ee.displayName}:f(se)},[xe,f]),Ye=Ae(e),Be=b.useMemo(()=>{var se;return new Set(((se=z==null?void 0:z.participants)==null?void 0:se.map(Ee=>Ee.agentId))??[])},[z==null?void 0:z.participants]),qe=b.useMemo(()=>{const se=new Set;for(const Ze of(z==null?void 0:z.participants)??[])se.add(Ze.agentId);for(const Ze of($==null?void 0:$.agents)??[])se.add(Ze.agentId);se.size===0&&se.add(e);const Ee=new Map;for(const Ze of($==null?void 0:$.agents)??[])Ee.set(Ze.agentId,Ze.managedByMe);const Ne=[];for(const Ze of se){if(Ze===m)continue;const wt=Ce(Ze);!wt||!wt.name||Ne.push({agentId:Ze,name:wt.name,displayName:wt.displayName,managedByMe:Ee.get(Ze)??!1})}return Ne},[z==null?void 0:z.participants,$==null?void 0:$.agents,e,Ce,m]),We=b.useMemo(()=>{if(!z)return!1;if(z.type==="group")return!0;const se=z.participants.some(Ee=>Ee.agentId===m);return z.type==="direct"&&!se&&z.participants.length>=2},[z,m]);b.useEffect(()=>{if(n||B.current.has(t)||!L||!ee||!z||V.length>0||h.length>0||We||Ye===e)return;const se=`Hi ${Ye}! What can you help with?`;p(se),w(se.length),B.current.add(t),requestAnimationFrame(()=>{const Ee=D.current;Ee&&(Ee.focus(),Ee.setSelectionRange(se.length,se.length))})},[t,e,L,ee,z,V.length,h.length,Ye,We,n]);const it=b.useMemo(()=>{const se=qe.map(Ee=>({agentId:Ee.agentId,name:Ee.name}));return VN(h,se)},[h,qe]),Se=b.useMemo(()=>Be.size===0?[]:it.filter(se=>!Be.has(se)),[it,Be]),Ie=FT({value:h,cursor:g,candidates:qe,disabled:Q.isPending||j,onSelect:se=>{p(se.text),w(se.cursor),requestAnimationFrame(()=>{const Ee=D.current;Ee&&(Ee.focus(),Ee.setSelectionRange(se.cursor,se.cursor))})}});return l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6)",borderBottom:"var(--hairline) solid var(--border)"},children:l.jsxs("div",{className:"flex items-center",style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%",gap:10},children:[l.jsxs("div",{className:"flex items-center min-w-0",style:{gap:8,flex:1},children:[n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"truncate text-subtitle min-w-0",style:{color:"var(--fg)"},children:(z==null?void 0:z.title)??a??"…"}),l.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"})]}):G?l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:M,value:J,onChange:se=>ve(se.target.value),onKeyDown:se=>{se.nativeEvent.isComposing||(se.key==="Enter"?(se.preventDefault(),U()):se.key==="Escape"&&(se.preventDefault(),ie(!1)))},disabled:P.isPending,maxLength:500,placeholder:(z==null?void 0:z.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)"}}),l.jsx("button",{type:"button",onClick:U,disabled:P.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:l.jsx(hr,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>ie(!1),disabled:P.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:l.jsx(pi,{className:"h-3.5 w-3.5"})})]}):l.jsx("button",{type:"button",onClick:()=>{ve((z==null?void 0:z.topic)??""),ie(!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:(z==null?void 0:z.title)??"…"}),l.jsx(UY,{metadata:z==null?void 0:z.metadata})]}),l.jsx(BY,{chatId:t,participantIds:((ot=z==null?void 0:z.participants)==null?void 0:ot.map(se=>se.agentId))??[e],candidates:qe,agentIdentity:Ce,onAdded:()=>o.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),(z==null?void 0:z.engagementStatus)===Uy.DELETED&&l.jsxs("div",{className:"shrink-0 flex items-center",style:{gap:"var(--sp-2)",padding:"var(--sp-1_5) var(--sp-6)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:[l.jsx("span",{className:"text-body",style:{flex:1},children:"This chat is deleted and won't appear in your conversation list."}),l.jsx("button",{type:"button",disabled:_.isPending,onClick:()=>_.mutate(),className:"text-body",style:{padding:"var(--sp-0_5) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-raised)",color:"var(--fg)",cursor:_.isPending?"default":"pointer",opacity:_.isPending?.6:1},children:_.isPending?"Restoring…":"Restore"})]}),l.jsx("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-6)"},children:l.jsxs("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:[re===0&&l.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[l.jsx(Av,{className:"h-8 w-8",style:{opacity:.3}}),n?"No messages yet":"Send a message to start the conversation"]}),l.jsx("div",{className:"flex flex-col",style:{gap:4},children:V.map(se=>{if(se.kind==="workgroup")return l.jsx(NY,{events:se.events,defaultOpen:(z==null?void 0:z.type)==="direct"},se.key);if(se.kind==="event"){const Ne=se.data;switch(Ne.kind){case"assistant_text":return l.jsx(AY,{event:Ne,agentId:e,agentNameFn:Ae},se.key);case"error":return l.jsx(RY,{event:Ne},se.key);default:return null}}const Ee=se.data;if(Ee.format==="question"&&xY(Ee.content)){const Ne=Z.get(Ee.content.correlationId)??null,Ze=Ne?"answered":"pending";return l.jsx(LY,{msg:Ee,chatId:t,content:Ee.content,answer:Ne,status:Ze,agentNameFn:Ae},se.key)}return Ee.format==="question_answer"?l.jsx(PY,{msg:Ee,agentNameFn:Ae},se.key):l.jsx(OY,{msg:Ee,myAgentId:m,agentNameFn:Ae},se.key)})}),l.jsx("div",{ref:I})]})}),l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6) var(--sp-3)"},children:l.jsx("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:n?l.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:[l.jsx(qC,{className:"h-4 w-4 shrink-0",style:{color:"var(--fg-3)"}}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)"},children:"You're watching this chat — read-only."}),(s==null?void 0:s.error)&&l.jsx("div",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:2},children:s.error})]}),s&&l.jsx(be,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:s.onJoin,disabled:s.joining,children:s.joining?"Joining…":"Join to reply"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:se=>se.preventDefault(),onDrop:se=>{se.preventDefault(),ne(Array.from(se.dataTransfer.files))},children:[x.length>0&&l.jsx("div",{className:"flex items-center",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) 0",overflowX:"auto"},children:x.map(se=>l.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[l.jsx("img",{src:se.previewUrl,alt:se.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),l.jsx("button",{type:"button",onClick:()=>Y(se.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:l.jsx(pi,{className:"h-2 w-2"})})]},se.id))}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx($T,{trigger:Ie.trigger,results:Ie.results,highlightIndex:Ie.highlightIndex,anchorRef:D,onPick:Ie.pick}),l.jsx("textarea",{ref:D,value:h,onChange:se=>{p(se.target.value),w(se.target.selectionStart??se.target.value.length),T(null)},onSelect:se=>{w(se.currentTarget.selectionStart??h.length)},onFocus:()=>{We&&(R.current||h.length>0||qe.length===0||(R.current=!0,p("@"),w(1),requestAnimationFrame(()=>{const se=D.current;se&&se.setSelectionRange(1,1)})))},onPaste:se=>{const Ee=Array.from(se.clipboardData.files);Ee.length>0&&(se.preventDefault(),ne(Ee))},placeholder:We?"Type @ to pick a recipient, then your message":`Message @${Ye} · / for commands · @ to mention`,rows:2,onKeyDown:se=>{se.nativeEvent.isComposing||Ie.handleKey(se)||se.key==="Enter"&&!se.shiftKey&&(se.preventDefault(),X())},disabled:Q.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",minHeight:"calc(2lh + var(--sp-2_25) + var(--sp-7_5))",maxHeight:"10.5rem",overflowY:"auto",resize:"none",color:"var(--fg)"}})]}),l.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[l.jsxs("span",{className:"mono flex items-center",style:{gap:10},children:[l.jsx("button",{type:"button",onClick:()=>{const se=D.current;if(!se)return;const Ee=se.selectionStart??h.length,Ne=se.selectionEnd??Ee,Ze=`${h.slice(0,Ee)}@${h.slice(Ne)}`;p(Ze),w(Ee+1),requestAnimationFrame(()=>{se.focus(),se.setSelectionRange(Ee+1,Ee+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:l.jsx(oD,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>{var se;return(se=O.current)==null?void 0:se.click()},title:"Attach image",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:l.jsx(FD,{className:"h-3.5 w-3.5"})}),l.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:se=>{se.target.files&&(ne(Array.from(se.target.files)),se.target.value="")}})]}),l.jsxs("span",{className:"flex items-center",style:{gap:8},children:[j&&l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),l.jsx("button",{type:"button",onClick:X,disabled:Q.isPending||j||!h.trim()&&x.length===0||We&&it.length===0,title:We&&it.length===0?"Pick at least one recipient with @ before sending in a group chat":"Send (Enter)","aria-label":"Send",className:Oe("inline-flex items-center justify-center transition-opacity",(Q.isPending||j||!h.trim()&&x.length===0||We&&it.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:l.jsx(FC,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(Q.isError||E)&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:E??(Q.error instanceof Error?Q.error.message:"Failed to send")})]})})})]})}function BY({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:o=!1}){const[c,f]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{if(!c)return;const g=w=>{m.current&&(m.current.contains(w.target)||f(!1))};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]);const h=pt({mutationFn:g=>PT(e,{participantIds:[g]}),onSuccess:()=>{f(!1),s()}}),p=b.useMemo(()=>n.filter(g=>!t.includes(g.agentId)),[n,t]);return l.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(g=>{const w=a(g),x=(w==null?void 0:w.displayName)??(w==null?void 0:w.name)??g.slice(0,8);return l.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:x},g)}),!o&&l.jsxs("div",{ref:m,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>f(!c),disabled:p.length===0||h.isPending,title:p.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:p.length===0?"var(--fg-4)":"var(--fg-3)",cursor:p.length===0?"not-allowed":"pointer"},children:l.jsx(Sa,{className:"h-3 w-3"})}),c&&p.length>0&&l.jsxs("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:[l.jsx("div",{role:"note",className:"text-caption",style:{padding:"var(--sp-1) var(--sp-3)",color:"var(--fg-3)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-sunken)",whiteSpace:"normal",lineHeight:1.4},children:"Adding is final in V1 — participants can't be removed yet."}),(()=>{const g=zb(p);return Lb(p).map(w=>"divider"in w?l.jsx("div",{role:"presentation",style:{height:"var(--hairline)",background:"var(--border-faint)",margin:"var(--sp-0_5) var(--sp-3)"}},"__divider"):l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:w.name?`@${w.name}`:void 0,onClick:()=>h.mutate(w.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:l.jsx(Ib,{candidate:w,ambiguous:g})},w.agentId))})()]})]})]})}function Lj(e,t){return e?e.find(n=>n.chatId===t)??null:null}function FY(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 $Y({chatId:e}){const t=vn(),{agentId:n}=ct(),a=b.useRef(new Map),{data:s}=Xe({queryKey:["chat-detail",e],queryFn:()=>UT(e),enabled:!!e}),{data:o}=Xe({queryKey:["me","chats","all"],queryFn:()=>sh({filter:"all"}),refetchInterval:3e4}),{data:c}=Xe({queryKey:["me","chats","watching"],queryFn:()=>sh({filter:"watching"}),refetchInterval:3e4}),f=b.useMemo(()=>Lj(o==null?void 0:o.rows,e)??Lj(c==null?void 0:c.rows,e)??null,[o,c,e]),m=b.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=b.useMemo(()=>FY(m,n),[m,n]),g=pt({mutationFn:()=>gK(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,w=(f==null?void 0:f.lastMessageAt)??"";b.useEffect(()=>{!f||a.current.get(e)===w||(a.current.set(e,w),g())},[e,f,w,g]);const x=pt({mutationFn:()=>vK(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),k=(f==null?void 0:f.membershipKind)==="watching";return h?k?l.jsx(Ij,{agentId:h,chatId:e,readOnly:!0,titleFallback:(f==null?void 0:f.title)??null,joinAction:{onJoin:()=>x.mutate(),joining:x.isPending,error:x.isError?x.error instanceof Error?x.error.message:"Failed to join":null}}):l.jsx(Ij,{agentId:h,chatId:e}):l.jsx("div",{className:"flex-1 flex items-center justify-center",style:{padding:"var(--sp-8)"},children:l.jsxs("div",{className:"text-center",style:{color:"var(--fg-3)"},children:[l.jsx("div",{className:"text-subtitle",style:{color:"var(--fg-2)",marginBottom:6},children:"Loading chat…"}),l.jsx("div",{className:"text-body",children:"Resolving participants."})]})})}function HY(){return l.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:l.jsxs("div",{className:"text-center max-w-sm",children:[l.jsx(Bc,{width:36,height:40,className:"mx-auto mb-3 text-primary opacity-60"}),l.jsx("div",{className:"text-subtitle mb-1",children:"Select a chat"}),l.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."})]})})}function qY(e,t){return!e||!t?!1:e.toLowerCase()===`${t.toLowerCase()}'s team`}function ZY({organizationId:e,onContinue:t}){const[n,a]=b.useState([]),[s,o]=b.useState(""),[c,f]=b.useState(""),[m,h]=b.useState(!1),[p,g]=b.useState(null),[w,x]=b.useState(!1),[k,j]=b.useState(null),C=b.useRef(null);b.useEffect(()=>{(async()=>{try{const D=await je.get("/me/organizations");a(D)}catch(D){j(D instanceof Error?D.message:"Failed to load your team")}finally{x(!0)}})()},[]),b.useEffect(()=>{var I;const D=((I=n.find(R=>R.id===e))==null?void 0:I.displayName)??"";o(D),f(D)},[n,e]),b.useEffect(()=>{const D=C.current;if(!D||!c)return;D.focus();const I=D.value.length;D.setSelectionRange(I,I)},[c]);const E=s.trim(),T=E.length>0&&!m&&w&&!k,O=b.useCallback(async D=>{if(D==null||D.preventDefault(),!(!T||!e)){g(null);try{E!==c.trim()&&(h(!0),await je.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:E}),mi("team_renamed")),t()}catch(I){g(I instanceof Error?I.message:"Failed to rename team")}finally{h(!1)}}},[T,e,E,c,t]);return l.jsxs("form",{onSubmit:O,className:"flex flex-col",style:{gap:"var(--sp-5)"},children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:["Name your ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"agent team"})," — where humans and AIs collaborate."]}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:"onboarding-team-name",className:"text-label",style:{color:"var(--fg-3)"},children:"Team name"}),l.jsx("input",{ref:C,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:D=>o(D.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:D=>{D.currentTarget.style.borderColor="var(--accent)"},onBlur:D=>{D.currentTarget.style.borderColor="var(--border)"}})]}),p||k?l.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:p??`Couldn't load your team — ${k}. Refresh the page and try again.`}):null,l.jsx("div",{className:"flex justify-end",children:l.jsxs(be,{type:"submit",disabled:!T,children:[l.jsx("span",{children:"Continue"}),l.jsx(BC,{className:"h-4 w-4"})]})})]})}function Pb(){return l.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 di({number:e,state:t,children:n}){const a=t==="active",s=t==="complete";return l.jsxs("section",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:"var(--sp-3)",marginTop:e==="01"?0:"var(--sp-5)",position:"relative"},children:[l.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?l.jsx(hr,{className:"h-3 w-3"}):e}),l.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}const GY=3e4,VY=1e3,QY=3e3;function KY(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function YY({organizationId:e,memberId:t,orgHasOtherMembers:n,refreshMe:a}){var Ye;const s=Dn(),{user:o}=ct(),c=BM(e,t),f=$M(c),m=f!=null&&f.connectToken&&f.connectTokenExpiresAt&&f.connectTokenExpiresAt>Date.now()?f.connectToken:null,h=m?(f==null?void 0:f.connectTokenExpiresAt)??null:null,[p,g]=b.useState(()=>(f==null?void 0:f.displayName)??(o!=null&&o.username?`${o.username}'s assistant`:"Assistant")),[w,x]=b.useState(()=>(f==null?void 0:f.visibility)??"organization"),[k,j]=b.useState(()=>(f==null?void 0:f.selectedRuntime)??null),[C,E]=b.useState(null),[T,O]=b.useState(null),[D,I]=b.useState(null),[R,B]=b.useState(()=>m),[L,ee]=b.useState(()=>h),[z,$]=b.useState([]),[Q,ne]=b.useState("form"),[Y,X]=b.useState(null),G=b.useRef(null),ie=b.useRef(null),J=b.useRef(null),ve=b.useRef(0);b.useEffect(()=>()=>{ie.current&&(ie.current.cancelled=!0)},[]),b.useEffect(()=>{HM(c,{displayName:p,selectedRuntime:k,connectToken:R,connectTokenExpiresAt:L,visibility:w})},[c,p,k,R,L,w]),b.useEffect(()=>{(async()=>{try{const Be=await je.get("/me/organizations");$(Be)}catch{}})()},[]),b.useEffect(()=>{if(Q!=="form")return;let Be=!1;const qe=async()=>{const it=++ve.current;try{const Se=await gi();if(Be||it!==ve.current)return;const ot=Se.filter(se=>se.status==="connected").sort((se,Ee)=>Ee.lastSeenAt.localeCompare(se.lastSeenAt))[0]??null;if(E(se=>(se==null?void 0:se.id)===(ot==null?void 0:ot.id)?se:ot),ot){J.current!==ot.id&&(J.current=null,I(null),O(null));try{const se=await mh(ot.id);if(Be||it!==ve.current)return;J.current=ot.id,I(ot.id),O(se.capabilities)}catch{}}else J.current=null,I(null),O(null)}catch{}};qe();const We=setInterval(qe,QY);return()=>{Be=!0,clearInterval(We)}},[Q]),b.useEffect(()=>{if(C)return;if(R&&L&&L>Date.now()){const qe=Math.max(L-Date.now(),0),We=window.setTimeout(()=>{B(null),ee(null)},qe);return()=>window.clearTimeout(We)}R&&(B(null),ee(null));let Be=!1;return(async()=>{try{const qe=await je.post("/me/connect-tokens",{});Be||(B(qe.token),ee(Date.now()+qe.expiresIn*1e3))}catch(qe){Be||X(qe instanceof Error?qe.message:"Failed to generate connect token")}})(),()=>{Be=!0}},[C,R,L]);const M=C&&D===C.id?T:null;b.useEffect(()=>{j(Be=>{var We;if(!M)return Be;const qe=XY(M);return Be&&qe&&Object.keys(M).includes(Be)&&((We=M[Be])==null?void 0:We.state)==="ok"?Be:qe})},[M]);const P=M?Object.entries(M).filter(([,Be])=>Be.state==="ok").map(([Be])=>Be):[],U=((Ye=z.find(Be=>Be.id===e))==null?void 0:Ye.displayName)??"",_=p.trim(),V=_||"your agent",Z=R?`npm install -g @agent-team-foundation/first-tree-hub
|
|
413
|
+
first-tree-hub connect ${R}`:null,re=b.useCallback(async Be=>{ie.current&&(ie.current.cancelled=!0);const qe={cancelled:!1};ie.current=qe;const We=Date.now();for(;!qe.cancelled;){let it=!1;try{const Se=await je.get(`/agents/${encodeURIComponent(Be)}/client-status`);if(qe.cancelled)return;it=Se.online===!0}catch{if(qe.cancelled)return}if(it){qM(c);try{await a()}catch{}if(qe.cancelled)return;s("/",{replace:!0});return}if(Date.now()-We>GY){qe.cancelled||ne("timeout");return}await new Promise(Se=>setTimeout(Se,VY))}},[c,a,s]),xe=!!(_&&C&&k&&P.includes(k)&&Q==="form"),Ae=b.useCallback(async()=>{if(!C||!k||!_)return;X(null),ne("creating");const Be=ev(_);let qe;try{qe=(await je.post(hn("/agents"),{type:"personal_assistant",displayName:_,...Be?{name:Be}:{},clientId:C.id,runtimeProvider:k,visibility:w,...e?{organizationId:e}:{}})).uuid,G.current=qe,LM(qe),mi("agent_created",{runtimeProvider:k})}catch(We){X(We instanceof Error?We.message:"Failed to create agent"),ne("form");return}await re(qe)},[_,C,k,w,re,e]),Ce=b.useCallback(async()=>{const Be=G.current;Be&&(X(null),ne("creating"),await re(Be))},[re]);return Q==="creating"?l.jsx(iX,{nameOrFallback:V}):Q==="timeout"?l.jsx(sX,{nameOrFallback:V,hostname:(C==null?void 0:C.hostname)??null,error:Y,onRetry:Ce}):l.jsx(WY,{orgHasOtherMembers:n,teamName:U,displayName:p,setDisplayName:g,trimmedName:_,connectedClient:C,cliCommand:Z,capabilitiesLoaded:M!==null,okRuntimes:P,selectedRuntime:k,setSelectedRuntime:j,visibility:w,setVisibility:x,error:Y,canCreate:xe,onCreate:Ae})}function XY(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 WY({orgHasOtherMembers:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:c,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:p,visibility:g,setVisibility:w,error:x,canCreate:k,onCreate:j}){const C=b.useRef(null),E=e&&!!t,T=!!o&&!!h&&f&&m.includes(h),O=f&&m.length===0&&!!o,D=s?o?O?"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 b.useEffect(()=>{var I;s||(I=C.current)==null||I.focus()},[s]),l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:E?l.jsxs(l.Fragment,{children:["You've joined"," ",l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Let's set up your first agent."]}):l.jsx(l.Fragment,{children:"Let's set up your first agent."})}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Pb,{}),l.jsx(di,{number:"01",state:s?"complete":"active",children:l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",flexWrap:"wrap"},children:[l.jsx("label",{htmlFor:"onboarding-name",className:"text-body font-normal",style:{color:"var(--fg-2)",whiteSpace:"nowrap"},children:"Name your agent"}),l.jsx("input",{ref:C,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:I=>a(I.target.value),placeholder:"e.g. Buddy, Helper",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:I=>{I.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:I=>{I.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),l.jsx(di,{number:"02",state:T?"complete":s?"active":"idle",children:l.jsxs("div",{style:{animation:s?"subtle-fade 200ms ease-out":void 0},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:s?"var(--fg)":"var(--fg-4)",fontWeight:s?600:500},children:"Connect a computer"}),s?l.jsxs(l.Fragment,{children:[l.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&&l.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?l.jsxs(l.Fragment,{children:[l.jsx(rX,{hostname:o.hostname??o.id}),l.jsx(tX,{runtimes:m,selected:h,onSelect:p,capabilitiesLoaded:f})]}):l.jsxs(l.Fragment,{children:[l.jsx(JY,{command:c}),l.jsx(eX,{})]})]}):null]})}),l.jsx(di,{number:"03",state:T?"active":"idle",children:l.jsxs("div",{style:{animation:T?"subtle-fade 200ms ease-out":void 0},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:T?"var(--fg)":"var(--fg-4)",fontWeight:T?600:500},children:"Pick who can use it"}),T?l.jsx(nX,{value:g,onChange:w}):null]})})]}),x&&l.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:x}),s&&l.jsxs("div",{style:{marginTop:k?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!k&&l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:D}),k&&l.jsxs(be,{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:j,onMouseEnter:I=>{I.currentTarget.style.transform="scale(1.01)",I.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:I=>{I.currentTarget.style.transform="scale(1)",I.currentTarget.style.boxShadow="var(--shadow-md)"},children:[l.jsxs("span",{children:["Create ",s]}),l.jsx(BC,{className:"h-4 w-4"})]}),l.jsx("p",{className:"text-caption",style:{margin:k?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function JY({command:e}){const[t,n]=b.useState(!1),s=(e?e.split(`
|
|
414
|
+
`):[]).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 l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[l.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…"}),l.jsxs(be,{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?l.jsx(hr,{className:"h-3.5 w-3.5"}):l.jsx(HC,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function eX(){return l.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:[l.jsx(aX,{}),l.jsx("span",{children:"Waiting for your computer…"})]})}function tX({runtimes:e,selected:t,onSelect:n,capabilitiesLoaded:a}){return e.length===0?l.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…"}):l.jsxs("div",{style:{marginTop:"var(--sp-3)"},children:[l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Powered by"}),l.jsxs("fieldset",{className:"flex",style:{gap:"var(--sp-4)",flexWrap:"wrap",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"sr-only",children:"Runtime provider"}),e.map((s,o)=>{const c=t===s;return l.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:[l.jsx("input",{type:"radio",name:"onboarding-runtime",value:s,checked:c,onChange:()=>n(s),className:"sr-only"}),l.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&&l.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),KY(s)]},s)})]})]})}function nX({value:e,onChange:t}){const n=[{value:"organization",title:"Shared with team",description:"Anyone in your org can @mention and chat with this agent."},{value:"private",title:"Private to you",description:"Only you can see this agent and chat with it. Others on the team won't see it listed."}];return l.jsxs("fieldset",{className:"flex flex-col",style:{gap:"var(--sp-2)",margin:"var(--sp-2) 0 0",padding:0,border:0},children:[l.jsx("legend",{className:"sr-only",children:"Agent visibility"}),n.map(a=>{const s=e===a.value;return l.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:s?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:"pointer",color:s?"var(--fg)":"var(--fg-2)",transition:"background 120ms ease, border-color 120ms ease"},children:[l.jsx("input",{type:"radio",name:"onboarding-visibility",value:a.value,checked:s,onChange:()=>t(a.value),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",className:"inline-flex items-center justify-center",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",marginTop:"var(--sp-0_5)",borderRadius:"50%",border:s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-strong)",background:s?"color-mix(in oklch, var(--accent) 8%, transparent)":"transparent",flexShrink:0,transition:"border-color 160ms ease, background 160ms ease"},children:s&&l.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),l.jsxs("span",{className:"flex flex-col",style:{gap:"var(--sp-0_5)",minWidth:0},children:[l.jsx("span",{className:"font-medium",style:{color:s?"var(--fg)":"var(--fg-2)"},children:a.title}),l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:a.description})]})]},a.value)})]})}function rX({hostname:e}){return l.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:[l.jsx(hr,{className:"h-3.5 w-3.5"}),l.jsxs("span",{children:[l.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function aX(){return l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",display:"inline-block",width:8,height:8,flexShrink:0},children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.55}})]})}function iX({nameOrFallback:e}){return l.jsxs("div",{className:"flex flex-col items-center text-center",style:{paddingTop:"var(--sp-12)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:["Creating ",e,"…"]}),l.jsx(lX,{}),l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function sX({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const s=t??"your computer";return l.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?l.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}):l.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[l.jsx("p",{children:"This usually means:"}),l.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[l.jsxs("li",{children:["The runtime can't start on ",s," (missing API key, etc.)"]}),l.jsxs("li",{children:["The connection to ",s," dropped"]})]}),l.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",s,", then click ",l.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),l.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:l.jsx(be,{onClick:a,children:"Try again"})})]})}function lX(){return l.jsxs("span",{className:"flex items-center",style:{gap:6},children:[l.jsx(Gg,{delayMs:0}),l.jsx(Gg,{delayMs:160}),l.jsx(Gg,{delayMs:320})]})}function Gg({delayMs:e}){return l.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"}})}async function XT(){return(await je.get("/me/github/repos")).repos}const WT="https://github.com/agent-team-foundation/first-tree";function JT(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function Ub(e,t){const n=JT(e),a=e.length===1?"Bind my source repo to an existing context-tree.":"Bind my source repos to an existing context-tree.",s=e.length===1?"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.":"Your workspace already has each source repo cloned in its own subdirectory; the first-tree skill will locate them. For every source repo, use the first-tree CLI to install the skill and write the binding metadata pointing at the existing tree, then open a PR back to that source repo. Walk me through each PR as it goes up.";return[a,"",...n,`Existing tree: ${t}`,"",s,"",`Reference: ${WT}`].join(`
|
|
415
|
+
`)}function oX(e){const t=JT(e),n=e.length===1?"Create a brand-new context-tree for my source repo.":"Create a brand-new context-tree for my source repos.",a=e.length===1?"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.":"Your workspace already has each source repo cloned in its own subdirectory; the first-tree skill will locate them. Scaffold ONE shared tree directory that all the source repos bind to. For every source repo, install the first-tree skill and write the binding metadata pointing at that shared tree. Push the new tree directory up to GitHub as its own repo — if all the source repos share a single GitHub owner, host the tree under that owner; otherwise ask me which owner to use before pushing. Then open a PR back to each source repo with its skill + binding files.";return[n,"",...t,"",a,"","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 PRs.","",`Reference: ${WT}`].join(`
|
|
416
|
+
`)}function uX(){const{role:e}=ct();return e==="admin"?l.jsx(gX,{}):l.jsx(cX,{})}function cX(){var f,m;const{organizationId:e}=ct(),[t,n]=b.useState({kind:"loading"}),[a,s]=b.useState(0);if(b.useEffect(()=>{if(!e){n({kind:"loaded",tree:null,repos:null});return}let h=!1;return n({kind:"loading"}),(async()=>{try{const[p,g]=await Promise.all([Ob(e),DT(e)]);if(h)return;n({kind:"loaded",tree:p,repos:g})}catch(p){if(h)return;n({kind:"error",message:p instanceof Error?p.message:"Failed to load team setup"})}})(),()=>{h=!0}},[e,a]),t.kind==="loading")return l.jsx(fX,{});if(t.kind==="error")return l.jsx(dX,{message:t.message,onRetry:()=>s(h=>h+1)});const o=((f=t.tree)==null?void 0:f.repo)??"",c=((m=t.repos)==null?void 0:m.repos)??[];return o&&c.length>0?l.jsx(hX,{treeUrl:o,teamRepos:c}):o?l.jsx(mX,{treeUrl:o}):l.jsx(pX,{})}function dX({message:e,onRetry:t}){return l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Couldn't load your team's setup"}),l.jsxs("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:[e,". This is usually a transient network issue."]}),l.jsx("div",{style:{marginTop:"var(--sp-3)"},children:l.jsx(be,{type:"button",onClick:t,children:"Try again"})})]})}function fX(){return l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function hX({treeUrl:e,teamRepos:t}){var C;const n=Dn(),{dismissOnboarding:a,markOnboardingCompleted:s}=ct(),{addToast:o}=$c(),[c,f]=b.useState(!1),[m,h]=b.useState(null),[p,g]=b.useState(()=>t.map(E=>E.url)),w=p.length>0,x=b.useCallback(E=>{g(T=>T.includes(E)?T.filter(O=>O!==E):[...T,E])},[]),k=b.useCallback(async()=>{if(p.length!==0){f(!0),h(null);try{const E=await Bb(),T=await gc(E.uuid);await Ah(E.uuid,{expectedVersion:T.version,payload:{gitRepos:p.map(I=>({url:I}))}});const O=await Mb(E.uuid),D=Ub(p,e);try{await No(O.id,D)}catch{}mi("tree_chat_started",{agentUuid:E.uuid,chatId:O.id,treeMode:"existing",joinPath:"invite"}),a(),s(),n(`/?c=${encodeURIComponent(O.id)}`,{replace:!1})}catch(E){h(E instanceof Error?E.message:"Failed to start the chat"),f(!1)}}},[p,e,n,a,s]),j=b.useCallback(()=>{mi("tree_intro_dismissed",{joinPath:"invite"}),a(),o(Fb(n))},[a,o,n]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Your team has already set up its ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Confirm to bind your agent."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[l.jsx(sv,{label:"Tree",value:e}),t.length===1?l.jsx(sv,{label:"Source repo",value:((C=t[0])==null?void 0:C.url)??""}):l.jsxs("fieldset",{disabled:c,style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"text-label",style:{color:"var(--fg-3)",padding:0,marginBottom:"var(--sp-1)"},children:"Pick the source repos to bind your agent to"}),t.map(E=>{const T=p.includes(E.url);return l.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:T?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:T?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:c?"not-allowed":"pointer",color:T?"var(--fg)":"var(--fg-2)",fontWeight:T?600:400},children:[l.jsx("input",{type:"checkbox",value:E.url,checked:T,onChange:()=>x(E.url),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:T?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:T?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:T?l.jsx(hr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"mono truncate",style:{minWidth:0,flex:1},children:E.url})]},E.url)})]}),m?l.jsx($b,{children:m}):null,l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[l.jsx(be,{type:"button",disabled:!w||c,onClick:()=>void k(),children:c?"Starting…":"Confirm"}),l.jsx(be,{type:"button",variant:"outline",onClick:j,disabled:c,children:"I'll do it later"})]})]})]})}function mX({treeUrl:e}){const t=Dn(),{dismissOnboarding:n,markOnboardingCompleted:a}=ct(),{addToast:s}=$c(),[o,c]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,w]=b.useState(null),[x,k]=b.useState([]),j=x.length>0,C=b.useCallback(O=>{k(D=>D.includes(O)?D.filter(I=>I!==O):[...D,O])},[]);b.useEffect(()=>{let O=!1;return(async()=>{try{const D=await XT();if(O)return;p(D)}catch(D){O||w(D instanceof Error?D.message:"Failed to list GitHub repositories")}})(),()=>{O=!0}},[]);const E=b.useCallback(async()=>{if(x.length!==0){c(!0),m(null);try{const O=await Bb(),D=await gc(O.uuid);await Ah(O.uuid,{expectedVersion:D.version,payload:{gitRepos:x.map(B=>({url:B}))}});const I=await Mb(O.uuid),R=Ub(x,e);try{await No(I.id,R)}catch{}mi("tree_chat_started",{agentUuid:O.uuid,chatId:I.id,treeMode:"existing",joinPath:"invite"}),n(),a(),t(`/?c=${encodeURIComponent(I.id)}`,{replace:!1})}catch(O){m(O instanceof Error?O.message:"Failed to start the chat"),c(!1)}}},[x,e,t,n,a]),T=b.useCallback(()=>{mi("tree_intro_dismissed",{joinPath:"invite"}),n(),s(Fb(t))},[n,s,t]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Joining your team's ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Pick the source repos you'll work with."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Pb,{}),l.jsx(di,{number:"01",state:"complete",children:l.jsx(sv,{label:"Tree",value:e})}),l.jsx(di,{number:"02",state:j?"complete":"active",children:l.jsx(eA,{disabled:o,repos:h,error:g,selectedRepoUrls:x,onToggle:C})}),l.jsxs(di,{number:"03",state:j?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:j?"var(--fg)":"var(--fg-4)",fontWeight:j?600:500},children:"Let your agent join the tree"}),j?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill and bind"," ",x.length>1?"each source repo":"your source repo"," to the existing team tree."]}),f?l.jsx($b,{style:{marginTop:"var(--sp-3)"},children:f}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(be,{type:"button",disabled:!j||o,onClick:()=>void E(),children:o?"Starting…":"Continue"}),l.jsx(be,{type:"button",variant:"outline",onClick:T,disabled:o,children:"I'll do it later"})]})]}):null]})]})]})}function pX(){const{dismissOnboarding:e}=ct(),{addToast:t}=$c(),n=b.useRef(!1);return b.useEffect(()=>{n.current||(n.current=!0,mi("tree_intro_dismissed",{joinPath:"invite",reason:"team_unconfigured"}),e(),t({title:"Your team admin hasn't finished setup",description:"Ask your admin to bind a context-tree and source repo. You can keep using your agent for general chat in the meantime."}))},[e,t]),l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Your team admin hasn't finished setup yet"}),l.jsx("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:"Once they finish setup, this view will guide your agent to join. For now, your agent can help with anything that doesn't depend on your team's shared knowledge."})]})}function gX(){const e=Dn(),{dismissOnboarding:t,markOnboardingCompleted:n,organizationId:a}=ct(),{addToast:s}=$c(),[o,c]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,w]=b.useState(""),[x,k]=b.useState([]),[j,C]=b.useState(null),[E,T]=b.useState(null),O=b.useCallback($=>{k(Q=>Q.includes($)?Q.filter(ne=>ne!==$):[...Q,$])},[]);b.useEffect(()=>{let $=!1;return(async()=>{try{const Q=await XT();if($)return;C(Q)}catch(Q){$||T(Q instanceof Error?Q.message:"Failed to list GitHub repositories")}})(),()=>{$=!0}},[]),b.useEffect(()=>{if(!a)return;let $=!1;return(async()=>{try{const Q=await Ob(a);if($)return;Q.repo&&(w(Q.repo),p(ne=>ne??"existing"))}catch{}})(),()=>{$=!0}},[a]);const D=g.trim(),I=(()=>{if(h!=="existing")return!0;if(!D)return!1;try{return new URL(D).protocol==="https:"}catch{return!1}})(),R=b.useCallback(()=>{mi("tree_intro_dismissed"),t(),s(Fb(e))},[t,s,e]),B=b.useCallback(async()=>{if(x.length!==0&&h&&!(h==="existing"&&!I)){m(null),c(!0);try{const $=await Bb(),Q=await gc($.uuid),ne=x.map(G=>({url:G}));await Ah($.uuid,{expectedVersion:Q.version,payload:{gitRepos:ne}}),a&&await zT(a,{repos:ne}),h==="existing"&&a&&await MT(a,{repo:D});const Y=await Mb($.uuid),X=h==="existing"?Ub(x,D):oX(x);try{await No(Y.id,X)}catch{}mi("tree_chat_started",{agentUuid:$.uuid,chatId:Y.id,treeMode:h}),t(),n(),e(`/?c=${encodeURIComponent(Y.id)}`,{replace:!1})}catch($){m($ instanceof Error?$.message:"Failed to start the tree-init chat"),c(!1)}}},[x,h,I,D,a,e,t,n]),L=x.length>0,ee=L&&h!==null&&!o&&(h==="new"||I),z=!!h&&(h==="new"||I);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Build the ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"})," — your team's shared knowledge that grows with your code."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Pb,{}),l.jsx(di,{number:"01",state:L?"complete":"active",children:l.jsx(eA,{disabled:o,repos:j,error:E,selectedRepoUrls:x,onToggle:O})}),l.jsxs(di,{number:"02",state:z?"complete":L?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:L?"var(--fg)":"var(--fg-4)",fontWeight:L?600:500},children:"Bind or create the tree"}),L?l.jsxs("div",{style:{marginTop:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsxs("fieldset",{"aria-label":"Bind or create the tree",disabled:o,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:[l.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($=>{const Q=h===$.value;return l.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:Q?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:Q?"var(--fg)":"var(--fg-3)",fontWeight:Q?600:400,boxShadow:Q?"var(--shadow-sm)":"none",cursor:o?"not-allowed":"pointer",userSelect:"none"},children:[l.jsx("input",{type:"radio",name:"tree-mode",value:$.value,checked:Q,onChange:()=>p($.value),className:"sr-only"}),$.label]},$.value)})]}),h==="existing"?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("label",{htmlFor:"onboarding-existing-tree-url",className:"text-label",style:{color:"var(--fg-3)"},children:"Tree GitHub URL"}),l.jsx("input",{id:"onboarding-existing-tree-url",type:"url",value:g,onChange:$=>w($.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:o,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,h==="new"?l.jsxs("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"," ",x.length>1?"each selected source repo":"the source repo"," to it."]}):null]}):null]}),l.jsxs(di,{number:"03",state:z?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:z?"var(--fg)":"var(--fg-4)",fontWeight:z?600:500},children:"Let your agent build it"}),z?l.jsxs(l.Fragment,{children:[l.jsxs("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"," ",x.length>1?"each source repo":"your source repo","."]}),f?l.jsx($b,{style:{marginTop:"var(--sp-3)"},children:f}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(be,{type:"button",disabled:!ee,onClick:()=>void B(),children:o?"Starting…":"Continue"}),l.jsx(be,{type:"button",variant:"outline",onClick:R,disabled:o,children:"I'll do it later"})]})]}):null]})]})]})}async function Bb(){const e=IM(),t=await Fv(),n=t.filter(s=>s.type!=="human"),a=(e?t.find(s=>s.uuid===e):void 0)??n.slice().sort((s,o)=>o.uuid.localeCompare(s.uuid))[0]??t[0];if(!a)throw new Error("No agent available to chat with — finish Step 2 first.");return a}function Fb(e){return{title:"Setup hidden",description:"Your agent isn't bound to a source repo yet. Resume from Settings → Onboarding any time to finish.",action:{label:"Resume setup",onClick:()=>e("/settings/onboarding")}}}function sv({label:e,value:t}){return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:e}),l.jsx("span",{className:"mono text-body truncate",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",minWidth:0},title:t,children:t})]})}function $b({children:e,style:t}){return l.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)",...t},children:e})}function eA({disabled:e,repos:t,error:n,selectedRepoUrls:a,onToggle:s}){const o=l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:e?"var(--fg-4)":"var(--fg)",fontWeight:e?500:600},children:"Pick source repos"});return e?l.jsx("div",{children:o}):n?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsxs("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[n,". Reconnect your GitHub account to grant repo access."]}),l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsx(be,{type:"button",variant:"outline",size:"sm",asChild:!0,children:l.jsx("a",{href:"/api/v1/auth/github/start?next=/",children:"Reconnect GitHub"})})})]}):t===null?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"Loading your GitHub repositories…"})]}):t.length===0?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.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."})]}):l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"The code your tree will organize knowledge about. Pick one or more."}),l.jsx(yX,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function yX({repos:e,selectedRepoUrls:t,onToggle:n}){const[a,s]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>{if(!a)return;const p=w=>{o.current&&!o.current.contains(w.target)&&s(!1)},g=w=>{w.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[a]);const c=b.useMemo(()=>{const p=new Map;for(const g of e){const w=g.fullName.split("/")[0]??"",x=p.get(w);x?x.push(g):p.set(w,[g])}return[...p.entries()].sort(([g],[w])=>g.localeCompare(w))},[e]),f=b.useMemo(()=>new Set(t),[t]),m=b.useMemo(()=>e.filter(p=>f.has(p.cloneUrl)),[e,f]),h=m.length===0?"Select repositories…":"Add another repository";return l.jsxs("div",{ref:o,className:"relative",style:{marginTop:"var(--sp-2)"},children:[m.length>0&&l.jsx("div",{style:{marginBottom:"var(--sp-2)",display:"flex",flexWrap:"wrap",gap:"var(--sp-1_5)"},children:m.map(p=>l.jsx(vX,{fullName:p.fullName,onRemove:()=>n(p.cloneUrl)},p.cloneUrl))}),l.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(p=>!p),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:"var(--fg-3)",outline:"none",cursor:"pointer",textAlign:"left"},children:[l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:h}),l.jsx(_v,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&l.jsx("div",{role:"listbox","aria-label":"GitHub repositories","aria-multiselectable":"true",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(([p,g],w)=>l.jsxs("div",{children:[l.jsx("div",{className:"text-eyebrow",style:{paddingTop:w>0?"var(--sp-3)":"var(--sp-1)",paddingBottom:"var(--sp-1)",paddingLeft:"calc(var(--sp-3) + var(--sp-3_5) + var(--sp-2))",paddingRight:"var(--sp-3)",color:"var(--fg-2)"},children:p}),g.map(x=>{const k=f.has(x.cloneUrl),j=x.fullName.slice(p.length+1);return l.jsxs("button",{type:"button",role:"option","aria-selected":k,onClick:()=>n(x.cloneUrl),className:"text-body transition-colors w-full",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:k?"var(--accent-bg)":"transparent",color:k?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:C=>{k||(C.currentTarget.style.background="var(--surface-1)")},onMouseLeave:C=>{k||(C.currentTarget.style.background="transparent")},children:[l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:k?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:k?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:k?l.jsx(hr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:j}),x.private&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:"var(--fg-4)",border:"var(--hairline) solid var(--border-faint)",background:"var(--bg-sunken)",flexShrink:0},children:"private"})]},x.cloneUrl)})]},p))})]})}function vX({fullName:e,onRemove:t}){return l.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",paddingLeft:"var(--sp-2)",paddingRight:"var(--sp-0_5)",paddingTop:"var(--sp-0_5)",paddingBottom:"var(--sp-0_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",maxWidth:"20rem"},children:[l.jsx("span",{className:"mono truncate",style:{minWidth:0},children:e}),l.jsx("button",{type:"button","aria-label":`Remove ${e}`,onClick:t,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--sp-4)",height:"var(--sp-4)",border:0,padding:0,background:"transparent",color:"var(--fg-3)",cursor:"pointer",borderRadius:"var(--radius-chip)",flexShrink:0,transition:"background 120ms ease, color 120ms ease"},onMouseEnter:n=>{n.currentTarget.style.background="var(--surface-2)",n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.background="transparent",n.currentTarget.style.color="var(--fg-3)"},children:l.jsx(pi,{className:"h-3 w-3"})})]})}function bX(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s,user:o,teamDisplayName:c,orgHasOtherMembers:f}=ct(),[m,h]=Oo(),p=m.get("step"),[g,w]=b.useState(()=>IC()),x=b.useCallback(O=>{zM(O),w(O)},[]),k=s==="admin",j=(o==null?void 0:o.username)??null,C=qY(c,j),E=b.useMemo(()=>p==="team"&&k?"step1":p==="agent"?"step2":p==="tree"||e==="completed"?"step3-intro":e==="connect"&&!g&&k&&C?"step1":"step2",[p,e,g,k,C]),T=b.useCallback(()=>{x(!0);const O=new URLSearchParams(m);O.delete("step"),h(O,{replace:!0})},[x,m,h]);return l.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:l.jsx("div",{style:{width:"100%",maxWidth:720},children:E==="step1"?l.jsx(ZY,{organizationId:n,onContinue:T}):E==="step2"?l.jsx(YY,{organizationId:n,memberId:a,orgHasOtherMembers:f,refreshMe:t}):l.jsx(uX,{})})})}function xX({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=ct();return e===Db?l.jsx(PK,{onCreated:t}):e?l.jsx($Y,{chatId:e}):n!==null&&!a?l.jsx(bX,{}):l.jsx(HY,{})}const wX={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function SX(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=ct(),{addToast:a}=$c(),s=Dn(),[o,c]=Oo(),f=o.get("c"),m=o.get("step"),h=IC(),g=PM()==="invite",w=b.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||f||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!g?1:2,[m,f,e,h,g]);if(e===null||t)return null;const x=e==="completed",k=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},j={1:Vg(1,w,e),2:Vg(2,w,e),3:Vg(3,w,e)},C=E=>{if(E!==3)return;const T=new URLSearchParams(o);T.delete("c"),T.set("step","tree"),c(T,{replace:!1})};return l.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:[l.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((E,T)=>{const O=j[E],D=[1,2,3][T+1],I=D?Pj(O)&&Pj(j[D]):!1;return l.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[l.jsx(kX,{index:E,state:O,label:wX[E],onClick:E===3&&O==="active"?()=>C(E):void 0}),D?l.jsx(CX,{solid:I}):null]},E)})}),l.jsx("button",{type:"button",onClick:k,disabled:!x,title:x?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:x?"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:x?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:x?1:.5},onMouseEnter:E=>{x&&(E.currentTarget.style.background="var(--surface-2)")},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:"✕"})]})}function Vg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function Pj(e){return e==="active"||e==="completed"}function kX({index:e,state:t,label:n,onClick:a}){const s=!!a,o=jX(t,e);return l.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,l.jsxs("span",{className:"text-label whitespace-nowrap",style:{textDecoration:s?"none":void 0},children:["Step ",e," · ",n]})]})}function jX(e,t){return e==="completed"?l.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"?l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:22,height:22,flexShrink:0,display:"inline-block"},children:[l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.5}}),l.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"?l.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:"⊗"}):l.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 CX({solid:e}){return l.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)"}})}const EX=ib.catch("active"),NX=eb.catch("manual");function _X(){const[e,t]=Oo(),n=e.get("c"),a=e.get("a"),s=EX.parse(e.get("engagement")),o=NX.parse(e.get("source"));v_(),b.useEffect(()=>{if(a&&n){const p=new URLSearchParams(e);p.delete("a"),p.set("c",n),t(p,{replace:!0});return}if(a&&!n){const p=new URLSearchParams(e);p.delete("a"),p.delete("c"),t(p,{replace:!0})}},[a,e,n,t]);const c=b.useCallback(p=>{const g=new URLSearchParams(e);g.set("c",p),lh(g),t(g)},[e,t]),f=b.useCallback(()=>{const p=new URLSearchParams(e);p.set("c",Db),lh(p),t(p)},[e,t]),m=b.useCallback(p=>{t(TX(e,p),{replace:!0})},[e,t]),h=b.useCallback(p=>{t(AX(e,p),{replace:!0})},[e,t]);return l.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[l.jsx(MK,{selectedChatId:n,onSelectChat:c,onNewChat:f,engagement:s,onEngagementChange:m,source:o,onSourceChange:h}),l.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[l.jsx(SX,{}),l.jsx(xX,{selectedChatId:n,onSelectChat:c})]}),l.jsx(hK,{})]})}function lh(e){e.delete("docChat"),e.delete("docAgent"),e.delete("docPath"),e.delete("docBase")}function TX(e,t){const n=new URLSearchParams(e);return t==="active"?n.delete("engagement"):n.set("engagement",t),n.delete("c"),lh(n),n}function AX(e,t){const n=new URLSearchParams(e);return t==="manual"?n.delete("source"):n.set("source",t),n.delete("c"),lh(n),n}const RX=new ZR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function OX(){return l.jsx(GR,{client:RX,children:l.jsx(VM,{children:l.jsx(m5,{children:l.jsx(wM,{children:l.jsxs(YO,{children:[l.jsx($t,{path:"/login",element:l.jsx(DV,{})}),l.jsx($t,{path:"/signup",element:l.jsx(er,{to:"/login",replace:!0})}),l.jsx($t,{path:"/auth/github/complete",element:l.jsx(zV,{})}),l.jsx($t,{path:"/invite/:token",element:l.jsx(AV,{})}),null,null,l.jsx($t,{element:l.jsx(WM,{}),children:l.jsxs($t,{element:l.jsx(g9,{children:l.jsx(f5,{})}),children:[l.jsx($t,{index:!0,element:l.jsx(_X,{})}),l.jsx($t,{path:"context",element:l.jsx(cV,{})}),l.jsx($t,{path:"agents/:uuid",element:l.jsx(eV,{})}),l.jsx($t,{path:"team",element:l.jsx(HQ,{})}),l.jsxs($t,{path:"settings",element:l.jsx(wQ,{}),children:[l.jsx($t,{index:!0,element:l.jsx(er,{to:"computers",replace:!0})}),l.jsx($t,{path:"team",element:l.jsx(iK,{})}),l.jsx($t,{path:"computers",element:l.jsx(KV,{})}),l.jsx($t,{path:"github",element:l.jsx(nQ,{})}),l.jsx($t,{path:"integrations",element:l.jsx(vQ,{})}),l.jsx($t,{path:"onboarding",element:l.jsx(bQ,{})}),l.jsx($t,{path:"setup",element:l.jsx(er,{to:"/settings/onboarding",replace:!0})})]}),l.jsx($t,{path:"agents",element:l.jsx(er,{to:"/team",replace:!0})}),l.jsx($t,{path:"clients",element:l.jsx(er,{to:"/settings/computers",replace:!0})}),l.jsx($t,{path:"integrations",element:l.jsx(er,{to:"/settings/integrations",replace:!0})}),l.jsx($t,{path:"team/members",element:l.jsx(er,{to:"/team",replace:!0})}),l.jsx($t,{path:"team/agents",element:l.jsx(er,{to:"/team",replace:!0})}),l.jsx($t,{path:"team/invite",element:l.jsx(er,{to:"/team",replace:!0})}),l.jsx($t,{path:"team/settings",element:l.jsx(er,{to:"/settings/team",replace:!0})}),l.jsx($t,{path:"admin",element:l.jsx(MX,{})})]})})]})})})})})}function MX(){const e=Rr();return e.hash==="#bindings"?l.jsx(er,{to:`/settings/integrations${e.search}`,replace:!0}):l.jsx(er,{to:`/team${e.hash}`,replace:!0})}const tA=document.getElementById("root");if(!tA)throw new Error("Root element not found");bR.createRoot(tA).render(l.jsx(b.StrictMode,{children:l.jsx(OX,{})}));export{BC as A,Bc as F,Dc as L,QC as U,lt as c,l as j,b as r};
|