var Mj=Object.defineProperty;var Kg=e=>{throw TypeError(e)};var Dj=(e,a,i)=>a in e?Mj(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i;var la=(e,a,i)=>Dj(e,typeof a!="symbol"?a+"":a,i),Qf=(e,a,i)=>a.has(e)||Kg("Cannot "+i);var re=(e,a,i)=>(Qf(e,a,"read from private field"),i?i.call(e):a.get(e)),Ye=(e,a,i)=>a.has(e)?Kg("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(e):a.set(e,i),Ae=(e,a,i,l)=>(Qf(e,a,"write to private field"),l?l.call(e,i):a.set(e,i),i),Xt=(e,a,i)=>(Qf(e,a,"access private method"),i);var Lc=(e,a,i,l)=>({set _(o){Ae(e,a,o,i)},get _(){return re(e,a,l)}});(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function i(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(o){if(o.ep)return;o.ep=!0;const u=i(o);fetch(o.href,u)}})();function hu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xf={exports:{}},qs={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Wg;function Oj(){if(Wg)return qs;Wg=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function i(l,o,u){var d=null;if(u!==void 0&&(d=""+u),o.key!==void 0&&(d=""+o.key),"key"in o){u={};for(var f in o)f!=="key"&&(u[f]=o[f])}else u=o;return o=u.ref,{$$typeof:e,type:l,key:d,ref:o!==void 0?o:null,props:u}}return qs.Fragment=a,qs.jsx=i,qs.jsxs=i,qs}var eb;function Rj(){return eb||(eb=1,Xf.exports=Oj()),Xf.exports}var r=Rj(),Jf={exports:{}},De={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var tb;function _j(){if(tb)return De;tb=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function y(R){return R===null||typeof R!="object"?null:(R=v&&R[v]||R["@@iterator"],typeof R=="function"?R:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,j={};function N(R,P,T){this.props=R,this.context=P,this.refs=j,this.updater=T||k}N.prototype.isReactComponent={},N.prototype.setState=function(R,P){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,P,"setState")},N.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function D(){}D.prototype=N.prototype;function E(R,P,T){this.props=R,this.context=P,this.refs=j,this.updater=T||k}var L=E.prototype=new D;L.constructor=E,z(L,N.prototype),L.isPureReactComponent=!0;var Y=Array.isArray;function A(){}var H={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function ee(R,P,T){var F=T.ref;return{$$typeof:e,type:R,key:P,ref:F!==void 0?F:null,props:T}}function O(R,P){return ee(R.type,P,R.props)}function U(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function $(R){var P={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(T){return P[T]})}var me=/\/+/g;function V(R,P){return typeof R=="object"&&R!==null&&R.key!=null?$(""+R.key):P.toString(36)}function te(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(A,A):(R.status="pending",R.then(function(P){R.status==="pending"&&(R.status="fulfilled",R.value=P)},function(P){R.status==="pending"&&(R.status="rejected",R.reason=P)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function B(R,P,T,F,ge){var ye=typeof R;(ye==="undefined"||ye==="boolean")&&(R=null);var Z=!1;if(R===null)Z=!0;else switch(ye){case"bigint":case"string":case"number":Z=!0;break;case"object":switch(R.$$typeof){case e:case a:Z=!0;break;case g:return Z=R._init,B(Z(R._payload),P,T,F,ge)}}if(Z)return ge=ge(R),Z=F===""?"."+V(R,0):F,Y(ge)?(T="",Z!=null&&(T=Z.replace(me,"$&/")+"/"),B(ge,P,T,"",function(it){return it})):ge!=null&&(U(ge)&&(ge=O(ge,T+(ge.key==null||R&&R.key===ge.key?"":(""+ge.key).replace(me,"$&/")+"/")+Z)),P.push(ge)),1;Z=0;var de=F===""?".":F+":";if(Y(R))for(var Ne=0;Ne<R.length;Ne++)F=R[Ne],ye=de+V(F,Ne),Z+=B(F,P,T,ye,ge);else if(Ne=y(R),typeof Ne=="function")for(R=Ne.call(R),Ne=0;!(F=R.next()).done;)F=F.value,ye=de+V(F,Ne++),Z+=B(F,P,T,ye,ge);else if(ye==="object"){if(typeof R.then=="function")return B(te(R),P,T,F,ge);throw P=String(R),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return Z}function X(R,P,T){if(R==null)return R;var F=[],ge=0;return B(R,F,"","",function(ye){return P.call(T,ye,ge++)}),F}function ce(R){if(R._status===-1){var P=R._result;P=P(),P.then(function(T){(R._status===0||R._status===-1)&&(R._status=1,R._result=T)},function(T){(R._status===0||R._status===-1)&&(R._status=2,R._result=T)}),R._status===-1&&(R._status=0,R._result=P)}if(R._status===1)return R._result.default;throw R._result}var ue=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=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(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},M={map:X,forEach:function(R,P,T){X(R,function(){P.apply(this,arguments)},T)},count:function(R){var P=0;return X(R,function(){P++}),P},toArray:function(R){return X(R,function(P){return P})||[]},only:function(R){if(!U(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return De.Activity=b,De.Children=M,De.Component=N,De.Fragment=i,De.Profiler=o,De.PureComponent=E,De.StrictMode=l,De.Suspense=p,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,De.__COMPILER_RUNTIME={__proto__:null,c:function(R){return H.H.useMemoCache(R)}},De.cache=function(R){return function(){return R.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(R,P,T){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var F=z({},R.props),ge=R.key;if(P!=null)for(ye in P.key!==void 0&&(ge=""+P.key),P)!ae.call(P,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&P.ref===void 0||(F[ye]=P[ye]);var ye=arguments.length-2;if(ye===1)F.children=T;else if(1<ye){for(var Z=Array(ye),de=0;de<ye;de++)Z[de]=arguments[de+2];F.children=Z}return ee(R.type,ge,F)},De.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},De.createElement=function(R,P,T){var F,ge={},ye=null;if(P!=null)for(F in P.key!==void 0&&(ye=""+P.key),P)ae.call(P,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(ge[F]=P[F]);var Z=arguments.length-2;if(Z===1)ge.children=T;else if(1<Z){for(var de=Array(Z),Ne=0;Ne<Z;Ne++)de[Ne]=arguments[Ne+2];ge.children=de}if(R&&R.defaultProps)for(F in Z=R.defaultProps,Z)ge[F]===void 0&&(ge[F]=Z[F]);return ee(R,ye,ge)},De.createRef=function(){return{current:null}},De.forwardRef=function(R){return{$$typeof:f,render:R}},De.isValidElement=U,De.lazy=function(R){return{$$typeof:g,_payload:{_status:-1,_result:R},_init:ce}},De.memo=function(R,P){return{$$typeof:h,type:R,compare:P===void 0?null:P}},De.startTransition=function(R){var P=H.T,T={};H.T=T;try{var F=R(),ge=H.S;ge!==null&&ge(T,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(A,ue)}catch(ye){ue(ye)}finally{P!==null&&T.types!==null&&(P.types=T.types),H.T=P}},De.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},De.use=function(R){return H.H.use(R)},De.useActionState=function(R,P,T){return H.H.useActionState(R,P,T)},De.useCallback=function(R,P){return H.H.useCallback(R,P)},De.useContext=function(R){return H.H.useContext(R)},De.useDebugValue=function(){},De.useDeferredValue=function(R,P){return H.H.useDeferredValue(R,P)},De.useEffect=function(R,P){return H.H.useEffect(R,P)},De.useEffectEvent=function(R){return H.H.useEffectEvent(R)},De.useId=function(){return H.H.useId()},De.useImperativeHandle=function(R,P,T){return H.H.useImperativeHandle(R,P,T)},De.useInsertionEffect=function(R,P){return H.H.useInsertionEffect(R,P)},De.useLayoutEffect=function(R,P){return H.H.useLayoutEffect(R,P)},De.useMemo=function(R,P){return H.H.useMemo(R,P)},De.useOptimistic=function(R,P){return H.H.useOptimistic(R,P)},De.useReducer=function(R,P,T){return H.H.useReducer(R,P,T)},De.useRef=function(R){return H.H.useRef(R)},De.useState=function(R){return H.H.useState(R)},De.useSyncExternalStore=function(R,P,T){return H.H.useSyncExternalStore(R,P,T)},De.useTransition=function(){return H.H.useTransition()},De.version="19.2.4",De}var nb;function rm(){return nb||(nb=1,Jf.exports=_j()),Jf.exports}var C=rm();const pe=hu(C);var Zf={exports:{}},Fs={},Kf={exports:{}},Wf={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ab;function Lj(){return ab||(ab=1,(function(e){function a(B,X){var ce=B.length;B.push(X);e:for(;0<ce;){var ue=ce-1>>>1,M=B[ue];if(0<o(M,X))B[ue]=X,B[ce]=M,ce=ue;else break e}}function i(B){return B.length===0?null:B[0]}function l(B){if(B.length===0)return null;var X=B[0],ce=B.pop();if(ce!==X){B[0]=ce;e:for(var ue=0,M=B.length,R=M>>>1;ue<R;){var P=2*(ue+1)-1,T=B[P],F=P+1,ge=B[F];if(0>o(T,ce))F<M&&0>o(ge,T)?(B[ue]=ge,B[F]=ce,ue=F):(B[ue]=T,B[P]=ce,ue=P);else if(F<M&&0>o(ge,ce))B[ue]=ge,B[F]=ce,ue=F;else break e}}return X}function o(B,X){var ce=B.sortIndex-X.sortIndex;return ce!==0?ce:B.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var p=[],h=[],g=1,b=null,v=3,y=!1,k=!1,z=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function L(B){for(var X=i(h);X!==null;){if(X.callback===null)l(h);else if(X.startTime<=B)l(h),X.sortIndex=X.expirationTime,a(p,X);else break;X=i(h)}}function Y(B){if(z=!1,L(B),!k)if(i(p)!==null)k=!0,A||(A=!0,$());else{var X=i(h);X!==null&&te(Y,X.startTime-B)}}var A=!1,H=-1,ae=5,ee=-1;function O(){return j?!0:!(e.unstable_now()-ee<ae)}function U(){if(j=!1,A){var B=e.unstable_now();ee=B;var X=!0;try{e:{k=!1,z&&(z=!1,D(H),H=-1),y=!0;var ce=v;try{t:{for(L(B),b=i(p);b!==null&&!(b.expirationTime>B&&O());){var ue=b.callback;if(typeof ue=="function"){b.callback=null,v=b.priorityLevel;var M=ue(b.expirationTime<=B);if(B=e.unstable_now(),typeof M=="function"){b.callback=M,L(B),X=!0;break t}b===i(p)&&l(p),L(B)}else l(p);b=i(p)}if(b!==null)X=!0;else{var R=i(h);R!==null&&te(Y,R.startTime-B),X=!1}}break e}finally{b=null,v=ce,y=!1}X=void 0}}finally{X?$():A=!1}}}var $;if(typeof E=="function")$=function(){E(U)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,V=me.port2;me.port1.onmessage=U,$=function(){V.postMessage(null)}}else $=function(){N(U,0)};function te(B,X){H=N(function(){B(e.unstable_now())},X)}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(B){B.callback=null},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ae=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(B){switch(v){case 1:case 2:case 3:var X=3;break;default:X=v}var ce=v;v=X;try{return B()}finally{v=ce}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(B,X){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ce=v;v=B;try{return X()}finally{v=ce}},e.unstable_scheduleCallback=function(B,X,ce){var ue=e.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?ue+ce:ue):ce=ue,B){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=ce+M,B={id:g++,callback:X,priorityLevel:B,startTime:ce,expirationTime:M,sortIndex:-1},ce>ue?(B.sortIndex=ce,a(h,B),i(p)===null&&B===i(h)&&(z?(D(H),H=-1):z=!0,te(Y,ce-ue))):(B.sortIndex=M,a(p,B),k||y||(k=!0,A||(A=!0,$()))),B},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(B){var X=v;return function(){var ce=v;v=X;try{return B.apply(this,arguments)}finally{v=ce}}}})(Wf)),Wf}var ib;function Bj(){return ib||(ib=1,Kf.exports=Lj()),Kf.exports}var eh={exports:{}},Jt={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var rb;function Uj(){if(rb)return Jt;rb=1;var e=rm();function a(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var l={d:{f:i,r:function(){throw Error(a(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function u(p,h,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:b==null?null:""+b,children:p,containerInfo:h,implementation:g}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Jt.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(a(299));return u(p,h,null,g)},Jt.flushSync=function(p){var h=d.T,g=l.p;try{if(d.T=null,l.p=2,p)return p()}finally{d.T=h,l.p=g,l.d.f()}},Jt.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,l.d.C(p,h))},Jt.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},Jt.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,b=f(g,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?l.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:y}):g==="script"&&l.d.X(p,{crossOrigin:b,integrity:v,fetchPriority:y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Jt.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);l.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&l.d.M(p)},Jt.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,b=f(g,h.crossOrigin);l.d.L(p,g,{crossOrigin:b,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})}},Jt.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=f(h.as,h.crossOrigin);l.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else l.d.m(p)},Jt.requestFormReset=function(p){l.d.r(p)},Jt.unstable_batchedUpdates=function(p,h){return p(h)},Jt.useFormState=function(p,h,g){return d.H.useFormState(p,h,g)},Jt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Jt.version="19.2.4",Jt}var lb;function Vy(){if(lb)return eh.exports;lb=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(a){console.error(a)}}return e(),eh.exports=Uj(),eh.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var sb;function Ij(){if(sb)return Fs;sb=1;var e=Bj(),a=rm(),i=Vy();function l(t){var n="https://react.dev/errors/"+t;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var n=t,s=t;if(t.alternate)for(;n.return;)n=n.return;else{t=n;do n=t,(n.flags&4098)!==0&&(s=n.return),t=n.return;while(t)}return n.tag===3?s:null}function d(t){if(t.tag===13){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function f(t){if(t.tag===31){var n=t.memoizedState;if(n===null&&(t=t.alternate,t!==null&&(n=t.memoizedState)),n!==null)return n.dehydrated}return null}function p(t){if(u(t)!==t)throw Error(l(188))}function h(t){var n=t.alternate;if(!n){if(n=u(t),n===null)throw Error(l(188));return n!==t?null:t}for(var s=t,c=n;;){var m=s.return;if(m===null)break;var x=m.alternate;if(x===null){if(c=m.return,c!==null){s=c;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===s)return p(m),t;if(x===c)return p(m),n;x=x.sibling}throw Error(l(188))}if(s.return!==c.return)s=m,c=x;else{for(var w=!1,S=m.child;S;){if(S===s){w=!0,s=m,c=x;break}if(S===c){w=!0,c=m,s=x;break}S=S.sibling}if(!w){for(S=x.child;S;){if(S===s){w=!0,s=x,c=m;break}if(S===c){w=!0,c=x,s=m;break}S=S.sibling}if(!w)throw Error(l(189))}}if(s.alternate!==c)throw Error(l(190))}if(s.tag!==3)throw Error(l(188));return s.stateNode.current===s?t:n}function g(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t;for(t=t.child;t!==null;){if(n=g(t),n!==null)return n;t=t.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),E=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),O=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function $(t){return t===null||typeof t!="object"?null:(t=U&&t[U]||t["@@iterator"],typeof t=="function"?t:null)}var me=Symbol.for("react.client.reference");function V(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===me?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case z:return"Fragment";case N:return"Profiler";case j:return"StrictMode";case Y:return"Suspense";case A:return"SuspenseList";case ee:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case E:return t.displayName||"Context";case D:return(t._context.displayName||"Context")+".Consumer";case L:var n=t.render;return t=t.displayName,t||(t=n.displayName||n.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case H:return n=t.displayName||null,n!==null?n:V(t.type)||"Memo";case ae:n=t._payload,t=t._init;try{return V(t(n))}catch{}}return null}var te=Array.isArray,B=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},ue=[],M=-1;function R(t){return{current:t}}function P(t){0>M||(t.current=ue[M],ue[M]=null,M--)}function T(t,n){M++,ue[M]=t.current,t.current=n}var F=R(null),ge=R(null),ye=R(null),Z=R(null);function de(t,n){switch(T(ye,n),T(ge,t),T(F,null),n.nodeType){case 9:case 11:t=(t=n.documentElement)&&(t=t.namespaceURI)?wg(t):0;break;default:if(t=n.tagName,n=n.namespaceURI)n=wg(n),t=jg(n,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}P(F),T(F,t)}function Ne(){P(F),P(ge),P(ye)}function it(t){t.memoizedState!==null&&T(Z,t);var n=F.current,s=jg(n,t.type);n!==s&&(T(ge,t),T(F,s))}function yt(t){ge.current===t&&(P(F),P(ge)),Z.current===t&&(P(Z),Bs._currentValue=ce)}var un,Da;function zn(t){if(un===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);un=n&&n[1]||"",Da=-1<s.stack.indexOf(`
    at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
`+un+t+Da}var Un=!1;function kn(t,n){if(!t||Un)return"";Un=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(n){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(W){var J=W}Reflect.construct(t,[],se)}else{try{se.call()}catch(W){J=W}t.call(se.prototype)}}else{try{throw Error()}catch(W){J=W}(se=t())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(W){if(W&&J&&typeof W.stack=="string")return[W.stack,J.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=c.DetermineComponentFrameRoot(),w=x[0],S=x[1];if(w&&S){var _=w.split(`
`),Q=S.split(`
`);for(m=c=0;c<_.length&&!_[c].includes("DetermineComponentFrameRoot");)c++;for(;m<Q.length&&!Q[m].includes("DetermineComponentFrameRoot");)m++;if(c===_.length||m===Q.length)for(c=_.length-1,m=Q.length-1;1<=c&&0<=m&&_[c]!==Q[m];)m--;for(;1<=c&&0<=m;c--,m--)if(_[c]!==Q[m]){if(c!==1||m!==1)do if(c--,m--,0>m||_[c]!==Q[m]){var ne=`
`+_[c].replace(" at new "," at ");return t.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",t.displayName)),ne}while(1<=c&&0<=m);break}}}finally{Un=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?zn(s):""}function Oa(t,n){switch(t.tag){case 26:case 27:case 5:return zn(t.type);case 16:return zn("Lazy");case 13:return t.child!==n&&n!==null?zn("Suspense Fallback"):zn("Suspense");case 19:return zn("SuspenseList");case 0:case 15:return kn(t.type,!1);case 11:return kn(t.type.render,!1);case 1:return kn(t.type,!0);case 31:return zn("Activity");default:return""}}function xe(t){try{var n="",s=null;do n+=Oa(t,s),s=t,t=t.return;while(t);return n}catch(c){return`
Error generating stack: `+c.message+`
`+c.stack}}var ve=Object.prototype.hasOwnProperty,Me=e.unstable_scheduleCallback,ze=e.unstable_cancelCallback,Be=e.unstable_shouldYield,Ie=e.unstable_requestPaint,et=e.unstable_now,Nt=e.unstable_getCurrentPriorityLevel,K=e.unstable_ImmediatePriority,fe=e.unstable_UserBlockingPriority,Ee=e.unstable_NormalPriority,Ue=e.unstable_LowPriority,Ve=e.unstable_IdlePriority,an=e.log,In=e.unstable_setDisableYieldValue,Ot=null,ft=null;function Ht(t){if(typeof an=="function"&&In(t),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(Ot,t)}catch{}}var Qe=Math.clz32?Math.clz32:zo,ba=Math.log,Nn=Math.LN2;function zo(t){return t>>>=0,t===0?32:31-(ba(t)/Nn|0)|0}var Qi=256,Tr=262144,oi=4194304;function Qt(t){var n=t&42;if(n!==0)return n;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ar(t,n,s){var c=t.pendingLanes;if(c===0)return 0;var m=0,x=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var S=c&134217727;return S!==0?(c=S&~x,c!==0?m=Qt(c):(w&=S,w!==0?m=Qt(w):s||(s=S&~t,s!==0&&(m=Qt(s))))):(S=c&~x,S!==0?m=Qt(S):w!==0?m=Qt(w):s||(s=c&~t,s!==0&&(m=Qt(s)))),m===0?0:n!==0&&n!==m&&(n&x)===0&&(x=m&-m,s=n&-n,x>=s||x===32&&(s&4194048)!==0)?n:m}function Te(t,n){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&n)===0}function tt(t,n){switch(t){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 ct(){var t=oi;return oi<<=1,(oi&62914560)===0&&(oi=4194304),t}function rn(t){for(var n=[],s=0;31>s;s++)n.push(t);return n}function qt(t,n){t.pendingLanes|=n,n!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ya(t,n,s,c,m,x){var w=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var S=t.entanglements,_=t.expirationTimes,Q=t.hiddenUpdates;for(s=w&~s;0<s;){var ne=31-Qe(s),se=1<<ne;S[ne]=0,_[ne]=-1;var J=Q[ne];if(J!==null)for(Q[ne]=null,ne=0;ne<J.length;ne++){var W=J[ne];W!==null&&(W.lane&=-536870913)}s&=~se}c!==0&&va(t,c,0),x!==0&&m===0&&t.tag!==0&&(t.suspendedLanes|=x&~(w&~n))}function va(t,n,s){t.pendingLanes|=n,t.suspendedLanes&=~n;var c=31-Qe(n);t.entangledLanes|=n,t.entanglements[c]=t.entanglements[c]|1073741824|s&261930}function dn(t,n){var s=t.entangledLanes|=n;for(t=t.entanglements;s;){var c=31-Qe(s),m=1<<c;m&n|t[c]&n&&(t[c]|=n),s&=~m}}function na(t,n){var s=n&-n;return s=(s&42)!==0?1:Lu(s),(s&(t.suspendedLanes|n))!==0?0:s}function Lu(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Bu(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function l0(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:Vg(t.type))}function s0(t,n){var s=X.p;try{return X.p=t,n()}finally{X.p=s}}var ci=Math.random().toString(36).slice(2),Ft="__reactFiber$"+ci,fn="__reactProps$"+ci,Mr="__reactContainer$"+ci,Uu="__reactEvents$"+ci,v2="__reactListeners$"+ci,w2="__reactHandles$"+ci,o0="__reactResources$"+ci,Kl="__reactMarker$"+ci;function Iu(t){delete t[Ft],delete t[fn],delete t[Uu],delete t[v2],delete t[w2]}function Dr(t){var n=t[Ft];if(n)return n;for(var s=t.parentNode;s;){if(n=s[Mr]||s[Ft]){if(s=n.alternate,n.child!==null||s!==null&&s.child!==null)for(t=Tg(t);t!==null;){if(s=t[Ft])return s;t=Tg(t)}return n}t=s,s=t.parentNode}return null}function Or(t){if(t=t[Ft]||t[Mr]){var n=t.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return t}return null}function Wl(t){var n=t.tag;if(n===5||n===26||n===27||n===6)return t.stateNode;throw Error(l(33))}function Rr(t){var n=t[o0];return n||(n=t[o0]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Lt(t){t[Kl]=!0}var c0=new Set,u0={};function Xi(t,n){_r(t,n),_r(t+"Capture",n)}function _r(t,n){for(u0[t]=n,t=0;t<n.length;t++)c0.add(n[t])}var j2=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]*$"),d0={},f0={};function z2(t){return ve.call(f0,t)?!0:ve.call(d0,t)?!1:j2.test(t)?f0[t]=!0:(d0[t]=!0,!1)}function ko(t,n,s){if(z2(n))if(s===null)t.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(n);return;case"boolean":var c=n.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(n);return}}t.setAttribute(n,""+s)}}function No(t,n,s){if(s===null)t.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttribute(n,""+s)}}function Ra(t,n,s,c){if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(n,s,""+c)}}function Hn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function h0(t){var n=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function k2(t,n,s){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,n);if(!t.hasOwnProperty(n)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var m=c.get,x=c.set;return Object.defineProperty(t,n,{configurable:!0,get:function(){return m.call(this)},set:function(w){s=""+w,x.call(this,w)}}),Object.defineProperty(t,n,{enumerable:c.enumerable}),{getValue:function(){return s},setValue:function(w){s=""+w},stopTracking:function(){t._valueTracker=null,delete t[n]}}}}function Hu(t){if(!t._valueTracker){var n=h0(t)?"checked":"value";t._valueTracker=k2(t,n,""+t[n])}}function m0(t){if(!t)return!1;var n=t._valueTracker;if(!n)return!0;var s=n.getValue(),c="";return t&&(c=h0(t)?t.checked?"true":"false":t.value),t=c,t!==s?(n.setValue(t),!0):!1}function So(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var N2=/[\n"\\]/g;function qn(t){return t.replace(N2,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function qu(t,n,s,c,m,x,w,S){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),n!=null?w==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+Hn(n)):t.value!==""+Hn(n)&&(t.value=""+Hn(n)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),n!=null?Fu(t,w,Hn(n)):s!=null?Fu(t,w,Hn(s)):c!=null&&t.removeAttribute("value"),m==null&&x!=null&&(t.defaultChecked=!!x),m!=null&&(t.checked=m&&typeof m!="function"&&typeof m!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.name=""+Hn(S):t.removeAttribute("name")}function p0(t,n,s,c,m,x,w,S){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.type=x),n!=null||s!=null){if(!(x!=="submit"&&x!=="reset"||n!=null)){Hu(t);return}s=s!=null?""+Hn(s):"",n=n!=null?""+Hn(n):s,S||n===t.value||(t.value=n),t.defaultValue=n}c=c??m,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=S?t.checked:!!c,t.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),Hu(t)}function Fu(t,n,s){n==="number"&&So(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function Lr(t,n,s,c){if(t=t.options,n){n={};for(var m=0;m<s.length;m++)n["$"+s[m]]=!0;for(s=0;s<t.length;s++)m=n.hasOwnProperty("$"+t[s].value),t[s].selected!==m&&(t[s].selected=m),m&&c&&(t[s].defaultSelected=!0)}else{for(s=""+Hn(s),n=null,m=0;m<t.length;m++){if(t[m].value===s){t[m].selected=!0,c&&(t[m].defaultSelected=!0);return}n!==null||t[m].disabled||(n=t[m])}n!==null&&(n.selected=!0)}}function x0(t,n,s){if(n!=null&&(n=""+Hn(n),n!==t.value&&(t.value=n),s==null)){t.defaultValue!==n&&(t.defaultValue=n);return}t.defaultValue=s!=null?""+Hn(s):""}function g0(t,n,s,c){if(n==null){if(c!=null){if(s!=null)throw Error(l(92));if(te(c)){if(1<c.length)throw Error(l(93));c=c[0]}s=c}s==null&&(s=""),n=s}s=Hn(n),t.defaultValue=s,c=t.textContent,c===s&&c!==""&&c!==null&&(t.value=c),Hu(t)}function Br(t,n){if(n){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=n;return}}t.textContent=n}var S2=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 b0(t,n,s){var c=n.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?c?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="":c?t.setProperty(n,s):typeof s!="number"||s===0||S2.has(n)?n==="float"?t.cssFloat=s:t[n]=(""+s).trim():t[n]=s+"px"}function y0(t,n,s){if(n!=null&&typeof n!="object")throw Error(l(62));if(t=t.style,s!=null){for(var c in s)!s.hasOwnProperty(c)||n!=null&&n.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var m in n)c=n[m],n.hasOwnProperty(m)&&s[m]!==c&&b0(t,m,c)}else for(var x in n)n.hasOwnProperty(x)&&b0(t,x,n[x])}function Pu(t){if(t.indexOf("-")===-1)return!1;switch(t){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 C2=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"]]),E2=/^[\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 Co(t){return E2.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function _a(){}var $u=null;function Vu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ur=null,Ir=null;function v0(t){var n=Or(t);if(n&&(t=n.stateNode)){var s=t[fn]||null;e:switch(t=n.stateNode,n.type){case"input":if(qu(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),n=s.name,s.type==="radio"&&n!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+qn(""+n)+'"][type="radio"]'),n=0;n<s.length;n++){var c=s[n];if(c!==t&&c.form===t.form){var m=c[fn]||null;if(!m)throw Error(l(90));qu(c,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(n=0;n<s.length;n++)c=s[n],c.form===t.form&&m0(c)}break e;case"textarea":x0(t,s.value,s.defaultValue);break e;case"select":n=s.value,n!=null&&Lr(t,!!s.multiple,n,!1)}}}var Gu=!1;function w0(t,n,s){if(Gu)return t(n,s);Gu=!0;try{var c=t(n);return c}finally{if(Gu=!1,(Ur!==null||Ir!==null)&&(mc(),Ur&&(n=Ur,t=Ir,Ir=Ur=null,v0(n),t)))for(n=0;n<t.length;n++)v0(t[n])}}function es(t,n){var s=t.stateNode;if(s===null)return null;var c=s[fn]||null;if(c===null)return null;s=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(l(231,n,typeof s));return s}var La=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yu=!1;if(La)try{var ts={};Object.defineProperty(ts,"passive",{get:function(){Yu=!0}}),window.addEventListener("test",ts,ts),window.removeEventListener("test",ts,ts)}catch{Yu=!1}var ui=null,Qu=null,Eo=null;function j0(){if(Eo)return Eo;var t,n=Qu,s=n.length,c,m="value"in ui?ui.value:ui.textContent,x=m.length;for(t=0;t<s&&n[t]===m[t];t++);var w=s-t;for(c=1;c<=w&&n[s-c]===m[x-c];c++);return Eo=m.slice(t,1<c?1-c:void 0)}function To(t){var n=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&n===13&&(t=13)):t=n,t===10&&(t=13),32<=t||t===13?t:0}function Ao(){return!0}function z0(){return!1}function hn(t){function n(s,c,m,x,w){this._reactName=s,this._targetInst=m,this.type=c,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var S in t)t.hasOwnProperty(S)&&(s=t[S],this[S]=s?s(x):x[S]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Ao:z0,this.isPropagationStopped=z0,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=Ao)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=Ao)},persist:function(){},isPersistent:Ao}),n}var Ji={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mo=hn(Ji),ns=b({},Ji,{view:0,detail:0}),T2=hn(ns),Xu,Ju,as,Do=b({},ns,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ku,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==as&&(as&&t.type==="mousemove"?(Xu=t.screenX-as.screenX,Ju=t.screenY-as.screenY):Ju=Xu=0,as=t),Xu)},movementY:function(t){return"movementY"in t?t.movementY:Ju}}),k0=hn(Do),A2=b({},Do,{dataTransfer:0}),M2=hn(A2),D2=b({},ns,{relatedTarget:0}),Zu=hn(D2),O2=b({},Ji,{animationName:0,elapsedTime:0,pseudoElement:0}),R2=hn(O2),_2=b({},Ji,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),L2=hn(_2),B2=b({},Ji,{data:0}),N0=hn(B2),U2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},I2={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"},H2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function q2(t){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(t):(t=H2[t])?!!n[t]:!1}function Ku(){return q2}var F2=b({},ns,{key:function(t){if(t.key){var n=U2[t.key]||t.key;if(n!=="Unidentified")return n}return t.type==="keypress"?(t=To(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?I2[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ku,charCode:function(t){return t.type==="keypress"?To(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?To(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),P2=hn(F2),$2=b({},Do,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),S0=hn($2),V2=b({},ns,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ku}),G2=hn(V2),Y2=b({},Ji,{propertyName:0,elapsedTime:0,pseudoElement:0}),Q2=hn(Y2),X2=b({},Do,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),J2=hn(X2),Z2=b({},Ji,{newState:0,oldState:0}),K2=hn(Z2),W2=[9,13,27,32],Wu=La&&"CompositionEvent"in window,is=null;La&&"documentMode"in document&&(is=document.documentMode);var ew=La&&"TextEvent"in window&&!is,C0=La&&(!Wu||is&&8<is&&11>=is),E0=" ",T0=!1;function A0(t,n){switch(t){case"keyup":return W2.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function M0(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Hr=!1;function tw(t,n){switch(t){case"compositionend":return M0(n);case"keypress":return n.which!==32?null:(T0=!0,E0);case"textInput":return t=n.data,t===E0&&T0?null:t;default:return null}}function nw(t,n){if(Hr)return t==="compositionend"||!Wu&&A0(t,n)?(t=j0(),Eo=Qu=ui=null,Hr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return C0&&n.locale!=="ko"?null:n.data;default:return null}}var aw={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 D0(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n==="input"?!!aw[t.type]:n==="textarea"}function O0(t,n,s,c){Ur?Ir?Ir.push(c):Ir=[c]:Ur=c,n=wc(n,"onChange"),0<n.length&&(s=new Mo("onChange","change",null,s,c),t.push({event:s,listeners:n}))}var rs=null,ls=null;function iw(t){pg(t,0)}function Oo(t){var n=Wl(t);if(m0(n))return t}function R0(t,n){if(t==="change")return n}var _0=!1;if(La){var ed;if(La){var td="oninput"in document;if(!td){var L0=document.createElement("div");L0.setAttribute("oninput","return;"),td=typeof L0.oninput=="function"}ed=td}else ed=!1;_0=ed&&(!document.documentMode||9<document.documentMode)}function B0(){rs&&(rs.detachEvent("onpropertychange",U0),ls=rs=null)}function U0(t){if(t.propertyName==="value"&&Oo(ls)){var n=[];O0(n,ls,t,Vu(t)),w0(iw,n)}}function rw(t,n,s){t==="focusin"?(B0(),rs=n,ls=s,rs.attachEvent("onpropertychange",U0)):t==="focusout"&&B0()}function lw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Oo(ls)}function sw(t,n){if(t==="click")return Oo(n)}function ow(t,n){if(t==="input"||t==="change")return Oo(n)}function cw(t,n){return t===n&&(t!==0||1/t===1/n)||t!==t&&n!==n}var Sn=typeof Object.is=="function"?Object.is:cw;function ss(t,n){if(Sn(t,n))return!0;if(typeof t!="object"||t===null||typeof n!="object"||n===null)return!1;var s=Object.keys(t),c=Object.keys(n);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var m=s[c];if(!ve.call(n,m)||!Sn(t[m],n[m]))return!1}return!0}function I0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function H0(t,n){var s=I0(t);t=0;for(var c;s;){if(s.nodeType===3){if(c=t+s.textContent.length,t<=n&&c>=n)return{node:s,offset:n-t};t=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=I0(s)}}function q0(t,n){return t&&n?t===n?!0:t&&t.nodeType===3?!1:n&&n.nodeType===3?q0(t,n.parentNode):"contains"in t?t.contains(n):t.compareDocumentPosition?!!(t.compareDocumentPosition(n)&16):!1:!1}function F0(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var n=So(t.document);n instanceof t.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)t=n.contentWindow;else break;n=So(t.document)}return n}function nd(t){var n=t&&t.nodeName&&t.nodeName.toLowerCase();return n&&(n==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||n==="textarea"||t.contentEditable==="true")}var uw=La&&"documentMode"in document&&11>=document.documentMode,qr=null,ad=null,os=null,id=!1;function P0(t,n,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;id||qr==null||qr!==So(c)||(c=qr,"selectionStart"in c&&nd(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),os&&ss(os,c)||(os=c,c=wc(ad,"onSelect"),0<c.length&&(n=new Mo("onSelect","select",null,n,s),t.push({event:n,listeners:c}),n.target=qr)))}function Zi(t,n){var s={};return s[t.toLowerCase()]=n.toLowerCase(),s["Webkit"+t]="webkit"+n,s["Moz"+t]="moz"+n,s}var Fr={animationend:Zi("Animation","AnimationEnd"),animationiteration:Zi("Animation","AnimationIteration"),animationstart:Zi("Animation","AnimationStart"),transitionrun:Zi("Transition","TransitionRun"),transitionstart:Zi("Transition","TransitionStart"),transitioncancel:Zi("Transition","TransitionCancel"),transitionend:Zi("Transition","TransitionEnd")},rd={},$0={};La&&($0=document.createElement("div").style,"AnimationEvent"in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),"TransitionEvent"in window||delete Fr.transitionend.transition);function Ki(t){if(rd[t])return rd[t];if(!Fr[t])return t;var n=Fr[t],s;for(s in n)if(n.hasOwnProperty(s)&&s in $0)return rd[t]=n[s];return t}var V0=Ki("animationend"),G0=Ki("animationiteration"),Y0=Ki("animationstart"),dw=Ki("transitionrun"),fw=Ki("transitionstart"),hw=Ki("transitioncancel"),Q0=Ki("transitionend"),X0=new Map,ld="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(" ");ld.push("scrollEnd");function aa(t,n){X0.set(t,n),Xi(n,[t])}var Ro=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Fn=[],Pr=0,sd=0;function _o(){for(var t=Pr,n=sd=Pr=0;n<t;){var s=Fn[n];Fn[n++]=null;var c=Fn[n];Fn[n++]=null;var m=Fn[n];Fn[n++]=null;var x=Fn[n];if(Fn[n++]=null,c!==null&&m!==null){var w=c.pending;w===null?m.next=m:(m.next=w.next,w.next=m),c.pending=m}x!==0&&J0(s,m,x)}}function Lo(t,n,s,c){Fn[Pr++]=t,Fn[Pr++]=n,Fn[Pr++]=s,Fn[Pr++]=c,sd|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function od(t,n,s,c){return Lo(t,n,s,c),Bo(t)}function Wi(t,n){return Lo(t,null,null,n),Bo(t)}function J0(t,n,s){t.lanes|=s;var c=t.alternate;c!==null&&(c.lanes|=s);for(var m=!1,x=t.return;x!==null;)x.childLanes|=s,c=x.alternate,c!==null&&(c.childLanes|=s),x.tag===22&&(t=x.stateNode,t===null||t._visibility&1||(m=!0)),t=x,x=x.return;return t.tag===3?(x=t.stateNode,m&&n!==null&&(m=31-Qe(s),t=x.hiddenUpdates,c=t[m],c===null?t[m]=[n]:c.push(n),n.lane=s|536870912),x):null}function Bo(t){if(50<As)throw As=0,bf=null,Error(l(185));for(var n=t.return;n!==null;)t=n,n=t.return;return t.tag===3?t.stateNode:null}var $r={};function mw(t,n,s,c){this.tag=t,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cn(t,n,s,c){return new mw(t,n,s,c)}function cd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ba(t,n){var s=t.alternate;return s===null?(s=Cn(t.tag,n,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=n,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,n=t.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function Z0(t,n){t.flags&=65011714;var s=t.alternate;return s===null?(t.childLanes=0,t.lanes=n,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,n=s.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t}function Uo(t,n,s,c,m,x){var w=0;if(c=t,typeof t=="function")cd(t)&&(w=1);else if(typeof t=="string")w=yj(t,s,F.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case ee:return t=Cn(31,s,n,m),t.elementType=ee,t.lanes=x,t;case z:return er(s.children,m,x,n);case j:w=8,m|=24;break;case N:return t=Cn(12,s,n,m|2),t.elementType=N,t.lanes=x,t;case Y:return t=Cn(13,s,n,m),t.elementType=Y,t.lanes=x,t;case A:return t=Cn(19,s,n,m),t.elementType=A,t.lanes=x,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case E:w=10;break e;case D:w=9;break e;case L:w=11;break e;case H:w=14;break e;case ae:w=16,c=null;break e}w=29,s=Error(l(130,t===null?"null":typeof t,"")),c=null}return n=Cn(w,s,n,m),n.elementType=t,n.type=c,n.lanes=x,n}function er(t,n,s,c){return t=Cn(7,t,c,n),t.lanes=s,t}function ud(t,n,s){return t=Cn(6,t,null,n),t.lanes=s,t}function K0(t){var n=Cn(18,null,null,0);return n.stateNode=t,n}function dd(t,n,s){return n=Cn(4,t.children!==null?t.children:[],t.key,n),n.lanes=s,n.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},n}var W0=new WeakMap;function Pn(t,n){if(typeof t=="object"&&t!==null){var s=W0.get(t);return s!==void 0?s:(n={value:t,source:n,stack:xe(n)},W0.set(t,n),n)}return{value:t,source:n,stack:xe(n)}}var Vr=[],Gr=0,Io=null,cs=0,$n=[],Vn=0,di=null,wa=1,ja="";function Ua(t,n){Vr[Gr++]=cs,Vr[Gr++]=Io,Io=t,cs=n}function ep(t,n,s){$n[Vn++]=wa,$n[Vn++]=ja,$n[Vn++]=di,di=t;var c=wa;t=ja;var m=32-Qe(c)-1;c&=~(1<<m),s+=1;var x=32-Qe(n)+m;if(30<x){var w=m-m%5;x=(c&(1<<w)-1).toString(32),c>>=w,m-=w,wa=1<<32-Qe(n)+m|s<<m|c,ja=x+t}else wa=1<<x|s<<m|c,ja=t}function fd(t){t.return!==null&&(Ua(t,1),ep(t,1,0))}function hd(t){for(;t===Io;)Io=Vr[--Gr],Vr[Gr]=null,cs=Vr[--Gr],Vr[Gr]=null;for(;t===di;)di=$n[--Vn],$n[Vn]=null,ja=$n[--Vn],$n[Vn]=null,wa=$n[--Vn],$n[Vn]=null}function tp(t,n){$n[Vn++]=wa,$n[Vn++]=ja,$n[Vn++]=di,wa=n.id,ja=n.overflow,di=t}var Pt=null,mt=null,Ge=!1,fi=null,Gn=!1,md=Error(l(519));function hi(t){var n=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw us(Pn(n,t)),md}function np(t){var n=t.stateNode,s=t.type,c=t.memoizedProps;switch(n[Ft]=t,n[fn]=c,s){case"dialog":qe("cancel",n),qe("close",n);break;case"iframe":case"object":case"embed":qe("load",n);break;case"video":case"audio":for(s=0;s<Ds.length;s++)qe(Ds[s],n);break;case"source":qe("error",n);break;case"img":case"image":case"link":qe("error",n),qe("load",n);break;case"details":qe("toggle",n);break;case"input":qe("invalid",n),p0(n,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":qe("invalid",n);break;case"textarea":qe("invalid",n),g0(n,c.value,c.defaultValue,c.children)}s=c.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||n.textContent===""+s||c.suppressHydrationWarning===!0||yg(n.textContent,s)?(c.popover!=null&&(qe("beforetoggle",n),qe("toggle",n)),c.onScroll!=null&&qe("scroll",n),c.onScrollEnd!=null&&qe("scrollend",n),c.onClick!=null&&(n.onclick=_a),n=!0):n=!1,n||hi(t,!0)}function ap(t){for(Pt=t.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:Gn=!1;return;case 27:case 3:Gn=!0;return;default:Pt=Pt.return}}function Yr(t){if(t!==Pt)return!1;if(!Ge)return ap(t),Ge=!0,!1;var n=t.tag,s;if((s=n!==3&&n!==27)&&((s=n===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||Of(t.type,t.memoizedProps)),s=!s),s&&mt&&hi(t),ap(t),n===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));mt=Eg(t)}else if(n===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));mt=Eg(t)}else n===27?(n=mt,Ci(t.type)?(t=Uf,Uf=null,mt=t):mt=n):mt=Pt?Qn(t.stateNode.nextSibling):null;return!0}function tr(){mt=Pt=null,Ge=!1}function pd(){var t=fi;return t!==null&&(gn===null?gn=t:gn.push.apply(gn,t),fi=null),t}function us(t){fi===null?fi=[t]:fi.push(t)}var xd=R(null),nr=null,Ia=null;function mi(t,n,s){T(xd,n._currentValue),n._currentValue=s}function Ha(t){t._currentValue=xd.current,P(xd)}function gd(t,n,s){for(;t!==null;){var c=t.alternate;if((t.childLanes&n)!==n?(t.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),t===s)break;t=t.return}}function bd(t,n,s,c){var m=t.child;for(m!==null&&(m.return=t);m!==null;){var x=m.dependencies;if(x!==null){var w=m.child;x=x.firstContext;e:for(;x!==null;){var S=x;x=m;for(var _=0;_<n.length;_++)if(S.context===n[_]){x.lanes|=s,S=x.alternate,S!==null&&(S.lanes|=s),gd(x.return,s,t),c||(w=null);break e}x=S.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(l(341));w.lanes|=s,x=w.alternate,x!==null&&(x.lanes|=s),gd(w,s,t),w=null}else w=m.child;if(w!==null)w.return=m;else for(w=m;w!==null;){if(w===t){w=null;break}if(m=w.sibling,m!==null){m.return=w.return,w=m;break}w=w.return}m=w}}function Qr(t,n,s,c){t=null;for(var m=n,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var w=m.alternate;if(w===null)throw Error(l(387));if(w=w.memoizedProps,w!==null){var S=m.type;Sn(m.pendingProps.value,w.value)||(t!==null?t.push(S):t=[S])}}else if(m===Z.current){if(w=m.alternate,w===null)throw Error(l(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(t!==null?t.push(Bs):t=[Bs])}m=m.return}t!==null&&bd(n,t,s,c),n.flags|=262144}function Ho(t){for(t=t.firstContext;t!==null;){if(!Sn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function ar(t){nr=t,Ia=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function $t(t){return ip(nr,t)}function qo(t,n){return nr===null&&ar(t),ip(t,n)}function ip(t,n){var s=n._currentValue;if(n={context:n,memoizedValue:s,next:null},Ia===null){if(t===null)throw Error(l(308));Ia=n,t.dependencies={lanes:0,firstContext:n},t.flags|=524288}else Ia=Ia.next=n;return s}var pw=typeof AbortController<"u"?AbortController:function(){var t=[],n=this.signal={aborted:!1,addEventListener:function(s,c){t.push(c)}};this.abort=function(){n.aborted=!0,t.forEach(function(s){return s()})}},xw=e.unstable_scheduleCallback,gw=e.unstable_NormalPriority,St={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function yd(){return{controller:new pw,data:new Map,refCount:0}}function ds(t){t.refCount--,t.refCount===0&&xw(gw,function(){t.controller.abort()})}var fs=null,vd=0,Xr=0,Jr=null;function bw(t,n){if(fs===null){var s=fs=[];vd=0,Xr=kf(),Jr={status:"pending",value:void 0,then:function(c){s.push(c)}}}return vd++,n.then(rp,rp),n}function rp(){if(--vd===0&&fs!==null){Jr!==null&&(Jr.status="fulfilled");var t=fs;fs=null,Xr=0,Jr=null;for(var n=0;n<t.length;n++)(0,t[n])()}}function yw(t,n){var s=[],c={status:"pending",value:null,reason:null,then:function(m){s.push(m)}};return t.then(function(){c.status="fulfilled",c.value=n;for(var m=0;m<s.length;m++)(0,s[m])(n)},function(m){for(c.status="rejected",c.reason=m,m=0;m<s.length;m++)(0,s[m])(void 0)}),c}var lp=B.S;B.S=function(t,n){Px=et(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&bw(t,n),lp!==null&&lp(t,n)};var ir=R(null);function wd(){var t=ir.current;return t!==null?t:ut.pooledCache}function Fo(t,n){n===null?T(ir,ir.current):T(ir,n.pool)}function sp(){var t=wd();return t===null?null:{parent:St._currentValue,pool:t}}var Zr=Error(l(460)),jd=Error(l(474)),Po=Error(l(542)),$o={then:function(){}};function op(t){return t=t.status,t==="fulfilled"||t==="rejected"}function cp(t,n,s){switch(s=t[s],s===void 0?t.push(n):s!==n&&(n.then(_a,_a),n=s),n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,dp(t),t;default:if(typeof n.status=="string")n.then(_a,_a);else{if(t=ut,t!==null&&100<t.shellSuspendCounter)throw Error(l(482));t=n,t.status="pending",t.then(function(c){if(n.status==="pending"){var m=n;m.status="fulfilled",m.value=c}},function(c){if(n.status==="pending"){var m=n;m.status="rejected",m.reason=c}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw t=n.reason,dp(t),t}throw lr=n,Zr}}function rr(t){try{var n=t._init;return n(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(lr=s,Zr):s}}var lr=null;function up(){if(lr===null)throw Error(l(459));var t=lr;return lr=null,t}function dp(t){if(t===Zr||t===Po)throw Error(l(483))}var Kr=null,hs=0;function Vo(t){var n=hs;return hs+=1,Kr===null&&(Kr=[]),cp(Kr,t,n)}function ms(t,n){n=n.props.ref,t.ref=n!==void 0?n:null}function Go(t,n){throw n.$$typeof===v?Error(l(525)):(t=Object.prototype.toString.call(n),Error(l(31,t==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":t)))}function fp(t){function n(q,I){if(t){var G=q.deletions;G===null?(q.deletions=[I],q.flags|=16):G.push(I)}}function s(q,I){if(!t)return null;for(;I!==null;)n(q,I),I=I.sibling;return null}function c(q){for(var I=new Map;q!==null;)q.key!==null?I.set(q.key,q):I.set(q.index,q),q=q.sibling;return I}function m(q,I){return q=Ba(q,I),q.index=0,q.sibling=null,q}function x(q,I,G){return q.index=G,t?(G=q.alternate,G!==null?(G=G.index,G<I?(q.flags|=67108866,I):G):(q.flags|=67108866,I)):(q.flags|=1048576,I)}function w(q){return t&&q.alternate===null&&(q.flags|=67108866),q}function S(q,I,G,le){return I===null||I.tag!==6?(I=ud(G,q.mode,le),I.return=q,I):(I=m(I,G),I.return=q,I)}function _(q,I,G,le){var ke=G.type;return ke===z?ne(q,I,G.props.children,le,G.key):I!==null&&(I.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===ae&&rr(ke)===I.type)?(I=m(I,G.props),ms(I,G),I.return=q,I):(I=Uo(G.type,G.key,G.props,null,q.mode,le),ms(I,G),I.return=q,I)}function Q(q,I,G,le){return I===null||I.tag!==4||I.stateNode.containerInfo!==G.containerInfo||I.stateNode.implementation!==G.implementation?(I=dd(G,q.mode,le),I.return=q,I):(I=m(I,G.children||[]),I.return=q,I)}function ne(q,I,G,le,ke){return I===null||I.tag!==7?(I=er(G,q.mode,le,ke),I.return=q,I):(I=m(I,G),I.return=q,I)}function se(q,I,G){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return I=ud(""+I,q.mode,G),I.return=q,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case y:return G=Uo(I.type,I.key,I.props,null,q.mode,G),ms(G,I),G.return=q,G;case k:return I=dd(I,q.mode,G),I.return=q,I;case ae:return I=rr(I),se(q,I,G)}if(te(I)||$(I))return I=er(I,q.mode,G,null),I.return=q,I;if(typeof I.then=="function")return se(q,Vo(I),G);if(I.$$typeof===E)return se(q,qo(q,I),G);Go(q,I)}return null}function J(q,I,G,le){var ke=I!==null?I.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return ke!==null?null:S(q,I,""+G,le);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case y:return G.key===ke?_(q,I,G,le):null;case k:return G.key===ke?Q(q,I,G,le):null;case ae:return G=rr(G),J(q,I,G,le)}if(te(G)||$(G))return ke!==null?null:ne(q,I,G,le,null);if(typeof G.then=="function")return J(q,I,Vo(G),le);if(G.$$typeof===E)return J(q,I,qo(q,G),le);Go(q,G)}return null}function W(q,I,G,le,ke){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return q=q.get(G)||null,S(I,q,""+le,ke);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case y:return q=q.get(le.key===null?G:le.key)||null,_(I,q,le,ke);case k:return q=q.get(le.key===null?G:le.key)||null,Q(I,q,le,ke);case ae:return le=rr(le),W(q,I,G,le,ke)}if(te(le)||$(le))return q=q.get(G)||null,ne(I,q,le,ke,null);if(typeof le.then=="function")return W(q,I,G,Vo(le),ke);if(le.$$typeof===E)return W(q,I,G,qo(I,le),ke);Go(I,le)}return null}function we(q,I,G,le){for(var ke=null,Ze=null,je=I,Re=I=0,$e=null;je!==null&&Re<G.length;Re++){je.index>Re?($e=je,je=null):$e=je.sibling;var Ke=J(q,je,G[Re],le);if(Ke===null){je===null&&(je=$e);break}t&&je&&Ke.alternate===null&&n(q,je),I=x(Ke,I,Re),Ze===null?ke=Ke:Ze.sibling=Ke,Ze=Ke,je=$e}if(Re===G.length)return s(q,je),Ge&&Ua(q,Re),ke;if(je===null){for(;Re<G.length;Re++)je=se(q,G[Re],le),je!==null&&(I=x(je,I,Re),Ze===null?ke=je:Ze.sibling=je,Ze=je);return Ge&&Ua(q,Re),ke}for(je=c(je);Re<G.length;Re++)$e=W(je,q,Re,G[Re],le),$e!==null&&(t&&$e.alternate!==null&&je.delete($e.key===null?Re:$e.key),I=x($e,I,Re),Ze===null?ke=$e:Ze.sibling=$e,Ze=$e);return t&&je.forEach(function(Di){return n(q,Di)}),Ge&&Ua(q,Re),ke}function Ce(q,I,G,le){if(G==null)throw Error(l(151));for(var ke=null,Ze=null,je=I,Re=I=0,$e=null,Ke=G.next();je!==null&&!Ke.done;Re++,Ke=G.next()){je.index>Re?($e=je,je=null):$e=je.sibling;var Di=J(q,je,Ke.value,le);if(Di===null){je===null&&(je=$e);break}t&&je&&Di.alternate===null&&n(q,je),I=x(Di,I,Re),Ze===null?ke=Di:Ze.sibling=Di,Ze=Di,je=$e}if(Ke.done)return s(q,je),Ge&&Ua(q,Re),ke;if(je===null){for(;!Ke.done;Re++,Ke=G.next())Ke=se(q,Ke.value,le),Ke!==null&&(I=x(Ke,I,Re),Ze===null?ke=Ke:Ze.sibling=Ke,Ze=Ke);return Ge&&Ua(q,Re),ke}for(je=c(je);!Ke.done;Re++,Ke=G.next())Ke=W(je,q,Re,Ke.value,le),Ke!==null&&(t&&Ke.alternate!==null&&je.delete(Ke.key===null?Re:Ke.key),I=x(Ke,I,Re),Ze===null?ke=Ke:Ze.sibling=Ke,Ze=Ke);return t&&je.forEach(function(Aj){return n(q,Aj)}),Ge&&Ua(q,Re),ke}function st(q,I,G,le){if(typeof G=="object"&&G!==null&&G.type===z&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case y:e:{for(var ke=G.key;I!==null;){if(I.key===ke){if(ke=G.type,ke===z){if(I.tag===7){s(q,I.sibling),le=m(I,G.props.children),le.return=q,q=le;break e}}else if(I.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===ae&&rr(ke)===I.type){s(q,I.sibling),le=m(I,G.props),ms(le,G),le.return=q,q=le;break e}s(q,I);break}else n(q,I);I=I.sibling}G.type===z?(le=er(G.props.children,q.mode,le,G.key),le.return=q,q=le):(le=Uo(G.type,G.key,G.props,null,q.mode,le),ms(le,G),le.return=q,q=le)}return w(q);case k:e:{for(ke=G.key;I!==null;){if(I.key===ke)if(I.tag===4&&I.stateNode.containerInfo===G.containerInfo&&I.stateNode.implementation===G.implementation){s(q,I.sibling),le=m(I,G.children||[]),le.return=q,q=le;break e}else{s(q,I);break}else n(q,I);I=I.sibling}le=dd(G,q.mode,le),le.return=q,q=le}return w(q);case ae:return G=rr(G),st(q,I,G,le)}if(te(G))return we(q,I,G,le);if($(G)){if(ke=$(G),typeof ke!="function")throw Error(l(150));return G=ke.call(G),Ce(q,I,G,le)}if(typeof G.then=="function")return st(q,I,Vo(G),le);if(G.$$typeof===E)return st(q,I,qo(q,G),le);Go(q,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,I!==null&&I.tag===6?(s(q,I.sibling),le=m(I,G),le.return=q,q=le):(s(q,I),le=ud(G,q.mode,le),le.return=q,q=le),w(q)):s(q,I)}return function(q,I,G,le){try{hs=0;var ke=st(q,I,G,le);return Kr=null,ke}catch(je){if(je===Zr||je===Po)throw je;var Ze=Cn(29,je,null,q.mode);return Ze.lanes=le,Ze.return=q,Ze}finally{}}}var sr=fp(!0),hp=fp(!1),pi=!1;function zd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function kd(t,n){t=t.updateQueue,n.updateQueue===t&&(n.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function xi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function gi(t,n,s){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(We&2)!==0){var m=c.pending;return m===null?n.next=n:(n.next=m.next,m.next=n),c.pending=n,n=Bo(t),J0(t,null,s),n}return Lo(t,c,n,s),Bo(t)}function ps(t,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194048)!==0)){var c=n.lanes;c&=t.pendingLanes,s|=c,n.lanes=s,dn(t,s)}}function Nd(t,n){var s=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var m=null,x=null;if(s=s.firstBaseUpdate,s!==null){do{var w={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};x===null?m=x=w:x=x.next=w,s=s.next}while(s!==null);x===null?m=x=n:x=x.next=n}else m=x=n;s={baseState:c.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:c.shared,callbacks:c.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=n:t.next=n,s.lastBaseUpdate=n}var Sd=!1;function xs(){if(Sd){var t=Jr;if(t!==null)throw t}}function gs(t,n,s,c){Sd=!1;var m=t.updateQueue;pi=!1;var x=m.firstBaseUpdate,w=m.lastBaseUpdate,S=m.shared.pending;if(S!==null){m.shared.pending=null;var _=S,Q=_.next;_.next=null,w===null?x=Q:w.next=Q,w=_;var ne=t.alternate;ne!==null&&(ne=ne.updateQueue,S=ne.lastBaseUpdate,S!==w&&(S===null?ne.firstBaseUpdate=Q:S.next=Q,ne.lastBaseUpdate=_))}if(x!==null){var se=m.baseState;w=0,ne=Q=_=null,S=x;do{var J=S.lane&-536870913,W=J!==S.lane;if(W?(Pe&J)===J:(c&J)===J){J!==0&&J===Xr&&(Sd=!0),ne!==null&&(ne=ne.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var we=t,Ce=S;J=n;var st=s;switch(Ce.tag){case 1:if(we=Ce.payload,typeof we=="function"){se=we.call(st,se,J);break e}se=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ce.payload,J=typeof we=="function"?we.call(st,se,J):we,J==null)break e;se=b({},se,J);break e;case 2:pi=!0}}J=S.callback,J!==null&&(t.flags|=64,W&&(t.flags|=8192),W=m.callbacks,W===null?m.callbacks=[J]:W.push(J))}else W={lane:J,tag:S.tag,payload:S.payload,callback:S.callback,next:null},ne===null?(Q=ne=W,_=se):ne=ne.next=W,w|=J;if(S=S.next,S===null){if(S=m.shared.pending,S===null)break;W=S,S=W.next,W.next=null,m.lastBaseUpdate=W,m.shared.pending=null}}while(!0);ne===null&&(_=se),m.baseState=_,m.firstBaseUpdate=Q,m.lastBaseUpdate=ne,x===null&&(m.shared.lanes=0),ji|=w,t.lanes=w,t.memoizedState=se}}function mp(t,n){if(typeof t!="function")throw Error(l(191,t));t.call(n)}function pp(t,n){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)mp(s[t],n)}var Wr=R(null),Yo=R(0);function xp(t,n){t=Xa,T(Yo,t),T(Wr,n),Xa=t|n.baseLanes}function Cd(){T(Yo,Xa),T(Wr,Wr.current)}function Ed(){Xa=Yo.current,P(Wr),P(Yo)}var En=R(null),Yn=null;function bi(t){var n=t.alternate;T(zt,zt.current&1),T(En,t),Yn===null&&(n===null||Wr.current!==null||n.memoizedState!==null)&&(Yn=t)}function Td(t){T(zt,zt.current),T(En,t),Yn===null&&(Yn=t)}function gp(t){t.tag===22?(T(zt,zt.current),T(En,t),Yn===null&&(Yn=t)):yi()}function yi(){T(zt,zt.current),T(En,En.current)}function Tn(t){P(En),Yn===t&&(Yn=null),P(zt)}var zt=R(0);function Qo(t){for(var n=t;n!==null;){if(n.tag===13){var s=n.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Lf(s)||Bf(s)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var qa=0,Oe=null,rt=null,Ct=null,Xo=!1,el=!1,or=!1,Jo=0,bs=0,tl=null,vw=0;function vt(){throw Error(l(321))}function Ad(t,n){if(n===null)return!1;for(var s=0;s<n.length&&s<t.length;s++)if(!Sn(t[s],n[s]))return!1;return!0}function Md(t,n,s,c,m,x){return qa=x,Oe=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,B.H=t===null||t.memoizedState===null?ex:Gd,or=!1,x=s(c,m),or=!1,el&&(x=yp(n,s,c,m)),bp(t),x}function bp(t){B.H=ws;var n=rt!==null&&rt.next!==null;if(qa=0,Ct=rt=Oe=null,Xo=!1,bs=0,tl=null,n)throw Error(l(300));t===null||Et||(t=t.dependencies,t!==null&&Ho(t)&&(Et=!0))}function yp(t,n,s,c){Oe=t;var m=0;do{if(el&&(tl=null),bs=0,el=!1,25<=m)throw Error(l(301));if(m+=1,Ct=rt=null,t.updateQueue!=null){var x=t.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}B.H=tx,x=n(s,c)}while(el);return x}function ww(){var t=B.H,n=t.useState()[0];return n=typeof n.then=="function"?ys(n):n,t=t.useState()[0],(rt!==null?rt.memoizedState:null)!==t&&(Oe.flags|=1024),n}function Dd(){var t=Jo!==0;return Jo=0,t}function Od(t,n,s){n.updateQueue=t.updateQueue,n.flags&=-2053,t.lanes&=~s}function Rd(t){if(Xo){for(t=t.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}Xo=!1}qa=0,Ct=rt=Oe=null,el=!1,bs=Jo=0,tl=null}function ln(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?Oe.memoizedState=Ct=t:Ct=Ct.next=t,Ct}function kt(){if(rt===null){var t=Oe.alternate;t=t!==null?t.memoizedState:null}else t=rt.next;var n=Ct===null?Oe.memoizedState:Ct.next;if(n!==null)Ct=n,rt=t;else{if(t===null)throw Oe.alternate===null?Error(l(467)):Error(l(310));rt=t,t={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Ct===null?Oe.memoizedState=Ct=t:Ct=Ct.next=t}return Ct}function Zo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ys(t){var n=bs;return bs+=1,tl===null&&(tl=[]),t=cp(tl,t,n),n=Oe,(Ct===null?n.memoizedState:Ct.next)===null&&(n=n.alternate,B.H=n===null||n.memoizedState===null?ex:Gd),t}function Ko(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ys(t);if(t.$$typeof===E)return $t(t)}throw Error(l(438,String(t)))}function _d(t){var n=null,s=Oe.updateQueue;if(s!==null&&(n=s.memoCache),n==null){var c=Oe.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(n={data:c.data.map(function(m){return m.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),s===null&&(s=Zo(),Oe.updateQueue=s),s.memoCache=n,s=n.data[n.index],s===void 0)for(s=n.data[n.index]=Array(t),c=0;c<t;c++)s[c]=O;return n.index++,s}function Fa(t,n){return typeof n=="function"?n(t):n}function Wo(t){var n=kt();return Ld(n,rt,t)}function Ld(t,n,s){var c=t.queue;if(c===null)throw Error(l(311));c.lastRenderedReducer=s;var m=t.baseQueue,x=c.pending;if(x!==null){if(m!==null){var w=m.next;m.next=x.next,x.next=w}n.baseQueue=m=x,c.pending=null}if(x=t.baseState,m===null)t.memoizedState=x;else{n=m.next;var S=w=null,_=null,Q=n,ne=!1;do{var se=Q.lane&-536870913;if(se!==Q.lane?(Pe&se)===se:(qa&se)===se){var J=Q.revertLane;if(J===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),se===Xr&&(ne=!0);else if((qa&J)===J){Q=Q.next,J===Xr&&(ne=!0);continue}else se={lane:0,revertLane:Q.revertLane,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},_===null?(S=_=se,w=x):_=_.next=se,Oe.lanes|=J,ji|=J;se=Q.action,or&&s(x,se),x=Q.hasEagerState?Q.eagerState:s(x,se)}else J={lane:se,revertLane:Q.revertLane,gesture:Q.gesture,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},_===null?(S=_=J,w=x):_=_.next=J,Oe.lanes|=se,ji|=se;Q=Q.next}while(Q!==null&&Q!==n);if(_===null?w=x:_.next=S,!Sn(x,t.memoizedState)&&(Et=!0,ne&&(s=Jr,s!==null)))throw s;t.memoizedState=x,t.baseState=w,t.baseQueue=_,c.lastRenderedState=x}return m===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function Bd(t){var n=kt(),s=n.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=t;var c=s.dispatch,m=s.pending,x=n.memoizedState;if(m!==null){s.pending=null;var w=m=m.next;do x=t(x,w.action),w=w.next;while(w!==m);Sn(x,n.memoizedState)||(Et=!0),n.memoizedState=x,n.baseQueue===null&&(n.baseState=x),s.lastRenderedState=x}return[x,c]}function vp(t,n,s){var c=Oe,m=kt(),x=Ge;if(x){if(s===void 0)throw Error(l(407));s=s()}else s=n();var w=!Sn((rt||m).memoizedState,s);if(w&&(m.memoizedState=s,Et=!0),m=m.queue,Hd(zp.bind(null,c,m,t),[t]),m.getSnapshot!==n||w||Ct!==null&&Ct.memoizedState.tag&1){if(c.flags|=2048,nl(9,{destroy:void 0},jp.bind(null,c,m,s,n),null),ut===null)throw Error(l(349));x||(qa&127)!==0||wp(c,n,s)}return s}function wp(t,n,s){t.flags|=16384,t={getSnapshot:n,value:s},n=Oe.updateQueue,n===null?(n=Zo(),Oe.updateQueue=n,n.stores=[t]):(s=n.stores,s===null?n.stores=[t]:s.push(t))}function jp(t,n,s,c){n.value=s,n.getSnapshot=c,kp(n)&&Np(t)}function zp(t,n,s){return s(function(){kp(n)&&Np(t)})}function kp(t){var n=t.getSnapshot;t=t.value;try{var s=n();return!Sn(t,s)}catch{return!0}}function Np(t){var n=Wi(t,2);n!==null&&bn(n,t,2)}function Ud(t){var n=ln();if(typeof t=="function"){var s=t;if(t=s(),or){Ht(!0);try{s()}finally{Ht(!1)}}}return n.memoizedState=n.baseState=t,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:t},n}function Sp(t,n,s,c){return t.baseState=s,Ld(t,rt,typeof c=="function"?c:Fa)}function jw(t,n,s,c,m){if(nc(t))throw Error(l(485));if(t=n.action,t!==null){var x={payload:m,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};B.T!==null?s(!0):x.isTransition=!1,c(x),s=n.pending,s===null?(x.next=n.pending=x,Cp(n,x)):(x.next=s.next,n.pending=s.next=x)}}function Cp(t,n){var s=n.action,c=n.payload,m=t.state;if(n.isTransition){var x=B.T,w={};B.T=w;try{var S=s(m,c),_=B.S;_!==null&&_(w,S),Ep(t,n,S)}catch(Q){Id(t,n,Q)}finally{x!==null&&w.types!==null&&(x.types=w.types),B.T=x}}else try{x=s(m,c),Ep(t,n,x)}catch(Q){Id(t,n,Q)}}function Ep(t,n,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(c){Tp(t,n,c)},function(c){return Id(t,n,c)}):Tp(t,n,s)}function Tp(t,n,s){n.status="fulfilled",n.value=s,Ap(n),t.state=s,n=t.pending,n!==null&&(s=n.next,s===n?t.pending=null:(s=s.next,n.next=s,Cp(t,s)))}function Id(t,n,s){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do n.status="rejected",n.reason=s,Ap(n),n=n.next;while(n!==c)}t.action=null}function Ap(t){t=t.listeners;for(var n=0;n<t.length;n++)(0,t[n])()}function Mp(t,n){return n}function Dp(t,n){if(Ge){var s=ut.formState;if(s!==null){e:{var c=Oe;if(Ge){if(mt){t:{for(var m=mt,x=Gn;m.nodeType!==8;){if(!x){m=null;break t}if(m=Qn(m.nextSibling),m===null){m=null;break t}}x=m.data,m=x==="F!"||x==="F"?m:null}if(m){mt=Qn(m.nextSibling),c=m.data==="F!";break e}}hi(c)}c=!1}c&&(n=s[0])}}return s=ln(),s.memoizedState=s.baseState=n,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mp,lastRenderedState:n},s.queue=c,s=Zp.bind(null,Oe,c),c.dispatch=s,c=Ud(!1),x=Vd.bind(null,Oe,!1,c.queue),c=ln(),m={state:n,dispatch:null,action:t,pending:null},c.queue=m,s=jw.bind(null,Oe,m,x,s),m.dispatch=s,c.memoizedState=t,[n,s,!1]}function Op(t){var n=kt();return Rp(n,rt,t)}function Rp(t,n,s){if(n=Ld(t,n,Mp)[0],t=Wo(Fa)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var c=ys(n)}catch(w){throw w===Zr?Po:w}else c=n;n=kt();var m=n.queue,x=m.dispatch;return s!==n.memoizedState&&(Oe.flags|=2048,nl(9,{destroy:void 0},zw.bind(null,m,s),null)),[c,x,t]}function zw(t,n){t.action=n}function _p(t){var n=kt(),s=rt;if(s!==null)return Rp(n,s,t);kt(),n=n.memoizedState,s=kt();var c=s.queue.dispatch;return s.memoizedState=t,[n,c,!1]}function nl(t,n,s,c){return t={tag:t,create:s,deps:c,inst:n,next:null},n=Oe.updateQueue,n===null&&(n=Zo(),Oe.updateQueue=n),s=n.lastEffect,s===null?n.lastEffect=t.next=t:(c=s.next,s.next=t,t.next=c,n.lastEffect=t),t}function Lp(){return kt().memoizedState}function ec(t,n,s,c){var m=ln();Oe.flags|=t,m.memoizedState=nl(1|n,{destroy:void 0},s,c===void 0?null:c)}function tc(t,n,s,c){var m=kt();c=c===void 0?null:c;var x=m.memoizedState.inst;rt!==null&&c!==null&&Ad(c,rt.memoizedState.deps)?m.memoizedState=nl(n,x,s,c):(Oe.flags|=t,m.memoizedState=nl(1|n,x,s,c))}function Bp(t,n){ec(8390656,8,t,n)}function Hd(t,n){tc(2048,8,t,n)}function kw(t){Oe.flags|=4;var n=Oe.updateQueue;if(n===null)n=Zo(),Oe.updateQueue=n,n.events=[t];else{var s=n.events;s===null?n.events=[t]:s.push(t)}}function Up(t){var n=kt().memoizedState;return kw({ref:n,nextImpl:t}),function(){if((We&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}function Ip(t,n){return tc(4,2,t,n)}function Hp(t,n){return tc(4,4,t,n)}function qp(t,n){if(typeof n=="function"){t=t();var s=n(t);return function(){typeof s=="function"?s():n(null)}}if(n!=null)return t=t(),n.current=t,function(){n.current=null}}function Fp(t,n,s){s=s!=null?s.concat([t]):null,tc(4,4,qp.bind(null,n,t),s)}function qd(){}function Pp(t,n){var s=kt();n=n===void 0?null:n;var c=s.memoizedState;return n!==null&&Ad(n,c[1])?c[0]:(s.memoizedState=[t,n],t)}function $p(t,n){var s=kt();n=n===void 0?null:n;var c=s.memoizedState;if(n!==null&&Ad(n,c[1]))return c[0];if(c=t(),or){Ht(!0);try{t()}finally{Ht(!1)}}return s.memoizedState=[c,n],c}function Fd(t,n,s){return s===void 0||(qa&1073741824)!==0&&(Pe&261930)===0?t.memoizedState=n:(t.memoizedState=s,t=Vx(),Oe.lanes|=t,ji|=t,s)}function Vp(t,n,s,c){return Sn(s,n)?s:Wr.current!==null?(t=Fd(t,s,c),Sn(t,n)||(Et=!0),t):(qa&42)===0||(qa&1073741824)!==0&&(Pe&261930)===0?(Et=!0,t.memoizedState=s):(t=Vx(),Oe.lanes|=t,ji|=t,n)}function Gp(t,n,s,c,m){var x=X.p;X.p=x!==0&&8>x?x:8;var w=B.T,S={};B.T=S,Vd(t,!1,n,s);try{var _=m(),Q=B.S;if(Q!==null&&Q(S,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var ne=yw(_,c);vs(t,n,ne,Dn(t))}else vs(t,n,c,Dn(t))}catch(se){vs(t,n,{then:function(){},status:"rejected",reason:se},Dn())}finally{X.p=x,w!==null&&S.types!==null&&(w.types=S.types),B.T=w}}function Nw(){}function Pd(t,n,s,c){if(t.tag!==5)throw Error(l(476));var m=Yp(t).queue;Gp(t,m,n,ce,s===null?Nw:function(){return Qp(t),s(c)})}function Yp(t){var n=t.memoizedState;if(n!==null)return n;n={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:ce},next:null};var s={};return n.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fa,lastRenderedState:s},next:null},t.memoizedState=n,t=t.alternate,t!==null&&(t.memoizedState=n),n}function Qp(t){var n=Yp(t);n.next===null&&(n=t.alternate.memoizedState),vs(t,n.next.queue,{},Dn())}function $d(){return $t(Bs)}function Xp(){return kt().memoizedState}function Jp(){return kt().memoizedState}function Sw(t){for(var n=t.return;n!==null;){switch(n.tag){case 24:case 3:var s=Dn();t=xi(s);var c=gi(n,t,s);c!==null&&(bn(c,n,s),ps(c,n,s)),n={cache:yd()},t.payload=n;return}n=n.return}}function Cw(t,n,s){var c=Dn();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},nc(t)?Kp(n,s):(s=od(t,n,s,c),s!==null&&(bn(s,t,c),Wp(s,n,c)))}function Zp(t,n,s){var c=Dn();vs(t,n,s,c)}function vs(t,n,s,c){var m={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(nc(t))Kp(n,m);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=n.lastRenderedReducer,x!==null))try{var w=n.lastRenderedState,S=x(w,s);if(m.hasEagerState=!0,m.eagerState=S,Sn(S,w))return Lo(t,n,m,0),ut===null&&_o(),!1}catch{}finally{}if(s=od(t,n,m,c),s!==null)return bn(s,t,c),Wp(s,n,c),!0}return!1}function Vd(t,n,s,c){if(c={lane:2,revertLane:kf(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},nc(t)){if(n)throw Error(l(479))}else n=od(t,s,c,2),n!==null&&bn(n,t,2)}function nc(t){var n=t.alternate;return t===Oe||n!==null&&n===Oe}function Kp(t,n){el=Xo=!0;var s=t.pending;s===null?n.next=n:(n.next=s.next,s.next=n),t.pending=n}function Wp(t,n,s){if((s&4194048)!==0){var c=n.lanes;c&=t.pendingLanes,s|=c,n.lanes=s,dn(t,s)}}var ws={readContext:$t,use:Ko,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useLayoutEffect:vt,useInsertionEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useSyncExternalStore:vt,useId:vt,useHostTransitionStatus:vt,useFormState:vt,useActionState:vt,useOptimistic:vt,useMemoCache:vt,useCacheRefresh:vt};ws.useEffectEvent=vt;var ex={readContext:$t,use:Ko,useCallback:function(t,n){return ln().memoizedState=[t,n===void 0?null:n],t},useContext:$t,useEffect:Bp,useImperativeHandle:function(t,n,s){s=s!=null?s.concat([t]):null,ec(4194308,4,qp.bind(null,n,t),s)},useLayoutEffect:function(t,n){return ec(4194308,4,t,n)},useInsertionEffect:function(t,n){ec(4,2,t,n)},useMemo:function(t,n){var s=ln();n=n===void 0?null:n;var c=t();if(or){Ht(!0);try{t()}finally{Ht(!1)}}return s.memoizedState=[c,n],c},useReducer:function(t,n,s){var c=ln();if(s!==void 0){var m=s(n);if(or){Ht(!0);try{s(n)}finally{Ht(!1)}}}else m=n;return c.memoizedState=c.baseState=m,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:m},c.queue=t,t=t.dispatch=Cw.bind(null,Oe,t),[c.memoizedState,t]},useRef:function(t){var n=ln();return t={current:t},n.memoizedState=t},useState:function(t){t=Ud(t);var n=t.queue,s=Zp.bind(null,Oe,n);return n.dispatch=s,[t.memoizedState,s]},useDebugValue:qd,useDeferredValue:function(t,n){var s=ln();return Fd(s,t,n)},useTransition:function(){var t=Ud(!1);return t=Gp.bind(null,Oe,t.queue,!0,!1),ln().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,n,s){var c=Oe,m=ln();if(Ge){if(s===void 0)throw Error(l(407));s=s()}else{if(s=n(),ut===null)throw Error(l(349));(Pe&127)!==0||wp(c,n,s)}m.memoizedState=s;var x={value:s,getSnapshot:n};return m.queue=x,Bp(zp.bind(null,c,x,t),[t]),c.flags|=2048,nl(9,{destroy:void 0},jp.bind(null,c,x,s,n),null),s},useId:function(){var t=ln(),n=ut.identifierPrefix;if(Ge){var s=ja,c=wa;s=(c&~(1<<32-Qe(c)-1)).toString(32)+s,n="_"+n+"R_"+s,s=Jo++,0<s&&(n+="H"+s.toString(32)),n+="_"}else s=vw++,n="_"+n+"r_"+s.toString(32)+"_";return t.memoizedState=n},useHostTransitionStatus:$d,useFormState:Dp,useActionState:Dp,useOptimistic:function(t){var n=ln();n.memoizedState=n.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=s,n=Vd.bind(null,Oe,!0,s),s.dispatch=n,[t,n]},useMemoCache:_d,useCacheRefresh:function(){return ln().memoizedState=Sw.bind(null,Oe)},useEffectEvent:function(t){var n=ln(),s={impl:t};return n.memoizedState=s,function(){if((We&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},Gd={readContext:$t,use:Ko,useCallback:Pp,useContext:$t,useEffect:Hd,useImperativeHandle:Fp,useInsertionEffect:Ip,useLayoutEffect:Hp,useMemo:$p,useReducer:Wo,useRef:Lp,useState:function(){return Wo(Fa)},useDebugValue:qd,useDeferredValue:function(t,n){var s=kt();return Vp(s,rt.memoizedState,t,n)},useTransition:function(){var t=Wo(Fa)[0],n=kt().memoizedState;return[typeof t=="boolean"?t:ys(t),n]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:$d,useFormState:Op,useActionState:Op,useOptimistic:function(t,n){var s=kt();return Sp(s,rt,t,n)},useMemoCache:_d,useCacheRefresh:Jp};Gd.useEffectEvent=Up;var tx={readContext:$t,use:Ko,useCallback:Pp,useContext:$t,useEffect:Hd,useImperativeHandle:Fp,useInsertionEffect:Ip,useLayoutEffect:Hp,useMemo:$p,useReducer:Bd,useRef:Lp,useState:function(){return Bd(Fa)},useDebugValue:qd,useDeferredValue:function(t,n){var s=kt();return rt===null?Fd(s,t,n):Vp(s,rt.memoizedState,t,n)},useTransition:function(){var t=Bd(Fa)[0],n=kt().memoizedState;return[typeof t=="boolean"?t:ys(t),n]},useSyncExternalStore:vp,useId:Xp,useHostTransitionStatus:$d,useFormState:_p,useActionState:_p,useOptimistic:function(t,n){var s=kt();return rt!==null?Sp(s,rt,t,n):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:_d,useCacheRefresh:Jp};tx.useEffectEvent=Up;function Yd(t,n,s,c){n=t.memoizedState,s=s(c,n),s=s==null?n:b({},n,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Qd={enqueueSetState:function(t,n,s){t=t._reactInternals;var c=Dn(),m=xi(c);m.payload=n,s!=null&&(m.callback=s),n=gi(t,m,c),n!==null&&(bn(n,t,c),ps(n,t,c))},enqueueReplaceState:function(t,n,s){t=t._reactInternals;var c=Dn(),m=xi(c);m.tag=1,m.payload=n,s!=null&&(m.callback=s),n=gi(t,m,c),n!==null&&(bn(n,t,c),ps(n,t,c))},enqueueForceUpdate:function(t,n){t=t._reactInternals;var s=Dn(),c=xi(s);c.tag=2,n!=null&&(c.callback=n),n=gi(t,c,s),n!==null&&(bn(n,t,s),ps(n,t,s))}};function nx(t,n,s,c,m,x,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,x,w):n.prototype&&n.prototype.isPureReactComponent?!ss(s,c)||!ss(m,x):!0}function ax(t,n,s,c){t=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(s,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(s,c),n.state!==t&&Qd.enqueueReplaceState(n,n.state,null)}function cr(t,n){var s=n;if("ref"in n){s={};for(var c in n)c!=="ref"&&(s[c]=n[c])}if(t=t.defaultProps){s===n&&(s=b({},s));for(var m in t)s[m]===void 0&&(s[m]=t[m])}return s}function ix(t){Ro(t)}function rx(t){console.error(t)}function lx(t){Ro(t)}function ac(t,n){try{var s=t.onUncaughtError;s(n.value,{componentStack:n.stack})}catch(c){setTimeout(function(){throw c})}}function sx(t,n,s){try{var c=t.onCaughtError;c(s.value,{componentStack:s.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Xd(t,n,s){return s=xi(s),s.tag=3,s.payload={element:null},s.callback=function(){ac(t,n)},s}function ox(t){return t=xi(t),t.tag=3,t}function cx(t,n,s,c){var m=s.type.getDerivedStateFromError;if(typeof m=="function"){var x=c.value;t.payload=function(){return m(x)},t.callback=function(){sx(n,s,c)}}var w=s.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){sx(n,s,c),typeof m!="function"&&(zi===null?zi=new Set([this]):zi.add(this));var S=c.stack;this.componentDidCatch(c.value,{componentStack:S!==null?S:""})})}function Ew(t,n,s,c,m){if(s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(n=s.alternate,n!==null&&Qr(n,s,m,!0),s=En.current,s!==null){switch(s.tag){case 31:case 13:return Yn===null?pc():s.alternate===null&&wt===0&&(wt=3),s.flags&=-257,s.flags|=65536,s.lanes=m,c===$o?s.flags|=16384:(n=s.updateQueue,n===null?s.updateQueue=new Set([c]):n.add(c),wf(t,c,m)),!1;case 22:return s.flags|=65536,c===$o?s.flags|=16384:(n=s.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([c])},s.updateQueue=n):(s=n.retryQueue,s===null?n.retryQueue=new Set([c]):s.add(c)),wf(t,c,m)),!1}throw Error(l(435,s.tag))}return wf(t,c,m),pc(),!1}if(Ge)return n=En.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=m,c!==md&&(t=Error(l(422),{cause:c}),us(Pn(t,s)))):(c!==md&&(n=Error(l(423),{cause:c}),us(Pn(n,s))),t=t.current.alternate,t.flags|=65536,m&=-m,t.lanes|=m,c=Pn(c,s),m=Xd(t.stateNode,c,m),Nd(t,m),wt!==4&&(wt=2)),!1;var x=Error(l(520),{cause:c});if(x=Pn(x,s),Ts===null?Ts=[x]:Ts.push(x),wt!==4&&(wt=2),n===null)return!0;c=Pn(c,s),s=n;do{switch(s.tag){case 3:return s.flags|=65536,t=m&-m,s.lanes|=t,t=Xd(s.stateNode,c,t),Nd(s,t),!1;case 1:if(n=s.type,x=s.stateNode,(s.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(zi===null||!zi.has(x))))return s.flags|=65536,m&=-m,s.lanes|=m,m=ox(m),cx(m,t,s,c),Nd(s,m),!1}s=s.return}while(s!==null);return!1}var Jd=Error(l(461)),Et=!1;function Vt(t,n,s,c){n.child=t===null?hp(n,null,s,c):sr(n,t.child,s,c)}function ux(t,n,s,c,m){s=s.render;var x=n.ref;if("ref"in c){var w={};for(var S in c)S!=="ref"&&(w[S]=c[S])}else w=c;return ar(n),c=Md(t,n,s,w,x,m),S=Dd(),t!==null&&!Et?(Od(t,n,m),Pa(t,n,m)):(Ge&&S&&fd(n),n.flags|=1,Vt(t,n,c,m),n.child)}function dx(t,n,s,c,m){if(t===null){var x=s.type;return typeof x=="function"&&!cd(x)&&x.defaultProps===void 0&&s.compare===null?(n.tag=15,n.type=x,fx(t,n,x,c,m)):(t=Uo(s.type,null,c,n,n.mode,m),t.ref=n.ref,t.return=n,n.child=t)}if(x=t.child,!rf(t,m)){var w=x.memoizedProps;if(s=s.compare,s=s!==null?s:ss,s(w,c)&&t.ref===n.ref)return Pa(t,n,m)}return n.flags|=1,t=Ba(x,c),t.ref=n.ref,t.return=n,n.child=t}function fx(t,n,s,c,m){if(t!==null){var x=t.memoizedProps;if(ss(x,c)&&t.ref===n.ref)if(Et=!1,n.pendingProps=c=x,rf(t,m))(t.flags&131072)!==0&&(Et=!0);else return n.lanes=t.lanes,Pa(t,n,m)}return Zd(t,n,s,c,m)}function hx(t,n,s,c){var m=c.children,x=t!==null?t.memoizedState:null;if(t===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((n.flags&128)!==0){if(x=x!==null?x.baseLanes|s:s,t!==null){for(c=n.child=t.child,m=0;c!==null;)m=m|c.lanes|c.childLanes,c=c.sibling;c=m&~x}else c=0,n.child=null;return mx(t,n,x,s,c)}if((s&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},t!==null&&Fo(n,x!==null?x.cachePool:null),x!==null?xp(n,x):Cd(),gp(n);else return c=n.lanes=536870912,mx(t,n,x!==null?x.baseLanes|s:s,s,c)}else x!==null?(Fo(n,x.cachePool),xp(n,x),yi(),n.memoizedState=null):(t!==null&&Fo(n,null),Cd(),yi());return Vt(t,n,m,s),n.child}function js(t,n){return t!==null&&t.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function mx(t,n,s,c,m){var x=wd();return x=x===null?null:{parent:St._currentValue,pool:x},n.memoizedState={baseLanes:s,cachePool:x},t!==null&&Fo(n,null),Cd(),gp(n),t!==null&&Qr(t,n,c,!0),n.childLanes=m,null}function ic(t,n){return n=lc({mode:n.mode,children:n.children},t.mode),n.ref=t.ref,t.child=n,n.return=t,n}function px(t,n,s){return sr(n,t.child,null,s),t=ic(n,n.pendingProps),t.flags|=2,Tn(n),n.memoizedState=null,t}function Tw(t,n,s){var c=n.pendingProps,m=(n.flags&128)!==0;if(n.flags&=-129,t===null){if(Ge){if(c.mode==="hidden")return t=ic(n,c),n.lanes=536870912,js(null,t);if(Td(n),(t=mt)?(t=Cg(t,Gn),t=t!==null&&t.data==="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:di!==null?{id:wa,overflow:ja}:null,retryLane:536870912,hydrationErrors:null},s=K0(t),s.return=n,n.child=s,Pt=n,mt=null)):t=null,t===null)throw hi(n);return n.lanes=536870912,null}return ic(n,c)}var x=t.memoizedState;if(x!==null){var w=x.dehydrated;if(Td(n),m)if(n.flags&256)n.flags&=-257,n=px(t,n,s);else if(n.memoizedState!==null)n.child=t.child,n.flags|=128,n=null;else throw Error(l(558));else if(Et||Qr(t,n,s,!1),m=(s&t.childLanes)!==0,Et||m){if(c=ut,c!==null&&(w=na(c,s),w!==0&&w!==x.retryLane))throw x.retryLane=w,Wi(t,w),bn(c,t,w),Jd;pc(),n=px(t,n,s)}else t=x.treeContext,mt=Qn(w.nextSibling),Pt=n,Ge=!0,fi=null,Gn=!1,t!==null&&tp(n,t),n=ic(n,c),n.flags|=4096;return n}return t=Ba(t.child,{mode:c.mode,children:c.children}),t.ref=n.ref,n.child=t,t.return=n,t}function rc(t,n){var s=n.ref;if(s===null)t!==null&&t.ref!==null&&(n.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(l(284));(t===null||t.ref!==s)&&(n.flags|=4194816)}}function Zd(t,n,s,c,m){return ar(n),s=Md(t,n,s,c,void 0,m),c=Dd(),t!==null&&!Et?(Od(t,n,m),Pa(t,n,m)):(Ge&&c&&fd(n),n.flags|=1,Vt(t,n,s,m),n.child)}function xx(t,n,s,c,m,x){return ar(n),n.updateQueue=null,s=yp(n,c,s,m),bp(t),c=Dd(),t!==null&&!Et?(Od(t,n,x),Pa(t,n,x)):(Ge&&c&&fd(n),n.flags|=1,Vt(t,n,s,x),n.child)}function gx(t,n,s,c,m){if(ar(n),n.stateNode===null){var x=$r,w=s.contextType;typeof w=="object"&&w!==null&&(x=$t(w)),x=new s(c,x),n.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Qd,n.stateNode=x,x._reactInternals=n,x=n.stateNode,x.props=c,x.state=n.memoizedState,x.refs={},zd(n),w=s.contextType,x.context=typeof w=="object"&&w!==null?$t(w):$r,x.state=n.memoizedState,w=s.getDerivedStateFromProps,typeof w=="function"&&(Yd(n,s,w,c),x.state=n.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(w=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),w!==x.state&&Qd.enqueueReplaceState(x,x.state,null),gs(n,c,x,m),xs(),x.state=n.memoizedState),typeof x.componentDidMount=="function"&&(n.flags|=4194308),c=!0}else if(t===null){x=n.stateNode;var S=n.memoizedProps,_=cr(s,S);x.props=_;var Q=x.context,ne=s.contextType;w=$r,typeof ne=="object"&&ne!==null&&(w=$t(ne));var se=s.getDerivedStateFromProps;ne=typeof se=="function"||typeof x.getSnapshotBeforeUpdate=="function",S=n.pendingProps!==S,ne||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(S||Q!==w)&&ax(n,x,c,w),pi=!1;var J=n.memoizedState;x.state=J,gs(n,c,x,m),xs(),Q=n.memoizedState,S||J!==Q||pi?(typeof se=="function"&&(Yd(n,s,se,c),Q=n.memoizedState),(_=pi||nx(n,s,_,c,J,Q,w))?(ne||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(n.flags|=4194308)):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=Q),x.props=c,x.state=Q,x.context=w,c=_):(typeof x.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{x=n.stateNode,kd(t,n),w=n.memoizedProps,ne=cr(s,w),x.props=ne,se=n.pendingProps,J=x.context,Q=s.contextType,_=$r,typeof Q=="object"&&Q!==null&&(_=$t(Q)),S=s.getDerivedStateFromProps,(Q=typeof S=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==se||J!==_)&&ax(n,x,c,_),pi=!1,J=n.memoizedState,x.state=J,gs(n,c,x,m),xs();var W=n.memoizedState;w!==se||J!==W||pi||t!==null&&t.dependencies!==null&&Ho(t.dependencies)?(typeof S=="function"&&(Yd(n,s,S,c),W=n.memoizedState),(ne=pi||nx(n,s,ne,c,J,W,_)||t!==null&&t.dependencies!==null&&Ho(t.dependencies))?(Q||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(c,W,_),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(c,W,_)),typeof x.componentDidUpdate=="function"&&(n.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=W),x.props=c,x.state=W,x.context=_,c=ne):(typeof x.componentDidUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&J===t.memoizedState||(n.flags|=1024),c=!1)}return x=c,rc(t,n),c=(n.flags&128)!==0,x||c?(x=n.stateNode,s=c&&typeof s.getDerivedStateFromError!="function"?null:x.render(),n.flags|=1,t!==null&&c?(n.child=sr(n,t.child,null,m),n.child=sr(n,null,s,m)):Vt(t,n,s,m),n.memoizedState=x.state,t=n.child):t=Pa(t,n,m),t}function bx(t,n,s,c){return tr(),n.flags|=256,Vt(t,n,s,c),n.child}var Kd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wd(t){return{baseLanes:t,cachePool:sp()}}function ef(t,n,s){return t=t!==null?t.childLanes&~s:0,n&&(t|=Mn),t}function yx(t,n,s){var c=n.pendingProps,m=!1,x=(n.flags&128)!==0,w;if((w=x)||(w=t!==null&&t.memoizedState===null?!1:(zt.current&2)!==0),w&&(m=!0,n.flags&=-129),w=(n.flags&32)!==0,n.flags&=-33,t===null){if(Ge){if(m?bi(n):yi(),(t=mt)?(t=Cg(t,Gn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(n.memoizedState={dehydrated:t,treeContext:di!==null?{id:wa,overflow:ja}:null,retryLane:536870912,hydrationErrors:null},s=K0(t),s.return=n,n.child=s,Pt=n,mt=null)):t=null,t===null)throw hi(n);return Bf(t)?n.lanes=32:n.lanes=536870912,null}var S=c.children;return c=c.fallback,m?(yi(),m=n.mode,S=lc({mode:"hidden",children:S},m),c=er(c,m,s,null),S.return=n,c.return=n,S.sibling=c,n.child=S,c=n.child,c.memoizedState=Wd(s),c.childLanes=ef(t,w,s),n.memoizedState=Kd,js(null,c)):(bi(n),tf(n,S))}var _=t.memoizedState;if(_!==null&&(S=_.dehydrated,S!==null)){if(x)n.flags&256?(bi(n),n.flags&=-257,n=nf(t,n,s)):n.memoizedState!==null?(yi(),n.child=t.child,n.flags|=128,n=null):(yi(),S=c.fallback,m=n.mode,c=lc({mode:"visible",children:c.children},m),S=er(S,m,s,null),S.flags|=2,c.return=n,S.return=n,c.sibling=S,n.child=c,sr(n,t.child,null,s),c=n.child,c.memoizedState=Wd(s),c.childLanes=ef(t,w,s),n.memoizedState=Kd,n=js(null,c));else if(bi(n),Bf(S)){if(w=S.nextSibling&&S.nextSibling.dataset,w)var Q=w.dgst;w=Q,c=Error(l(419)),c.stack="",c.digest=w,us({value:c,source:null,stack:null}),n=nf(t,n,s)}else if(Et||Qr(t,n,s,!1),w=(s&t.childLanes)!==0,Et||w){if(w=ut,w!==null&&(c=na(w,s),c!==0&&c!==_.retryLane))throw _.retryLane=c,Wi(t,c),bn(w,t,c),Jd;Lf(S)||pc(),n=nf(t,n,s)}else Lf(S)?(n.flags|=192,n.child=t.child,n=null):(t=_.treeContext,mt=Qn(S.nextSibling),Pt=n,Ge=!0,fi=null,Gn=!1,t!==null&&tp(n,t),n=tf(n,c.children),n.flags|=4096);return n}return m?(yi(),S=c.fallback,m=n.mode,_=t.child,Q=_.sibling,c=Ba(_,{mode:"hidden",children:c.children}),c.subtreeFlags=_.subtreeFlags&65011712,Q!==null?S=Ba(Q,S):(S=er(S,m,s,null),S.flags|=2),S.return=n,c.return=n,c.sibling=S,n.child=c,js(null,c),c=n.child,S=t.child.memoizedState,S===null?S=Wd(s):(m=S.cachePool,m!==null?(_=St._currentValue,m=m.parent!==_?{parent:_,pool:_}:m):m=sp(),S={baseLanes:S.baseLanes|s,cachePool:m}),c.memoizedState=S,c.childLanes=ef(t,w,s),n.memoizedState=Kd,js(t.child,c)):(bi(n),s=t.child,t=s.sibling,s=Ba(s,{mode:"visible",children:c.children}),s.return=n,s.sibling=null,t!==null&&(w=n.deletions,w===null?(n.deletions=[t],n.flags|=16):w.push(t)),n.child=s,n.memoizedState=null,s)}function tf(t,n){return n=lc({mode:"visible",children:n},t.mode),n.return=t,t.child=n}function lc(t,n){return t=Cn(22,t,null,n),t.lanes=0,t}function nf(t,n,s){return sr(n,t.child,null,s),t=tf(n,n.pendingProps.children),t.flags|=2,n.memoizedState=null,t}function vx(t,n,s){t.lanes|=n;var c=t.alternate;c!==null&&(c.lanes|=n),gd(t.return,n,s)}function af(t,n,s,c,m,x){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:m,treeForkCount:x}:(w.isBackwards=n,w.rendering=null,w.renderingStartTime=0,w.last=c,w.tail=s,w.tailMode=m,w.treeForkCount=x)}function wx(t,n,s){var c=n.pendingProps,m=c.revealOrder,x=c.tail;c=c.children;var w=zt.current,S=(w&2)!==0;if(S?(w=w&1|2,n.flags|=128):w&=1,T(zt,w),Vt(t,n,c,s),c=Ge?cs:0,!S&&t!==null&&(t.flags&128)!==0)e:for(t=n.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vx(t,s,n);else if(t.tag===19)vx(t,s,n);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===n)break e;for(;t.sibling===null;){if(t.return===null||t.return===n)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(m){case"forwards":for(s=n.child,m=null;s!==null;)t=s.alternate,t!==null&&Qo(t)===null&&(m=s),s=s.sibling;s=m,s===null?(m=n.child,n.child=null):(m=s.sibling,s.sibling=null),af(n,!1,m,s,x,c);break;case"backwards":case"unstable_legacy-backwards":for(s=null,m=n.child,n.child=null;m!==null;){if(t=m.alternate,t!==null&&Qo(t)===null){n.child=m;break}t=m.sibling,m.sibling=s,s=m,m=t}af(n,!0,s,null,x,c);break;case"together":af(n,!1,null,null,void 0,c);break;default:n.memoizedState=null}return n.child}function Pa(t,n,s){if(t!==null&&(n.dependencies=t.dependencies),ji|=n.lanes,(s&n.childLanes)===0)if(t!==null){if(Qr(t,n,s,!1),(s&n.childLanes)===0)return null}else return null;if(t!==null&&n.child!==t.child)throw Error(l(153));if(n.child!==null){for(t=n.child,s=Ba(t,t.pendingProps),n.child=s,s.return=n;t.sibling!==null;)t=t.sibling,s=s.sibling=Ba(t,t.pendingProps),s.return=n;s.sibling=null}return n.child}function rf(t,n){return(t.lanes&n)!==0?!0:(t=t.dependencies,!!(t!==null&&Ho(t)))}function Aw(t,n,s){switch(n.tag){case 3:de(n,n.stateNode.containerInfo),mi(n,St,t.memoizedState.cache),tr();break;case 27:case 5:it(n);break;case 4:de(n,n.stateNode.containerInfo);break;case 10:mi(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Td(n),null;break;case 13:var c=n.memoizedState;if(c!==null)return c.dehydrated!==null?(bi(n),n.flags|=128,null):(s&n.child.childLanes)!==0?yx(t,n,s):(bi(n),t=Pa(t,n,s),t!==null?t.sibling:null);bi(n);break;case 19:var m=(t.flags&128)!==0;if(c=(s&n.childLanes)!==0,c||(Qr(t,n,s,!1),c=(s&n.childLanes)!==0),m){if(c)return wx(t,n,s);n.flags|=128}if(m=n.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),T(zt,zt.current),c)break;return null;case 22:return n.lanes=0,hx(t,n,s,n.pendingProps);case 24:mi(n,St,t.memoizedState.cache)}return Pa(t,n,s)}function jx(t,n,s){if(t!==null)if(t.memoizedProps!==n.pendingProps)Et=!0;else{if(!rf(t,s)&&(n.flags&128)===0)return Et=!1,Aw(t,n,s);Et=(t.flags&131072)!==0}else Et=!1,Ge&&(n.flags&1048576)!==0&&ep(n,cs,n.index);switch(n.lanes=0,n.tag){case 16:e:{var c=n.pendingProps;if(t=rr(n.elementType),n.type=t,typeof t=="function")cd(t)?(c=cr(t,c),n.tag=1,n=gx(null,n,t,c,s)):(n.tag=0,n=Zd(null,n,t,c,s));else{if(t!=null){var m=t.$$typeof;if(m===L){n.tag=11,n=ux(null,n,t,c,s);break e}else if(m===H){n.tag=14,n=dx(null,n,t,c,s);break e}}throw n=V(t)||t,Error(l(306,n,""))}}return n;case 0:return Zd(t,n,n.type,n.pendingProps,s);case 1:return c=n.type,m=cr(c,n.pendingProps),gx(t,n,c,m,s);case 3:e:{if(de(n,n.stateNode.containerInfo),t===null)throw Error(l(387));c=n.pendingProps;var x=n.memoizedState;m=x.element,kd(t,n),gs(n,c,null,s);var w=n.memoizedState;if(c=w.cache,mi(n,St,c),c!==x.cache&&bd(n,[St],s,!0),xs(),c=w.element,x.isDehydrated)if(x={element:c,isDehydrated:!1,cache:w.cache},n.updateQueue.baseState=x,n.memoizedState=x,n.flags&256){n=bx(t,n,c,s);break e}else if(c!==m){m=Pn(Error(l(424)),n),us(m),n=bx(t,n,c,s);break e}else{switch(t=n.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(mt=Qn(t.firstChild),Pt=n,Ge=!0,fi=null,Gn=!0,s=hp(n,null,c,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling}else{if(tr(),c===m){n=Pa(t,n,s);break e}Vt(t,n,c,s)}n=n.child}return n;case 26:return rc(t,n),t===null?(s=Og(n.type,null,n.pendingProps,null))?n.memoizedState=s:Ge||(s=n.type,t=n.pendingProps,c=jc(ye.current).createElement(s),c[Ft]=n,c[fn]=t,Gt(c,s,t),Lt(c),n.stateNode=c):n.memoizedState=Og(n.type,t.memoizedProps,n.pendingProps,t.memoizedState),null;case 27:return it(n),t===null&&Ge&&(c=n.stateNode=Ag(n.type,n.pendingProps,ye.current),Pt=n,Gn=!0,m=mt,Ci(n.type)?(Uf=m,mt=Qn(c.firstChild)):mt=m),Vt(t,n,n.pendingProps.children,s),rc(t,n),t===null&&(n.flags|=4194304),n.child;case 5:return t===null&&Ge&&((m=c=mt)&&(c=lj(c,n.type,n.pendingProps,Gn),c!==null?(n.stateNode=c,Pt=n,mt=Qn(c.firstChild),Gn=!1,m=!0):m=!1),m||hi(n)),it(n),m=n.type,x=n.pendingProps,w=t!==null?t.memoizedProps:null,c=x.children,Of(m,x)?c=null:w!==null&&Of(m,w)&&(n.flags|=32),n.memoizedState!==null&&(m=Md(t,n,ww,null,null,s),Bs._currentValue=m),rc(t,n),Vt(t,n,c,s),n.child;case 6:return t===null&&Ge&&((t=s=mt)&&(s=sj(s,n.pendingProps,Gn),s!==null?(n.stateNode=s,Pt=n,mt=null,t=!0):t=!1),t||hi(n)),null;case 13:return yx(t,n,s);case 4:return de(n,n.stateNode.containerInfo),c=n.pendingProps,t===null?n.child=sr(n,null,c,s):Vt(t,n,c,s),n.child;case 11:return ux(t,n,n.type,n.pendingProps,s);case 7:return Vt(t,n,n.pendingProps,s),n.child;case 8:return Vt(t,n,n.pendingProps.children,s),n.child;case 12:return Vt(t,n,n.pendingProps.children,s),n.child;case 10:return c=n.pendingProps,mi(n,n.type,c.value),Vt(t,n,c.children,s),n.child;case 9:return m=n.type._context,c=n.pendingProps.children,ar(n),m=$t(m),c=c(m),n.flags|=1,Vt(t,n,c,s),n.child;case 14:return dx(t,n,n.type,n.pendingProps,s);case 15:return fx(t,n,n.type,n.pendingProps,s);case 19:return wx(t,n,s);case 31:return Tw(t,n,s);case 22:return hx(t,n,s,n.pendingProps);case 24:return ar(n),c=$t(St),t===null?(m=wd(),m===null&&(m=ut,x=yd(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=s),m=x),n.memoizedState={parent:c,cache:m},zd(n),mi(n,St,m)):((t.lanes&s)!==0&&(kd(t,n),gs(n,null,null,s),xs()),m=t.memoizedState,x=n.memoizedState,m.parent!==c?(m={parent:c,cache:c},n.memoizedState=m,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=m),mi(n,St,c)):(c=x.cache,mi(n,St,c),c!==m.cache&&bd(n,[St],s,!0))),Vt(t,n,n.pendingProps.children,s),n.child;case 29:throw n.pendingProps}throw Error(l(156,n.tag))}function $a(t){t.flags|=4}function lf(t,n,s,c,m){if((n=(t.mode&32)!==0)&&(n=!1),n){if(t.flags|=16777216,(m&335544128)===m)if(t.stateNode.complete)t.flags|=8192;else if(Xx())t.flags|=8192;else throw lr=$o,jd}else t.flags&=-16777217}function zx(t,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Ug(n))if(Xx())t.flags|=8192;else throw lr=$o,jd}function sc(t,n){n!==null&&(t.flags|=4),t.flags&16384&&(n=t.tag!==22?ct():536870912,t.lanes|=n,ll|=n)}function zs(t,n){if(!Ge)switch(t.tailMode){case"hidden":n=t.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?n||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function pt(t){var n=t.alternate!==null&&t.alternate.child===t.child,s=0,c=0;if(n)for(var m=t.child;m!==null;)s|=m.lanes|m.childLanes,c|=m.subtreeFlags&65011712,c|=m.flags&65011712,m.return=t,m=m.sibling;else for(m=t.child;m!==null;)s|=m.lanes|m.childLanes,c|=m.subtreeFlags,c|=m.flags,m.return=t,m=m.sibling;return t.subtreeFlags|=c,t.childLanes=s,n}function Mw(t,n,s){var c=n.pendingProps;switch(hd(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(n),null;case 1:return pt(n),null;case 3:return s=n.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),n.memoizedState.cache!==c&&(n.flags|=2048),Ha(St),Ne(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Yr(n)?$a(n):t===null||t.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,pd())),pt(n),null;case 26:var m=n.type,x=n.memoizedState;return t===null?($a(n),x!==null?(pt(n),zx(n,x)):(pt(n),lf(n,m,null,c,s))):x?x!==t.memoizedState?($a(n),pt(n),zx(n,x)):(pt(n),n.flags&=-16777217):(t=t.memoizedProps,t!==c&&$a(n),pt(n),lf(n,m,t,c,s)),null;case 27:if(yt(n),s=ye.current,m=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==c&&$a(n);else{if(!c){if(n.stateNode===null)throw Error(l(166));return pt(n),null}t=F.current,Yr(n)?np(n):(t=Ag(m,c,s),n.stateNode=t,$a(n))}return pt(n),null;case 5:if(yt(n),m=n.type,t!==null&&n.stateNode!=null)t.memoizedProps!==c&&$a(n);else{if(!c){if(n.stateNode===null)throw Error(l(166));return pt(n),null}if(x=F.current,Yr(n))np(n);else{var w=jc(ye.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?x.multiple=!0:c.size&&(x.size=c.size);break;default:x=typeof c.is=="string"?w.createElement(m,{is:c.is}):w.createElement(m)}}x[Ft]=n,x[fn]=c;e:for(w=n.child;w!==null;){if(w.tag===5||w.tag===6)x.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===n)break e;for(;w.sibling===null;){if(w.return===null||w.return===n)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}n.stateNode=x;e:switch(Gt(x,m,c),m){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&$a(n)}}return pt(n),lf(n,n.type,t===null?null:t.memoizedProps,n.pendingProps,s),null;case 6:if(t&&n.stateNode!=null)t.memoizedProps!==c&&$a(n);else{if(typeof c!="string"&&n.stateNode===null)throw Error(l(166));if(t=ye.current,Yr(n)){if(t=n.stateNode,s=n.memoizedProps,c=null,m=Pt,m!==null)switch(m.tag){case 27:case 5:c=m.memoizedProps}t[Ft]=n,t=!!(t.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||yg(t.nodeValue,s)),t||hi(n,!0)}else t=jc(t).createTextNode(c),t[Ft]=n,n.stateNode=t}return pt(n),null;case 31:if(s=n.memoizedState,t===null||t.memoizedState!==null){if(c=Yr(n),s!==null){if(t===null){if(!c)throw Error(l(318));if(t=n.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[Ft]=n}else tr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;pt(n),t=!1}else s=pd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return n.flags&256?(Tn(n),n):(Tn(n),null);if((n.flags&128)!==0)throw Error(l(558))}return pt(n),null;case 13:if(c=n.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(m=Yr(n),c!==null&&c.dehydrated!==null){if(t===null){if(!m)throw Error(l(318));if(m=n.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(l(317));m[Ft]=n}else tr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;pt(n),m=!1}else m=pd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=m),m=!0;if(!m)return n.flags&256?(Tn(n),n):(Tn(n),null)}return Tn(n),(n.flags&128)!==0?(n.lanes=s,n):(s=c!==null,t=t!==null&&t.memoizedState!==null,s&&(c=n.child,m=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(m=c.alternate.memoizedState.cachePool.pool),x=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(x=c.memoizedState.cachePool.pool),x!==m&&(c.flags|=2048)),s!==t&&s&&(n.child.flags|=8192),sc(n,n.updateQueue),pt(n),null);case 4:return Ne(),t===null&&Ef(n.stateNode.containerInfo),pt(n),null;case 10:return Ha(n.type),pt(n),null;case 19:if(P(zt),c=n.memoizedState,c===null)return pt(n),null;if(m=(n.flags&128)!==0,x=c.rendering,x===null)if(m)zs(c,!1);else{if(wt!==0||t!==null&&(t.flags&128)!==0)for(t=n.child;t!==null;){if(x=Qo(t),x!==null){for(n.flags|=128,zs(c,!1),t=x.updateQueue,n.updateQueue=t,sc(n,t),n.subtreeFlags=0,t=s,s=n.child;s!==null;)Z0(s,t),s=s.sibling;return T(zt,zt.current&1|2),Ge&&Ua(n,c.treeForkCount),n.child}t=t.sibling}c.tail!==null&&et()>fc&&(n.flags|=128,m=!0,zs(c,!1),n.lanes=4194304)}else{if(!m)if(t=Qo(x),t!==null){if(n.flags|=128,m=!0,t=t.updateQueue,n.updateQueue=t,sc(n,t),zs(c,!0),c.tail===null&&c.tailMode==="hidden"&&!x.alternate&&!Ge)return pt(n),null}else 2*et()-c.renderingStartTime>fc&&s!==536870912&&(n.flags|=128,m=!0,zs(c,!1),n.lanes=4194304);c.isBackwards?(x.sibling=n.child,n.child=x):(t=c.last,t!==null?t.sibling=x:n.child=x,c.last=x)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=et(),t.sibling=null,s=zt.current,T(zt,m?s&1|2:s&1),Ge&&Ua(n,c.treeForkCount),t):(pt(n),null);case 22:case 23:return Tn(n),Ed(),c=n.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(n.flags|=8192):c&&(n.flags|=8192),c?(s&536870912)!==0&&(n.flags&128)===0&&(pt(n),n.subtreeFlags&6&&(n.flags|=8192)):pt(n),s=n.updateQueue,s!==null&&sc(n,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),c=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(c=n.memoizedState.cachePool.pool),c!==s&&(n.flags|=2048),t!==null&&P(ir),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),Ha(St),pt(n),null;case 25:return null;case 30:return null}throw Error(l(156,n.tag))}function Dw(t,n){switch(hd(n),n.tag){case 1:return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 3:return Ha(St),Ne(),t=n.flags,(t&65536)!==0&&(t&128)===0?(n.flags=t&-65537|128,n):null;case 26:case 27:case 5:return yt(n),null;case 31:if(n.memoizedState!==null){if(Tn(n),n.alternate===null)throw Error(l(340));tr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 13:if(Tn(n),t=n.memoizedState,t!==null&&t.dehydrated!==null){if(n.alternate===null)throw Error(l(340));tr()}return t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 19:return P(zt),null;case 4:return Ne(),null;case 10:return Ha(n.type),null;case 22:case 23:return Tn(n),Ed(),t!==null&&P(ir),t=n.flags,t&65536?(n.flags=t&-65537|128,n):null;case 24:return Ha(St),null;case 25:return null;default:return null}}function kx(t,n){switch(hd(n),n.tag){case 3:Ha(St),Ne();break;case 26:case 27:case 5:yt(n);break;case 4:Ne();break;case 31:n.memoizedState!==null&&Tn(n);break;case 13:Tn(n);break;case 19:P(zt);break;case 10:Ha(n.type);break;case 22:case 23:Tn(n),Ed(),t!==null&&P(ir);break;case 24:Ha(St)}}function ks(t,n){try{var s=n.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var m=c.next;s=m;do{if((s.tag&t)===t){c=void 0;var x=s.create,w=s.inst;c=x(),w.destroy=c}s=s.next}while(s!==m)}}catch(S){at(n,n.return,S)}}function vi(t,n,s){try{var c=n.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var x=m.next;c=x;do{if((c.tag&t)===t){var w=c.inst,S=w.destroy;if(S!==void 0){w.destroy=void 0,m=n;var _=s,Q=S;try{Q()}catch(ne){at(m,_,ne)}}}c=c.next}while(c!==x)}}catch(ne){at(n,n.return,ne)}}function Nx(t){var n=t.updateQueue;if(n!==null){var s=t.stateNode;try{pp(n,s)}catch(c){at(t,t.return,c)}}}function Sx(t,n,s){s.props=cr(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(c){at(t,n,c)}}function Ns(t,n){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof s=="function"?t.refCleanup=s(c):s.current=c}}catch(m){at(t,n,m)}}function za(t,n){var s=t.ref,c=t.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(m){at(t,n,m)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(m){at(t,n,m)}else s.current=null}function Cx(t){var n=t.type,s=t.memoizedProps,c=t.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(m){at(t,t.return,m)}}function sf(t,n,s){try{var c=t.stateNode;ej(c,t.type,s,n),c[fn]=n}catch(m){at(t,t.return,m)}}function Ex(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ci(t.type)||t.tag===4}function of(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Ex(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ci(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function cf(t,n,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,n?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,n):(n=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,n.appendChild(t),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=_a));else if(c!==4&&(c===27&&Ci(t.type)&&(s=t.stateNode,n=null),t=t.child,t!==null))for(cf(t,n,s),t=t.sibling;t!==null;)cf(t,n,s),t=t.sibling}function oc(t,n,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,n?s.insertBefore(t,n):s.appendChild(t);else if(c!==4&&(c===27&&Ci(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(oc(t,n,s),t=t.sibling;t!==null;)oc(t,n,s),t=t.sibling}function Tx(t){var n=t.stateNode,s=t.memoizedProps;try{for(var c=t.type,m=n.attributes;m.length;)n.removeAttributeNode(m[0]);Gt(n,c,s),n[Ft]=t,n[fn]=s}catch(x){at(t,t.return,x)}}var Va=!1,Tt=!1,uf=!1,Ax=typeof WeakSet=="function"?WeakSet:Set,Bt=null;function Ow(t,n){if(t=t.containerInfo,Mf=Tc,t=F0(t),nd(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var m=c.anchorOffset,x=c.focusNode;c=c.focusOffset;try{s.nodeType,x.nodeType}catch{s=null;break e}var w=0,S=-1,_=-1,Q=0,ne=0,se=t,J=null;t:for(;;){for(var W;se!==s||m!==0&&se.nodeType!==3||(S=w+m),se!==x||c!==0&&se.nodeType!==3||(_=w+c),se.nodeType===3&&(w+=se.nodeValue.length),(W=se.firstChild)!==null;)J=se,se=W;for(;;){if(se===t)break t;if(J===s&&++Q===m&&(S=w),J===x&&++ne===c&&(_=w),(W=se.nextSibling)!==null)break;se=J,J=se.parentNode}se=W}s=S===-1||_===-1?null:{start:S,end:_}}else s=null}s=s||{start:0,end:0}}else s=null;for(Df={focusedElem:t,selectionRange:s},Tc=!1,Bt=n;Bt!==null;)if(n=Bt,t=n.child,(n.subtreeFlags&1028)!==0&&t!==null)t.return=n,Bt=t;else for(;Bt!==null;){switch(n=Bt,x=n.alternate,t=n.flags,n.tag){case 0:if((t&4)!==0&&(t=n.updateQueue,t=t!==null?t.events:null,t!==null))for(s=0;s<t.length;s++)m=t[s],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&x!==null){t=void 0,s=n,m=x.memoizedProps,x=x.memoizedState,c=s.stateNode;try{var we=cr(s.type,m);t=c.getSnapshotBeforeUpdate(we,x),c.__reactInternalSnapshotBeforeUpdate=t}catch(Ce){at(s,s.return,Ce)}}break;case 3:if((t&1024)!==0){if(t=n.stateNode.containerInfo,s=t.nodeType,s===9)_f(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":_f(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(l(163))}if(t=n.sibling,t!==null){t.return=n.return,Bt=t;break}Bt=n.return}}function Mx(t,n,s){var c=s.flags;switch(s.tag){case 0:case 11:case 15:Ya(t,s),c&4&&ks(5,s);break;case 1:if(Ya(t,s),c&4)if(t=s.stateNode,n===null)try{t.componentDidMount()}catch(w){at(s,s.return,w)}else{var m=cr(s.type,n.memoizedProps);n=n.memoizedState;try{t.componentDidUpdate(m,n,t.__reactInternalSnapshotBeforeUpdate)}catch(w){at(s,s.return,w)}}c&64&&Nx(s),c&512&&Ns(s,s.return);break;case 3:if(Ya(t,s),c&64&&(t=s.updateQueue,t!==null)){if(n=null,s.child!==null)switch(s.child.tag){case 27:case 5:n=s.child.stateNode;break;case 1:n=s.child.stateNode}try{pp(t,n)}catch(w){at(s,s.return,w)}}break;case 27:n===null&&c&4&&Tx(s);case 26:case 5:Ya(t,s),n===null&&c&4&&Cx(s),c&512&&Ns(s,s.return);break;case 12:Ya(t,s);break;case 31:Ya(t,s),c&4&&Rx(t,s);break;case 13:Ya(t,s),c&4&&_x(t,s),c&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=Fw.bind(null,s),oj(t,s))));break;case 22:if(c=s.memoizedState!==null||Va,!c){n=n!==null&&n.memoizedState!==null||Tt,m=Va;var x=Tt;Va=c,(Tt=n)&&!x?Qa(t,s,(s.subtreeFlags&8772)!==0):Ya(t,s),Va=m,Tt=x}break;case 30:break;default:Ya(t,s)}}function Dx(t){var n=t.alternate;n!==null&&(t.alternate=null,Dx(n)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(n=t.stateNode,n!==null&&Iu(n)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var gt=null,mn=!1;function Ga(t,n,s){for(s=s.child;s!==null;)Ox(t,n,s),s=s.sibling}function Ox(t,n,s){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(Ot,s)}catch{}switch(s.tag){case 26:Tt||za(s,n),Ga(t,n,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Tt||za(s,n);var c=gt,m=mn;Ci(s.type)&&(gt=s.stateNode,mn=!1),Ga(t,n,s),Rs(s.stateNode),gt=c,mn=m;break;case 5:Tt||za(s,n);case 6:if(c=gt,m=mn,gt=null,Ga(t,n,s),gt=c,mn=m,gt!==null)if(mn)try{(gt.nodeType===9?gt.body:gt.nodeName==="HTML"?gt.ownerDocument.body:gt).removeChild(s.stateNode)}catch(x){at(s,n,x)}else try{gt.removeChild(s.stateNode)}catch(x){at(s,n,x)}break;case 18:gt!==null&&(mn?(t=gt,Ng(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),ml(t)):Ng(gt,s.stateNode));break;case 4:c=gt,m=mn,gt=s.stateNode.containerInfo,mn=!0,Ga(t,n,s),gt=c,mn=m;break;case 0:case 11:case 14:case 15:vi(2,s,n),Tt||vi(4,s,n),Ga(t,n,s);break;case 1:Tt||(za(s,n),c=s.stateNode,typeof c.componentWillUnmount=="function"&&Sx(s,n,c)),Ga(t,n,s);break;case 21:Ga(t,n,s);break;case 22:Tt=(c=Tt)||s.memoizedState!==null,Ga(t,n,s),Tt=c;break;default:Ga(t,n,s)}}function Rx(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ml(t)}catch(s){at(n,n.return,s)}}}function _x(t,n){if(n.memoizedState===null&&(t=n.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ml(t)}catch(s){at(n,n.return,s)}}function Rw(t){switch(t.tag){case 31:case 13:case 19:var n=t.stateNode;return n===null&&(n=t.stateNode=new Ax),n;case 22:return t=t.stateNode,n=t._retryCache,n===null&&(n=t._retryCache=new Ax),n;default:throw Error(l(435,t.tag))}}function cc(t,n){var s=Rw(t);n.forEach(function(c){if(!s.has(c)){s.add(c);var m=Pw.bind(null,t,c);c.then(m,m)}})}function pn(t,n){var s=n.deletions;if(s!==null)for(var c=0;c<s.length;c++){var m=s[c],x=t,w=n,S=w;e:for(;S!==null;){switch(S.tag){case 27:if(Ci(S.type)){gt=S.stateNode,mn=!1;break e}break;case 5:gt=S.stateNode,mn=!1;break e;case 3:case 4:gt=S.stateNode.containerInfo,mn=!0;break e}S=S.return}if(gt===null)throw Error(l(160));Ox(x,w,m),gt=null,mn=!1,x=m.alternate,x!==null&&(x.return=null),m.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Lx(n,t),n=n.sibling}var ia=null;function Lx(t,n){var s=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:pn(n,t),xn(t),c&4&&(vi(3,t,t.return),ks(3,t),vi(5,t,t.return));break;case 1:pn(n,t),xn(t),c&512&&(Tt||s===null||za(s,s.return)),c&64&&Va&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?c:s.concat(c))));break;case 26:var m=ia;if(pn(n,t),xn(t),c&512&&(Tt||s===null||za(s,s.return)),c&4){var x=s!==null?s.memoizedState:null;if(c=t.memoizedState,s===null)if(c===null)if(t.stateNode===null){e:{c=t.type,s=t.memoizedProps,m=m.ownerDocument||m;t:switch(c){case"title":x=m.getElementsByTagName("title")[0],(!x||x[Kl]||x[Ft]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=m.createElement(c),m.head.insertBefore(x,m.querySelector("head > title"))),Gt(x,c,s),x[Ft]=t,Lt(x),c=x;break e;case"link":var w=Lg("link","href",m).get(c+(s.href||""));if(w){for(var S=0;S<w.length;S++)if(x=w[S],x.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&x.getAttribute("rel")===(s.rel==null?null:s.rel)&&x.getAttribute("title")===(s.title==null?null:s.title)&&x.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){w.splice(S,1);break t}}x=m.createElement(c),Gt(x,c,s),m.head.appendChild(x);break;case"meta":if(w=Lg("meta","content",m).get(c+(s.content||""))){for(S=0;S<w.length;S++)if(x=w[S],x.getAttribute("content")===(s.content==null?null:""+s.content)&&x.getAttribute("name")===(s.name==null?null:s.name)&&x.getAttribute("property")===(s.property==null?null:s.property)&&x.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&x.getAttribute("charset")===(s.charSet==null?null:s.charSet)){w.splice(S,1);break t}}x=m.createElement(c),Gt(x,c,s),m.head.appendChild(x);break;default:throw Error(l(468,c))}x[Ft]=t,Lt(x),c=x}t.stateNode=c}else Bg(m,t.type,t.stateNode);else t.stateNode=_g(m,c,t.memoizedProps);else x!==c?(x===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):x.count--,c===null?Bg(m,t.type,t.stateNode):_g(m,c,t.memoizedProps)):c===null&&t.stateNode!==null&&sf(t,t.memoizedProps,s.memoizedProps)}break;case 27:pn(n,t),xn(t),c&512&&(Tt||s===null||za(s,s.return)),s!==null&&c&4&&sf(t,t.memoizedProps,s.memoizedProps);break;case 5:if(pn(n,t),xn(t),c&512&&(Tt||s===null||za(s,s.return)),t.flags&32){m=t.stateNode;try{Br(m,"")}catch(we){at(t,t.return,we)}}c&4&&t.stateNode!=null&&(m=t.memoizedProps,sf(t,m,s!==null?s.memoizedProps:m)),c&1024&&(uf=!0);break;case 6:if(pn(n,t),xn(t),c&4){if(t.stateNode===null)throw Error(l(162));c=t.memoizedProps,s=t.stateNode;try{s.nodeValue=c}catch(we){at(t,t.return,we)}}break;case 3:if(Nc=null,m=ia,ia=zc(n.containerInfo),pn(n,t),ia=m,xn(t),c&4&&s!==null&&s.memoizedState.isDehydrated)try{ml(n.containerInfo)}catch(we){at(t,t.return,we)}uf&&(uf=!1,Bx(t));break;case 4:c=ia,ia=zc(t.stateNode.containerInfo),pn(n,t),xn(t),ia=c;break;case 12:pn(n,t),xn(t);break;case 31:pn(n,t),xn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,cc(t,c)));break;case 13:pn(n,t),xn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(dc=et()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,cc(t,c)));break;case 22:m=t.memoizedState!==null;var _=s!==null&&s.memoizedState!==null,Q=Va,ne=Tt;if(Va=Q||m,Tt=ne||_,pn(n,t),Tt=ne,Va=Q,xn(t),c&8192)e:for(n=t.stateNode,n._visibility=m?n._visibility&-2:n._visibility|1,m&&(s===null||_||Va||Tt||ur(t)),s=null,n=t;;){if(n.tag===5||n.tag===26){if(s===null){_=s=n;try{if(x=_.stateNode,m)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{S=_.stateNode;var se=_.memoizedProps.style,J=se!=null&&se.hasOwnProperty("display")?se.display:null;S.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(we){at(_,_.return,we)}}}else if(n.tag===6){if(s===null){_=n;try{_.stateNode.nodeValue=m?"":_.memoizedProps}catch(we){at(_,_.return,we)}}}else if(n.tag===18){if(s===null){_=n;try{var W=_.stateNode;m?Sg(W,!0):Sg(_.stateNode,!1)}catch(we){at(_,_.return,we)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break e;for(;n.sibling===null;){if(n.return===null||n.return===t)break e;s===n&&(s=null),n=n.return}s===n&&(s=null),n.sibling.return=n.return,n=n.sibling}c&4&&(c=t.updateQueue,c!==null&&(s=c.retryQueue,s!==null&&(c.retryQueue=null,cc(t,s))));break;case 19:pn(n,t),xn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,cc(t,c)));break;case 30:break;case 21:break;default:pn(n,t),xn(t)}}function xn(t){var n=t.flags;if(n&2){try{for(var s,c=t.return;c!==null;){if(Ex(c)){s=c;break}c=c.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var m=s.stateNode,x=of(t);oc(t,x,m);break;case 5:var w=s.stateNode;s.flags&32&&(Br(w,""),s.flags&=-33);var S=of(t);oc(t,S,w);break;case 3:case 4:var _=s.stateNode.containerInfo,Q=of(t);cf(t,Q,_);break;default:throw Error(l(161))}}catch(ne){at(t,t.return,ne)}t.flags&=-3}n&4096&&(t.flags&=-4097)}function Bx(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var n=t;Bx(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),t=t.sibling}}function Ya(t,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Mx(t,n.alternate,n),n=n.sibling}function ur(t){for(t=t.child;t!==null;){var n=t;switch(n.tag){case 0:case 11:case 14:case 15:vi(4,n,n.return),ur(n);break;case 1:za(n,n.return);var s=n.stateNode;typeof s.componentWillUnmount=="function"&&Sx(n,n.return,s),ur(n);break;case 27:Rs(n.stateNode);case 26:case 5:za(n,n.return),ur(n);break;case 22:n.memoizedState===null&&ur(n);break;case 30:ur(n);break;default:ur(n)}t=t.sibling}}function Qa(t,n,s){for(s=s&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var c=n.alternate,m=t,x=n,w=x.flags;switch(x.tag){case 0:case 11:case 15:Qa(m,x,s),ks(4,x);break;case 1:if(Qa(m,x,s),c=x,m=c.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(Q){at(c,c.return,Q)}if(c=x,m=c.updateQueue,m!==null){var S=c.stateNode;try{var _=m.shared.hiddenCallbacks;if(_!==null)for(m.shared.hiddenCallbacks=null,m=0;m<_.length;m++)mp(_[m],S)}catch(Q){at(c,c.return,Q)}}s&&w&64&&Nx(x),Ns(x,x.return);break;case 27:Tx(x);case 26:case 5:Qa(m,x,s),s&&c===null&&w&4&&Cx(x),Ns(x,x.return);break;case 12:Qa(m,x,s);break;case 31:Qa(m,x,s),s&&w&4&&Rx(m,x);break;case 13:Qa(m,x,s),s&&w&4&&_x(m,x);break;case 22:x.memoizedState===null&&Qa(m,x,s),Ns(x,x.return);break;case 30:break;default:Qa(m,x,s)}n=n.sibling}}function df(t,n){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(t=n.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&ds(s))}function ff(t,n){t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&ds(t))}function ra(t,n,s,c){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ux(t,n,s,c),n=n.sibling}function Ux(t,n,s,c){var m=n.flags;switch(n.tag){case 0:case 11:case 15:ra(t,n,s,c),m&2048&&ks(9,n);break;case 1:ra(t,n,s,c);break;case 3:ra(t,n,s,c),m&2048&&(t=null,n.alternate!==null&&(t=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==t&&(n.refCount++,t!=null&&ds(t)));break;case 12:if(m&2048){ra(t,n,s,c),t=n.stateNode;try{var x=n.memoizedProps,w=x.id,S=x.onPostCommit;typeof S=="function"&&S(w,n.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(_){at(n,n.return,_)}}else ra(t,n,s,c);break;case 31:ra(t,n,s,c);break;case 13:ra(t,n,s,c);break;case 23:break;case 22:x=n.stateNode,w=n.alternate,n.memoizedState!==null?x._visibility&2?ra(t,n,s,c):Ss(t,n):x._visibility&2?ra(t,n,s,c):(x._visibility|=2,al(t,n,s,c,(n.subtreeFlags&10256)!==0||!1)),m&2048&&df(w,n);break;case 24:ra(t,n,s,c),m&2048&&ff(n.alternate,n);break;default:ra(t,n,s,c)}}function al(t,n,s,c,m){for(m=m&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var x=t,w=n,S=s,_=c,Q=w.flags;switch(w.tag){case 0:case 11:case 15:al(x,w,S,_,m),ks(8,w);break;case 23:break;case 22:var ne=w.stateNode;w.memoizedState!==null?ne._visibility&2?al(x,w,S,_,m):Ss(x,w):(ne._visibility|=2,al(x,w,S,_,m)),m&&Q&2048&&df(w.alternate,w);break;case 24:al(x,w,S,_,m),m&&Q&2048&&ff(w.alternate,w);break;default:al(x,w,S,_,m)}n=n.sibling}}function Ss(t,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var s=t,c=n,m=c.flags;switch(c.tag){case 22:Ss(s,c),m&2048&&df(c.alternate,c);break;case 24:Ss(s,c),m&2048&&ff(c.alternate,c);break;default:Ss(s,c)}n=n.sibling}}var Cs=8192;function il(t,n,s){if(t.subtreeFlags&Cs)for(t=t.child;t!==null;)Ix(t,n,s),t=t.sibling}function Ix(t,n,s){switch(t.tag){case 26:il(t,n,s),t.flags&Cs&&t.memoizedState!==null&&vj(s,ia,t.memoizedState,t.memoizedProps);break;case 5:il(t,n,s);break;case 3:case 4:var c=ia;ia=zc(t.stateNode.containerInfo),il(t,n,s),ia=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=Cs,Cs=16777216,il(t,n,s),Cs=c):il(t,n,s));break;default:il(t,n,s)}}function Hx(t){var n=t.alternate;if(n!==null&&(t=n.child,t!==null)){n.child=null;do n=t.sibling,t.sibling=null,t=n;while(t!==null)}}function Es(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var c=n[s];Bt=c,Fx(c,t)}Hx(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)qx(t),t=t.sibling}function qx(t){switch(t.tag){case 0:case 11:case 15:Es(t),t.flags&2048&&vi(9,t,t.return);break;case 3:Es(t);break;case 12:Es(t);break;case 22:var n=t.stateNode;t.memoizedState!==null&&n._visibility&2&&(t.return===null||t.return.tag!==13)?(n._visibility&=-3,uc(t)):Es(t);break;default:Es(t)}}function uc(t){var n=t.deletions;if((t.flags&16)!==0){if(n!==null)for(var s=0;s<n.length;s++){var c=n[s];Bt=c,Fx(c,t)}Hx(t)}for(t=t.child;t!==null;){switch(n=t,n.tag){case 0:case 11:case 15:vi(8,n,n.return),uc(n);break;case 22:s=n.stateNode,s._visibility&2&&(s._visibility&=-3,uc(n));break;default:uc(n)}t=t.sibling}}function Fx(t,n){for(;Bt!==null;){var s=Bt;switch(s.tag){case 0:case 11:case 15:vi(8,s,n);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var c=s.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:ds(s.memoizedState.cache)}if(c=s.child,c!==null)c.return=s,Bt=c;else e:for(s=t;Bt!==null;){c=Bt;var m=c.sibling,x=c.return;if(Dx(c),c===s){Bt=null;break e}if(m!==null){m.return=x,Bt=m;break e}Bt=x}}}var _w={getCacheForType:function(t){var n=$t(St),s=n.data.get(t);return s===void 0&&(s=t(),n.data.set(t,s)),s},cacheSignal:function(){return $t(St).controller.signal}},Lw=typeof WeakMap=="function"?WeakMap:Map,We=0,ut=null,He=null,Pe=0,nt=0,An=null,wi=!1,rl=!1,hf=!1,Xa=0,wt=0,ji=0,dr=0,mf=0,Mn=0,ll=0,Ts=null,gn=null,pf=!1,dc=0,Px=0,fc=1/0,hc=null,zi=null,Rt=0,ki=null,sl=null,Ja=0,xf=0,gf=null,$x=null,As=0,bf=null;function Dn(){return(We&2)!==0&&Pe!==0?Pe&-Pe:B.T!==null?kf():l0()}function Vx(){if(Mn===0)if((Pe&536870912)===0||Ge){var t=Tr;Tr<<=1,(Tr&3932160)===0&&(Tr=262144),Mn=t}else Mn=536870912;return t=En.current,t!==null&&(t.flags|=32),Mn}function bn(t,n,s){(t===ut&&(nt===2||nt===9)||t.cancelPendingCommit!==null)&&(ol(t,0),Ni(t,Pe,Mn,!1)),qt(t,s),((We&2)===0||t!==ut)&&(t===ut&&((We&2)===0&&(dr|=s),wt===4&&Ni(t,Pe,Mn,!1)),ka(t))}function Gx(t,n,s){if((We&6)!==0)throw Error(l(327));var c=!s&&(n&127)===0&&(n&t.expiredLanes)===0||Te(t,n),m=c?Iw(t,n):vf(t,n,!0),x=c;do{if(m===0){rl&&!c&&Ni(t,n,0,!1);break}else{if(s=t.current.alternate,x&&!Bw(s)){m=vf(t,n,!1),x=!1;continue}if(m===2){if(x=n,t.errorRecoveryDisabledLanes&x)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){n=w;e:{var S=t;m=Ts;var _=S.current.memoizedState.isDehydrated;if(_&&(ol(S,w).flags|=256),w=vf(S,w,!1),w!==2){if(hf&&!_){S.errorRecoveryDisabledLanes|=x,dr|=x,m=4;break e}x=gn,gn=m,x!==null&&(gn===null?gn=x:gn.push.apply(gn,x))}m=w}if(x=!1,m!==2)continue}}if(m===1){ol(t,0),Ni(t,n,0,!0);break}e:{switch(c=t,x=m,x){case 0:case 1:throw Error(l(345));case 4:if((n&4194048)!==n)break;case 6:Ni(c,n,Mn,!wi);break e;case 2:gn=null;break;case 3:case 5:break;default:throw Error(l(329))}if((n&62914560)===n&&(m=dc+300-et(),10<m)){if(Ni(c,n,Mn,!wi),Ar(c,0,!0)!==0)break e;Ja=n,c.timeoutHandle=zg(Yx.bind(null,c,s,gn,hc,pf,n,Mn,dr,ll,wi,x,"Throttled",-0,0),m);break e}Yx(c,s,gn,hc,pf,n,Mn,dr,ll,wi,x,null,-0,0)}}break}while(!0);ka(t)}function Yx(t,n,s,c,m,x,w,S,_,Q,ne,se,J,W){if(t.timeoutHandle=-1,se=n.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_a},Ix(n,x,se);var we=(x&62914560)===x?dc-et():(x&4194048)===x?Px-et():0;if(we=wj(se,we),we!==null){Ja=x,t.cancelPendingCommit=we(tg.bind(null,t,n,x,s,c,m,w,S,_,ne,se,null,J,W)),Ni(t,x,w,!Q);return}}tg(t,n,x,s,c,m,w,S,_)}function Bw(t){for(var n=t;;){var s=n.tag;if((s===0||s===11||s===15)&&n.flags&16384&&(s=n.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var c=0;c<s.length;c++){var m=s[c],x=m.getSnapshot;m=m.value;try{if(!Sn(x(),m))return!1}catch{return!1}}if(s=n.child,n.subtreeFlags&16384&&s!==null)s.return=n,n=s;else{if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ni(t,n,s,c){n&=~mf,n&=~dr,t.suspendedLanes|=n,t.pingedLanes&=~n,c&&(t.warmLanes|=n),c=t.expirationTimes;for(var m=n;0<m;){var x=31-Qe(m),w=1<<x;c[x]=-1,m&=~w}s!==0&&va(t,s,n)}function mc(){return(We&6)===0?(Ms(0),!1):!0}function yf(){if(He!==null){if(nt===0)var t=He.return;else t=He,Ia=nr=null,Rd(t),Kr=null,hs=0,t=He;for(;t!==null;)kx(t.alternate,t),t=t.return;He=null}}function ol(t,n){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,aj(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),Ja=0,yf(),ut=t,He=s=Ba(t.current,null),Pe=n,nt=0,An=null,wi=!1,rl=Te(t,n),hf=!1,ll=Mn=mf=dr=ji=wt=0,gn=Ts=null,pf=!1,(n&8)!==0&&(n|=n&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=n;0<c;){var m=31-Qe(c),x=1<<m;n|=t[m],c&=~x}return Xa=n,_o(),s}function Qx(t,n){Oe=null,B.H=ws,n===Zr||n===Po?(n=up(),nt=3):n===jd?(n=up(),nt=4):nt=n===Jd?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,An=n,He===null&&(wt=1,ac(t,Pn(n,t.current)))}function Xx(){var t=En.current;return t===null?!0:(Pe&4194048)===Pe?Yn===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?t===Yn:!1}function Jx(){var t=B.H;return B.H=ws,t===null?ws:t}function Zx(){var t=B.A;return B.A=_w,t}function pc(){wt=4,wi||(Pe&4194048)!==Pe&&En.current!==null||(rl=!0),(ji&134217727)===0&&(dr&134217727)===0||ut===null||Ni(ut,Pe,Mn,!1)}function vf(t,n,s){var c=We;We|=2;var m=Jx(),x=Zx();(ut!==t||Pe!==n)&&(hc=null,ol(t,n)),n=!1;var w=wt;e:do try{if(nt!==0&&He!==null){var S=He,_=An;switch(nt){case 8:yf(),w=6;break e;case 3:case 2:case 9:case 6:En.current===null&&(n=!0);var Q=nt;if(nt=0,An=null,cl(t,S,_,Q),s&&rl){w=0;break e}break;default:Q=nt,nt=0,An=null,cl(t,S,_,Q)}}Uw(),w=wt;break}catch(ne){Qx(t,ne)}while(!0);return n&&t.shellSuspendCounter++,Ia=nr=null,We=c,B.H=m,B.A=x,He===null&&(ut=null,Pe=0,_o()),w}function Uw(){for(;He!==null;)Kx(He)}function Iw(t,n){var s=We;We|=2;var c=Jx(),m=Zx();ut!==t||Pe!==n?(hc=null,fc=et()+500,ol(t,n)):rl=Te(t,n);e:do try{if(nt!==0&&He!==null){n=He;var x=An;t:switch(nt){case 1:nt=0,An=null,cl(t,n,x,1);break;case 2:case 9:if(op(x)){nt=0,An=null,Wx(n);break}n=function(){nt!==2&&nt!==9||ut!==t||(nt=7),ka(t)},x.then(n,n);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:op(x)?(nt=0,An=null,Wx(n)):(nt=0,An=null,cl(t,n,x,7));break;case 5:var w=null;switch(He.tag){case 26:w=He.memoizedState;case 5:case 27:var S=He;if(w?Ug(w):S.stateNode.complete){nt=0,An=null;var _=S.sibling;if(_!==null)He=_;else{var Q=S.return;Q!==null?(He=Q,xc(Q)):He=null}break t}}nt=0,An=null,cl(t,n,x,5);break;case 6:nt=0,An=null,cl(t,n,x,6);break;case 8:yf(),wt=6;break e;default:throw Error(l(462))}}Hw();break}catch(ne){Qx(t,ne)}while(!0);return Ia=nr=null,B.H=c,B.A=m,We=s,He!==null?0:(ut=null,Pe=0,_o(),wt)}function Hw(){for(;He!==null&&!Be();)Kx(He)}function Kx(t){var n=jx(t.alternate,t,Xa);t.memoizedProps=t.pendingProps,n===null?xc(t):He=n}function Wx(t){var n=t,s=n.alternate;switch(n.tag){case 15:case 0:n=xx(s,n,n.pendingProps,n.type,void 0,Pe);break;case 11:n=xx(s,n,n.pendingProps,n.type.render,n.ref,Pe);break;case 5:Rd(n);default:kx(s,n),n=He=Z0(n,Xa),n=jx(s,n,Xa)}t.memoizedProps=t.pendingProps,n===null?xc(t):He=n}function cl(t,n,s,c){Ia=nr=null,Rd(n),Kr=null,hs=0;var m=n.return;try{if(Ew(t,m,n,s,Pe)){wt=1,ac(t,Pn(s,t.current)),He=null;return}}catch(x){if(m!==null)throw He=m,x;wt=1,ac(t,Pn(s,t.current)),He=null;return}n.flags&32768?(Ge||c===1?t=!0:rl||(Pe&536870912)!==0?t=!1:(wi=t=!0,(c===2||c===9||c===3||c===6)&&(c=En.current,c!==null&&c.tag===13&&(c.flags|=16384))),eg(n,t)):xc(n)}function xc(t){var n=t;do{if((n.flags&32768)!==0){eg(n,wi);return}t=n.return;var s=Mw(n.alternate,n,Xa);if(s!==null){He=s;return}if(n=n.sibling,n!==null){He=n;return}He=n=t}while(n!==null);wt===0&&(wt=5)}function eg(t,n){do{var s=Dw(t.alternate,t);if(s!==null){s.flags&=32767,He=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!n&&(t=t.sibling,t!==null)){He=t;return}He=t=s}while(t!==null);wt=6,He=null}function tg(t,n,s,c,m,x,w,S,_){t.cancelPendingCommit=null;do gc();while(Rt!==0);if((We&6)!==0)throw Error(l(327));if(n!==null){if(n===t.current)throw Error(l(177));if(x=n.lanes|n.childLanes,x|=sd,ya(t,s,x,w,S,_),t===ut&&(He=ut=null,Pe=0),sl=n,ki=t,Ja=s,xf=x,gf=m,$x=c,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,$w(Ee,function(){return lg(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||c){c=B.T,B.T=null,m=X.p,X.p=2,w=We,We|=4;try{Ow(t,n,s)}finally{We=w,X.p=m,B.T=c}}Rt=1,ng(),ag(),ig()}}function ng(){if(Rt===1){Rt=0;var t=ki,n=sl,s=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||s){s=B.T,B.T=null;var c=X.p;X.p=2;var m=We;We|=4;try{Lx(n,t);var x=Df,w=F0(t.containerInfo),S=x.focusedElem,_=x.selectionRange;if(w!==S&&S&&S.ownerDocument&&q0(S.ownerDocument.documentElement,S)){if(_!==null&&nd(S)){var Q=_.start,ne=_.end;if(ne===void 0&&(ne=Q),"selectionStart"in S)S.selectionStart=Q,S.selectionEnd=Math.min(ne,S.value.length);else{var se=S.ownerDocument||document,J=se&&se.defaultView||window;if(J.getSelection){var W=J.getSelection(),we=S.textContent.length,Ce=Math.min(_.start,we),st=_.end===void 0?Ce:Math.min(_.end,we);!W.extend&&Ce>st&&(w=st,st=Ce,Ce=w);var q=H0(S,Ce),I=H0(S,st);if(q&&I&&(W.rangeCount!==1||W.anchorNode!==q.node||W.anchorOffset!==q.offset||W.focusNode!==I.node||W.focusOffset!==I.offset)){var G=se.createRange();G.setStart(q.node,q.offset),W.removeAllRanges(),Ce>st?(W.addRange(G),W.extend(I.node,I.offset)):(G.setEnd(I.node,I.offset),W.addRange(G))}}}}for(se=[],W=S;W=W.parentNode;)W.nodeType===1&&se.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<se.length;S++){var le=se[S];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Tc=!!Mf,Df=Mf=null}finally{We=m,X.p=c,B.T=s}}t.current=n,Rt=2}}function ag(){if(Rt===2){Rt=0;var t=ki,n=sl,s=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||s){s=B.T,B.T=null;var c=X.p;X.p=2;var m=We;We|=4;try{Mx(t,n.alternate,n)}finally{We=m,X.p=c,B.T=s}}Rt=3}}function ig(){if(Rt===4||Rt===3){Rt=0,Ie();var t=ki,n=sl,s=Ja,c=$x;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Rt=5:(Rt=0,sl=ki=null,rg(t,t.pendingLanes));var m=t.pendingLanes;if(m===0&&(zi=null),Bu(s),n=n.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(Ot,n,void 0,(n.current.flags&128)===128)}catch{}if(c!==null){n=B.T,m=X.p,X.p=2,B.T=null;try{for(var x=t.onRecoverableError,w=0;w<c.length;w++){var S=c[w];x(S.value,{componentStack:S.stack})}}finally{B.T=n,X.p=m}}(Ja&3)!==0&&gc(),ka(t),m=t.pendingLanes,(s&261930)!==0&&(m&42)!==0?t===bf?As++:(As=0,bf=t):As=0,Ms(0)}}function rg(t,n){(t.pooledCacheLanes&=n)===0&&(n=t.pooledCache,n!=null&&(t.pooledCache=null,ds(n)))}function gc(){return ng(),ag(),ig(),lg()}function lg(){if(Rt!==5)return!1;var t=ki,n=xf;xf=0;var s=Bu(Ja),c=B.T,m=X.p;try{X.p=32>s?32:s,B.T=null,s=gf,gf=null;var x=ki,w=Ja;if(Rt=0,sl=ki=null,Ja=0,(We&6)!==0)throw Error(l(331));var S=We;if(We|=4,qx(x.current),Ux(x,x.current,w,s),We=S,Ms(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(Ot,x)}catch{}return!0}finally{X.p=m,B.T=c,rg(t,n)}}function sg(t,n,s){n=Pn(s,n),n=Xd(t.stateNode,n,2),t=gi(t,n,2),t!==null&&(qt(t,2),ka(t))}function at(t,n,s){if(t.tag===3)sg(t,t,s);else for(;n!==null;){if(n.tag===3){sg(n,t,s);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(zi===null||!zi.has(c))){t=Pn(s,t),s=ox(2),c=gi(n,s,2),c!==null&&(cx(s,c,n,t),qt(c,2),ka(c));break}}n=n.return}}function wf(t,n,s){var c=t.pingCache;if(c===null){c=t.pingCache=new Lw;var m=new Set;c.set(n,m)}else m=c.get(n),m===void 0&&(m=new Set,c.set(n,m));m.has(s)||(hf=!0,m.add(s),t=qw.bind(null,t,n,s),n.then(t,t))}function qw(t,n,s){var c=t.pingCache;c!==null&&c.delete(n),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,ut===t&&(Pe&s)===s&&(wt===4||wt===3&&(Pe&62914560)===Pe&&300>et()-dc?(We&2)===0&&ol(t,0):mf|=s,ll===Pe&&(ll=0)),ka(t)}function og(t,n){n===0&&(n=ct()),t=Wi(t,n),t!==null&&(qt(t,n),ka(t))}function Fw(t){var n=t.memoizedState,s=0;n!==null&&(s=n.retryLane),og(t,s)}function Pw(t,n){var s=0;switch(t.tag){case 31:case 13:var c=t.stateNode,m=t.memoizedState;m!==null&&(s=m.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(l(314))}c!==null&&c.delete(n),og(t,s)}function $w(t,n){return Me(t,n)}var bc=null,ul=null,jf=!1,yc=!1,zf=!1,Si=0;function ka(t){t!==ul&&t.next===null&&(ul===null?bc=ul=t:ul=ul.next=t),yc=!0,jf||(jf=!0,Gw())}function Ms(t,n){if(!zf&&yc){zf=!0;do for(var s=!1,c=bc;c!==null;){if(t!==0){var m=c.pendingLanes;if(m===0)var x=0;else{var w=c.suspendedLanes,S=c.pingedLanes;x=(1<<31-Qe(42|t)+1)-1,x&=m&~(w&~S),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(s=!0,fg(c,x))}else x=Pe,x=Ar(c,c===ut?x:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(x&3)===0||Te(c,x)||(s=!0,fg(c,x));c=c.next}while(s);zf=!1}}function Vw(){cg()}function cg(){yc=jf=!1;var t=0;Si!==0&&nj()&&(t=Si);for(var n=et(),s=null,c=bc;c!==null;){var m=c.next,x=ug(c,n);x===0?(c.next=null,s===null?bc=m:s.next=m,m===null&&(ul=s)):(s=c,(t!==0||(x&3)!==0)&&(yc=!0)),c=m}Rt!==0&&Rt!==5||Ms(t),Si!==0&&(Si=0)}function ug(t,n){for(var s=t.suspendedLanes,c=t.pingedLanes,m=t.expirationTimes,x=t.pendingLanes&-62914561;0<x;){var w=31-Qe(x),S=1<<w,_=m[w];_===-1?((S&s)===0||(S&c)!==0)&&(m[w]=tt(S,n)):_<=n&&(t.expiredLanes|=S),x&=~S}if(n=ut,s=Pe,s=Ar(t,t===n?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,s===0||t===n&&(nt===2||nt===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&ze(c),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||Te(t,s)){if(n=s&-s,n===t.callbackPriority)return n;switch(c!==null&&ze(c),Bu(s)){case 2:case 8:s=fe;break;case 32:s=Ee;break;case 268435456:s=Ve;break;default:s=Ee}return c=dg.bind(null,t),s=Me(s,c),t.callbackPriority=n,t.callbackNode=s,n}return c!==null&&c!==null&&ze(c),t.callbackPriority=2,t.callbackNode=null,2}function dg(t,n){if(Rt!==0&&Rt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(gc()&&t.callbackNode!==s)return null;var c=Pe;return c=Ar(t,t===ut?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(Gx(t,c,n),ug(t,et()),t.callbackNode!=null&&t.callbackNode===s?dg.bind(null,t):null)}function fg(t,n){if(gc())return null;Gx(t,n,!0)}function Gw(){ij(function(){(We&6)!==0?Me(K,Vw):cg()})}function kf(){if(Si===0){var t=Xr;t===0&&(t=Qi,Qi<<=1,(Qi&261888)===0&&(Qi=256)),Si=t}return Si}function hg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Co(""+t)}function mg(t,n){var s=n.ownerDocument.createElement("input");return s.name=n.name,s.value=n.value,t.id&&s.setAttribute("form",t.id),n.parentNode.insertBefore(s,n),t=new FormData(t),s.parentNode.removeChild(s),t}function Yw(t,n,s,c,m){if(n==="submit"&&s&&s.stateNode===m){var x=hg((m[fn]||null).action),w=c.submitter;w&&(n=(n=w[fn]||null)?hg(n.formAction):w.getAttribute("formAction"),n!==null&&(x=n,w=null));var S=new Mo("action","action",null,c,m);t.push({event:S,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Si!==0){var _=w?mg(m,w):new FormData(m);Pd(s,{pending:!0,data:_,method:m.method,action:x},null,_)}}else typeof x=="function"&&(S.preventDefault(),_=w?mg(m,w):new FormData(m),Pd(s,{pending:!0,data:_,method:m.method,action:x},x,_))},currentTarget:m}]})}}for(var Nf=0;Nf<ld.length;Nf++){var Sf=ld[Nf],Qw=Sf.toLowerCase(),Xw=Sf[0].toUpperCase()+Sf.slice(1);aa(Qw,"on"+Xw)}aa(V0,"onAnimationEnd"),aa(G0,"onAnimationIteration"),aa(Y0,"onAnimationStart"),aa("dblclick","onDoubleClick"),aa("focusin","onFocus"),aa("focusout","onBlur"),aa(dw,"onTransitionRun"),aa(fw,"onTransitionStart"),aa(hw,"onTransitionCancel"),aa(Q0,"onTransitionEnd"),_r("onMouseEnter",["mouseout","mouseover"]),_r("onMouseLeave",["mouseout","mouseover"]),_r("onPointerEnter",["pointerout","pointerover"]),_r("onPointerLeave",["pointerout","pointerover"]),Xi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ds="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(" "),Jw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ds));function pg(t,n){n=(n&4)!==0;for(var s=0;s<t.length;s++){var c=t[s],m=c.event;c=c.listeners;e:{var x=void 0;if(n)for(var w=c.length-1;0<=w;w--){var S=c[w],_=S.instance,Q=S.currentTarget;if(S=S.listener,_!==x&&m.isPropagationStopped())break e;x=S,m.currentTarget=Q;try{x(m)}catch(ne){Ro(ne)}m.currentTarget=null,x=_}else for(w=0;w<c.length;w++){if(S=c[w],_=S.instance,Q=S.currentTarget,S=S.listener,_!==x&&m.isPropagationStopped())break e;x=S,m.currentTarget=Q;try{x(m)}catch(ne){Ro(ne)}m.currentTarget=null,x=_}}}}function qe(t,n){var s=n[Uu];s===void 0&&(s=n[Uu]=new Set);var c=t+"__bubble";s.has(c)||(xg(n,t,2,!1),s.add(c))}function Cf(t,n,s){var c=0;n&&(c|=4),xg(s,t,c,n)}var vc="_reactListening"+Math.random().toString(36).slice(2);function Ef(t){if(!t[vc]){t[vc]=!0,c0.forEach(function(s){s!=="selectionchange"&&(Jw.has(s)||Cf(s,!1,t),Cf(s,!0,t))});var n=t.nodeType===9?t:t.ownerDocument;n===null||n[vc]||(n[vc]=!0,Cf("selectionchange",!1,n))}}function xg(t,n,s,c){switch(Vg(n)){case 2:var m=kj;break;case 8:m=Nj;break;default:m=Pf}s=m.bind(null,n,s,t),m=void 0,!Yu||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(m=!0),c?m!==void 0?t.addEventListener(n,s,{capture:!0,passive:m}):t.addEventListener(n,s,!0):m!==void 0?t.addEventListener(n,s,{passive:m}):t.addEventListener(n,s,!1)}function Tf(t,n,s,c,m){var x=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var S=c.stateNode.containerInfo;if(S===m)break;if(w===4)for(w=c.return;w!==null;){var _=w.tag;if((_===3||_===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;S!==null;){if(w=Dr(S),w===null)return;if(_=w.tag,_===5||_===6||_===26||_===27){c=x=w;continue e}S=S.parentNode}}c=c.return}w0(function(){var Q=x,ne=Vu(s),se=[];e:{var J=X0.get(t);if(J!==void 0){var W=Mo,we=t;switch(t){case"keypress":if(To(s)===0)break e;case"keydown":case"keyup":W=P2;break;case"focusin":we="focus",W=Zu;break;case"focusout":we="blur",W=Zu;break;case"beforeblur":case"afterblur":W=Zu;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=k0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=M2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=G2;break;case V0:case G0:case Y0:W=R2;break;case Q0:W=Q2;break;case"scroll":case"scrollend":W=T2;break;case"wheel":W=J2;break;case"copy":case"cut":case"paste":W=L2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=S0;break;case"toggle":case"beforetoggle":W=K2}var Ce=(n&4)!==0,st=!Ce&&(t==="scroll"||t==="scrollend"),q=Ce?J!==null?J+"Capture":null:J;Ce=[];for(var I=Q,G;I!==null;){var le=I;if(G=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||G===null||q===null||(le=es(I,q),le!=null&&Ce.push(Os(I,le,G))),st)break;I=I.return}0<Ce.length&&(J=new W(J,we,null,s,ne),se.push({event:J,listeners:Ce}))}}if((n&7)===0){e:{if(J=t==="mouseover"||t==="pointerover",W=t==="mouseout"||t==="pointerout",J&&s!==$u&&(we=s.relatedTarget||s.fromElement)&&(Dr(we)||we[Mr]))break e;if((W||J)&&(J=ne.window===ne?ne:(J=ne.ownerDocument)?J.defaultView||J.parentWindow:window,W?(we=s.relatedTarget||s.toElement,W=Q,we=we?Dr(we):null,we!==null&&(st=u(we),Ce=we.tag,we!==st||Ce!==5&&Ce!==27&&Ce!==6)&&(we=null)):(W=null,we=Q),W!==we)){if(Ce=k0,le="onMouseLeave",q="onMouseEnter",I="mouse",(t==="pointerout"||t==="pointerover")&&(Ce=S0,le="onPointerLeave",q="onPointerEnter",I="pointer"),st=W==null?J:Wl(W),G=we==null?J:Wl(we),J=new Ce(le,I+"leave",W,s,ne),J.target=st,J.relatedTarget=G,le=null,Dr(ne)===Q&&(Ce=new Ce(q,I+"enter",we,s,ne),Ce.target=G,Ce.relatedTarget=st,le=Ce),st=le,W&&we)t:{for(Ce=Zw,q=W,I=we,G=0,le=q;le;le=Ce(le))G++;le=0;for(var ke=I;ke;ke=Ce(ke))le++;for(;0<G-le;)q=Ce(q),G--;for(;0<le-G;)I=Ce(I),le--;for(;G--;){if(q===I||I!==null&&q===I.alternate){Ce=q;break t}q=Ce(q),I=Ce(I)}Ce=null}else Ce=null;W!==null&&gg(se,J,W,Ce,!1),we!==null&&st!==null&&gg(se,st,we,Ce,!0)}}e:{if(J=Q?Wl(Q):window,W=J.nodeName&&J.nodeName.toLowerCase(),W==="select"||W==="input"&&J.type==="file")var Ze=R0;else if(D0(J))if(_0)Ze=ow;else{Ze=lw;var je=rw}else W=J.nodeName,!W||W.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Q&&Pu(Q.elementType)&&(Ze=R0):Ze=sw;if(Ze&&(Ze=Ze(t,Q))){O0(se,Ze,s,ne);break e}je&&je(t,J,Q),t==="focusout"&&Q&&J.type==="number"&&Q.memoizedProps.value!=null&&Fu(J,"number",J.value)}switch(je=Q?Wl(Q):window,t){case"focusin":(D0(je)||je.contentEditable==="true")&&(qr=je,ad=Q,os=null);break;case"focusout":os=ad=qr=null;break;case"mousedown":id=!0;break;case"contextmenu":case"mouseup":case"dragend":id=!1,P0(se,s,ne);break;case"selectionchange":if(uw)break;case"keydown":case"keyup":P0(se,s,ne)}var Re;if(Wu)e:{switch(t){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else Hr?A0(t,s)&&($e="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&($e="onCompositionStart");$e&&(C0&&s.locale!=="ko"&&(Hr||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Hr&&(Re=j0()):(ui=ne,Qu="value"in ui?ui.value:ui.textContent,Hr=!0)),je=wc(Q,$e),0<je.length&&($e=new N0($e,t,null,s,ne),se.push({event:$e,listeners:je}),Re?$e.data=Re:(Re=M0(s),Re!==null&&($e.data=Re)))),(Re=ew?tw(t,s):nw(t,s))&&($e=wc(Q,"onBeforeInput"),0<$e.length&&(je=new N0("onBeforeInput","beforeinput",null,s,ne),se.push({event:je,listeners:$e}),je.data=Re)),Yw(se,t,Q,s,ne)}pg(se,n)})}function Os(t,n,s){return{instance:t,listener:n,currentTarget:s}}function wc(t,n){for(var s=n+"Capture",c=[];t!==null;){var m=t,x=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||x===null||(m=es(t,s),m!=null&&c.unshift(Os(t,m,x)),m=es(t,n),m!=null&&c.push(Os(t,m,x))),t.tag===3)return c;t=t.return}return[]}function Zw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function gg(t,n,s,c,m){for(var x=n._reactName,w=[];s!==null&&s!==c;){var S=s,_=S.alternate,Q=S.stateNode;if(S=S.tag,_!==null&&_===c)break;S!==5&&S!==26&&S!==27||Q===null||(_=Q,m?(Q=es(s,x),Q!=null&&w.unshift(Os(s,Q,_))):m||(Q=es(s,x),Q!=null&&w.push(Os(s,Q,_)))),s=s.return}w.length!==0&&t.push({event:n,listeners:w})}var Kw=/\r\n?/g,Ww=/\u0000|\uFFFD/g;function bg(t){return(typeof t=="string"?t:""+t).replace(Kw,`
`).replace(Ww,"")}function yg(t,n){return n=bg(n),bg(t)===n}function lt(t,n,s,c,m,x){switch(s){case"children":typeof c=="string"?n==="body"||n==="textarea"&&c===""||Br(t,c):(typeof c=="number"||typeof c=="bigint")&&n!=="body"&&Br(t,""+c);break;case"className":No(t,"class",c);break;case"tabIndex":No(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":No(t,s,c);break;case"style":y0(t,c,x);break;case"data":if(n!=="object"){No(t,"data",c);break}case"src":case"href":if(c===""&&(n!=="a"||s!=="href")){t.removeAttribute(s);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=Co(""+c),t.setAttribute(s,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(s,"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 x=="function"&&(s==="formAction"?(n!=="input"&&lt(t,n,"name",m.name,m,null),lt(t,n,"formEncType",m.formEncType,m,null),lt(t,n,"formMethod",m.formMethod,m,null),lt(t,n,"formTarget",m.formTarget,m,null)):(lt(t,n,"encType",m.encType,m,null),lt(t,n,"method",m.method,m,null),lt(t,n,"target",m.target,m,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=Co(""+c),t.setAttribute(s,c);break;case"onClick":c!=null&&(t.onclick=_a);break;case"onScroll":c!=null&&qe("scroll",t);break;case"onScrollEnd":c!=null&&qe("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(s=c.__html,s!=null){if(m.children!=null)throw Error(l(60));t.innerHTML=s}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}s=Co(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""+c):t.removeAttribute(s);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":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":c===!0?t.setAttribute(s,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,c):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(s,c):t.removeAttribute(s);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(s):t.setAttribute(s,c);break;case"popover":qe("beforetoggle",t),qe("toggle",t),ko(t,"popover",c);break;case"xlinkActuate":Ra(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Ra(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Ra(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Ra(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Ra(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Ra(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Ra(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":ko(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=C2.get(s)||s,ko(t,s,c))}}function Af(t,n,s,c,m,x){switch(s){case"style":y0(t,c,x);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(s=c.__html,s!=null){if(m.children!=null)throw Error(l(60));t.innerHTML=s}}break;case"children":typeof c=="string"?Br(t,c):(typeof c=="number"||typeof c=="bigint")&&Br(t,""+c);break;case"onScroll":c!=null&&qe("scroll",t);break;case"onScrollEnd":c!=null&&qe("scrollend",t);break;case"onClick":c!=null&&(t.onclick=_a);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!u0.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(m=s.endsWith("Capture"),n=s.slice(2,m?s.length-7:void 0),x=t[fn]||null,x=x!=null?x[s]:null,typeof x=="function"&&t.removeEventListener(n,x,m),typeof c=="function")){typeof x!="function"&&x!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(n,c,m);break e}s in t?t[s]=c:c===!0?t.setAttribute(s,""):ko(t,s,c)}}}function Gt(t,n,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",t),qe("load",t);var c=!1,m=!1,x;for(x in s)if(s.hasOwnProperty(x)){var w=s[x];if(w!=null)switch(x){case"src":c=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:lt(t,n,x,w,s,null)}}m&&lt(t,n,"srcSet",s.srcSet,s,null),c&&lt(t,n,"src",s.src,s,null);return;case"input":qe("invalid",t);var S=x=w=m=null,_=null,Q=null;for(c in s)if(s.hasOwnProperty(c)){var ne=s[c];if(ne!=null)switch(c){case"name":m=ne;break;case"type":w=ne;break;case"checked":_=ne;break;case"defaultChecked":Q=ne;break;case"value":x=ne;break;case"defaultValue":S=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(l(137,n));break;default:lt(t,n,c,ne,s,null)}}p0(t,x,S,_,Q,w,m,!1);return;case"select":qe("invalid",t),c=w=x=null;for(m in s)if(s.hasOwnProperty(m)&&(S=s[m],S!=null))switch(m){case"value":x=S;break;case"defaultValue":w=S;break;case"multiple":c=S;default:lt(t,n,m,S,s,null)}n=x,s=w,t.multiple=!!c,n!=null?Lr(t,!!c,n,!1):s!=null&&Lr(t,!!c,s,!0);return;case"textarea":qe("invalid",t),x=m=c=null;for(w in s)if(s.hasOwnProperty(w)&&(S=s[w],S!=null))switch(w){case"value":c=S;break;case"defaultValue":m=S;break;case"children":x=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(l(91));break;default:lt(t,n,w,S,s,null)}g0(t,c,m,x);return;case"option":for(_ in s)if(s.hasOwnProperty(_)&&(c=s[_],c!=null))switch(_){case"selected":t.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:lt(t,n,_,c,s,null)}return;case"dialog":qe("beforetoggle",t),qe("toggle",t),qe("cancel",t),qe("close",t);break;case"iframe":case"object":qe("load",t);break;case"video":case"audio":for(c=0;c<Ds.length;c++)qe(Ds[c],t);break;case"image":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"embed":case"source":case"link":qe("error",t),qe("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Q in s)if(s.hasOwnProperty(Q)&&(c=s[Q],c!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,n));default:lt(t,n,Q,c,s,null)}return;default:if(Pu(n)){for(ne in s)s.hasOwnProperty(ne)&&(c=s[ne],c!==void 0&&Af(t,n,ne,c,s,void 0));return}}for(S in s)s.hasOwnProperty(S)&&(c=s[S],c!=null&&lt(t,n,S,c,s,null))}function ej(t,n,s,c){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,x=null,w=null,S=null,_=null,Q=null,ne=null;for(W in s){var se=s[W];if(s.hasOwnProperty(W)&&se!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":_=se;default:c.hasOwnProperty(W)||lt(t,n,W,null,c,se)}}for(var J in c){var W=c[J];if(se=s[J],c.hasOwnProperty(J)&&(W!=null||se!=null))switch(J){case"type":x=W;break;case"name":m=W;break;case"checked":Q=W;break;case"defaultChecked":ne=W;break;case"value":w=W;break;case"defaultValue":S=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(l(137,n));break;default:W!==se&&lt(t,n,J,W,c,se)}}qu(t,w,S,_,Q,ne,x,m);return;case"select":W=w=S=J=null;for(x in s)if(_=s[x],s.hasOwnProperty(x)&&_!=null)switch(x){case"value":break;case"multiple":W=_;default:c.hasOwnProperty(x)||lt(t,n,x,null,c,_)}for(m in c)if(x=c[m],_=s[m],c.hasOwnProperty(m)&&(x!=null||_!=null))switch(m){case"value":J=x;break;case"defaultValue":S=x;break;case"multiple":w=x;default:x!==_&&lt(t,n,m,x,c,_)}n=S,s=w,c=W,J!=null?Lr(t,!!s,J,!1):!!c!=!!s&&(n!=null?Lr(t,!!s,n,!0):Lr(t,!!s,s?[]:"",!1));return;case"textarea":W=J=null;for(S in s)if(m=s[S],s.hasOwnProperty(S)&&m!=null&&!c.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:lt(t,n,S,null,c,m)}for(w in c)if(m=c[w],x=s[w],c.hasOwnProperty(w)&&(m!=null||x!=null))switch(w){case"value":J=m;break;case"defaultValue":W=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(l(91));break;default:m!==x&&lt(t,n,w,m,c,x)}x0(t,J,W);return;case"option":for(var we in s)if(J=s[we],s.hasOwnProperty(we)&&J!=null&&!c.hasOwnProperty(we))switch(we){case"selected":t.selected=!1;break;default:lt(t,n,we,null,c,J)}for(_ in c)if(J=c[_],W=s[_],c.hasOwnProperty(_)&&J!==W&&(J!=null||W!=null))switch(_){case"selected":t.selected=J&&typeof J!="function"&&typeof J!="symbol";break;default:lt(t,n,_,J,c,W)}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 Ce in s)J=s[Ce],s.hasOwnProperty(Ce)&&J!=null&&!c.hasOwnProperty(Ce)&&lt(t,n,Ce,null,c,J);for(Q in c)if(J=c[Q],W=s[Q],c.hasOwnProperty(Q)&&J!==W&&(J!=null||W!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(l(137,n));break;default:lt(t,n,Q,J,c,W)}return;default:if(Pu(n)){for(var st in s)J=s[st],s.hasOwnProperty(st)&&J!==void 0&&!c.hasOwnProperty(st)&&Af(t,n,st,void 0,c,J);for(ne in c)J=c[ne],W=s[ne],!c.hasOwnProperty(ne)||J===W||J===void 0&&W===void 0||Af(t,n,ne,J,c,W);return}}for(var q in s)J=s[q],s.hasOwnProperty(q)&&J!=null&&!c.hasOwnProperty(q)&&lt(t,n,q,null,c,J);for(se in c)J=c[se],W=s[se],!c.hasOwnProperty(se)||J===W||J==null&&W==null||lt(t,n,se,J,c,W)}function vg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function tj(){if(typeof performance.getEntriesByType=="function"){for(var t=0,n=0,s=performance.getEntriesByType("resource"),c=0;c<s.length;c++){var m=s[c],x=m.transferSize,w=m.initiatorType,S=m.duration;if(x&&S&&vg(w)){for(w=0,S=m.responseEnd,c+=1;c<s.length;c++){var _=s[c],Q=_.startTime;if(Q>S)break;var ne=_.transferSize,se=_.initiatorType;ne&&vg(se)&&(_=_.responseEnd,w+=ne*(_<S?1:(S-Q)/(_-Q)))}if(--c,n+=8*(x+w)/(m.duration/1e3),t++,10<t)break}}if(0<t)return n/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Mf=null,Df=null;function jc(t){return t.nodeType===9?t:t.ownerDocument}function wg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function jg(t,n){if(t===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&n==="foreignObject"?0:t}function Of(t,n){return t==="textarea"||t==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Rf=null;function nj(){var t=window.event;return t&&t.type==="popstate"?t===Rf?!1:(Rf=t,!0):(Rf=null,!1)}var zg=typeof setTimeout=="function"?setTimeout:void 0,aj=typeof clearTimeout=="function"?clearTimeout:void 0,kg=typeof Promise=="function"?Promise:void 0,ij=typeof queueMicrotask=="function"?queueMicrotask:typeof kg<"u"?function(t){return kg.resolve(null).then(t).catch(rj)}:zg;function rj(t){setTimeout(function(){throw t})}function Ci(t){return t==="head"}function Ng(t,n){var s=n,c=0;do{var m=s.nextSibling;if(t.removeChild(s),m&&m.nodeType===8)if(s=m.data,s==="/$"||s==="/&"){if(c===0){t.removeChild(m),ml(n);return}c--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")c++;else if(s==="html")Rs(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,Rs(s);for(var x=s.firstChild;x;){var w=x.nextSibling,S=x.nodeName;x[Kl]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&x.rel.toLowerCase()==="stylesheet"||s.removeChild(x),x=w}}else s==="body"&&Rs(t.ownerDocument.body);s=m}while(s);ml(n)}function Sg(t,n){var s=t;t=0;do{var c=s.nextSibling;if(s.nodeType===1?n?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(n?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=c}while(s)}function _f(t){var n=t.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var s=n;switch(n=n.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":_f(s),Iu(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function lj(t,n,s,c){for(;t.nodeType===1;){var m=s;if(t.nodeName.toLowerCase()!==n.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[Kl])switch(n){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(x=t.getAttribute("rel"),x==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(x!==m.rel||t.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||t.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||t.getAttribute("title")!==(m.title==null?null:m.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(x=t.getAttribute("src"),(x!==(m.src==null?null:m.src)||t.getAttribute("type")!==(m.type==null?null:m.type)||t.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&x&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(n==="input"&&t.type==="hidden"){var x=m.name==null?null:""+m.name;if(m.type==="hidden"&&t.getAttribute("name")===x)return t}else return t;if(t=Qn(t.nextSibling),t===null)break}return null}function sj(t,n,s){if(n==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=Qn(t.nextSibling),t===null))return null;return t}function Cg(t,n){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=Qn(t.nextSibling),t===null))return null;return t}function Lf(t){return t.data==="$?"||t.data==="$~"}function Bf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function oj(t,n){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=n;else if(t.data!=="$?"||s.readyState!=="loading")n();else{var c=function(){n(),s.removeEventListener("DOMContentLoaded",c)};s.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function Qn(t){for(;t!=null;t=t.nextSibling){var n=t.nodeType;if(n===1||n===3)break;if(n===8){if(n=t.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return t}var Uf=null;function Eg(t){t=t.nextSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(n===0)return Qn(t.nextSibling);n--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||n++}t=t.nextSibling}return null}function Tg(t){t=t.previousSibling;for(var n=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(n===0)return t;n--}else s!=="/$"&&s!=="/&"||n++}t=t.previousSibling}return null}function Ag(t,n,s){switch(n=jc(s),t){case"html":if(t=n.documentElement,!t)throw Error(l(452));return t;case"head":if(t=n.head,!t)throw Error(l(453));return t;case"body":if(t=n.body,!t)throw Error(l(454));return t;default:throw Error(l(451))}}function Rs(t){for(var n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Iu(t)}var Xn=new Map,Mg=new Set;function zc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Za=X.d;X.d={f:cj,r:uj,D:dj,C:fj,L:hj,m:mj,X:xj,S:pj,M:gj};function cj(){var t=Za.f(),n=mc();return t||n}function uj(t){var n=Or(t);n!==null&&n.tag===5&&n.type==="form"?Qp(n):Za.r(t)}var dl=typeof document>"u"?null:document;function Dg(t,n,s){var c=dl;if(c&&typeof n=="string"&&n){var m=qn(n);m='link[rel="'+t+'"][href="'+m+'"]',typeof s=="string"&&(m+='[crossorigin="'+s+'"]'),Mg.has(m)||(Mg.add(m),t={rel:t,crossOrigin:s,href:n},c.querySelector(m)===null&&(n=c.createElement("link"),Gt(n,"link",t),Lt(n),c.head.appendChild(n)))}}function dj(t){Za.D(t),Dg("dns-prefetch",t,null)}function fj(t,n){Za.C(t,n),Dg("preconnect",t,n)}function hj(t,n,s){Za.L(t,n,s);var c=dl;if(c&&t&&n){var m='link[rel="preload"][as="'+qn(n)+'"]';n==="image"&&s&&s.imageSrcSet?(m+='[imagesrcset="'+qn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(m+='[imagesizes="'+qn(s.imageSizes)+'"]')):m+='[href="'+qn(t)+'"]';var x=m;switch(n){case"style":x=fl(t);break;case"script":x=hl(t)}Xn.has(x)||(t=b({rel:"preload",href:n==="image"&&s&&s.imageSrcSet?void 0:t,as:n},s),Xn.set(x,t),c.querySelector(m)!==null||n==="style"&&c.querySelector(_s(x))||n==="script"&&c.querySelector(Ls(x))||(n=c.createElement("link"),Gt(n,"link",t),Lt(n),c.head.appendChild(n)))}}function mj(t,n){Za.m(t,n);var s=dl;if(s&&t){var c=n&&typeof n.as=="string"?n.as:"script",m='link[rel="modulepreload"][as="'+qn(c)+'"][href="'+qn(t)+'"]',x=m;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=hl(t)}if(!Xn.has(x)&&(t=b({rel:"modulepreload",href:t},n),Xn.set(x,t),s.querySelector(m)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Ls(x)))return}c=s.createElement("link"),Gt(c,"link",t),Lt(c),s.head.appendChild(c)}}}function pj(t,n,s){Za.S(t,n,s);var c=dl;if(c&&t){var m=Rr(c).hoistableStyles,x=fl(t);n=n||"default";var w=m.get(x);if(!w){var S={loading:0,preload:null};if(w=c.querySelector(_s(x)))S.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":n},s),(s=Xn.get(x))&&If(t,s);var _=w=c.createElement("link");Lt(_),Gt(_,"link",t),_._p=new Promise(function(Q,ne){_.onload=Q,_.onerror=ne}),_.addEventListener("load",function(){S.loading|=1}),_.addEventListener("error",function(){S.loading|=2}),S.loading|=4,kc(w,n,c)}w={type:"stylesheet",instance:w,count:1,state:S},m.set(x,w)}}}function xj(t,n){Za.X(t,n);var s=dl;if(s&&t){var c=Rr(s).hoistableScripts,m=hl(t),x=c.get(m);x||(x=s.querySelector(Ls(m)),x||(t=b({src:t,async:!0},n),(n=Xn.get(m))&&Hf(t,n),x=s.createElement("script"),Lt(x),Gt(x,"link",t),s.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(m,x))}}function gj(t,n){Za.M(t,n);var s=dl;if(s&&t){var c=Rr(s).hoistableScripts,m=hl(t),x=c.get(m);x||(x=s.querySelector(Ls(m)),x||(t=b({src:t,async:!0,type:"module"},n),(n=Xn.get(m))&&Hf(t,n),x=s.createElement("script"),Lt(x),Gt(x,"link",t),s.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(m,x))}}function Og(t,n,s,c){var m=(m=ye.current)?zc(m):null;if(!m)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(n=fl(s.href),s=Rr(m).hoistableStyles,c=s.get(n),c||(c={type:"style",instance:null,count:0,state:null},s.set(n,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=fl(s.href);var x=Rr(m).hoistableStyles,w=x.get(t);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(t,w),(x=m.querySelector(_s(t)))&&!x._p&&(w.instance=x,w.state.loading=5),Xn.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Xn.set(t,s),x||bj(m,t,s,w.state))),n&&c===null)throw Error(l(528,""));return w}if(n&&c!==null)throw Error(l(529,""));return null;case"script":return n=s.async,s=s.src,typeof s=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=hl(s),s=Rr(m).hoistableScripts,c=s.get(n),c||(c={type:"script",instance:null,count:0,state:null},s.set(n,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function fl(t){return'href="'+qn(t)+'"'}function _s(t){return'link[rel="stylesheet"]['+t+"]"}function Rg(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function bj(t,n,s,c){t.querySelector('link[rel="preload"][as="style"]['+n+"]")?c.loading=1:(n=t.createElement("link"),c.preload=n,n.addEventListener("load",function(){return c.loading|=1}),n.addEventListener("error",function(){return c.loading|=2}),Gt(n,"link",s),Lt(n),t.head.appendChild(n))}function hl(t){return'[src="'+qn(t)+'"]'}function Ls(t){return"script[async]"+t}function _g(t,n,s){if(n.count++,n.instance===null)switch(n.type){case"style":var c=t.querySelector('style[data-href~="'+qn(s.href)+'"]');if(c)return n.instance=c,Lt(c),c;var m=b({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Lt(c),Gt(c,"style",m),kc(c,s.precedence,t),n.instance=c;case"stylesheet":m=fl(s.href);var x=t.querySelector(_s(m));if(x)return n.state.loading|=4,n.instance=x,Lt(x),x;c=Rg(s),(m=Xn.get(m))&&If(c,m),x=(t.ownerDocument||t).createElement("link"),Lt(x);var w=x;return w._p=new Promise(function(S,_){w.onload=S,w.onerror=_}),Gt(x,"link",c),n.state.loading|=4,kc(x,s.precedence,t),n.instance=x;case"script":return x=hl(s.src),(m=t.querySelector(Ls(x)))?(n.instance=m,Lt(m),m):(c=s,(m=Xn.get(x))&&(c=b({},s),Hf(c,m)),t=t.ownerDocument||t,m=t.createElement("script"),Lt(m),Gt(m,"link",c),t.head.appendChild(m),n.instance=m);case"void":return null;default:throw Error(l(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(c=n.instance,n.state.loading|=4,kc(c,s.precedence,t));return n.instance}function kc(t,n,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=c.length?c[c.length-1]:null,x=m,w=0;w<c.length;w++){var S=c[w];if(S.dataset.precedence===n)x=S;else if(x!==m)break}x?x.parentNode.insertBefore(t,x.nextSibling):(n=s.nodeType===9?s.head:s,n.insertBefore(t,n.firstChild))}function If(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.title==null&&(t.title=n.title)}function Hf(t,n){t.crossOrigin==null&&(t.crossOrigin=n.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=n.referrerPolicy),t.integrity==null&&(t.integrity=n.integrity)}var Nc=null;function Lg(t,n,s){if(Nc===null){var c=new Map,m=Nc=new Map;m.set(s,c)}else m=Nc,c=m.get(s),c||(c=new Map,m.set(s,c));if(c.has(t))return c;for(c.set(t,null),s=s.getElementsByTagName(t),m=0;m<s.length;m++){var x=s[m];if(!(x[Kl]||x[Ft]||t==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(n)||"";w=t+w;var S=c.get(w);S?S.push(x):c.set(w,[x])}}return c}function Bg(t,n,s){t=t.ownerDocument||t,t.head.insertBefore(s,n==="title"?t.querySelector("head > title"):null)}function yj(t,n,s){if(s===1||n.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return t=n.disabled,typeof n.precedence=="string"&&t==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Ug(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function vj(t,n,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var m=fl(c.href),x=n.querySelector(_s(m));if(x){n=x._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(t.count++,t=Sc.bind(t),n.then(t,t)),s.state.loading|=4,s.instance=x,Lt(x);return}x=n.ownerDocument||n,c=Rg(c),(m=Xn.get(m))&&If(c,m),x=x.createElement("link"),Lt(x);var w=x;w._p=new Promise(function(S,_){w.onload=S,w.onerror=_}),Gt(x,"link",c),s.instance=x}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,n),(n=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=Sc.bind(t),n.addEventListener("load",s),n.addEventListener("error",s))}}var qf=0;function wj(t,n){return t.stylesheets&&t.count===0&&Ec(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var c=setTimeout(function(){if(t.stylesheets&&Ec(t,t.stylesheets),t.unsuspend){var x=t.unsuspend;t.unsuspend=null,x()}},6e4+n);0<t.imgBytes&&qf===0&&(qf=62500*tj());var m=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Ec(t,t.stylesheets),t.unsuspend)){var x=t.unsuspend;t.unsuspend=null,x()}},(t.imgBytes>qf?50:800)+n);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(m)}}:null}function Sc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ec(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Cc=null;function Ec(t,n){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Cc=new Map,n.forEach(jj,t),Cc=null,Sc.call(t))}function jj(t,n){if(!(n.state.loading&4)){var s=Cc.get(t);if(s)var c=s.get(null);else{s=new Map,Cc.set(t,s);for(var m=t.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<m.length;x++){var w=m[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(s.set(w.dataset.precedence,w),c=w)}c&&s.set(null,c)}m=n.instance,w=m.getAttribute("data-precedence"),x=s.get(w)||c,x===c&&s.set(null,m),s.set(w,m),this.count++,c=Sc.bind(this),m.addEventListener("load",c),m.addEventListener("error",c),x?x.parentNode.insertBefore(m,x.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(m,t.firstChild)),n.state.loading|=4}}var Bs={$$typeof:E,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function zj(t,n,s,c,m,x,w,S,_){this.tag=1,this.containerInfo=t,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=rn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rn(0),this.hiddenUpdates=rn(null),this.identifierPrefix=c,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_,this.incompleteTransitions=new Map}function Ig(t,n,s,c,m,x,w,S,_,Q,ne,se){return t=new zj(t,n,s,w,_,Q,ne,se,S),n=1,x===!0&&(n|=24),x=Cn(3,null,null,n),t.current=x,x.stateNode=t,n=yd(),n.refCount++,t.pooledCache=n,n.refCount++,x.memoizedState={element:c,isDehydrated:s,cache:n},zd(x),t}function Hg(t){return t?(t=$r,t):$r}function qg(t,n,s,c,m,x){m=Hg(m),c.context===null?c.context=m:c.pendingContext=m,c=xi(n),c.payload={element:s},x=x===void 0?null:x,x!==null&&(c.callback=x),s=gi(t,c,n),s!==null&&(bn(s,t,n),ps(s,t,n))}function Fg(t,n){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<n?s:n}}function Ff(t,n){Fg(t,n),(t=t.alternate)&&Fg(t,n)}function Pg(t){if(t.tag===13||t.tag===31){var n=Wi(t,67108864);n!==null&&bn(n,t,67108864),Ff(t,67108864)}}function $g(t){if(t.tag===13||t.tag===31){var n=Dn();n=Lu(n);var s=Wi(t,n);s!==null&&bn(s,t,n),Ff(t,n)}}var Tc=!0;function kj(t,n,s,c){var m=B.T;B.T=null;var x=X.p;try{X.p=2,Pf(t,n,s,c)}finally{X.p=x,B.T=m}}function Nj(t,n,s,c){var m=B.T;B.T=null;var x=X.p;try{X.p=8,Pf(t,n,s,c)}finally{X.p=x,B.T=m}}function Pf(t,n,s,c){if(Tc){var m=$f(c);if(m===null)Tf(t,n,c,Ac,s),Gg(t,c);else if(Cj(m,t,n,s,c))c.stopPropagation();else if(Gg(t,c),n&4&&-1<Sj.indexOf(t)){for(;m!==null;){var x=Or(m);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=Qt(x.pendingLanes);if(w!==0){var S=x;for(S.pendingLanes|=2,S.entangledLanes|=2;w;){var _=1<<31-Qe(w);S.entanglements[1]|=_,w&=~_}ka(x),(We&6)===0&&(fc=et()+500,Ms(0))}}break;case 31:case 13:S=Wi(x,2),S!==null&&bn(S,x,2),mc(),Ff(x,2)}if(x=$f(c),x===null&&Tf(t,n,c,Ac,s),x===m)break;m=x}m!==null&&c.stopPropagation()}else Tf(t,n,c,null,s)}}function $f(t){return t=Vu(t),Vf(t)}var Ac=null;function Vf(t){if(Ac=null,t=Dr(t),t!==null){var n=u(t);if(n===null)t=null;else{var s=n.tag;if(s===13){if(t=d(n),t!==null)return t;t=null}else if(s===31){if(t=f(n),t!==null)return t;t=null}else if(s===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;t=null}else n!==t&&(t=null)}}return Ac=t,null}function Vg(t){switch(t){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(Nt()){case K:return 2;case fe:return 8;case Ee:case Ue:return 32;case Ve:return 268435456;default:return 32}default:return 32}}var Gf=!1,Ei=null,Ti=null,Ai=null,Us=new Map,Is=new Map,Mi=[],Sj="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 Gg(t,n){switch(t){case"focusin":case"focusout":Ei=null;break;case"dragenter":case"dragleave":Ti=null;break;case"mouseover":case"mouseout":Ai=null;break;case"pointerover":case"pointerout":Us.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Is.delete(n.pointerId)}}function Hs(t,n,s,c,m,x){return t===null||t.nativeEvent!==x?(t={blockedOn:n,domEventName:s,eventSystemFlags:c,nativeEvent:x,targetContainers:[m]},n!==null&&(n=Or(n),n!==null&&Pg(n)),t):(t.eventSystemFlags|=c,n=t.targetContainers,m!==null&&n.indexOf(m)===-1&&n.push(m),t)}function Cj(t,n,s,c,m){switch(n){case"focusin":return Ei=Hs(Ei,t,n,s,c,m),!0;case"dragenter":return Ti=Hs(Ti,t,n,s,c,m),!0;case"mouseover":return Ai=Hs(Ai,t,n,s,c,m),!0;case"pointerover":var x=m.pointerId;return Us.set(x,Hs(Us.get(x)||null,t,n,s,c,m)),!0;case"gotpointercapture":return x=m.pointerId,Is.set(x,Hs(Is.get(x)||null,t,n,s,c,m)),!0}return!1}function Yg(t){var n=Dr(t.target);if(n!==null){var s=u(n);if(s!==null){if(n=s.tag,n===13){if(n=d(s),n!==null){t.blockedOn=n,s0(t.priority,function(){$g(s)});return}}else if(n===31){if(n=f(s),n!==null){t.blockedOn=n,s0(t.priority,function(){$g(s)});return}}else if(n===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Mc(t){if(t.blockedOn!==null)return!1;for(var n=t.targetContainers;0<n.length;){var s=$f(t.nativeEvent);if(s===null){s=t.nativeEvent;var c=new s.constructor(s.type,s);$u=c,s.target.dispatchEvent(c),$u=null}else return n=Or(s),n!==null&&Pg(n),t.blockedOn=s,!1;n.shift()}return!0}function Qg(t,n,s){Mc(t)&&s.delete(n)}function Ej(){Gf=!1,Ei!==null&&Mc(Ei)&&(Ei=null),Ti!==null&&Mc(Ti)&&(Ti=null),Ai!==null&&Mc(Ai)&&(Ai=null),Us.forEach(Qg),Is.forEach(Qg)}function Dc(t,n){t.blockedOn===n&&(t.blockedOn=null,Gf||(Gf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Ej)))}var Oc=null;function Xg(t){Oc!==t&&(Oc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Oc===t&&(Oc=null);for(var n=0;n<t.length;n+=3){var s=t[n],c=t[n+1],m=t[n+2];if(typeof c!="function"){if(Vf(c||s)===null)continue;break}var x=Or(s);x!==null&&(t.splice(n,3),n-=3,Pd(x,{pending:!0,data:m,method:s.method,action:c},c,m))}}))}function ml(t){function n(_){return Dc(_,t)}Ei!==null&&Dc(Ei,t),Ti!==null&&Dc(Ti,t),Ai!==null&&Dc(Ai,t),Us.forEach(n),Is.forEach(n);for(var s=0;s<Mi.length;s++){var c=Mi[s];c.blockedOn===t&&(c.blockedOn=null)}for(;0<Mi.length&&(s=Mi[0],s.blockedOn===null);)Yg(s),s.blockedOn===null&&Mi.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(c=0;c<s.length;c+=3){var m=s[c],x=s[c+1],w=m[fn]||null;if(typeof x=="function")w||Xg(s);else if(w){var S=null;if(x&&x.hasAttribute("formAction")){if(m=x,w=x[fn]||null)S=w.formAction;else if(Vf(m)!==null)continue}else S=w.action;typeof S=="function"?s[c+1]=S:(s.splice(c,3),c-=3),Xg(s)}}}function Jg(){function t(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function n(){m!==null&&(m(),m=null),c||setTimeout(s,20)}function s(){if(!c&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,m=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(s,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),m!==null&&(m(),m=null)}}}function Yf(t){this._internalRoot=t}Rc.prototype.render=Yf.prototype.render=function(t){var n=this._internalRoot;if(n===null)throw Error(l(409));var s=n.current,c=Dn();qg(s,c,t,n,null,null)},Rc.prototype.unmount=Yf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var n=t.containerInfo;qg(t.current,2,null,t,null,null),mc(),n[Mr]=null}};function Rc(t){this._internalRoot=t}Rc.prototype.unstable_scheduleHydration=function(t){if(t){var n=l0();t={blockedOn:null,target:t,priority:n};for(var s=0;s<Mi.length&&n!==0&&n<Mi[s].priority;s++);Mi.splice(s,0,t),s===0&&Yg(t)}};var Zg=a.version;if(Zg!=="19.2.4")throw Error(l(527,Zg,"19.2.4"));X.findDOMNode=function(t){var n=t._reactInternals;if(n===void 0)throw typeof t.render=="function"?Error(l(188)):(t=Object.keys(t).join(","),Error(l(268,t)));return t=h(n),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var Tj={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _c=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_c.isDisabled&&_c.supportsFiber)try{Ot=_c.inject(Tj),ft=_c}catch{}}return Fs.createRoot=function(t,n){if(!o(t))throw Error(l(299));var s=!1,c="",m=ix,x=rx,w=lx;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(m=n.onUncaughtError),n.onCaughtError!==void 0&&(x=n.onCaughtError),n.onRecoverableError!==void 0&&(w=n.onRecoverableError)),n=Ig(t,1,!1,null,null,s,c,null,m,x,w,Jg),t[Mr]=n.current,Ef(t),new Yf(n)},Fs.hydrateRoot=function(t,n,s){if(!o(t))throw Error(l(299));var c=!1,m="",x=ix,w=rx,S=lx,_=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(m=s.identifierPrefix),s.onUncaughtError!==void 0&&(x=s.onUncaughtError),s.onCaughtError!==void 0&&(w=s.onCaughtError),s.onRecoverableError!==void 0&&(S=s.onRecoverableError),s.formState!==void 0&&(_=s.formState)),n=Ig(t,1,!0,n,s??null,c,m,_,x,w,S,Jg),n.context=Hg(null),s=n.current,c=Dn(),c=Lu(c),m=xi(c),m.callback=null,gi(s,m,c),s=c,n.current.lanes=s,qt(n,s),ka(n),t[Mr]=n.current,Ef(t),new Rc(n)},Fs.version="19.2.4",Fs}var ob;function Hj(){if(ob)return Zf.exports;ob=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(a){console.error(a)}}return e(),Zf.exports=Ij(),Zf.exports}var qj=Hj();/**
 * react-router v7.13.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var cb="popstate";function Fj(e={}){function a(l,o){let{pathname:u,search:d,hash:f}=l.location;return Dh("",{pathname:u,search:d,hash:f},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function i(l,o){return typeof o=="string"?o:ao(o)}return $j(a,i,null,e)}function bt(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function fa(e,a){if(!e){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function Pj(){return Math.random().toString(36).substring(2,10)}function ub(e,a){return{usr:e.state,key:e.key,idx:a}}function Dh(e,a,i=null,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof a=="string"?ql(a):a,state:i,key:a&&a.key||l||Pj()}}function ao({pathname:e="/",search:a="",hash:i=""}){return a&&a!=="?"&&(e+=a.charAt(0)==="?"?a:"?"+a),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function ql(e){let a={};if(e){let i=e.indexOf("#");i>=0&&(a.hash=e.substring(i),e=e.substring(0,i));let l=e.indexOf("?");l>=0&&(a.search=e.substring(l),e=e.substring(0,l)),e&&(a.pathname=e)}return a}function $j(e,a,i,l={}){let{window:o=document.defaultView,v5Compat:u=!1}=l,d=o.history,f="POP",p=null,h=g();h==null&&(h=0,d.replaceState({...d.state,idx:h},""));function g(){return(d.state||{idx:null}).idx}function b(){f="POP";let j=g(),N=j==null?null:j-h;h=j,p&&p({action:f,location:z.location,delta:N})}function v(j,N){f="PUSH";let D=Dh(z.location,j,N);h=g()+1;let E=ub(D,h),L=z.createHref(D);try{d.pushState(E,"",L)}catch(Y){if(Y instanceof DOMException&&Y.name==="DataCloneError")throw Y;o.location.assign(L)}u&&p&&p({action:f,location:z.location,delta:1})}function y(j,N){f="REPLACE";let D=Dh(z.location,j,N);h=g();let E=ub(D,h),L=z.createHref(D);d.replaceState(E,"",L),u&&p&&p({action:f,location:z.location,delta:0})}function k(j){return Vj(j)}let z={get action(){return f},get location(){return e(o,d)},listen(j){if(p)throw new Error("A history only accepts one active listener");return o.addEventListener(cb,b),p=j,()=>{o.removeEventListener(cb,b),p=null}},createHref(j){return a(o,j)},createURL:k,encodeLocation(j){let N=k(j);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:v,replace:y,go(j){return d.go(j)}};return z}function Vj(e,a=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),bt(i,"No window.location.(origin|href) available to create URL");let l=typeof e=="string"?e:ao(e);return l=l.replace(/ $/,"%20"),!a&&l.startsWith("//")&&(l=i+l),new URL(l,i)}function Gy(e,a,i="/"){return Gj(e,a,i,!1)}function Gj(e,a,i,l){let o=typeof a=="string"?ql(a):a,u=ri(o.pathname||"/",i);if(u==null)return null;let d=Yy(e);Yj(d);let f=null;for(let p=0;f==null&&p<d.length;++p){let h=iz(u);f=nz(d[p],h,l)}return f}function Yy(e,a=[],i=[],l="",o=!1){let u=(d,f,p=o,h)=>{let g={relativePath:h===void 0?d.path||"":h,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(l)&&p)return;bt(g.relativePath.startsWith(l),`Absolute route path "${g.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(l.length)}let b=ai([l,g.relativePath]),v=i.concat(g);d.children&&d.children.length>0&&(bt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),Yy(d.children,a,v,b,p)),!(d.path==null&&!d.index)&&a.push({path:b,score:ez(b,d.index),routesMeta:v})};return e.forEach((d,f)=>{var p;if(d.path===""||!((p=d.path)!=null&&p.includes("?")))u(d,f);else for(let h of Qy(d.path))u(d,f,!0,h)}),a}function Qy(e){let a=e.split("/");if(a.length===0)return[];let[i,...l]=a,o=i.endsWith("?"),u=i.replace(/\?$/,"");if(l.length===0)return o?[u,""]:[u];let d=Qy(l.join("/")),f=[];return f.push(...d.map(p=>p===""?u:[u,p].join("/"))),o&&f.push(...d),f.map(p=>e.startsWith("/")&&p===""?"/":p)}function Yj(e){e.sort((a,i)=>a.score!==i.score?i.score-a.score:tz(a.routesMeta.map(l=>l.childrenIndex),i.routesMeta.map(l=>l.childrenIndex)))}var Qj=/^:[\w-]+$/,Xj=3,Jj=2,Zj=1,Kj=10,Wj=-2,db=e=>e==="*";function ez(e,a){let i=e.split("/"),l=i.length;return i.some(db)&&(l+=Wj),a&&(l+=Jj),i.filter(o=>!db(o)).reduce((o,u)=>o+(Qj.test(u)?Xj:u===""?Zj:Kj),l)}function tz(e,a){return e.length===a.length&&e.slice(0,-1).every((l,o)=>l===a[o])?e[e.length-1]-a[a.length-1]:0}function nz(e,a,i=!1){let{routesMeta:l}=e,o={},u="/",d=[];for(let f=0;f<l.length;++f){let p=l[f],h=f===l.length-1,g=u==="/"?a:a.slice(u.length)||"/",b=nu({path:p.relativePath,caseSensitive:p.caseSensitive,end:h},g),v=p.route;if(!b&&h&&i&&!l[l.length-1].route.index&&(b=nu({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!b)return null;Object.assign(o,b.params),d.push({params:o,pathname:ai([u,b.pathname]),pathnameBase:oz(ai([u,b.pathnameBase])),route:v}),b.pathnameBase!=="/"&&(u=ai([u,b.pathnameBase]))}return d}function nu(e,a){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[i,l]=az(e.path,e.caseSensitive,e.end),o=a.match(i);if(!o)return null;let u=o[0],d=u.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:l.reduce((h,{paramName:g,isOptional:b},v)=>{if(g==="*"){let k=f[v]||"";d=u.slice(0,u.length-k.length).replace(/(.)\/+$/,"$1")}const y=f[v];return b&&!y?h[g]=void 0:h[g]=(y||"").replace(/%2F/g,"/"),h},{}),pathname:u,pathnameBase:d,pattern:e}}function az(e,a=!1,i=!0){fa(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 l=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,p)=>(l.push({paramName:f,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(l.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,a?void 0:"i"),l]}function iz(e){try{return e.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return fa(!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 (${a}).`),e}}function ri(e,a){if(a==="/")return e;if(!e.toLowerCase().startsWith(a.toLowerCase()))return null;let i=a.endsWith("/")?a.length-1:a.length,l=e.charAt(i);return l&&l!=="/"?null:e.slice(i)||"/"}var rz=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function lz(e,a="/"){let{pathname:i,search:l="",hash:o=""}=typeof e=="string"?ql(e):e,u;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?u=fb(i.substring(1),"/"):u=fb(i,a)):u=a,{pathname:u,search:cz(l),hash:uz(o)}}function fb(e,a){let i=a.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?i.length>1&&i.pop():o!=="."&&i.push(o)}),i.length>1?i.join("/"):"/"}function th(e,a,i,l){return`Cannot include a '${e}' character in a manually specified \`to.${a}\` field [${JSON.stringify(l)}].  Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function sz(e){return e.filter((a,i)=>i===0||a.route.path&&a.route.path.length>0)}function lm(e){let a=sz(e);return a.map((i,l)=>l===a.length-1?i.pathname:i.pathnameBase)}function sm(e,a,i,l=!1){let o;typeof e=="string"?o=ql(e):(o={...e},bt(!o.pathname||!o.pathname.includes("?"),th("?","pathname","search",o)),bt(!o.pathname||!o.pathname.includes("#"),th("#","pathname","hash",o)),bt(!o.search||!o.search.includes("#"),th("#","search","hash",o)));let u=e===""||o.pathname==="",d=u?"/":o.pathname,f;if(d==null)f=i;else{let b=a.length-1;if(!l&&d.startsWith("..")){let v=d.split("/");for(;v[0]==="..";)v.shift(),b-=1;o.pathname=v.join("/")}f=b>=0?a[b]:"/"}let p=lz(o,f),h=d&&d!=="/"&&d.endsWith("/"),g=(u||d===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(h||g)&&(p.pathname+="/"),p}var ai=e=>e.join("/").replace(/\/\/+/g,"/"),oz=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),cz=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,uz=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,dz=class{constructor(e,a,i,l=!1){this.status=e,this.statusText=a||"",this.internal=l,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function fz(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function hz(e){return e.map(a=>a.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Xy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Jy(e,a){let i=e;if(typeof i!="string"||!rz.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let l=i,o=!1;if(Xy)try{let u=new URL(window.location.href),d=i.startsWith("//")?new URL(u.protocol+i):new URL(i),f=ri(d.pathname,a);d.origin===u.origin&&f!=null?i=f+d.search+d.hash:o=!0}catch{fa(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:o,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Zy=["POST","PUT","PATCH","DELETE"];new Set(Zy);var mz=["GET",...Zy];new Set(mz);var Fl=C.createContext(null);Fl.displayName="DataRouter";var mu=C.createContext(null);mu.displayName="DataRouterState";var pz=C.createContext(!1),Ky=C.createContext({isTransitioning:!1});Ky.displayName="ViewTransition";var xz=C.createContext(new Map);xz.displayName="Fetchers";var gz=C.createContext(null);gz.displayName="Await";var Ln=C.createContext(null);Ln.displayName="Navigation";var ho=C.createContext(null);ho.displayName="Location";var ha=C.createContext({outlet:null,matches:[],isDataRoute:!1});ha.displayName="Route";var om=C.createContext(null);om.displayName="RouteError";var Wy="REACT_ROUTER_ERROR",bz="REDIRECT",yz="ROUTE_ERROR_RESPONSE";function vz(e){if(e.startsWith(`${Wy}:${bz}:{`))try{let a=JSON.parse(e.slice(28));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.location=="string"&&typeof a.reloadDocument=="boolean"&&typeof a.replace=="boolean")return a}catch{}}function wz(e){if(e.startsWith(`${Wy}:${yz}:{`))try{let a=JSON.parse(e.slice(40));if(typeof a=="object"&&a&&typeof a.status=="number"&&typeof a.statusText=="string")return new dz(a.status,a.statusText,a.data)}catch{}}function jz(e,{relative:a}={}){bt(Pl(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:l}=C.useContext(Ln),{hash:o,pathname:u,search:d}=mo(e,{relative:a}),f=u;return i!=="/"&&(f=u==="/"?i:ai([i,u])),l.createHref({pathname:f,search:d,hash:o})}function Pl(){return C.useContext(ho)!=null}function ma(){return bt(Pl(),"useLocation() may be used only in the context of a <Router> component."),C.useContext(ho).location}var e1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function t1(e){C.useContext(Ln).static||C.useLayoutEffect(e)}function wn(){let{isDataRoute:e}=C.useContext(ha);return e?_z():zz()}function zz(){bt(Pl(),"useNavigate() may be used only in the context of a <Router> component.");let e=C.useContext(Fl),{basename:a,navigator:i}=C.useContext(Ln),{matches:l}=C.useContext(ha),{pathname:o}=ma(),u=JSON.stringify(lm(l)),d=C.useRef(!1);return t1(()=>{d.current=!0}),C.useCallback((p,h={})=>{if(fa(d.current,e1),!d.current)return;if(typeof p=="number"){i.go(p);return}let g=sm(p,JSON.parse(u),o,h.relative==="path");e==null&&a!=="/"&&(g.pathname=g.pathname==="/"?a:ai([a,g.pathname])),(h.replace?i.replace:i.push)(g,h.state,h)},[a,i,u,o,e])}C.createContext(null);function n1(){let{matches:e}=C.useContext(ha),a=e[e.length-1];return a?a.params:{}}function mo(e,{relative:a}={}){let{matches:i}=C.useContext(ha),{pathname:l}=ma(),o=JSON.stringify(lm(i));return C.useMemo(()=>sm(e,JSON.parse(o),l,a==="path"),[e,o,l,a])}function kz(e,a){return a1(e,a)}function a1(e,a,i,l,o){var D;bt(Pl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:u}=C.useContext(Ln),{matches:d}=C.useContext(ha),f=d[d.length-1],p=f?f.params:{},h=f?f.pathname:"/",g=f?f.pathnameBase:"/",b=f&&f.route;{let E=b&&b.path||"";r1(h,!b||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (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.

Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let v=ma(),y;if(a){let E=typeof a=="string"?ql(a):a;bt(g==="/"||((D=E.pathname)==null?void 0:D.startsWith(g)),`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 "${g}" but pathname "${E.pathname}" was given in the \`location\` prop.`),y=E}else y=v;let k=y.pathname||"/",z=k;if(g!=="/"){let E=g.replace(/^\//,"").split("/");z="/"+k.replace(/^\//,"").split("/").slice(E.length).join("/")}let j=Gy(e,{pathname:z});fa(b||j!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),fa(j==null||j[j.length-1].route.element!==void 0||j[j.length-1].route.Component!==void 0||j[j.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.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 N=Tz(j&&j.map(E=>Object.assign({},E,{params:Object.assign({},p,E.params),pathname:ai([g,u.encodeLocation?u.encodeLocation(E.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?g:ai([g,u.encodeLocation?u.encodeLocation(E.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),d,i,l,o);return a&&N?C.createElement(ho.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},N):N}function Nz(){let e=Rz(),a=fz(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=C.createElement(C.Fragment,null,C.createElement("p",null,"💿 Hey developer 👋"),C.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",C.createElement("code",{style:u},"ErrorBoundary")," or"," ",C.createElement("code",{style:u},"errorElement")," prop on your route.")),C.createElement(C.Fragment,null,C.createElement("h2",null,"Unexpected Application Error!"),C.createElement("h3",{style:{fontStyle:"italic"}},a),i?C.createElement("pre",{style:o},i):null,d)}var Sz=C.createElement(Nz,null),i1=class extends C.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,a){return a.location!==e.location||a.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:a.error,location:a.location,revalidation:e.revalidation||a.revalidation}}componentDidCatch(e,a){this.props.onError?this.props.onError(e,a):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 i=wz(e.digest);i&&(e=i)}let a=e!==void 0?C.createElement(ha.Provider,{value:this.props.routeContext},C.createElement(om.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?C.createElement(Cz,{error:e},a):a}};i1.contextType=pz;var nh=new WeakMap;function Cz({children:e,error:a}){let{basename:i}=C.useContext(Ln);if(typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){let l=vz(a.digest);if(l){let o=nh.get(a);if(o)throw o;let u=Jy(l.location,i);if(Xy&&!nh.get(a))if(u.isExternal||l.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw nh.set(a,d),d}return C.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return e}function Ez({routeContext:e,match:a,children:i}){let l=C.useContext(Fl);return l&&l.static&&l.staticContext&&(a.route.errorElement||a.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=a.route.id),C.createElement(ha.Provider,{value:e},i)}function Tz(e,a=[],i=null,l=null,o=null){if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(a.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let u=e,d=i==null?void 0:i.errors;if(d!=null){let g=u.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);bt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),u=u.slice(0,Math.min(u.length,g+1))}let f=!1,p=-1;if(i)for(let g=0;g<u.length;g++){let b=u[g];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=g),b.route.id){let{loaderData:v,errors:y}=i,k=b.route.loader&&!v.hasOwnProperty(b.route.id)&&(!y||y[b.route.id]===void 0);if(b.route.lazy||k){f=!0,p>=0?u=u.slice(0,p+1):u=[u[0]];break}}}let h=i&&l?(g,b)=>{var v,y;l(g,{location:i.location,params:((y=(v=i.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:hz(i.matches),errorInfo:b})}:void 0;return u.reduceRight((g,b,v)=>{let y,k=!1,z=null,j=null;i&&(y=d&&b.route.id?d[b.route.id]:void 0,z=b.route.errorElement||Sz,f&&(p<0&&v===0?(r1("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,j=null):p===v&&(k=!0,j=b.route.hydrateFallbackElement||null)));let N=a.concat(u.slice(0,v+1)),D=()=>{let E;return y?E=z:k?E=j:b.route.Component?E=C.createElement(b.route.Component,null):b.route.element?E=b.route.element:E=g,C.createElement(Ez,{match:b,routeContext:{outlet:g,matches:N,isDataRoute:i!=null},children:E})};return i&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?C.createElement(i1,{location:i.location,revalidation:i.revalidation,component:z,error:y,children:D(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:h}):D()},null)}function cm(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function Az(e){let a=C.useContext(Fl);return bt(a,cm(e)),a}function Mz(e){let a=C.useContext(mu);return bt(a,cm(e)),a}function Dz(e){let a=C.useContext(ha);return bt(a,cm(e)),a}function um(e){let a=Dz(e),i=a.matches[a.matches.length-1];return bt(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function Oz(){return um("useRouteId")}function Rz(){var l;let e=C.useContext(om),a=Mz("useRouteError"),i=um("useRouteError");return e!==void 0?e:(l=a.errors)==null?void 0:l[i]}function _z(){let{router:e}=Az("useNavigate"),a=um("useNavigate"),i=C.useRef(!1);return t1(()=>{i.current=!0}),C.useCallback(async(o,u={})=>{fa(i.current,e1),i.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:a,...u}))},[e,a])}var hb={};function r1(e,a,i){!a&&!hb[e]&&(hb[e]=!0,fa(!1,i))}C.memo(Lz);function Lz({routes:e,future:a,state:i,onError:l}){return a1(e,void 0,i,l,a)}function Qc({to:e,replace:a,state:i,relative:l}){bt(Pl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=C.useContext(Ln);fa(!o,"<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:u}=C.useContext(ha),{pathname:d}=ma(),f=wn(),p=sm(e,lm(u),d,l==="path"),h=JSON.stringify(p);return C.useEffect(()=>{f(JSON.parse(h),{replace:a,state:i,relative:l})},[f,h,l,a,i]),null}function At(e){bt(!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 Bz({basename:e="/",children:a=null,location:i,navigationType:l="POP",navigator:o,static:u=!1,unstable_useTransitions:d}){bt(!Pl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),p=C.useMemo(()=>({basename:f,navigator:o,static:u,unstable_useTransitions:d,future:{}}),[f,o,u,d]);typeof i=="string"&&(i=ql(i));let{pathname:h="/",search:g="",hash:b="",state:v=null,key:y="default"}=i,k=C.useMemo(()=>{let z=ri(h,f);return z==null?null:{location:{pathname:z,search:g,hash:b,state:v,key:y},navigationType:l}},[f,h,g,b,v,y,l]);return fa(k!=null,`<Router basename="${f}"> is not able to match the URL "${h}${g}${b}" because it does not start with the basename, so the <Router> won't render anything.`),k==null?null:C.createElement(Ln.Provider,{value:p},C.createElement(ho.Provider,{children:a,value:k}))}function Uz({children:e,location:a}){return kz(Oh(e),a)}function Oh(e,a=[]){let i=[];return C.Children.forEach(e,(l,o)=>{if(!C.isValidElement(l))return;let u=[...a,o];if(l.type===C.Fragment){i.push.apply(i,Oh(l.props.children,u));return}bt(l.type===At,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),bt(!l.props.index||!l.props.children,"An index route cannot have child routes.");let d={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(d.children=Oh(l.props.children,u)),i.push(d)}),i}var Xc="get",Jc="application/x-www-form-urlencoded";function pu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Iz(e){return pu(e)&&e.tagName.toLowerCase()==="button"}function Hz(e){return pu(e)&&e.tagName.toLowerCase()==="form"}function qz(e){return pu(e)&&e.tagName.toLowerCase()==="input"}function Fz(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Pz(e,a){return e.button===0&&(!a||a==="_self")&&!Fz(e)}var Bc=null;function $z(){if(Bc===null)try{new FormData(document.createElement("form"),0),Bc=!1}catch{Bc=!0}return Bc}var Vz=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ah(e){return e!=null&&!Vz.has(e)?(fa(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Jc}"`),null):e}function Gz(e,a){let i,l,o,u,d;if(Hz(e)){let f=e.getAttribute("action");l=f?ri(f,a):null,i=e.getAttribute("method")||Xc,o=ah(e.getAttribute("enctype"))||Jc,u=new FormData(e)}else if(Iz(e)||qz(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 p=e.getAttribute("formaction")||f.getAttribute("action");if(l=p?ri(p,a):null,i=e.getAttribute("formmethod")||f.getAttribute("method")||Xc,o=ah(e.getAttribute("formenctype"))||ah(f.getAttribute("enctype"))||Jc,u=new FormData(f,e),!$z()){let{name:h,type:g,value:b}=e;if(g==="image"){let v=h?`${h}.`:"";u.append(`${v}x`,"0"),u.append(`${v}y`,"0")}else h&&u.append(h,b)}}else{if(pu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Xc,l=null,o=Jc,d=e}return u&&o==="text/plain"&&(d=u,u=void 0),{action:l,method:i.toLowerCase(),encType:o,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function dm(e,a){if(e===!1||e===null||typeof e>"u")throw new Error(a)}function Yz(e,a,i,l){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return i?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${l}`:o.pathname=`${o.pathname}.${l}`:o.pathname==="/"?o.pathname=`_root.${l}`:a&&ri(o.pathname,a)==="/"?o.pathname=`${a.replace(/\/$/,"")}/_root.${l}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${l}`,o}async function Qz(e,a){if(e.id in a)return a[e.id];try{let i=await import(e.module);return a[e.id]=i,i}catch(i){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Xz(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 Jz(e,a,i){let l=await Promise.all(e.map(async o=>{let u=a.routes[o.route.id];if(u){let d=await Qz(u,i);return d.links?d.links():[]}return[]}));return ek(l.flat(1).filter(Xz).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function mb(e,a,i,l,o,u){let d=(p,h)=>i[h]?p.route.id!==i[h].route.id:!0,f=(p,h)=>{var g;return i[h].pathname!==p.pathname||((g=i[h].route.path)==null?void 0:g.endsWith("*"))&&i[h].params["*"]!==p.params["*"]};return u==="assets"?a.filter((p,h)=>d(p,h)||f(p,h)):u==="data"?a.filter((p,h)=>{var b;let g=l.routes[p.route.id];if(!g||!g.hasLoader)return!1;if(d(p,h)||f(p,h))return!0;if(p.route.shouldRevalidate){let v=p.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((b=i[0])==null?void 0:b.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function Zz(e,a,{includeHydrateFallback:i}={}){return Kz(e.map(l=>{let o=a.routes[l.route.id];if(!o)return[];let u=[o.module];return o.clientActionModule&&(u=u.concat(o.clientActionModule)),o.clientLoaderModule&&(u=u.concat(o.clientLoaderModule)),i&&o.hydrateFallbackModule&&(u=u.concat(o.hydrateFallbackModule)),o.imports&&(u=u.concat(o.imports)),u}).flat(1))}function Kz(e){return[...new Set(e)]}function Wz(e){let a={},i=Object.keys(e).sort();for(let l of i)a[l]=e[l];return a}function ek(e,a){let i=new Set;return new Set(a),e.reduce((l,o)=>{let u=JSON.stringify(Wz(o));return i.has(u)||(i.add(u),l.push({key:u,link:o})),l},[])}function l1(){let e=C.useContext(Fl);return dm(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function tk(){let e=C.useContext(mu);return dm(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var fm=C.createContext(void 0);fm.displayName="FrameworkContext";function s1(){let e=C.useContext(fm);return dm(e,"You must render this element inside a <HydratedRouter> element"),e}function nk(e,a){let i=C.useContext(fm),[l,o]=C.useState(!1),[u,d]=C.useState(!1),{onFocus:f,onBlur:p,onMouseEnter:h,onMouseLeave:g,onTouchStart:b}=a,v=C.useRef(null);C.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let z=N=>{N.forEach(D=>{d(D.isIntersecting)})},j=new IntersectionObserver(z,{threshold:.5});return v.current&&j.observe(v.current),()=>{j.disconnect()}}},[e]),C.useEffect(()=>{if(l){let z=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(z)}}},[l]);let y=()=>{o(!0)},k=()=>{o(!1),d(!1)};return i?e!=="intent"?[u,v,{}]:[u,v,{onFocus:Ps(f,y),onBlur:Ps(p,k),onMouseEnter:Ps(h,y),onMouseLeave:Ps(g,k),onTouchStart:Ps(b,y)}]:[!1,v,{}]}function Ps(e,a){return i=>{e&&e(i),i.defaultPrevented||a(i)}}function ak({page:e,...a}){let{router:i}=l1(),l=C.useMemo(()=>Gy(i.routes,e,i.basename),[i.routes,e,i.basename]);return l?C.createElement(rk,{page:e,matches:l,...a}):null}function ik(e){let{manifest:a,routeModules:i}=s1(),[l,o]=C.useState([]);return C.useEffect(()=>{let u=!1;return Jz(e,a,i).then(d=>{u||o(d)}),()=>{u=!0}},[e,a,i]),l}function rk({page:e,matches:a,...i}){let l=ma(),{future:o,manifest:u,routeModules:d}=s1(),{basename:f}=l1(),{loaderData:p,matches:h}=tk(),g=C.useMemo(()=>mb(e,a,h,u,l,"data"),[e,a,h,u,l]),b=C.useMemo(()=>mb(e,a,h,u,l,"assets"),[e,a,h,u,l]),v=C.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let z=new Set,j=!1;if(a.forEach(D=>{var L;let E=u.routes[D.route.id];!E||!E.hasLoader||(!g.some(Y=>Y.route.id===D.route.id)&&D.route.id in p&&((L=d[D.route.id])!=null&&L.shouldRevalidate)||E.hasClientLoader?j=!0:z.add(D.route.id))}),z.size===0)return[];let N=Yz(e,f,o.unstable_trailingSlashAwareDataRequests,"data");return j&&z.size>0&&N.searchParams.set("_routes",a.filter(D=>z.has(D.route.id)).map(D=>D.route.id).join(",")),[N.pathname+N.search]},[f,o.unstable_trailingSlashAwareDataRequests,p,l,u,g,a,e,d]),y=C.useMemo(()=>Zz(b,u),[b,u]),k=ik(b);return C.createElement(C.Fragment,null,v.map(z=>C.createElement("link",{key:z,rel:"prefetch",as:"fetch",href:z,...i})),y.map(z=>C.createElement("link",{key:z,rel:"modulepreload",href:z,...i})),k.map(({key:z,link:j})=>C.createElement("link",{key:z,nonce:i.nonce,...j,crossOrigin:j.crossOrigin??i.crossOrigin})))}function lk(...e){return a=>{e.forEach(i=>{typeof i=="function"?i(a):i!=null&&(i.current=a)})}}var sk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{sk&&(window.__reactRouterVersion="7.13.0")}catch{}function ok({basename:e,children:a,unstable_useTransitions:i,window:l}){let o=C.useRef();o.current==null&&(o.current=Fj({window:l,v5Compat:!0}));let u=o.current,[d,f]=C.useState({action:u.action,location:u.location}),p=C.useCallback(h=>{i===!1?f(h):C.startTransition(()=>f(h))},[i]);return C.useLayoutEffect(()=>u.listen(p),[u,p]),C.createElement(Bz,{basename:e,children:a,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:i})}var o1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,c1=C.forwardRef(function({onClick:a,discover:i="render",prefetch:l="none",relative:o,reloadDocument:u,replace:d,state:f,target:p,to:h,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:v,...y},k){let{basename:z,unstable_useTransitions:j}=C.useContext(Ln),N=typeof h=="string"&&o1.test(h),D=Jy(h,z);h=D.to;let E=jz(h,{relative:o}),[L,Y,A]=nk(l,y),H=fk(h,{replace:d,state:f,target:p,preventScrollReset:g,relative:o,viewTransition:b,unstable_defaultShouldRevalidate:v,unstable_useTransitions:j});function ae(O){a&&a(O),O.defaultPrevented||H(O)}let ee=C.createElement("a",{...y,...A,href:D.absoluteURL||E,onClick:D.isExternal||u?a:ae,ref:lk(k,Y),target:p,"data-discover":!N&&i==="render"?"true":void 0});return L&&!N?C.createElement(C.Fragment,null,ee,C.createElement(ak,{page:E})):ee});c1.displayName="Link";var ck=C.forwardRef(function({"aria-current":a="page",caseSensitive:i=!1,className:l="",end:o=!1,style:u,to:d,viewTransition:f,children:p,...h},g){let b=mo(d,{relative:h.relative}),v=ma(),y=C.useContext(mu),{navigator:k,basename:z}=C.useContext(Ln),j=y!=null&&gk(b)&&f===!0,N=k.encodeLocation?k.encodeLocation(b).pathname:b.pathname,D=v.pathname,E=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;i||(D=D.toLowerCase(),E=E?E.toLowerCase():null,N=N.toLowerCase()),E&&z&&(E=ri(E,z)||E);const L=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let Y=D===N||!o&&D.startsWith(N)&&D.charAt(L)==="/",A=E!=null&&(E===N||!o&&E.startsWith(N)&&E.charAt(N.length)==="/"),H={isActive:Y,isPending:A,isTransitioning:j},ae=Y?a:void 0,ee;typeof l=="function"?ee=l(H):ee=[l,Y?"active":null,A?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let O=typeof u=="function"?u(H):u;return C.createElement(c1,{...h,"aria-current":ae,className:ee,ref:g,style:O,to:d,viewTransition:f},typeof p=="function"?p(H):p)});ck.displayName="NavLink";var uk=C.forwardRef(({discover:e="render",fetcherKey:a,navigate:i,reloadDocument:l,replace:o,state:u,method:d=Xc,action:f,onSubmit:p,relative:h,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:v,...y},k)=>{let{unstable_useTransitions:z}=C.useContext(Ln),j=pk(),N=xk(f,{relative:h}),D=d.toLowerCase()==="get"?"get":"post",E=typeof f=="string"&&o1.test(f),L=Y=>{if(p&&p(Y),Y.defaultPrevented)return;Y.preventDefault();let A=Y.nativeEvent.submitter,H=(A==null?void 0:A.getAttribute("formmethod"))||d,ae=()=>j(A||Y.currentTarget,{fetcherKey:a,method:H,navigate:i,replace:o,state:u,relative:h,preventScrollReset:g,viewTransition:b,unstable_defaultShouldRevalidate:v});z&&i!==!1?C.startTransition(()=>ae()):ae()};return C.createElement("form",{ref:k,method:D,action:N,onSubmit:l?p:L,...y,"data-discover":!E&&e==="render"?"true":void 0})});uk.displayName="Form";function dk(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function u1(e){let a=C.useContext(Fl);return bt(a,dk(e)),a}function fk(e,{target:a,replace:i,state:l,preventScrollReset:o,relative:u,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:p}={}){let h=wn(),g=ma(),b=mo(e,{relative:u});return C.useCallback(v=>{if(Pz(v,a)){v.preventDefault();let y=i!==void 0?i:ao(g)===ao(b),k=()=>h(e,{replace:y,state:l,preventScrollReset:o,relative:u,viewTransition:d,unstable_defaultShouldRevalidate:f});p?C.startTransition(()=>k()):k()}},[g,h,b,i,l,a,e,o,u,d,f,p])}var hk=0,mk=()=>`__${String(++hk)}__`;function pk(){let{router:e}=u1("useSubmit"),{basename:a}=C.useContext(Ln),i=Oz(),l=e.fetch,o=e.navigate;return C.useCallback(async(u,d={})=>{let{action:f,method:p,encType:h,formData:g,body:b}=Gz(u,a);if(d.navigate===!1){let v=d.fetcherKey||mk();await l(v,i,d.action||f,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:b,formMethod:d.method||p,formEncType:d.encType||h,flushSync:d.flushSync})}else await o(d.action||f,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:b,formMethod:d.method||p,formEncType:d.encType||h,replace:d.replace,state:d.state,fromRouteId:i,flushSync:d.flushSync,viewTransition:d.viewTransition})},[l,o,a,i])}function xk(e,{relative:a}={}){let{basename:i}=C.useContext(Ln),l=C.useContext(ha);bt(l,"useFormAction must be used inside a RouteContext");let[o]=l.matches.slice(-1),u={...mo(e||".",{relative:a})},d=ma();if(e==null){u.search=d.search;let f=new URLSearchParams(u.search),p=f.getAll("index");if(p.some(g=>g==="")){f.delete("index"),p.filter(b=>b).forEach(b=>f.append("index",b));let g=f.toString();u.search=g?`?${g}`:""}}return(!e||e===".")&&o.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(u.pathname=u.pathname==="/"?i:ai([i,u.pathname])),ao(u)}function gk(e,{relative:a}={}){let i=C.useContext(Ky);bt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=u1("useViewTransitionState"),o=mo(e,{relative:a});if(!i.isTransitioning)return!1;let u=ri(i.currentLocation.pathname,l)||i.currentLocation.pathname,d=ri(i.nextLocation.pathname,l)||i.nextLocation.pathname;return nu(o.pathname,d)!=null||nu(o.pathname,u)!=null}var hm=Vy();const bk=hu(hm);var xu=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(){}},yk={setTimeout:(e,a)=>setTimeout(e,a),clearTimeout:e=>clearTimeout(e),setInterval:(e,a)=>setInterval(e,a),clearInterval:e=>clearInterval(e)},Bi,im,Ly,vk=(Ly=class{constructor(){Ye(this,Bi,yk);Ye(this,im,!1)}setTimeoutProvider(e){Ae(this,Bi,e)}setTimeout(e,a){return re(this,Bi).setTimeout(e,a)}clearTimeout(e){re(this,Bi).clearTimeout(e)}setInterval(e,a){return re(this,Bi).setInterval(e,a)}clearInterval(e){re(this,Bi).clearInterval(e)}},Bi=new WeakMap,im=new WeakMap,Ly),Rh=new vk;function wk(e){setTimeout(e,0)}var gu=typeof window>"u"||"Deno"in globalThis;function oa(){}function jk(e,a){return typeof e=="function"?e(a):e}function zk(e){return typeof e=="number"&&e>=0&&e!==1/0}function kk(e,a){return Math.max(e+(a||0)-Date.now(),0)}function _h(e,a){return typeof e=="function"?e(a):e}function Nk(e,a){return typeof e=="function"?e(a):e}function pb(e,a){const{type:i="all",exact:l,fetchStatus:o,predicate:u,queryKey:d,stale:f}=e;if(d){if(l){if(a.queryHash!==mm(d,a.options))return!1}else if(!ro(a.queryKey,d))return!1}if(i!=="all"){const p=a.isActive();if(i==="active"&&!p||i==="inactive"&&p)return!1}return!(typeof f=="boolean"&&a.isStale()!==f||o&&o!==a.state.fetchStatus||u&&!u(a))}function xb(e,a){const{exact:i,status:l,predicate:o,mutationKey:u}=e;if(u){if(!a.options.mutationKey)return!1;if(i){if(io(a.options.mutationKey)!==io(u))return!1}else if(!ro(a.options.mutationKey,u))return!1}return!(l&&a.state.status!==l||o&&!o(a))}function mm(e,a){return((a==null?void 0:a.queryKeyHashFn)||io)(e)}function io(e){return JSON.stringify(e,(a,i)=>Lh(i)?Object.keys(i).sort().reduce((l,o)=>(l[o]=i[o],l),{}):i)}function ro(e,a){return e===a?!0:typeof e!=typeof a?!1:e&&a&&typeof e=="object"&&typeof a=="object"?Object.keys(a).every(i=>ro(e[i],a[i])):!1}var Sk=Object.prototype.hasOwnProperty;function d1(e,a,i=0){if(e===a)return e;if(i>500)return a;const l=gb(e)&&gb(a);if(!l&&!(Lh(e)&&Lh(a)))return a;const u=(l?e:Object.keys(e)).length,d=l?a:Object.keys(a),f=d.length,p=l?new Array(f):{};let h=0;for(let g=0;g<f;g++){const b=l?g:d[g],v=e[b],y=a[b];if(v===y){p[b]=v,(l?g<u:Sk.call(e,b))&&h++;continue}if(v===null||y===null||typeof v!="object"||typeof y!="object"){p[b]=y;continue}const k=d1(v,y,i+1);p[b]=k,k===v&&h++}return u===f&&h===u?e:p}function gb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Lh(e){if(!bb(e))return!1;const a=e.constructor;if(a===void 0)return!0;const i=a.prototype;return!(!bb(i)||!i.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function bb(e){return Object.prototype.toString.call(e)==="[object Object]"}function Ck(e){return new Promise(a=>{Rh.setTimeout(a,e)})}function Ek(e,a,i){return typeof i.structuralSharing=="function"?i.structuralSharing(e,a):i.structuralSharing!==!1?d1(e,a):a}function Tk(e,a,i=0){const l=[...e,a];return i&&l.length>i?l.slice(1):l}function Ak(e,a,i=0){const l=[a,...e];return i&&l.length>i?l.slice(0,-1):l}var pm=Symbol();function f1(e,a){return!e.queryFn&&(a!=null&&a.initialPromise)?()=>a.initialPromise:!e.queryFn||e.queryFn===pm?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Mk(e,a,i){let l=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=a()),l||(l=!0,o.aborted?i():o.addEventListener("abort",i,{once:!0})),o)}),e}var gr,Ui,Sl,By,Dk=(By=class extends xu{constructor(){super();Ye(this,gr);Ye(this,Ui);Ye(this,Sl);Ae(this,Sl,a=>{if(!gu&&window.addEventListener){const i=()=>a();return window.addEventListener("visibilitychange",i,!1),()=>{window.removeEventListener("visibilitychange",i)}}})}onSubscribe(){re(this,Ui)||this.setEventListener(re(this,Sl))}onUnsubscribe(){var a;this.hasListeners()||((a=re(this,Ui))==null||a.call(this),Ae(this,Ui,void 0))}setEventListener(a){var i;Ae(this,Sl,a),(i=re(this,Ui))==null||i.call(this),Ae(this,Ui,a(l=>{typeof l=="boolean"?this.setFocused(l):this.onFocus()}))}setFocused(a){re(this,gr)!==a&&(Ae(this,gr,a),this.onFocus())}onFocus(){const a=this.isFocused();this.listeners.forEach(i=>{i(a)})}isFocused(){var a;return typeof re(this,gr)=="boolean"?re(this,gr):((a=globalThis.document)==null?void 0:a.visibilityState)!=="hidden"}},gr=new WeakMap,Ui=new WeakMap,Sl=new WeakMap,By),h1=new Dk;function Ok(){let e,a;const i=new Promise((o,u)=>{e=o,a=u});i.status="pending",i.catch(()=>{});function l(o){Object.assign(i,o),delete i.resolve,delete i.reject}return i.resolve=o=>{l({status:"fulfilled",value:o}),e(o)},i.reject=o=>{l({status:"rejected",reason:o}),a(o)},i}var Rk=wk;function _k(){let e=[],a=0,i=f=>{f()},l=f=>{f()},o=Rk;const u=f=>{a?e.push(f):o(()=>{i(f)})},d=()=>{const f=e;e=[],f.length&&o(()=>{l(()=>{f.forEach(p=>{i(p)})})})};return{batch:f=>{let p;a++;try{p=f()}finally{a--,a||d()}return p},batchCalls:f=>(...p)=>{u(()=>{f(...p)})},schedule:u,setNotifyFunction:f=>{i=f},setBatchNotifyFunction:f=>{l=f},setScheduler:f=>{o=f}}}var on=_k(),Cl,Ii,El,Uy,Lk=(Uy=class extends xu{constructor(){super();Ye(this,Cl,!0);Ye(this,Ii);Ye(this,El);Ae(this,El,a=>{if(!gu&&window.addEventListener){const i=()=>a(!0),l=()=>a(!1);return window.addEventListener("online",i,!1),window.addEventListener("offline",l,!1),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",l)}}})}onSubscribe(){re(this,Ii)||this.setEventListener(re(this,El))}onUnsubscribe(){var a;this.hasListeners()||((a=re(this,Ii))==null||a.call(this),Ae(this,Ii,void 0))}setEventListener(a){var i;Ae(this,El,a),(i=re(this,Ii))==null||i.call(this),Ae(this,Ii,a(this.setOnline.bind(this)))}setOnline(a){re(this,Cl)!==a&&(Ae(this,Cl,a),this.listeners.forEach(l=>{l(a)}))}isOnline(){return re(this,Cl)}},Cl=new WeakMap,Ii=new WeakMap,El=new WeakMap,Uy),au=new Lk;function Bk(e){return Math.min(1e3*2**e,3e4)}function m1(e){return(e??"online")==="online"?au.isOnline():!0}var Bh=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function p1(e){let a=!1,i=0,l;const o=Ok(),u=()=>o.status!=="pending",d=z=>{var j;if(!u()){const N=new Bh(z);v(N),(j=e.onCancel)==null||j.call(e,N)}},f=()=>{a=!0},p=()=>{a=!1},h=()=>h1.isFocused()&&(e.networkMode==="always"||au.isOnline())&&e.canRun(),g=()=>m1(e.networkMode)&&e.canRun(),b=z=>{u()||(l==null||l(),o.resolve(z))},v=z=>{u()||(l==null||l(),o.reject(z))},y=()=>new Promise(z=>{var j;l=N=>{(u()||h())&&z(N)},(j=e.onPause)==null||j.call(e)}).then(()=>{var z;l=void 0,u()||(z=e.onContinue)==null||z.call(e)}),k=()=>{if(u())return;let z;const j=i===0?e.initialPromise:void 0;try{z=j??e.fn()}catch(N){z=Promise.reject(N)}Promise.resolve(z).then(b).catch(N=>{var A;if(u())return;const D=e.retry??(gu?0:3),E=e.retryDelay??Bk,L=typeof E=="function"?E(i,N):E,Y=D===!0||typeof D=="number"&&i<D||typeof D=="function"&&D(i,N);if(a||!Y){v(N);return}i++,(A=e.onFail)==null||A.call(e,i,N),Ck(L).then(()=>h()?void 0:y()).then(()=>{a?v(N):k()})})};return{promise:o,status:()=>o.status,cancel:d,continue:()=>(l==null||l(),o),cancelRetry:f,continueRetry:p,canStart:g,start:()=>(g()?k():y().then(k),o)}}var br,Iy,x1=(Iy=class{constructor(){Ye(this,br)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zk(this.gcTime)&&Ae(this,br,Rh.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(gu?1/0:300*1e3))}clearGcTimeout(){re(this,br)&&(Rh.clearTimeout(re(this,br)),Ae(this,br,void 0))}},br=new WeakMap,Iy),yr,Tl,Jn,vr,Ut,co,wr,ca,ei,Hy,Uk=(Hy=class extends x1{constructor(a){super();Ye(this,ca);Ye(this,yr);Ye(this,Tl);Ye(this,Jn);Ye(this,vr);Ye(this,Ut);Ye(this,co);Ye(this,wr);Ae(this,wr,!1),Ae(this,co,a.defaultOptions),this.setOptions(a.options),this.observers=[],Ae(this,vr,a.client),Ae(this,Jn,re(this,vr).getQueryCache()),this.queryKey=a.queryKey,this.queryHash=a.queryHash,Ae(this,yr,vb(this.options)),this.state=a.state??re(this,yr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var a;return(a=re(this,Ut))==null?void 0:a.promise}setOptions(a){if(this.options={...re(this,co),...a},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const i=vb(this.options);i.data!==void 0&&(this.setState(yb(i.data,i.dataUpdatedAt)),Ae(this,yr,i))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&re(this,Jn).remove(this)}setData(a,i){const l=Ek(this.state.data,a,this.options);return Xt(this,ca,ei).call(this,{data:l,type:"success",dataUpdatedAt:i==null?void 0:i.updatedAt,manual:i==null?void 0:i.manual}),l}setState(a,i){Xt(this,ca,ei).call(this,{type:"setState",state:a,setStateOptions:i})}cancel(a){var l,o;const i=(l=re(this,Ut))==null?void 0:l.promise;return(o=re(this,Ut))==null||o.cancel(a),i?i.then(oa).catch(oa):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(re(this,yr))}isActive(){return this.observers.some(a=>Nk(a.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pm||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(a=>_h(a.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(a=>a.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(a=0){return this.state.data===void 0?!0:a==="static"?!1:this.state.isInvalidated?!0:!kk(this.state.dataUpdatedAt,a)}onFocus(){var i;const a=this.observers.find(l=>l.shouldFetchOnWindowFocus());a==null||a.refetch({cancelRefetch:!1}),(i=re(this,Ut))==null||i.continue()}onOnline(){var i;const a=this.observers.find(l=>l.shouldFetchOnReconnect());a==null||a.refetch({cancelRefetch:!1}),(i=re(this,Ut))==null||i.continue()}addObserver(a){this.observers.includes(a)||(this.observers.push(a),this.clearGcTimeout(),re(this,Jn).notify({type:"observerAdded",query:this,observer:a}))}removeObserver(a){this.observers.includes(a)&&(this.observers=this.observers.filter(i=>i!==a),this.observers.length||(re(this,Ut)&&(re(this,wr)?re(this,Ut).cancel({revert:!0}):re(this,Ut).cancelRetry()),this.scheduleGc()),re(this,Jn).notify({type:"observerRemoved",query:this,observer:a}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Xt(this,ca,ei).call(this,{type:"invalidate"})}async fetch(a,i){var p,h,g,b,v,y,k,z,j,N,D,E;if(this.state.fetchStatus!=="idle"&&((p=re(this,Ut))==null?void 0:p.status())!=="rejected"){if(this.state.data!==void 0&&(i!=null&&i.cancelRefetch))this.cancel({silent:!0});else if(re(this,Ut))return re(this,Ut).continueRetry(),re(this,Ut).promise}if(a&&this.setOptions(a),!this.options.queryFn){const L=this.observers.find(Y=>Y.options.queryFn);L&&this.setOptions(L.options)}const l=new AbortController,o=L=>{Object.defineProperty(L,"signal",{enumerable:!0,get:()=>(Ae(this,wr,!0),l.signal)})},u=()=>{const L=f1(this.options,i),A=(()=>{const H={client:re(this,vr),queryKey:this.queryKey,meta:this.meta};return o(H),H})();return Ae(this,wr,!1),this.options.persister?this.options.persister(L,A,this):L(A)},f=(()=>{const L={fetchOptions:i,options:this.options,queryKey:this.queryKey,client:re(this,vr),state:this.state,fetchFn:u};return o(L),L})();(h=this.options.behavior)==null||h.onFetch(f,this),Ae(this,Tl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((g=f.fetchOptions)==null?void 0:g.meta))&&Xt(this,ca,ei).call(this,{type:"fetch",meta:(b=f.fetchOptions)==null?void 0:b.meta}),Ae(this,Ut,p1({initialPromise:i==null?void 0:i.initialPromise,fn:f.fetchFn,onCancel:L=>{L instanceof Bh&&L.revert&&this.setState({...re(this,Tl),fetchStatus:"idle"}),l.abort()},onFail:(L,Y)=>{Xt(this,ca,ei).call(this,{type:"failed",failureCount:L,error:Y})},onPause:()=>{Xt(this,ca,ei).call(this,{type:"pause"})},onContinue:()=>{Xt(this,ca,ei).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const L=await re(this,Ut).start();if(L===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(L),(y=(v=re(this,Jn).config).onSuccess)==null||y.call(v,L,this),(z=(k=re(this,Jn).config).onSettled)==null||z.call(k,L,this.state.error,this),L}catch(L){if(L instanceof Bh){if(L.silent)return re(this,Ut).promise;if(L.revert){if(this.state.data===void 0)throw L;return this.state.data}}throw Xt(this,ca,ei).call(this,{type:"error",error:L}),(N=(j=re(this,Jn).config).onError)==null||N.call(j,L,this),(E=(D=re(this,Jn).config).onSettled)==null||E.call(D,this.state.data,L,this),L}finally{this.scheduleGc()}}},yr=new WeakMap,Tl=new WeakMap,Jn=new WeakMap,vr=new WeakMap,Ut=new WeakMap,co=new WeakMap,wr=new WeakMap,ca=new WeakSet,ei=function(a){const i=l=>{switch(a.type){case"failed":return{...l,fetchFailureCount:a.failureCount,fetchFailureReason:a.error};case"pause":return{...l,fetchStatus:"paused"};case"continue":return{...l,fetchStatus:"fetching"};case"fetch":return{...l,...Ik(l.data,this.options),fetchMeta:a.meta??null};case"success":const o={...l,...yb(a.data,a.dataUpdatedAt),dataUpdateCount:l.dataUpdateCount+1,...!a.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ae(this,Tl,a.manual?o:void 0),o;case"error":const u=a.error;return{...l,error:u,errorUpdateCount:l.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:l.fetchFailureCount+1,fetchFailureReason:u,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...l,isInvalidated:!0};case"setState":return{...l,...a.state}}};this.state=i(this.state),on.batch(()=>{this.observers.forEach(l=>{l.onQueryUpdate()}),re(this,Jn).notify({query:this,type:"updated",action:a})})},Hy);function Ik(e,a){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:m1(a.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function yb(e,a){return{data:e,dataUpdatedAt:a??Date.now(),error:null,isInvalidated:!1,status:"success"}}function vb(e){const a=typeof e.initialData=="function"?e.initialData():e.initialData,i=a!==void 0,l=i?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:a,dataUpdateCount:0,dataUpdatedAt:i?l??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:i?"success":"pending",fetchStatus:"idle"}}function wb(e){return{onFetch:(a,i)=>{var g,b,v,y,k;const l=a.options,o=(v=(b=(g=a.fetchOptions)==null?void 0:g.meta)==null?void 0:b.fetchMore)==null?void 0:v.direction,u=((y=a.state.data)==null?void 0:y.pages)||[],d=((k=a.state.data)==null?void 0:k.pageParams)||[];let f={pages:[],pageParams:[]},p=0;const h=async()=>{let z=!1;const j=E=>{Mk(E,()=>a.signal,()=>z=!0)},N=f1(a.options,a.fetchOptions),D=async(E,L,Y)=>{if(z)return Promise.reject();if(L==null&&E.pages.length)return Promise.resolve(E);const H=(()=>{const U={client:a.client,queryKey:a.queryKey,pageParam:L,direction:Y?"backward":"forward",meta:a.options.meta};return j(U),U})(),ae=await N(H),{maxPages:ee}=a.options,O=Y?Ak:Tk;return{pages:O(E.pages,ae,ee),pageParams:O(E.pageParams,L,ee)}};if(o&&u.length){const E=o==="backward",L=E?Hk:jb,Y={pages:u,pageParams:d},A=L(l,Y);f=await D(Y,A,E)}else{const E=e??u.length;do{const L=p===0?d[0]??l.initialPageParam:jb(l,f);if(p>0&&L==null)break;f=await D(f,L),p++}while(p<E)}return f};a.options.persister?a.fetchFn=()=>{var z,j;return(j=(z=a.options).persister)==null?void 0:j.call(z,h,{client:a.client,queryKey:a.queryKey,meta:a.options.meta,signal:a.signal},i)}:a.fetchFn=h}}}function jb(e,{pages:a,pageParams:i}){const l=a.length-1;return a.length>0?e.getNextPageParam(a[l],a,i[l],i):void 0}function Hk(e,{pages:a,pageParams:i}){var l;return a.length>0?(l=e.getPreviousPageParam)==null?void 0:l.call(e,a[0],a,i[0],i):void 0}var uo,Sa,Kt,jr,Ca,Li,qy,qk=(qy=class extends x1{constructor(a){super();Ye(this,Ca);Ye(this,uo);Ye(this,Sa);Ye(this,Kt);Ye(this,jr);Ae(this,uo,a.client),this.mutationId=a.mutationId,Ae(this,Kt,a.mutationCache),Ae(this,Sa,[]),this.state=a.state||Fk(),this.setOptions(a.options),this.scheduleGc()}setOptions(a){this.options=a,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(a){re(this,Sa).includes(a)||(re(this,Sa).push(a),this.clearGcTimeout(),re(this,Kt).notify({type:"observerAdded",mutation:this,observer:a}))}removeObserver(a){Ae(this,Sa,re(this,Sa).filter(i=>i!==a)),this.scheduleGc(),re(this,Kt).notify({type:"observerRemoved",mutation:this,observer:a})}optionalRemove(){re(this,Sa).length||(this.state.status==="pending"?this.scheduleGc():re(this,Kt).remove(this))}continue(){var a;return((a=re(this,jr))==null?void 0:a.continue())??this.execute(this.state.variables)}async execute(a){var d,f,p,h,g,b,v,y,k,z,j,N,D,E,L,Y,A,H;const i=()=>{Xt(this,Ca,Li).call(this,{type:"continue"})},l={client:re(this,uo),meta:this.options.meta,mutationKey:this.options.mutationKey};Ae(this,jr,p1({fn:()=>this.options.mutationFn?this.options.mutationFn(a,l):Promise.reject(new Error("No mutationFn found")),onFail:(ae,ee)=>{Xt(this,Ca,Li).call(this,{type:"failed",failureCount:ae,error:ee})},onPause:()=>{Xt(this,Ca,Li).call(this,{type:"pause"})},onContinue:i,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>re(this,Kt).canRun(this)}));const o=this.state.status==="pending",u=!re(this,jr).canStart();try{if(o)i();else{Xt(this,Ca,Li).call(this,{type:"pending",variables:a,isPaused:u}),re(this,Kt).config.onMutate&&await re(this,Kt).config.onMutate(a,this,l);const ee=await((f=(d=this.options).onMutate)==null?void 0:f.call(d,a,l));ee!==this.state.context&&Xt(this,Ca,Li).call(this,{type:"pending",context:ee,variables:a,isPaused:u})}const ae=await re(this,jr).start();return await((h=(p=re(this,Kt).config).onSuccess)==null?void 0:h.call(p,ae,a,this.state.context,this,l)),await((b=(g=this.options).onSuccess)==null?void 0:b.call(g,ae,a,this.state.context,l)),await((y=(v=re(this,Kt).config).onSettled)==null?void 0:y.call(v,ae,null,this.state.variables,this.state.context,this,l)),await((z=(k=this.options).onSettled)==null?void 0:z.call(k,ae,null,a,this.state.context,l)),Xt(this,Ca,Li).call(this,{type:"success",data:ae}),ae}catch(ae){try{await((N=(j=re(this,Kt).config).onError)==null?void 0:N.call(j,ae,a,this.state.context,this,l))}catch(ee){Promise.reject(ee)}try{await((E=(D=this.options).onError)==null?void 0:E.call(D,ae,a,this.state.context,l))}catch(ee){Promise.reject(ee)}try{await((Y=(L=re(this,Kt).config).onSettled)==null?void 0:Y.call(L,void 0,ae,this.state.variables,this.state.context,this,l))}catch(ee){Promise.reject(ee)}try{await((H=(A=this.options).onSettled)==null?void 0:H.call(A,void 0,ae,a,this.state.context,l))}catch(ee){Promise.reject(ee)}throw Xt(this,Ca,Li).call(this,{type:"error",error:ae}),ae}finally{re(this,Kt).runNext(this)}}},uo=new WeakMap,Sa=new WeakMap,Kt=new WeakMap,jr=new WeakMap,Ca=new WeakSet,Li=function(a){const i=l=>{switch(a.type){case"failed":return{...l,failureCount:a.failureCount,failureReason:a.error};case"pause":return{...l,isPaused:!0};case"continue":return{...l,isPaused:!1};case"pending":return{...l,context:a.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:a.isPaused,status:"pending",variables:a.variables,submittedAt:Date.now()};case"success":return{...l,data:a.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...l,data:void 0,error:a.error,failureCount:l.failureCount+1,failureReason:a.error,isPaused:!1,status:"error"}}};this.state=i(this.state),on.batch(()=>{re(this,Sa).forEach(l=>{l.onMutationUpdate(a)}),re(this,Kt).notify({mutation:this,type:"updated",action:a})})},qy);function Fk(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ti,ua,fo,Fy,Pk=(Fy=class extends xu{constructor(a={}){super();Ye(this,ti);Ye(this,ua);Ye(this,fo);this.config=a,Ae(this,ti,new Set),Ae(this,ua,new Map),Ae(this,fo,0)}build(a,i,l){const o=new qk({client:a,mutationCache:this,mutationId:++Lc(this,fo)._,options:a.defaultMutationOptions(i),state:l});return this.add(o),o}add(a){re(this,ti).add(a);const i=Uc(a);if(typeof i=="string"){const l=re(this,ua).get(i);l?l.push(a):re(this,ua).set(i,[a])}this.notify({type:"added",mutation:a})}remove(a){if(re(this,ti).delete(a)){const i=Uc(a);if(typeof i=="string"){const l=re(this,ua).get(i);if(l)if(l.length>1){const o=l.indexOf(a);o!==-1&&l.splice(o,1)}else l[0]===a&&re(this,ua).delete(i)}}this.notify({type:"removed",mutation:a})}canRun(a){const i=Uc(a);if(typeof i=="string"){const l=re(this,ua).get(i),o=l==null?void 0:l.find(u=>u.state.status==="pending");return!o||o===a}else return!0}runNext(a){var l;const i=Uc(a);if(typeof i=="string"){const o=(l=re(this,ua).get(i))==null?void 0:l.find(u=>u!==a&&u.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){on.batch(()=>{re(this,ti).forEach(a=>{this.notify({type:"removed",mutation:a})}),re(this,ti).clear(),re(this,ua).clear()})}getAll(){return Array.from(re(this,ti))}find(a){const i={exact:!0,...a};return this.getAll().find(l=>xb(i,l))}findAll(a={}){return this.getAll().filter(i=>xb(a,i))}notify(a){on.batch(()=>{this.listeners.forEach(i=>{i(a)})})}resumePausedMutations(){const a=this.getAll().filter(i=>i.state.isPaused);return on.batch(()=>Promise.all(a.map(i=>i.continue().catch(oa))))}},ti=new WeakMap,ua=new WeakMap,fo=new WeakMap,Fy);function Uc(e){var a;return(a=e.options.scope)==null?void 0:a.id}var Ea,Py,$k=(Py=class extends xu{constructor(a={}){super();Ye(this,Ea);this.config=a,Ae(this,Ea,new Map)}build(a,i,l){const o=i.queryKey,u=i.queryHash??mm(o,i);let d=this.get(u);return d||(d=new Uk({client:a,queryKey:o,queryHash:u,options:a.defaultQueryOptions(i),state:l,defaultOptions:a.getQueryDefaults(o)}),this.add(d)),d}add(a){re(this,Ea).has(a.queryHash)||(re(this,Ea).set(a.queryHash,a),this.notify({type:"added",query:a}))}remove(a){const i=re(this,Ea).get(a.queryHash);i&&(a.destroy(),i===a&&re(this,Ea).delete(a.queryHash),this.notify({type:"removed",query:a}))}clear(){on.batch(()=>{this.getAll().forEach(a=>{this.remove(a)})})}get(a){return re(this,Ea).get(a)}getAll(){return[...re(this,Ea).values()]}find(a){const i={exact:!0,...a};return this.getAll().find(l=>pb(i,l))}findAll(a={}){const i=this.getAll();return Object.keys(a).length>0?i.filter(l=>pb(a,l)):i}notify(a){on.batch(()=>{this.listeners.forEach(i=>{i(a)})})}onFocus(){on.batch(()=>{this.getAll().forEach(a=>{a.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(a=>{a.onOnline()})})}},Ea=new WeakMap,Py),jt,Hi,qi,Al,Ml,Fi,Dl,Ol,$y,Vk=($y=class{constructor(e={}){Ye(this,jt);Ye(this,Hi);Ye(this,qi);Ye(this,Al);Ye(this,Ml);Ye(this,Fi);Ye(this,Dl);Ye(this,Ol);Ae(this,jt,e.queryCache||new $k),Ae(this,Hi,e.mutationCache||new Pk),Ae(this,qi,e.defaultOptions||{}),Ae(this,Al,new Map),Ae(this,Ml,new Map),Ae(this,Fi,0)}mount(){Lc(this,Fi)._++,re(this,Fi)===1&&(Ae(this,Dl,h1.subscribe(async e=>{e&&(await this.resumePausedMutations(),re(this,jt).onFocus())})),Ae(this,Ol,au.subscribe(async e=>{e&&(await this.resumePausedMutations(),re(this,jt).onOnline())})))}unmount(){var e,a;Lc(this,Fi)._--,re(this,Fi)===0&&((e=re(this,Dl))==null||e.call(this),Ae(this,Dl,void 0),(a=re(this,Ol))==null||a.call(this),Ae(this,Ol,void 0))}isFetching(e){return re(this,jt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return re(this,Hi).findAll({...e,status:"pending"}).length}getQueryData(e){var i;const a=this.defaultQueryOptions({queryKey:e});return(i=re(this,jt).get(a.queryHash))==null?void 0:i.state.data}ensureQueryData(e){const a=this.defaultQueryOptions(e),i=re(this,jt).build(this,a),l=i.state.data;return l===void 0?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime(_h(a.staleTime,i))&&this.prefetchQuery(a),Promise.resolve(l))}getQueriesData(e){return re(this,jt).findAll(e).map(({queryKey:a,state:i})=>{const l=i.data;return[a,l]})}setQueryData(e,a,i){const l=this.defaultQueryOptions({queryKey:e}),o=re(this,jt).get(l.queryHash),u=o==null?void 0:o.state.data,d=jk(a,u);if(d!==void 0)return re(this,jt).build(this,l).setData(d,{...i,manual:!0})}setQueriesData(e,a,i){return on.batch(()=>re(this,jt).findAll(e).map(({queryKey:l})=>[l,this.setQueryData(l,a,i)]))}getQueryState(e){var i;const a=this.defaultQueryOptions({queryKey:e});return(i=re(this,jt).get(a.queryHash))==null?void 0:i.state}removeQueries(e){const a=re(this,jt);on.batch(()=>{a.findAll(e).forEach(i=>{a.remove(i)})})}resetQueries(e,a){const i=re(this,jt);return on.batch(()=>(i.findAll(e).forEach(l=>{l.reset()}),this.refetchQueries({type:"active",...e},a)))}cancelQueries(e,a={}){const i={revert:!0,...a},l=on.batch(()=>re(this,jt).findAll(e).map(o=>o.cancel(i)));return Promise.all(l).then(oa).catch(oa)}invalidateQueries(e,a={}){return on.batch(()=>(re(this,jt).findAll(e).forEach(i=>{i.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"},a)))}refetchQueries(e,a={}){const i={...a,cancelRefetch:a.cancelRefetch??!0},l=on.batch(()=>re(this,jt).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let u=o.fetch(void 0,i);return i.throwOnError||(u=u.catch(oa)),o.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(l).then(oa)}fetchQuery(e){const a=this.defaultQueryOptions(e);a.retry===void 0&&(a.retry=!1);const i=re(this,jt).build(this,a);return i.isStaleByTime(_h(a.staleTime,i))?i.fetch(a):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(oa).catch(oa)}fetchInfiniteQuery(e){return e.behavior=wb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(oa).catch(oa)}ensureInfiniteQueryData(e){return e.behavior=wb(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return au.isOnline()?re(this,Hi).resumePausedMutations():Promise.resolve()}getQueryCache(){return re(this,jt)}getMutationCache(){return re(this,Hi)}getDefaultOptions(){return re(this,qi)}setDefaultOptions(e){Ae(this,qi,e)}setQueryDefaults(e,a){re(this,Al).set(io(e),{queryKey:e,defaultOptions:a})}getQueryDefaults(e){const a=[...re(this,Al).values()],i={};return a.forEach(l=>{ro(e,l.queryKey)&&Object.assign(i,l.defaultOptions)}),i}setMutationDefaults(e,a){re(this,Ml).set(io(e),{mutationKey:e,defaultOptions:a})}getMutationDefaults(e){const a=[...re(this,Ml).values()],i={};return a.forEach(l=>{ro(e,l.mutationKey)&&Object.assign(i,l.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;const a={...re(this,qi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return a.queryHash||(a.queryHash=mm(a.queryKey,a)),a.refetchOnReconnect===void 0&&(a.refetchOnReconnect=a.networkMode!=="always"),a.throwOnError===void 0&&(a.throwOnError=!!a.suspense),!a.networkMode&&a.persister&&(a.networkMode="offlineFirst"),a.queryFn===pm&&(a.enabled=!1),a}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...re(this,qi).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){re(this,jt).clear(),re(this,Hi).clear()}},jt=new WeakMap,Hi=new WeakMap,qi=new WeakMap,Al=new WeakMap,Ml=new WeakMap,Fi=new WeakMap,Dl=new WeakMap,Ol=new WeakMap,$y),Gk=C.createContext(void 0),Yk=({client:e,children:a})=>(C.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(Gk.Provider,{value:e,children:a})),Qk=e=>{switch(e){case"success":return Zk;case"info":return Wk;case"warning":return Kk;case"error":return eN;default:return null}},Xk=Array(12).fill(0),Jk=({visible:e,className:a})=>pe.createElement("div",{className:["sonner-loading-wrapper",a].filter(Boolean).join(" "),"data-visible":e},pe.createElement("div",{className:"sonner-spinner"},Xk.map((i,l)=>pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${l}`})))),Zk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Kk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Wk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),eN=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),tN=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},pe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),pe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),nN=()=>{let[e,a]=pe.useState(document.hidden);return pe.useEffect(()=>{let i=()=>{a(document.hidden)};return document.addEventListener("visibilitychange",i),()=>window.removeEventListener("visibilitychange",i)},[]),e},Uh=1,aN=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let a=this.subscribers.indexOf(e);this.subscribers.splice(a,1)}),this.publish=e=>{this.subscribers.forEach(a=>a(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var a;let{message:i,...l}=e,o=typeof(e==null?void 0:e.id)=="number"||((a=e.id)==null?void 0:a.length)>0?e.id:Uh++,u=this.toasts.find(f=>f.id===o),d=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),u?this.toasts=this.toasts.map(f=>f.id===o?(this.publish({...f,...e,id:o,title:i}),{...f,...e,id:o,dismissible:d,title:i}):f):this.addToast({title:i,...l,dismissible:d,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(a=>{this.subscribers.forEach(i=>i({id:a.id,dismiss:!0}))}),this.subscribers.forEach(a=>a({id:e,dismiss:!0})),e),this.message=(e,a)=>this.create({...a,message:e}),this.error=(e,a)=>this.create({...a,message:e,type:"error"}),this.success=(e,a)=>this.create({...a,type:"success",message:e}),this.info=(e,a)=>this.create({...a,type:"info",message:e}),this.warning=(e,a)=>this.create({...a,type:"warning",message:e}),this.loading=(e,a)=>this.create({...a,type:"loading",message:e}),this.promise=(e,a)=>{if(!a)return;let i;a.loading!==void 0&&(i=this.create({...a,promise:e,type:"loading",message:a.loading,description:typeof a.description!="function"?a.description:void 0}));let l=e instanceof Promise?e:e(),o=i!==void 0,u,d=l.then(async p=>{if(u=["resolve",p],pe.isValidElement(p))o=!1,this.create({id:i,type:"default",message:p});else if(rN(p)&&!p.ok){o=!1;let h=typeof a.error=="function"?await a.error(`HTTP error! status: ${p.status}`):a.error,g=typeof a.description=="function"?await a.description(`HTTP error! status: ${p.status}`):a.description;this.create({id:i,type:"error",message:h,description:g})}else if(a.success!==void 0){o=!1;let h=typeof a.success=="function"?await a.success(p):a.success,g=typeof a.description=="function"?await a.description(p):a.description;this.create({id:i,type:"success",message:h,description:g})}}).catch(async p=>{if(u=["reject",p],a.error!==void 0){o=!1;let h=typeof a.error=="function"?await a.error(p):a.error,g=typeof a.description=="function"?await a.description(p):a.description;this.create({id:i,type:"error",message:h,description:g})}}).finally(()=>{var p;o&&(this.dismiss(i),i=void 0),(p=a.finally)==null||p.call(a)}),f=()=>new Promise((p,h)=>d.then(()=>u[0]==="reject"?h(u[1]):p(u[1])).catch(h));return typeof i!="string"&&typeof i!="number"?{unwrap:f}:Object.assign(i,{unwrap:f})},this.custom=(e,a)=>{let i=(a==null?void 0:a.id)||Uh++;return this.create({jsx:e(i),id:i,...a}),i},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},vn=new aN,iN=(e,a)=>{let i=(a==null?void 0:a.id)||Uh++;return vn.addToast({title:e,...a,id:i}),i},rN=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",lN=iN,sN=()=>vn.toasts,oN=()=>vn.getActiveToasts(),Xe=Object.assign(lN,{success:vn.success,info:vn.info,warning:vn.warning,error:vn.error,custom:vn.custom,message:vn.message,promise:vn.promise,dismiss:vn.dismiss,loading:vn.loading},{getHistory:sN,getToasts:oN});function cN(e,{insertAt:a}={}){if(typeof document>"u")return;let i=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css",a==="top"&&i.firstChild?i.insertBefore(l,i.firstChild):i.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}cN(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
`);function Ic(e){return e.label!==void 0}var uN=3,dN="32px",fN="16px",zb=4e3,hN=356,mN=14,pN=20,xN=200;function sa(...e){return e.filter(Boolean).join(" ")}function gN(e){let[a,i]=e.split("-"),l=[];return a&&l.push(a),i&&l.push(i),l}var bN=e=>{var a,i,l,o,u,d,f,p,h,g,b;let{invert:v,toast:y,unstyled:k,interacting:z,setHeights:j,visibleToasts:N,heights:D,index:E,toasts:L,expanded:Y,removeToast:A,defaultRichColors:H,closeButton:ae,style:ee,cancelButtonStyle:O,actionButtonStyle:U,className:$="",descriptionClassName:me="",duration:V,position:te,gap:B,loadingIcon:X,expandByDefault:ce,classNames:ue,icons:M,closeButtonAriaLabel:R="Close toast",pauseWhenPageIsHidden:P}=e,[T,F]=pe.useState(null),[ge,ye]=pe.useState(null),[Z,de]=pe.useState(!1),[Ne,it]=pe.useState(!1),[yt,un]=pe.useState(!1),[Da,zn]=pe.useState(!1),[Un,kn]=pe.useState(!1),[Oa,xe]=pe.useState(0),[ve,Me]=pe.useState(0),ze=pe.useRef(y.duration||V||zb),Be=pe.useRef(null),Ie=pe.useRef(null),et=E===0,Nt=E+1<=N,K=y.type,fe=y.dismissible!==!1,Ee=y.className||"",Ue=y.descriptionClassName||"",Ve=pe.useMemo(()=>D.findIndex(Te=>Te.toastId===y.id)||0,[D,y.id]),an=pe.useMemo(()=>{var Te;return(Te=y.closeButton)!=null?Te:ae},[y.closeButton,ae]),In=pe.useMemo(()=>y.duration||V||zb,[y.duration,V]),Ot=pe.useRef(0),ft=pe.useRef(0),Ht=pe.useRef(0),Qe=pe.useRef(null),[ba,Nn]=te.split("-"),zo=pe.useMemo(()=>D.reduce((Te,tt,ct)=>ct>=Ve?Te:Te+tt.height,0),[D,Ve]),Qi=nN(),Tr=y.invert||v,oi=K==="loading";ft.current=pe.useMemo(()=>Ve*B+zo,[Ve,zo]),pe.useEffect(()=>{ze.current=In},[In]),pe.useEffect(()=>{de(!0)},[]),pe.useEffect(()=>{let Te=Ie.current;if(Te){let tt=Te.getBoundingClientRect().height;return Me(tt),j(ct=>[{toastId:y.id,height:tt,position:y.position},...ct]),()=>j(ct=>ct.filter(rn=>rn.toastId!==y.id))}},[j,y.id]),pe.useLayoutEffect(()=>{if(!Z)return;let Te=Ie.current,tt=Te.style.height;Te.style.height="auto";let ct=Te.getBoundingClientRect().height;Te.style.height=tt,Me(ct),j(rn=>rn.find(qt=>qt.toastId===y.id)?rn.map(qt=>qt.toastId===y.id?{...qt,height:ct}:qt):[{toastId:y.id,height:ct,position:y.position},...rn])},[Z,y.title,y.description,j,y.id]);let Qt=pe.useCallback(()=>{it(!0),xe(ft.current),j(Te=>Te.filter(tt=>tt.toastId!==y.id)),setTimeout(()=>{A(y)},xN)},[y,A,j,ft]);pe.useEffect(()=>{if(y.promise&&K==="loading"||y.duration===1/0||y.type==="loading")return;let Te;return Y||z||P&&Qi?(()=>{if(Ht.current<Ot.current){let tt=new Date().getTime()-Ot.current;ze.current=ze.current-tt}Ht.current=new Date().getTime()})():ze.current!==1/0&&(Ot.current=new Date().getTime(),Te=setTimeout(()=>{var tt;(tt=y.onAutoClose)==null||tt.call(y,y),Qt()},ze.current)),()=>clearTimeout(Te)},[Y,z,y,K,P,Qi,Qt]),pe.useEffect(()=>{y.delete&&Qt()},[Qt,y.delete]);function Ar(){var Te,tt,ct;return M!=null&&M.loading?pe.createElement("div",{className:sa(ue==null?void 0:ue.loader,(Te=y==null?void 0:y.classNames)==null?void 0:Te.loader,"sonner-loader"),"data-visible":K==="loading"},M.loading):X?pe.createElement("div",{className:sa(ue==null?void 0:ue.loader,(tt=y==null?void 0:y.classNames)==null?void 0:tt.loader,"sonner-loader"),"data-visible":K==="loading"},X):pe.createElement(Jk,{className:sa(ue==null?void 0:ue.loader,(ct=y==null?void 0:y.classNames)==null?void 0:ct.loader),visible:K==="loading"})}return pe.createElement("li",{tabIndex:0,ref:Ie,className:sa($,Ee,ue==null?void 0:ue.toast,(a=y==null?void 0:y.classNames)==null?void 0:a.toast,ue==null?void 0:ue.default,ue==null?void 0:ue[K],(i=y==null?void 0:y.classNames)==null?void 0:i[K]),"data-sonner-toast":"","data-rich-colors":(l=y.richColors)!=null?l:H,"data-styled":!(y.jsx||y.unstyled||k),"data-mounted":Z,"data-promise":!!y.promise,"data-swiped":Un,"data-removed":Ne,"data-visible":Nt,"data-y-position":ba,"data-x-position":Nn,"data-index":E,"data-front":et,"data-swiping":yt,"data-dismissible":fe,"data-type":K,"data-invert":Tr,"data-swipe-out":Da,"data-swipe-direction":ge,"data-expanded":!!(Y||ce&&Z),style:{"--index":E,"--toasts-before":E,"--z-index":L.length-E,"--offset":`${Ne?Oa:ft.current}px`,"--initial-height":ce?"auto":`${ve}px`,...ee,...y.style},onDragEnd:()=>{un(!1),F(null),Qe.current=null},onPointerDown:Te=>{oi||!fe||(Be.current=new Date,xe(ft.current),Te.target.setPointerCapture(Te.pointerId),Te.target.tagName!=="BUTTON"&&(un(!0),Qe.current={x:Te.clientX,y:Te.clientY}))},onPointerUp:()=>{var Te,tt,ct,rn;if(Da||!fe)return;Qe.current=null;let qt=Number(((Te=Ie.current)==null?void 0:Te.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ya=Number(((tt=Ie.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),va=new Date().getTime()-((ct=Be.current)==null?void 0:ct.getTime()),dn=T==="x"?qt:ya,na=Math.abs(dn)/va;if(Math.abs(dn)>=pN||na>.11){xe(ft.current),(rn=y.onDismiss)==null||rn.call(y,y),ye(T==="x"?qt>0?"right":"left":ya>0?"down":"up"),Qt(),zn(!0),kn(!1);return}un(!1),F(null)},onPointerMove:Te=>{var tt,ct,rn,qt;if(!Qe.current||!fe||((tt=window.getSelection())==null?void 0:tt.toString().length)>0)return;let ya=Te.clientY-Qe.current.y,va=Te.clientX-Qe.current.x,dn=(ct=e.swipeDirections)!=null?ct:gN(te);!T&&(Math.abs(va)>1||Math.abs(ya)>1)&&F(Math.abs(va)>Math.abs(ya)?"x":"y");let na={x:0,y:0};T==="y"?(dn.includes("top")||dn.includes("bottom"))&&(dn.includes("top")&&ya<0||dn.includes("bottom")&&ya>0)&&(na.y=ya):T==="x"&&(dn.includes("left")||dn.includes("right"))&&(dn.includes("left")&&va<0||dn.includes("right")&&va>0)&&(na.x=va),(Math.abs(na.x)>0||Math.abs(na.y)>0)&&kn(!0),(rn=Ie.current)==null||rn.style.setProperty("--swipe-amount-x",`${na.x}px`),(qt=Ie.current)==null||qt.style.setProperty("--swipe-amount-y",`${na.y}px`)}},an&&!y.jsx?pe.createElement("button",{"aria-label":R,"data-disabled":oi,"data-close-button":!0,onClick:oi||!fe?()=>{}:()=>{var Te;Qt(),(Te=y.onDismiss)==null||Te.call(y,y)},className:sa(ue==null?void 0:ue.closeButton,(o=y==null?void 0:y.classNames)==null?void 0:o.closeButton)},(u=M==null?void 0:M.close)!=null?u:tN):null,y.jsx||C.isValidElement(y.title)?y.jsx?y.jsx:typeof y.title=="function"?y.title():y.title:pe.createElement(pe.Fragment,null,K||y.icon||y.promise?pe.createElement("div",{"data-icon":"",className:sa(ue==null?void 0:ue.icon,(d=y==null?void 0:y.classNames)==null?void 0:d.icon)},y.promise||y.type==="loading"&&!y.icon?y.icon||Ar():null,y.type!=="loading"?y.icon||(M==null?void 0:M[K])||Qk(K):null):null,pe.createElement("div",{"data-content":"",className:sa(ue==null?void 0:ue.content,(f=y==null?void 0:y.classNames)==null?void 0:f.content)},pe.createElement("div",{"data-title":"",className:sa(ue==null?void 0:ue.title,(p=y==null?void 0:y.classNames)==null?void 0:p.title)},typeof y.title=="function"?y.title():y.title),y.description?pe.createElement("div",{"data-description":"",className:sa(me,Ue,ue==null?void 0:ue.description,(h=y==null?void 0:y.classNames)==null?void 0:h.description)},typeof y.description=="function"?y.description():y.description):null),C.isValidElement(y.cancel)?y.cancel:y.cancel&&Ic(y.cancel)?pe.createElement("button",{"data-button":!0,"data-cancel":!0,style:y.cancelButtonStyle||O,onClick:Te=>{var tt,ct;Ic(y.cancel)&&fe&&((ct=(tt=y.cancel).onClick)==null||ct.call(tt,Te),Qt())},className:sa(ue==null?void 0:ue.cancelButton,(g=y==null?void 0:y.classNames)==null?void 0:g.cancelButton)},y.cancel.label):null,C.isValidElement(y.action)?y.action:y.action&&Ic(y.action)?pe.createElement("button",{"data-button":!0,"data-action":!0,style:y.actionButtonStyle||U,onClick:Te=>{var tt,ct;Ic(y.action)&&((ct=(tt=y.action).onClick)==null||ct.call(tt,Te),!Te.defaultPrevented&&Qt())},className:sa(ue==null?void 0:ue.actionButton,(b=y==null?void 0:y.classNames)==null?void 0:b.actionButton)},y.action.label):null))};function kb(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function yN(e,a){let i={};return[e,a].forEach((l,o)=>{let u=o===1,d=u?"--mobile-offset":"--offset",f=u?fN:dN;function p(h){["top","right","bottom","left"].forEach(g=>{i[`${d}-${g}`]=typeof h=="number"?`${h}px`:h})}typeof l=="number"||typeof l=="string"?p(l):typeof l=="object"?["top","right","bottom","left"].forEach(h=>{l[h]===void 0?i[`${d}-${h}`]=f:i[`${d}-${h}`]=typeof l[h]=="number"?`${l[h]}px`:l[h]}):p(f)}),i}var vN=C.forwardRef(function(e,a){let{invert:i,position:l="bottom-right",hotkey:o=["altKey","KeyT"],expand:u,closeButton:d,className:f,offset:p,mobileOffset:h,theme:g="light",richColors:b,duration:v,style:y,visibleToasts:k=uN,toastOptions:z,dir:j=kb(),gap:N=mN,loadingIcon:D,icons:E,containerAriaLabel:L="Notifications",pauseWhenPageIsHidden:Y}=e,[A,H]=pe.useState([]),ae=pe.useMemo(()=>Array.from(new Set([l].concat(A.filter(P=>P.position).map(P=>P.position)))),[A,l]),[ee,O]=pe.useState([]),[U,$]=pe.useState(!1),[me,V]=pe.useState(!1),[te,B]=pe.useState(g!=="system"?g:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),X=pe.useRef(null),ce=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),ue=pe.useRef(null),M=pe.useRef(!1),R=pe.useCallback(P=>{H(T=>{var F;return(F=T.find(ge=>ge.id===P.id))!=null&&F.delete||vn.dismiss(P.id),T.filter(({id:ge})=>ge!==P.id)})},[]);return pe.useEffect(()=>vn.subscribe(P=>{if(P.dismiss){H(T=>T.map(F=>F.id===P.id?{...F,delete:!0}:F));return}setTimeout(()=>{bk.flushSync(()=>{H(T=>{let F=T.findIndex(ge=>ge.id===P.id);return F!==-1?[...T.slice(0,F),{...T[F],...P},...T.slice(F+1)]:[P,...T]})})})}),[]),pe.useEffect(()=>{if(g!=="system"){B(g);return}if(g==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?B("dark"):B("light")),typeof window>"u")return;let P=window.matchMedia("(prefers-color-scheme: dark)");try{P.addEventListener("change",({matches:T})=>{B(T?"dark":"light")})}catch{P.addListener(({matches:F})=>{try{B(F?"dark":"light")}catch(ge){console.error(ge)}})}},[g]),pe.useEffect(()=>{A.length<=1&&$(!1)},[A]),pe.useEffect(()=>{let P=T=>{var F,ge;o.every(ye=>T[ye]||T.code===ye)&&($(!0),(F=X.current)==null||F.focus()),T.code==="Escape"&&(document.activeElement===X.current||(ge=X.current)!=null&&ge.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[o]),pe.useEffect(()=>{if(X.current)return()=>{ue.current&&(ue.current.focus({preventScroll:!0}),ue.current=null,M.current=!1)}},[X.current]),pe.createElement("section",{ref:a,"aria-label":`${L} ${ce}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ae.map((P,T)=>{var F;let[ge,ye]=P.split("-");return A.length?pe.createElement("ol",{key:P,dir:j==="auto"?kb():j,tabIndex:-1,ref:X,className:f,"data-sonner-toaster":!0,"data-theme":te,"data-y-position":ge,"data-lifted":U&&A.length>1&&!u,"data-x-position":ye,style:{"--front-toast-height":`${((F=ee[0])==null?void 0:F.height)||0}px`,"--width":`${hN}px`,"--gap":`${N}px`,...y,...yN(p,h)},onBlur:Z=>{M.current&&!Z.currentTarget.contains(Z.relatedTarget)&&(M.current=!1,ue.current&&(ue.current.focus({preventScroll:!0}),ue.current=null))},onFocus:Z=>{Z.target instanceof HTMLElement&&Z.target.dataset.dismissible==="false"||M.current||(M.current=!0,ue.current=Z.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{me||$(!1)},onDragEnd:()=>$(!1),onPointerDown:Z=>{Z.target instanceof HTMLElement&&Z.target.dataset.dismissible==="false"||V(!0)},onPointerUp:()=>V(!1)},A.filter(Z=>!Z.position&&T===0||Z.position===P).map((Z,de)=>{var Ne,it;return pe.createElement(bN,{key:Z.id,icons:E,index:de,toast:Z,defaultRichColors:b,duration:(Ne=z==null?void 0:z.duration)!=null?Ne:v,className:z==null?void 0:z.className,descriptionClassName:z==null?void 0:z.descriptionClassName,invert:i,visibleToasts:k,closeButton:(it=z==null?void 0:z.closeButton)!=null?it:d,interacting:me,position:P,style:z==null?void 0:z.style,unstyled:z==null?void 0:z.unstyled,classNames:z==null?void 0:z.classNames,cancelButtonStyle:z==null?void 0:z.cancelButtonStyle,actionButtonStyle:z==null?void 0:z.actionButtonStyle,removeToast:R,toasts:A.filter(yt=>yt.position==Z.position),heights:ee.filter(yt=>yt.position==Z.position),setHeights:O,expandByDefault:u,gap:N,loadingIcon:D,expanded:U,pauseWhenPageIsHidden:Y,swipeDirections:e.swipeDirections})})):null}))});/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),g1=(...e)=>e.filter((a,i,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===i).join(" ").trim();/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var jN={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"};/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zN=C.forwardRef(({color:e="currentColor",size:a=24,strokeWidth:i=2,absoluteStrokeWidth:l,className:o="",children:u,iconNode:d,...f},p)=>C.createElement("svg",{ref:p,...jN,width:a,height:a,stroke:e,strokeWidth:l?Number(i)*24/Number(a):i,className:g1("lucide",o),...f},[...d.map(([h,g])=>C.createElement(h,g)),...Array.isArray(u)?u:[u]]));/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oe=(e,a)=>{const i=C.forwardRef(({className:l,...o},u)=>C.createElement(zN,{ref:u,iconNode:a,className:g1(`lucide-${wN(e)}`,l),...o}));return i.displayName=`${e}`,i};/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const b1=oe("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kN=oe("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ih=oe("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const NN=oe("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const y1=oe("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SN=oe("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iu=oe("AtSign",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CN=oe("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const EN=oe("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ii=oe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zr=oe("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TN=oe("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const v1=oe("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xm=oe("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ru=oe("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wn=oe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const po=oe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bu=oe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kr=oe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gm=oe("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rl=oe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const AN=oe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _l=oe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MN=oe("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nr=oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $l=oe("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const DN=oe("Copy",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const w1=oe("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yu=oe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ON=oe("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pi=oe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const j1=oe("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const z1=oe("Ellipsis",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RN=oe("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const k1=oe("ExternalLink",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const N1=oe("EyeOff",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vu=oe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _N=oe("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LN=oe("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BN=oe("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ll=oe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UN=oe("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IN=oe("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bm=oe("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HN=oe("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qN=oe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FN=oe("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const PN=oe("Ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $N=oe("Github",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S1=oe("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VN=oe("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wu=oe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const GN=oe("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const YN=oe("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const QN=oe("LayoutDashboard",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const XN=oe("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const JN=oe("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ZN=oe("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const KN=oe("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ot=oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const C1=oe("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const WN=oe("Meh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"8",x2:"16",y1:"15",y2:"15",key:"1xb1d9"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const e4=oe("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lo=oe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $i=oe("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const t4=oe("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const n4=oe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ju=oe("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nb=oe("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E1=oe("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const a4=oe("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const T1=oe("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sb=oe("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zu=oe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ym=oe("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ta=oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i4=oe("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const r4=oe("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const A1=oe("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vi=oe("RefreshCw",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const l4=oe("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lu=oe("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vm=oe("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Aa=oe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hh=oe("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xo=oe("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ku=oe("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wm=oe("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pa=oe("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nu=oe("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s4=oe("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Kn=oe("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const M1=oe("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const o4=oe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Su=oe("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const su=oe("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const c4=oe("Sun",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jm=oe("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zm=oe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const D1=oe("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const go=oe("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bo=oe("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ea=oe("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bl=oe("TriangleAlert",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cu=oe("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const km=oe("UserPlus",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Eu=oe("User",[["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"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nm=oe("Users",[["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"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qh=oe("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ul=oe("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xa=oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
 * @license lucide-react v0.460.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vl=oe("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Cb=e=>{let a;const i=new Set,l=(h,g)=>{const b=typeof h=="function"?h(a):h;if(!Object.is(b,a)){const v=a;a=g??(typeof b!="object"||b===null)?b:Object.assign({},a,b),i.forEach(y=>y(a,v))}},o=()=>a,f={setState:l,getState:o,getInitialState:()=>p,subscribe:h=>(i.add(h),()=>i.delete(h))},p=a=e(l,o,f);return f},u4=(e=>e?Cb(e):Cb),d4=e=>e;function f4(e,a=d4){const i=pe.useSyncExternalStore(e.subscribe,pe.useCallback(()=>a(e.getState()),[e,a]),pe.useCallback(()=>a(e.getInitialState()),[e,a]));return pe.useDebugValue(i),i}const Eb=e=>{const a=u4(e),i=l=>f4(a,l);return Object.assign(i,a),i},_t=(e=>e?Eb(e):Eb);function h4(e,a){let i;try{i=e()}catch{return}return{getItem:o=>{var u;const d=p=>p===null?null:JSON.parse(p,void 0),f=(u=i.getItem(o))!=null?u:null;return f instanceof Promise?f.then(d):d(f)},setItem:(o,u)=>i.setItem(o,JSON.stringify(u,void 0)),removeItem:o=>i.removeItem(o)}}const Fh=e=>a=>{try{const i=e(a);return i instanceof Promise?i:{then(l){return Fh(l)(i)},catch(l){return this}}}catch(i){return{then(l){return this},catch(l){return Fh(l)(i)}}}},m4=(e,a)=>(i,l,o)=>{let u={storage:h4(()=>window.localStorage),partialize:j=>j,version:0,merge:(j,N)=>({...N,...j}),...a},d=!1,f=0;const p=new Set,h=new Set;let g=u.storage;if(!g)return e((...j)=>{console.warn(`[zustand persist middleware] Unable to update item '${u.name}', the given storage is currently unavailable.`),i(...j)},l,o);const b=()=>{const j=u.partialize({...l()});return g.setItem(u.name,{state:j,version:u.version})},v=o.setState;o.setState=(j,N)=>(v(j,N),b());const y=e((...j)=>(i(...j),b()),l,o);o.getInitialState=()=>y;let k;const z=()=>{var j,N;if(!g)return;const D=++f;d=!1,p.forEach(L=>{var Y;return L((Y=l())!=null?Y:y)});const E=((N=u.onRehydrateStorage)==null?void 0:N.call(u,(j=l())!=null?j:y))||void 0;return Fh(g.getItem.bind(g))(u.name).then(L=>{if(L)if(typeof L.version=="number"&&L.version!==u.version){if(u.migrate){const Y=u.migrate(L.state,L.version);return Y instanceof Promise?Y.then(A=>[!0,A]):[!0,Y]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,L.state];return[!1,void 0]}).then(L=>{var Y;if(D!==f)return;const[A,H]=L;if(k=u.merge(H,(Y=l())!=null?Y:y),i(k,!0),A)return b()}).then(()=>{D===f&&(E==null||E(k,void 0),k=l(),d=!0,h.forEach(L=>L(k)))}).catch(L=>{D===f&&(E==null||E(void 0,L))})};return o.persist={setOptions:j=>{u={...u,...j},j.storage&&(g=j.storage)},clearStorage:()=>{g==null||g.removeItem(u.name)},getOptions:()=>u,rehydrate:()=>z(),hasHydrated:()=>d,onHydrate:j=>(p.add(j),()=>{p.delete(j)}),onFinishHydration:j=>(h.add(j),()=>{h.delete(j)})},u.skipHydration||z(),k||y},tn=m4,ga=_t()(tn(e=>({user:null,accessToken:null,refreshToken:null,isAuthenticated:!1,isLoading:!0,setupRequired:null,setUser:a=>e({user:a,isAuthenticated:a!==null}),setTokens:(a,i)=>e({accessToken:a,refreshToken:i,isAuthenticated:!0}),setAccessToken:a=>e({accessToken:a}),setSetupRequired:a=>e({setupRequired:a,isLoading:!1}),setLoading:a=>e({isLoading:a}),login:(a,i,l)=>e({user:a,accessToken:i,refreshToken:l,isAuthenticated:!0,isLoading:!1,setupRequired:!1}),logout:()=>e({user:null,accessToken:null,refreshToken:null,isAuthenticated:!1,isLoading:!1}),updateUser:a=>e(i=>({user:i.user?{...i.user,...a}:null}))}),{name:"cachibot-auth",partialize:e=>({user:e.user,accessToken:e.accessToken,refreshToken:e.refreshToken,isAuthenticated:e.isAuthenticated})})),p4="/api";class x4 extends Error{constructor(a,i,l){super(a),this.status=i,this.data=l,this.name="AuthApiError"}}async function li(e,a={},i=!1){const l=`${p4}${e}`,o={"Content-Type":"application/json",...a.headers};if(i){const{accessToken:d}=ga.getState();d&&(o.Authorization=`Bearer ${d}`)}const u=await fetch(l,{...a,headers:o});if(!u.ok){const d=await u.json().catch(()=>({}));throw new x4(d.detail||`Request failed: ${u.statusText}`,u.status,d)}return u.json()}async function Sm(){return li("/auth/setup-required")}async function g4(e){return li("/auth/setup",{method:"POST",body:JSON.stringify(e)})}async function b4(e){return li("/auth/login",{method:"POST",body:JSON.stringify(e)})}async function y4(e){return li("/auth/refresh",{method:"POST",body:JSON.stringify(e)})}async function v4(){return li("/auth/me",{},!0)}async function O1(e=100,a=0){return li(`/auth/users?limit=${e}&offset=${a}`,{},!0)}async function R1(e){return li("/auth/users",{method:"POST",body:JSON.stringify(e)},!0)}async function _1(e,a){return li(`/auth/users/${e}`,{method:"PUT",body:JSON.stringify(a)},!0)}async function L1(e){return li(`/auth/users/${e}`,{method:"DELETE"},!0)}let $s=null;async function Tu(){const{refreshToken:e,setAccessToken:a,logout:i}=ga.getState();if(!e)return null;if($s)try{return(await $s).access_token}catch{return null}try{$s=y4({refresh_token:e});const l=await $s;return a(l.access_token),l.access_token}catch{return i(),null}finally{$s=null}}const w4="/api";let B1=class extends Error{constructor(a,i,l){super(a),this.status=i,this.data=l,this.name="ApiError"}};function j4(){const{accessToken:e}=ga.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function be(e,a={},i=!0){const l=`${w4}${e}`,o=await fetch(l,{headers:{"Content-Type":"application/json",...j4(),...a.headers},...a});if(o.status===401&&i&&await Tu())return be(e,a,!1);if(!o.ok){const u=await o.json().catch(()=>({}));throw new B1(u.detail||`Request failed: ${o.statusText}`,o.status,u)}return o.json()}async function z4(){return be("/health")}async function U1(){return be("/config")}async function Zc(e){return be("/config",{method:"PUT",body:JSON.stringify(e)})}async function k4(e=50,a=0){return be(`/chat/history?limit=${e}&offset=${a}`)}async function N4(){return be("/chat/history",{method:"DELETE"})}async function I1(e=[]){return(await be("/creation/names",{method:"POST",body:JSON.stringify({count:4,exclude:e})})).names}async function H1(e={}){return(await be("/creation/names-with-meanings",{method:"POST",body:JSON.stringify({count:e.count??4,exclude:e.exclude??[],purpose:e.purpose,personality:e.personality})})).names}async function q1(e){return(await be("/creation/follow-up-questions",{method:"POST",body:JSON.stringify(e)})).questions}async function F1(e){return be("/creation/generate-prompt",{method:"POST",body:JSON.stringify(e)})}async function S4(e){return be("/creation/suggest-prompt",{method:"POST",body:JSON.stringify(e)})}async function P1(e){return be("/creation/refine-prompt",{method:"POST",body:JSON.stringify(e)})}async function $1(e){return be("/creation/preview-bot",{method:"POST",body:JSON.stringify(e)})}async function Cm(e){return be(`/bots/${e.id}`,{method:"PUT",body:JSON.stringify(e)})}async function V1(e){return be(`/bots/${e}`,{method:"DELETE"})}async function C4(e){return be(`/bots/${e}/export`)}async function E4(e){return be("/bots/import",{method:"POST",body:JSON.stringify(e)})}async function G1(e){return be(`/bots/${e}/chats`)}async function Y1(e,a,i=50){return be(`/bots/${e}/chats/${a}/messages?limit=${i}`)}async function Q1(e,a){return be(`/bots/${e}/chats/${a}`,{method:"DELETE"})}async function X1(e,a){return be(`/bots/${e}/chats/${a}/_clear-messages`,{method:"POST"})}async function T4(e){return be(`/bots/${e}/chats/_clear`,{method:"POST"})}async function J1(e,a){return be(`/bots/${e}/chats/${a}/_archive`,{method:"POST"})}async function Em(e,a){return be(`/bots/${e}/chats/${a}/_unarchive`,{method:"POST"})}async function Z1(e){return be(`/bots/${e}/chats?include_archived=true`)}async function A4(e){return be(`/bots/${e}/functions`)}async function M4(e,a){return be(`/bots/${e}/functions/${a}`)}async function D4(e,a){return be(`/bots/${e}/functions`,{method:"POST",body:JSON.stringify(a)})}async function O4(e,a,i){return be(`/bots/${e}/functions/${a}`,{method:"PATCH",body:JSON.stringify(i)})}async function R4(e,a){return be(`/bots/${e}/functions/${a}`,{method:"DELETE"})}async function _4(e,a,i){return be(`/bots/${e}/functions/${a}/run`,{method:"POST",body:JSON.stringify(i||{})})}async function L4(e){return be(`/bots/${e}/schedules`)}async function B4(e,a){return be(`/bots/${e}/schedules/${a}`)}async function U4(e,a){return be(`/bots/${e}/schedules`,{method:"POST",body:JSON.stringify(a)})}async function I4(e,a,i){return be(`/bots/${e}/schedules/${a}`,{method:"PATCH",body:JSON.stringify(i)})}async function H4(e,a){return be(`/bots/${e}/schedules/${a}/toggle`,{method:"POST"})}async function q4(e,a){return be(`/bots/${e}/schedules/${a}`,{method:"DELETE"})}async function F4(e,a,i=50){const l=new URLSearchParams;return a&&l.set("status",a),l.set("limit",i.toString()),be(`/bots/${e}/work?${l}`)}async function P4(e){return be(`/bots/${e}/work/active`)}async function $4(e,a){return be(`/bots/${e}/work/${a}`)}async function V4(e,a){return be(`/bots/${e}/work`,{method:"POST",body:JSON.stringify(a)})}async function G4(e,a,i){return be(`/bots/${e}/work/${a}`,{method:"PATCH",body:JSON.stringify(i)})}async function Y4(e,a){return be(`/bots/${e}/work/${a}/start`,{method:"POST"})}async function Q4(e,a,i){return be(`/bots/${e}/work/${a}/complete`,{method:"POST",body:JSON.stringify({result:i})})}async function X4(e,a,i){return be(`/bots/${e}/work/${a}/fail`,{method:"POST",body:JSON.stringify({error:i})})}async function J4(e,a){return be(`/bots/${e}/work/${a}`,{method:"DELETE"})}async function Z4(e,a){return be(`/bots/${e}/work/${a}/tasks`)}async function K4(e,a){return be(`/bots/${e}/work/${a}/tasks/ready`)}async function W4(e,a){return be(`/bots/${e}/tasks/${a}`)}async function eS(e,a,i){return be(`/bots/${e}/work/${a}/tasks`,{method:"POST",body:JSON.stringify(i)})}async function tS(e,a,i){return be(`/bots/${e}/tasks/${a}`,{method:"PATCH",body:JSON.stringify(i)})}async function nS(e,a){return be(`/bots/${e}/tasks/${a}/start`,{method:"POST"})}async function aS(e,a,i){return be(`/bots/${e}/tasks/${a}/complete`,{method:"POST",body:JSON.stringify({result:i})})}async function iS(e,a,i){return be(`/bots/${e}/tasks/${a}/fail`,{method:"POST",body:JSON.stringify({error:i})})}async function rS(e,a){return be(`/bots/${e}/tasks/${a}`,{method:"DELETE"})}async function lS(e,a){return be(`/bots/${e}/tasks/${a}/jobs`)}async function sS(e,a){return be(`/bots/${e}/work/${a}/jobs`)}async function oS(e){return be(`/bots/${e}/jobs/running`)}async function cS(e,a){return be(`/bots/${e}/jobs/${a}`)}async function uS(e,a,i,l,o){return be(`/bots/${e}/jobs/${a}/log`,{method:"POST",body:JSON.stringify({level:i,message:l,data:o})})}async function dS(e,a,i){return be(`/bots/${e}/jobs/${a}/progress?progress=${i}`,{method:"PATCH"})}async function fS(e,a,i=50){const l=new URLSearchParams;return a&&l.set("status",a),l.set("limit",i.toString()),be(`/bots/${e}/todos?${l}`)}async function hS(e){return be(`/bots/${e}/todos/open`)}async function mS(e,a){return be(`/bots/${e}/todos/${a}`)}async function pS(e,a){return be(`/bots/${e}/todos`,{method:"POST",body:JSON.stringify(a)})}async function xS(e,a,i){return be(`/bots/${e}/todos/${a}`,{method:"PATCH",body:JSON.stringify(i)})}async function gS(e,a){return be(`/bots/${e}/todos/${a}/done`,{method:"POST"})}async function bS(e,a){return be(`/bots/${e}/todos/${a}/dismiss`,{method:"POST"})}async function yS(e,a,i){return be(`/bots/${e}/todos/${a}/convert`,{method:"POST",body:JSON.stringify(i||{})})}async function vS(e,a){return be(`/bots/${e}/todos/${a}`,{method:"DELETE"})}async function wS(e,a){return null}async function jS(e){return null}async function zS(){return null}async function Tm(e,a){const i=await wS();if(i)return i;const l=new URLSearchParams;return e&&l.set("category",e),a&&l.set("search",a),{...await be(`/marketplace/templates?${l}`),source:"local"}}async function kS(e){const a=await jS();return a||be(`/marketplace/templates/${e}`)}async function K1(e){return be(`/marketplace/templates/${e}/install`,{method:"POST"})}async function W1(){const e=await zS();return e||be("/marketplace/categories")}const Ph=Object.freeze(Object.defineProperty({__proto__:null,ApiError:B1,appendJobLog:uS,archivePlatformChat:J1,checkHealth:z4,clearBotPlatformData:T4,clearChatHistory:N4,clearChatMessages:X1,completeTask:aS,completeWork:Q4,convertTodoToWork:yS,createFunction:D4,createSchedule:U4,createTask:eS,createTodo:pS,createWork:V4,deleteBackendBot:V1,deleteFunction:R4,deletePlatformChat:Q1,deleteSchedule:q4,deleteTask:rS,deleteTodo:vS,deleteWork:J4,dismissTodo:bS,exportBot:C4,failTask:iS,failWork:X4,generateBotNames:I1,generateBotNamesWithMeanings:H1,generateFollowUpQuestions:q1,generateFullPrompt:F1,getActiveWork:P4,getChatHistory:k4,getConfig:U1,getFunction:M4,getFunctions:A4,getJob:cS,getJobsForTask:lS,getJobsForWork:sS,getMarketplaceCategories:W1,getMarketplaceTemplate:kS,getMarketplaceTemplates:Tm,getOpenTodos:hS,getPlatformChatMessages:Y1,getPlatformChats:G1,getPlatformChatsIncludingArchived:Z1,getReadyTasks:K4,getRunningJobs:oS,getSchedule:B4,getSchedules:L4,getTask:W4,getTasks:Z4,getTodo:mS,getTodos:fS,getWork:F4,getWorkById:$4,importBot:E4,installMarketplaceTemplate:K1,markTodoDone:gS,previewBot:$1,refinePrompt:P1,runFunction:_4,startTask:nS,startWork:Y4,suggestPrompt:S4,syncBot:Cm,toggleSchedule:H4,unarchivePlatformChat:Em,updateConfig:Zc,updateFunction:O4,updateJobProgress:dS,updateSchedule:I4,updateTask:tS,updateTodo:xS,updateWork:G4},Symbol.toStringTag,{value:"Module"})),pr={name:"CachiBot",description:"The Armored AI Agent - your general-purpose assistant",icon:"shield",color:"#22c55e",model:"moonshot/kimi-k2.5",systemPrompt:`You are CachiBot, a helpful AI assistant created by Juan Almonte.

## About Your Name
CachiBot is named after the Venezuelan *cachicamo* (armadillo) - a resilient, armored creature known for its protective shell and methodical nature. Like the cachicamo, you approach tasks with care, protection, and thoroughness.

## Guidelines
- Be concise and helpful
- Use tools when actions are needed
- Explain what you're doing
- When asked about yourself, refer to the information above - do not claim to be created by any other company`},NS={id:"default",...pr,tools:["file_read","file_write","python_execute","shell_run"],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};function Tb(e){e.systemPrompt&&Cm({id:e.id,name:e.name,description:e.description,icon:e.icon,color:e.color,model:e.model,systemPrompt:e.systemPrompt,capabilities:e.capabilities,createdAt:e.createdAt,updatedAt:e.updatedAt}).catch(a=>{console.warn("Failed to sync bot to backend:",a)})}const Dt=_t()(tn((e,a)=>({bots:[NS],activeBotId:"default",activeView:"chats",addBot:i=>{e(l=>({bots:[...l.bots,i]})),Tb(i)},updateBot:(i,l)=>{e(u=>({bots:u.bots.map(d=>d.id===i?{...d,...l,updatedAt:new Date().toISOString()}:d)}));const o=a().bots.find(u=>u.id===i);o&&Tb(o)},deleteBot:i=>{e(l=>{var o;return{bots:l.bots.filter(u=>u.id!==i),activeBotId:l.activeBotId===i?((o=l.bots[0])==null?void 0:o.id)??null:l.activeBotId}}),V1(i).catch(l=>{console.warn("Failed to delete bot from backend:",l)})},setActiveBot:i=>e({activeBotId:i}),setActiveView:i=>e({activeView:i}),getActiveBot:()=>{const i=a();return i.bots.find(l=>l.id===i.activeBotId)}}),{name:"cachibot-bots"})),Rn=_t()(tn((e,a)=>({chats:[],activeChatId:null,messages:{},thinking:null,toolCalls:[],isLoading:!1,error:null,addChat:i=>e(l=>({chats:[i,...l.chats]})),updateChat:(i,l)=>e(o=>({chats:o.chats.map(u=>u.id===i?{...u,...l,updatedAt:new Date().toISOString()}:u)})),deleteChat:i=>e(l=>{const{[i]:o,...u}=l.messages;return{chats:l.chats.filter(d=>d.id!==i),messages:u,activeChatId:l.activeChatId===i?null:l.activeChatId}}),setActiveChat:i=>e({activeChatId:i}),getChatsByBot:i=>a().chats.filter(o=>o.botId===i).sort((o,u)=>o.pinned&&!u.pinned?-1:!o.pinned&&u.pinned?1:new Date(u.updatedAt).getTime()-new Date(o.updatedAt).getTime()),syncPlatformChats:async i=>{try{const l=await G1(i);e(o=>{const u=new Set(o.chats.map(p=>p.id)),d=l.filter(p=>!u.has(p.id)).map(p=>({id:p.id,botId:p.botId,title:p.title,createdAt:p.createdAt,updatedAt:p.updatedAt,messageCount:0,pinned:p.pinned,platform:p.platform,platformChatId:p.platformChatId})),f=o.chats.map(p=>{const h=l.find(g=>g.id===p.id);return h?{...p,title:h.title,updatedAt:h.updatedAt,pinned:h.pinned}:p});return{chats:[...d,...f]}})}catch(l){console.warn("Failed to sync platform chats:",l)}},loadPlatformChatMessages:async(i,l)=>{try{const o=await Y1(i,l);e(u=>({messages:{...u.messages,[l]:o.map(d=>({id:d.id,role:d.role,content:d.content,timestamp:d.timestamp,metadata:d.metadata}))}}))}catch(o){console.warn("Failed to load platform chat messages:",o)}},archiveChat:async(i,l)=>{try{await J1(i,l),e(o=>({chats:o.chats.filter(u=>u.id!==l),activeChatId:o.activeChatId===l?null:o.activeChatId}))}catch(o){throw console.error("Failed to archive chat:",o),o}},unarchiveChat:async(i,l)=>{try{await Em(i,l),await a().syncPlatformChats(i)}catch(o){throw console.error("Failed to unarchive chat:",o),o}},addMessage:(i,l)=>e(o=>({messages:{...o.messages,[i]:[...o.messages[i]||[],l]}})),updateMessage:(i,l,o)=>e(u=>({messages:{...u.messages,[i]:(u.messages[i]||[]).map(d=>d.id===l?{...d,content:o}:d)}})),updateLastAssistantMessageMetadata:(i,l)=>e(o=>{const u=o.messages[i]||[];let d=-1;for(let f=u.length-1;f>=0;f--)if(u[f].role==="assistant"){d=f;break}return d===-1?o:{messages:{...o.messages,[i]:u.map((f,p)=>p===d?{...f,metadata:{...f.metadata,...l}}:f)}}}),getMessages:i=>a().messages[i]||[],clearMessages:i=>e(l=>({messages:{...l.messages,[i]:[]}})),setThinking:i=>e({thinking:i}),addToolCall:i=>e(l=>({toolCalls:[...l.toolCalls,{...i,startTime:Date.now()}]})),updateToolCall:(i,l,o)=>e(u=>({toolCalls:u.toolCalls.map(d=>d.id===i?{...d,result:l,success:o,endTime:Date.now()}:d)})),clearToolCalls:()=>e({toolCalls:[]}),setLoading:i=>e({isLoading:i}),setError:i=>e({error:i})}),{name:"cachibot-chats",partialize:e=>({chats:e.chats,messages:e.messages})})),$h=_t()(tn((e,a)=>({jobs:[],activeJobId:null,addJob:i=>e(l=>({jobs:[i,...l.jobs]})),updateJob:(i,l)=>e(o=>({jobs:o.jobs.map(u=>u.id===i?{...u,...l}:u)})),deleteJob:i=>e(l=>({jobs:l.jobs.filter(o=>o.id!==i),activeJobId:l.activeJobId===i?null:l.activeJobId})),setActiveJob:i=>e({activeJobId:i}),getJobsByBot:i=>a().jobs.filter(o=>o.botId===i).sort((o,u)=>new Date(u.createdAt).getTime()-new Date(o.createdAt).getTime()),getActiveJobs:i=>a().jobs.filter(o=>o.botId===i&&["pending","running"].includes(o.status))}),{name:"cachibot-jobs"})),Il=_t()(tn((e,a)=>({tasks:[],activeTaskId:null,filter:{status:"all",priority:"all"},addTask:i=>e(l=>({tasks:[...l.tasks,i]})),updateTask:(i,l)=>e(o=>({tasks:o.tasks.map(u=>u.id===i?{...u,...l}:u)})),deleteTask:i=>e(l=>({tasks:l.tasks.filter(o=>o.id!==i),activeTaskId:l.activeTaskId===i?null:l.activeTaskId})),setActiveTask:i=>e({activeTaskId:i}),getTasksByBot:i=>{const l=a();let o=l.tasks.filter(f=>f.botId===i);l.filter.status!=="all"&&(o=o.filter(f=>f.status===l.filter.status)),l.filter.priority!=="all"&&(o=o.filter(f=>f.priority===l.filter.priority));const u={todo:0,in_progress:1,blocked:2,done:3},d={high:0,medium:1,low:2};return o.sort((f,p)=>{const h=u[f.status]-u[p.status];return h!==0?h:d[f.priority]-d[p.priority]})},setFilter:i=>e(l=>({filter:{...l.filter,...i}}))}),{name:"cachibot-tasks"})),Am=_t()(tn((e,a)=>({work:[],activeWorkId:null,filter:{status:"all",priority:"all"},addWork:i=>e(l=>({work:[i,...l.work]})),updateWork:(i,l)=>e(o=>({work:o.work.map(u=>u.id===i?{...u,...l}:u)})),deleteWork:i=>e(l=>({work:l.work.filter(o=>o.id!==i),activeWorkId:l.activeWorkId===i?null:l.activeWorkId})),setActiveWork:i=>e({activeWorkId:i}),getWorkByBot:i=>{const l=a();let o=l.work.filter(d=>d.botId===i);l.filter.status!=="all"&&(o=o.filter(d=>d.status===l.filter.status)),l.filter.priority!=="all"&&(o=o.filter(d=>d.priority===l.filter.priority));const u={urgent:0,high:1,normal:2,low:3};return o.sort((d,f)=>{const p=u[d.priority]-u[f.priority];return p!==0?p:new Date(f.createdAt).getTime()-new Date(d.createdAt).getTime()})},getActiveWork:i=>a().work.filter(o=>o.botId===i&&["pending","in_progress"].includes(o.status)),setFilter:i=>e(l=>({filter:{...l.filter,...i}}))}),{name:"cachibot-work"}));_t()(tn((e,a)=>({tasks:[],activeTaskId:null,addTask:i=>e(l=>({tasks:[...l.tasks,i]})),addTasks:i=>e(l=>({tasks:[...l.tasks,...i]})),updateTask:(i,l)=>e(o=>({tasks:o.tasks.map(u=>u.id===i?{...u,...l}:u)})),deleteTask:i=>e(l=>({tasks:l.tasks.filter(o=>o.id!==i),activeTaskId:l.activeTaskId===i?null:l.activeTaskId})),setActiveTask:i=>e({activeTaskId:i}),getTasksByWork:i=>a().tasks.filter(o=>o.workId===i).sort((o,u)=>o.order-u.order),getReadyTasks:i=>{const o=a().tasks.filter(d=>d.workId===i),u=new Set(o.filter(d=>d.status==="completed").map(d=>d.id));return o.filter(d=>d.status!=="pending"?!1:d.dependsOn.every(f=>u.has(f)))},clearTasksForWork:i=>e(l=>({tasks:l.tasks.filter(o=>o.workId!==i)}))}),{name:"cachibot-work-tasks"}));_t()(tn((e,a)=>({jobs:[],activeJobId:null,addJob:i=>e(l=>({jobs:[i,...l.jobs]})),updateJob:(i,l)=>e(o=>({jobs:o.jobs.map(u=>u.id===i?{...u,...l}:u)})),appendLog:(i,l,o,u)=>e(d=>({jobs:d.jobs.map(f=>f.id===i?{...f,logs:[...f.logs,{timestamp:new Date().toISOString(),level:l,message:o,data:u}]}:f)})),deleteJob:i=>e(l=>({jobs:l.jobs.filter(o=>o.id!==i),activeJobId:l.activeJobId===i?null:l.activeJobId})),setActiveJob:i=>e({activeJobId:i}),getJobsByTask:i=>a().jobs.filter(o=>o.taskId===i).sort((o,u)=>o.attempt-u.attempt),getJobsByWork:i=>a().jobs.filter(o=>o.workId===i).sort((o,u)=>new Date(u.createdAt).getTime()-new Date(o.createdAt).getTime()),getRunningJobs:i=>a().jobs.filter(o=>!(o.status!=="running"||i&&o.botId!==i)),clearJobsForWork:i=>e(l=>({jobs:l.jobs.filter(o=>o.workId!==i)}))}),{name:"cachibot-work-jobs"}));_t()(tn((e,a)=>({todos:[],activeTodoId:null,filter:{status:"all",priority:"all"},addTodo:i=>e(l=>({todos:[i,...l.todos]})),updateTodo:(i,l)=>e(o=>({todos:o.todos.map(u=>u.id===i?{...u,...l}:u)})),deleteTodo:i=>e(l=>({todos:l.todos.filter(o=>o.id!==i),activeTodoId:l.activeTodoId===i?null:l.activeTodoId})),setActiveTodo:i=>e({activeTodoId:i}),getTodosByBot:i=>{const l=a();let o=l.todos.filter(d=>d.botId===i);l.filter.status!=="all"&&(o=o.filter(d=>d.status===l.filter.status)),l.filter.priority!=="all"&&(o=o.filter(d=>d.priority===l.filter.priority));const u={urgent:0,high:1,normal:2,low:3};return o.sort((d,f)=>{const p=u[d.priority]-u[f.priority];return p!==0?p:new Date(f.createdAt).getTime()-new Date(d.createdAt).getTime()})},getOpenTodos:i=>a().todos.filter(o=>o.botId===i&&o.status==="open"),markDone:i=>e(l=>({todos:l.todos.map(o=>o.id===i?{...o,status:"done",completedAt:new Date().toISOString()}:o)})),markConverted:(i,l,o)=>e(u=>({todos:u.todos.map(d=>d.id===i?{...d,status:"done",completedAt:new Date().toISOString(),convertedToWorkId:l,convertedToTaskId:o}:d)})),setFilter:i=>e(l=>({filter:{...l.filter,...i}}))}),{name:"cachibot-todos"}));_t()(tn((e,a)=>({functions:[],activeFunctionId:null,addFunction:i=>e(l=>({functions:[...l.functions,i]})),updateFunction:(i,l)=>e(o=>({functions:o.functions.map(u=>u.id===i?{...u,...l,updatedAt:new Date().toISOString()}:u)})),deleteFunction:i=>e(l=>({functions:l.functions.filter(o=>o.id!==i),activeFunctionId:l.activeFunctionId===i?null:l.activeFunctionId})),setActiveFunction:i=>e({activeFunctionId:i}),getFunctionsByBot:i=>a().functions.filter(o=>o.botId===i).sort((o,u)=>o.name.localeCompare(u.name)),incrementRunCount:(i,l)=>e(o=>({functions:o.functions.map(u=>{if(u.id!==i)return u;const d=u.runCount+1,h=(u.runCount*u.successRate+(l?1:0))/d;return{...u,runCount:d,successRate:h,lastRunAt:new Date().toISOString(),updatedAt:new Date().toISOString()}})}))}),{name:"cachibot-functions"}));const ev=_t()(tn((e,a)=>({schedules:[],activeScheduleId:null,addSchedule:i=>e(l=>({schedules:[...l.schedules,i]})),updateSchedule:(i,l)=>e(o=>({schedules:o.schedules.map(u=>u.id===i?{...u,...l,updatedAt:new Date().toISOString()}:u)})),deleteSchedule:i=>e(l=>({schedules:l.schedules.filter(o=>o.id!==i),activeScheduleId:l.activeScheduleId===i?null:l.activeScheduleId})),setActiveSchedule:i=>e({activeScheduleId:i}),getSchedulesByBot:i=>a().schedules.filter(o=>o.botId===i).sort((o,u)=>o.name.localeCompare(u.name)),getEnabledSchedules:i=>a().schedules.filter(o=>!(!o.enabled||i&&o.botId!==i)),toggleEnabled:i=>e(l=>({schedules:l.schedules.map(o=>o.id===i?{...o,enabled:!o.enabled,updatedAt:new Date().toISOString()}:o)})),recordRun:(i,l)=>e(o=>({schedules:o.schedules.map(u=>u.id===i?{...u,runCount:u.runCount+1,lastRunAt:new Date().toISOString(),nextRunAt:l||u.nextRunAt,updatedAt:new Date().toISOString()}:u)}))}),{name:"cachibot-schedules"})),Mm={green:{name:"Green",palette:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"}},pink:{name:"Pink",palette:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"}},blue:{name:"Blue",palette:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"}},purple:{name:"Purple",palette:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7c3aed",800:"#6b21a8",900:"#581c87",950:"#3b0764"}},orange:{name:"Orange",palette:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"}},red:{name:"Red",palette:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"}},cyan:{name:"Cyan",palette:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"}},yellow:{name:"Yellow",palette:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"}}},It=_t()(tn(e=>({theme:"system",accentColor:"green",sidebarCollapsed:!1,mobileMenuOpen:!1,settingsOpen:!1,botSettingsOpen:!1,createBotOpen:!1,commandPaletteOpen:!1,showThinking:!0,showCost:!0,settingsSection:"general",workSection:"overview",scheduleSection:"all",setTheme:a=>e({theme:a}),setAccentColor:a=>e({accentColor:a}),toggleTheme:()=>e(a=>({theme:a.theme==="light"?"dark":"light"})),setSidebarCollapsed:a=>e({sidebarCollapsed:a}),toggleSidebar:()=>e(a=>({sidebarCollapsed:!a.sidebarCollapsed})),setMobileMenuOpen:a=>e({mobileMenuOpen:a}),toggleMobileMenu:()=>e(a=>({mobileMenuOpen:!a.mobileMenuOpen})),setSettingsOpen:a=>e({settingsOpen:a}),setBotSettingsOpen:a=>e({botSettingsOpen:a}),setCreateBotOpen:a=>e({createBotOpen:a}),setCommandPaletteOpen:a=>e({commandPaletteOpen:a}),setShowThinking:a=>e({showThinking:a}),setShowCost:a=>e({showCost:a}),setSettingsSection:a=>e({settingsSection:a}),setWorkSection:a=>e({workSection:a}),setScheduleSection:a=>e({scheduleSection:a})}),{name:"cachibot-ui",partialize:e=>({theme:e.theme,accentColor:e.accentColor,sidebarCollapsed:e.sidebarCollapsed,showThinking:e.showThinking,showCost:e.showCost})})),SS={shield:pa,bot:ii,brain:zr,zap:Vl,flame:IN,gem:FN,rocket:l4,target:jm,laptop:YN,"bar-chart":ru,sparkles:Kn,star:Su,cpu:w1,ghost:PN,palette:ju,"pen-tool":a4,code:$l,terminal:zm};function ta({icon:e,className:a,size:i=24,color:l}){const o=SS[e]||pa;return r.jsx(o,{className:a,size:i,style:l?{color:l}:void 0})}const tv=[{id:"shield",label:"Shield"},{id:"bot",label:"Bot"},{id:"brain",label:"Brain"},{id:"zap",label:"Zap"},{id:"flame",label:"Flame"},{id:"gem",label:"Gem"},{id:"rocket",label:"Rocket"},{id:"target",label:"Target"},{id:"laptop",label:"Laptop"},{id:"bar-chart",label:"Chart"},{id:"sparkles",label:"Sparkles"},{id:"star",label:"Star"},{id:"cpu",label:"CPU"},{id:"ghost",label:"Ghost"},{id:"palette",label:"Palette"},{id:"pen-tool",label:"Pen"},{id:"code",label:"Code"},{id:"terminal",label:"Terminal"}];function nv(e){var a,i,l="";if(typeof e=="string"||typeof e=="number")l+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(a=0;a<o;a++)e[a]&&(i=nv(e[a]))&&(l&&(l+=" "),l+=i)}else for(i in e)e[i]&&(l&&(l+=" "),l+=i);return l}function CS(){for(var e,a,i=0,l="",o=arguments.length;i<o;i++)(e=arguments[i])&&(a=nv(e))&&(l&&(l+=" "),l+=a);return l}const Dm="-",ES=e=>{const a=AS(e),{conflictingClassGroups:i,conflictingClassGroupModifiers:l}=e;return{getClassGroupId:d=>{const f=d.split(Dm);return f[0]===""&&f.length!==1&&f.shift(),av(f,a)||TS(d)},getConflictingClassGroupIds:(d,f)=>{const p=i[d]||[];return f&&l[d]?[...p,...l[d]]:p}}},av=(e,a)=>{var d;if(e.length===0)return a.classGroupId;const i=e[0],l=a.nextPart.get(i),o=l?av(e.slice(1),l):void 0;if(o)return o;if(a.validators.length===0)return;const u=e.join(Dm);return(d=a.validators.find(({validator:f})=>f(u)))==null?void 0:d.classGroupId},Ab=/^\[(.+)\]$/,TS=e=>{if(Ab.test(e)){const a=Ab.exec(e)[1],i=a==null?void 0:a.substring(0,a.indexOf(":"));if(i)return"arbitrary.."+i}},AS=e=>{const{theme:a,prefix:i}=e,l={nextPart:new Map,validators:[]};return DS(Object.entries(e.classGroups),i).forEach(([u,d])=>{Vh(d,l,u,a)}),l},Vh=(e,a,i,l)=>{e.forEach(o=>{if(typeof o=="string"){const u=o===""?a:Mb(a,o);u.classGroupId=i;return}if(typeof o=="function"){if(MS(o)){Vh(o(l),a,i,l);return}a.validators.push({validator:o,classGroupId:i});return}Object.entries(o).forEach(([u,d])=>{Vh(d,Mb(a,u),i,l)})})},Mb=(e,a)=>{let i=e;return a.split(Dm).forEach(l=>{i.nextPart.has(l)||i.nextPart.set(l,{nextPart:new Map,validators:[]}),i=i.nextPart.get(l)}),i},MS=e=>e.isThemeGetter,DS=(e,a)=>a?e.map(([i,l])=>{const o=l.map(u=>typeof u=="string"?a+u:typeof u=="object"?Object.fromEntries(Object.entries(u).map(([d,f])=>[a+d,f])):u);return[i,o]}):e,OS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let a=0,i=new Map,l=new Map;const o=(u,d)=>{i.set(u,d),a++,a>e&&(a=0,l=i,i=new Map)};return{get(u){let d=i.get(u);if(d!==void 0)return d;if((d=l.get(u))!==void 0)return o(u,d),d},set(u,d){i.has(u)?i.set(u,d):o(u,d)}}},iv="!",RS=e=>{const{separator:a,experimentalParseClassName:i}=e,l=a.length===1,o=a[0],u=a.length,d=f=>{const p=[];let h=0,g=0,b;for(let j=0;j<f.length;j++){let N=f[j];if(h===0){if(N===o&&(l||f.slice(j,j+u)===a)){p.push(f.slice(g,j)),g=j+u;continue}if(N==="/"){b=j;continue}}N==="["?h++:N==="]"&&h--}const v=p.length===0?f:f.substring(g),y=v.startsWith(iv),k=y?v.substring(1):v,z=b&&b>g?b-g:void 0;return{modifiers:p,hasImportantModifier:y,baseClassName:k,maybePostfixModifierPosition:z}};return i?f=>i({className:f,parseClassName:d}):d},_S=e=>{if(e.length<=1)return e;const a=[];let i=[];return e.forEach(l=>{l[0]==="["?(a.push(...i.sort(),l),i=[]):i.push(l)}),a.push(...i.sort()),a},LS=e=>({cache:OS(e.cacheSize),parseClassName:RS(e),...ES(e)}),BS=/\s+/,US=(e,a)=>{const{parseClassName:i,getClassGroupId:l,getConflictingClassGroupIds:o}=a,u=[],d=e.trim().split(BS);let f="";for(let p=d.length-1;p>=0;p-=1){const h=d[p],{modifiers:g,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:y}=i(h);let k=!!y,z=l(k?v.substring(0,y):v);if(!z){if(!k){f=h+(f.length>0?" "+f:f);continue}if(z=l(v),!z){f=h+(f.length>0?" "+f:f);continue}k=!1}const j=_S(g).join(":"),N=b?j+iv:j,D=N+z;if(u.includes(D))continue;u.push(D);const E=o(z,k);for(let L=0;L<E.length;++L){const Y=E[L];u.push(N+Y)}f=h+(f.length>0?" "+f:f)}return f};function IS(){let e=0,a,i,l="";for(;e<arguments.length;)(a=arguments[e++])&&(i=rv(a))&&(l&&(l+=" "),l+=i);return l}const rv=e=>{if(typeof e=="string")return e;let a,i="";for(let l=0;l<e.length;l++)e[l]&&(a=rv(e[l]))&&(i&&(i+=" "),i+=a);return i};function HS(e,...a){let i,l,o,u=d;function d(p){const h=a.reduce((g,b)=>b(g),e());return i=LS(h),l=i.cache.get,o=i.cache.set,u=f,f(p)}function f(p){const h=l(p);if(h)return h;const g=US(p,i);return o(p,g),g}return function(){return u(IS.apply(null,arguments))}}const xt=e=>{const a=i=>i[e]||[];return a.isThemeGetter=!0,a},lv=/^\[(?:([a-z-]+):)?(.+)\]$/i,qS=/^\d+\/\d+$/,FS=new Set(["px","full","screen"]),PS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$S=/\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$/,VS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,GS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,YS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ka=e=>kl(e)||FS.has(e)||qS.test(e),Oi=e=>Gl(e,"length",t5),kl=e=>!!e&&!Number.isNaN(Number(e)),ih=e=>Gl(e,"number",kl),Vs=e=>!!e&&Number.isInteger(Number(e)),QS=e=>e.endsWith("%")&&kl(e.slice(0,-1)),_e=e=>lv.test(e),Ri=e=>PS.test(e),XS=new Set(["length","size","percentage"]),JS=e=>Gl(e,XS,sv),ZS=e=>Gl(e,"position",sv),KS=new Set(["image","url"]),WS=e=>Gl(e,KS,a5),e5=e=>Gl(e,"",n5),Gs=()=>!0,Gl=(e,a,i)=>{const l=lv.exec(e);return l?l[1]?typeof a=="string"?l[1]===a:a.has(l[1]):i(l[2]):!1},t5=e=>$S.test(e)&&!VS.test(e),sv=()=>!1,n5=e=>GS.test(e),a5=e=>YS.test(e),i5=()=>{const e=xt("colors"),a=xt("spacing"),i=xt("blur"),l=xt("brightness"),o=xt("borderColor"),u=xt("borderRadius"),d=xt("borderSpacing"),f=xt("borderWidth"),p=xt("contrast"),h=xt("grayscale"),g=xt("hueRotate"),b=xt("invert"),v=xt("gap"),y=xt("gradientColorStops"),k=xt("gradientColorStopPositions"),z=xt("inset"),j=xt("margin"),N=xt("opacity"),D=xt("padding"),E=xt("saturate"),L=xt("scale"),Y=xt("sepia"),A=xt("skew"),H=xt("space"),ae=xt("translate"),ee=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",_e,a],$=()=>[_e,a],me=()=>["",Ka,Oi],V=()=>["auto",kl,_e],te=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ce=()=>["start","end","center","between","around","evenly","stretch"],ue=()=>["","0",_e],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>[kl,_e];return{cacheSize:500,separator:":",theme:{colors:[Gs],spacing:[Ka,Oi],blur:["none","",Ri,_e],brightness:R(),borderColor:[e],borderRadius:["none","","full",Ri,_e],borderSpacing:$(),borderWidth:me(),contrast:R(),grayscale:ue(),hueRotate:R(),invert:ue(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[QS,Oi],inset:U(),margin:U(),opacity:R(),padding:$(),saturate:R(),scale:R(),sepia:ue(),skew:R(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",_e]}],container:["container"],columns:[{columns:[Ri]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"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"],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:[...te(),_e]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:ee()}],"overscroll-x":[{"overscroll-x":ee()}],"overscroll-y":[{"overscroll-y":ee()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[z]}],"inset-x":[{"inset-x":[z]}],"inset-y":[{"inset-y":[z]}],start:[{start:[z]}],end:[{end:[z]}],top:[{top:[z]}],right:[{right:[z]}],bottom:[{bottom:[z]}],left:[{left:[z]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Vs,_e]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",_e]}],grow:[{grow:ue()}],shrink:[{shrink:ue()}],order:[{order:["first","last","none",Vs,_e]}],"grid-cols":[{"grid-cols":[Gs]}],"col-start-end":[{col:["auto",{span:["full",Vs,_e]},_e]}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":[Gs]}],"row-start-end":[{row:["auto",{span:[Vs,_e]},_e]}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",_e]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",_e]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...ce()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ce(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ce(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",_e,a]}],"min-w":[{"min-w":[_e,a,"min","max","fit"]}],"max-w":[{"max-w":[_e,a,"none","full","min","max","fit","prose",{screen:[Ri]},Ri]}],h:[{h:[_e,a,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[_e,a,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[_e,a,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[_e,a,"auto","min","max","fit"]}],"font-size":[{text:["base",Ri,Oi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",ih]}],"font-family":[{font:[Gs]}],"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:["tighter","tight","normal","wide","wider","widest",_e]}],"line-clamp":[{"line-clamp":["none",kl,ih]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ka,_e]}],"list-image":[{"list-image":["none",_e]}],"list-style-type":[{list:["none","disc","decimal",_e]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ka,Oi]}],"underline-offset":[{"underline-offset":["auto",Ka,_e]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",_e]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",_e]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...te(),ZS]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",JS]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},WS]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[u]}],"rounded-s":[{"rounded-s":[u]}],"rounded-e":[{"rounded-e":[u]}],"rounded-t":[{"rounded-t":[u]}],"rounded-r":[{"rounded-r":[u]}],"rounded-b":[{"rounded-b":[u]}],"rounded-l":[{"rounded-l":[u]}],"rounded-ss":[{"rounded-ss":[u]}],"rounded-se":[{"rounded-se":[u]}],"rounded-ee":[{"rounded-ee":[u]}],"rounded-es":[{"rounded-es":[u]}],"rounded-tl":[{"rounded-tl":[u]}],"rounded-tr":[{"rounded-tr":[u]}],"rounded-br":[{"rounded-br":[u]}],"rounded-bl":[{"rounded-bl":[u]}],"border-w":[{border:[f]}],"border-w-x":[{"border-x":[f]}],"border-w-y":[{"border-y":[f]}],"border-w-s":[{"border-s":[f]}],"border-w-e":[{"border-e":[f]}],"border-w-t":[{"border-t":[f]}],"border-w-r":[{"border-r":[f]}],"border-w-b":[{"border-b":[f]}],"border-w-l":[{"border-l":[f]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[f]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[f]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:B()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...B()]}],"outline-offset":[{"outline-offset":[Ka,_e]}],"outline-w":[{outline:[Ka,Oi]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[Ka,Oi]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ri,e5]}],"shadow-color":[{shadow:[Gs]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[i]}],brightness:[{brightness:[l]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",Ri,_e]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[b]}],saturate:[{saturate:[E]}],sepia:[{sepia:[Y]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[i]}],"backdrop-brightness":[{"backdrop-brightness":[l]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[Y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[d]}],"border-spacing-x":[{"border-spacing-x":[d]}],"border-spacing-y":[{"border-spacing-y":[d]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",_e]}],duration:[{duration:R()}],ease:[{ease:["linear","in","out","in-out",_e]}],delay:[{delay:R()}],animate:[{animate:["none","spin","ping","pulse","bounce",_e]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[L]}],"scale-x":[{"scale-x":[L]}],"scale-y":[{"scale-y":[L]}],rotate:[{rotate:[Vs,_e]}],"translate-x":[{"translate-x":[ae]}],"translate-y":[{"translate-y":[ae]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",_e]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",_e]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",_e]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ka,Oi,ih]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","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","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","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-s","border-w-e","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-s","border-color-e","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"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","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-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"]}}},r5=HS(i5);function ie(...e){return r5(CS(e))}const l5=["/dashboard","/models","/settings"];function s5({onNavigate:e}){const a=wn(),i=ma(),{bots:l,activeBotId:o,setActiveBot:u}=Dt(),{setActiveChat:d}=Rn(),{setCreateBotOpen:f}=It(),p=i.pathname,h=l5.includes(p),g=v=>{u(v),d(null),a(`/${v}/chats`),e==null||e()},b=v=>{a(p===v?"/":v),e==null||e()};return r.jsxs("div",{className:"flex h-full w-[72px] flex-col items-center bg-zinc-200 py-3 dark:bg-zinc-950",children:[r.jsxs("div",{className:"flex flex-col items-center gap-2 pb-3",children:[r.jsxs("button",{onClick:()=>b("/dashboard"),className:ie("group relative flex h-12 w-12 items-center justify-center rounded-[24px] transition-all duration-200 hover:rounded-[16px]",p==="/dashboard"?"rounded-[16px] bg-accent-600 text-white":"bg-zinc-300 text-zinc-600 hover:bg-accent-600/80 hover:text-white dark:bg-zinc-800 dark:text-zinc-400"),children:[r.jsx(QN,{className:"h-5 w-5"}),r.jsx(wl,{children:"Dashboard"})]}),r.jsxs("button",{onClick:()=>b("/models"),className:ie("group relative flex h-12 w-12 items-center justify-center rounded-[24px] transition-all duration-200 hover:rounded-[16px]",p==="/models"?"rounded-[16px] bg-accent-600 text-white":"bg-zinc-300 text-zinc-600 hover:bg-accent-600/80 hover:text-white dark:bg-zinc-800 dark:text-zinc-400"),children:[r.jsx(zr,{className:"h-5 w-5"}),r.jsx(wl,{children:"Models"})]}),r.jsx(Db,{})]}),r.jsxs("div",{className:"flex flex-1 flex-col items-center gap-2 overflow-y-auto scrollbar-none",children:[l.map(v=>r.jsx(o5,{bot:v,active:v.id===o&&!h&&p.startsWith(`/${v.id}/`),onClick:()=>g(v.id)},v.id)),r.jsxs("button",{onClick:()=>f(!0),className:"group relative flex h-12 w-12 items-center justify-center rounded-[24px] bg-zinc-300 text-zinc-600 transition-all duration-200 hover:rounded-[16px] hover:bg-accent-600 hover:text-white dark:bg-zinc-800 dark:text-zinc-400",children:[r.jsx(Ta,{className:"h-5 w-5"}),r.jsx(wl,{children:"Create Bot"})]})]}),r.jsxs("div",{className:"mt-auto flex flex-col items-center gap-2 pt-3",children:[r.jsx(Db,{}),r.jsxs("a",{href:"https://github.com/jhd3197/CachiBot",target:"_blank",rel:"noopener noreferrer",className:"group relative flex h-12 w-12 items-center justify-center rounded-full text-zinc-600 transition-colors hover:bg-zinc-300 hover:text-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200",children:[r.jsx($N,{className:"h-5 w-5"}),r.jsx(wl,{children:"GitHub"})]}),r.jsxs("button",{onClick:()=>b("/settings"),className:ie("group relative flex h-12 w-12 items-center justify-center rounded-full transition-colors",p==="/settings"?"bg-accent-600/20 text-accent-600 dark:text-accent-400":"text-zinc-600 hover:bg-zinc-300 hover:text-zinc-800 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200"),children:[r.jsx(xo,{className:"h-5 w-5"}),r.jsx(wl,{children:"Settings"})]})]})]})}function o5({bot:e,active:a,onClick:i}){return r.jsxs("button",{onClick:i,className:"group relative",children:[r.jsx("div",{className:ie("absolute -left-3 top-1/2 h-2 w-1 -translate-y-1/2 rounded-r-full bg-zinc-900 transition-all duration-200 dark:bg-white",a?"h-10":"h-0 group-hover:h-5")}),r.jsx("div",{className:ie("flex h-12 w-12 items-center justify-center transition-all duration-200",a?"rounded-[16px]":"rounded-[24px] group-hover:rounded-[16px]"),style:{backgroundColor:e.color+"30"},children:r.jsx(ta,{icon:e.icon,className:"h-6 w-6",size:24})}),r.jsx(wl,{children:e.name})]})}function wl({children:e}){return r.jsxs("div",{className:"pointer-events-none absolute left-full top-1/2 z-50 ml-4 -translate-y-1/2 whitespace-nowrap rounded-md bg-zinc-800 px-3 py-2 text-sm font-medium text-white opacity-0 shadow-lg transition-opacity group-hover:opacity-100 dark:bg-zinc-900",children:[e,r.jsx("div",{className:"absolute -left-1 top-1/2 h-2 w-2 -translate-y-1/2 rotate-45 bg-zinc-800 dark:bg-zinc-900"})]})}function Db(){return r.jsx("div",{className:"h-px w-8 bg-zinc-300 dark:bg-zinc-800"})}const c5={file_read:Ll,file_write:BN,file_delete:ea,python_execute:$l,shell_run:zm,web_fetch:S1,web_search:Aa,database_query:yu};function Om({toolId:e,className:a,size:i=20}){const l=c5[e]||Ul;return r.jsx(l,{className:a,size:i})}const u5=[{id:"chats",label:"Chats",icon:$i},{id:"tasks",label:"Tasks",icon:M1},{id:"work",label:"Work",icon:bm},{id:"schedules",label:"Schedules",icon:v1},{id:"tools",label:"Tools",icon:Ul},{id:"settings",label:"Settings",icon:xo}];function d5({onNavigate:e}){const a=wn(),{getActiveBot:i,activeView:l,setActiveView:o,activeBotId:u}=Dt(),{sidebarCollapsed:d}=It(),f=i();if(!f)return null;const p=h=>{o(h),a(`/${u}/${h}`)};return r.jsxs("aside",{className:ie("flex h-full flex-col border-r border-zinc-300 bg-zinc-50 transition-all duration-300 dark:border-zinc-800 dark:bg-zinc-900/50",d?"w-16":"w-72"),children:[r.jsxs("div",{className:"flex h-14 items-center gap-3 border-b border-zinc-300 px-4 dark:border-zinc-800",children:[r.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:f.color+"20"},children:r.jsx(ta,{icon:f.icon,size:18})}),!d&&r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{className:"truncate text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:f.name}),r.jsx("p",{className:"truncate text-xs text-zinc-500",children:f.model})]})]}),r.jsx("nav",{className:"flex items-center justify-center gap-1 border-b border-zinc-300 px-3 py-2 dark:border-zinc-800",children:u5.map(h=>r.jsx(f5,{icon:h.icon,label:h.label,active:l===h.id,onClick:()=>p(h.id)},h.id))}),r.jsxs("div",{className:"flex-1 overflow-hidden",children:[l==="chats"&&r.jsx(h5,{botId:f.id,collapsed:d,onNavigate:e}),l==="tasks"&&r.jsx(m5,{botId:f.id,collapsed:d,onNavigate:e}),l==="work"&&r.jsx(p5,{botId:f.id,collapsed:d}),l==="schedules"&&r.jsx(x5,{botId:f.id,collapsed:d}),l==="tools"&&r.jsx(g5,{botId:f.id,collapsed:d}),l==="settings"&&r.jsx(b5,{collapsed:d})]})]})}function f5({icon:e,label:a,active:i,onClick:l}){return r.jsxs("button",{onClick:l,title:a,className:ie("group relative flex h-8 w-8 items-center justify-center rounded-lg transition-all",i?"bg-accent-600/20 text-accent-600 dark:text-accent-400":"text-zinc-500 hover:bg-zinc-200 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-200"),children:[r.jsx(e,{className:"h-4 w-4"}),r.jsx("span",{className:"pointer-events-none absolute -bottom-8 left-1/2 z-50 -translate-x-1/2 whitespace-nowrap rounded-md bg-zinc-700 px-2 py-1 text-xs font-medium text-white opacity-0 shadow-lg transition-opacity group-hover:opacity-100 dark:bg-zinc-800",children:a})]})}function h5({botId:e,collapsed:a,onNavigate:i}){const l=wn(),{getChatsByBot:o,activeChatId:u,setActiveChat:d,addChat:f,updateChat:p,deleteChat:h,clearMessages:g,syncPlatformChats:b,loadPlatformChatMessages:v,archiveChat:y}=Rn(),[k,z]=C.useState(""),[j,N]=C.useState(null);C.useEffect(()=>{b(e);const A=setInterval(()=>b(e),6e4);return()=>clearInterval(A)},[e,b]);const D=o(e).filter(A=>!k||A.title.toLowerCase().includes(k.toLowerCase())),E=A=>A.platform==="telegram"?r.jsx(lo,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-blue-400"}):A.platform==="discord"?r.jsx(lo,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-indigo-400"}):r.jsx($i,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-zinc-500"}),L=()=>{const A={id:crypto.randomUUID(),botId:e,title:"New Chat",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};f(A),d(A.id),l(`/${e}/chats/${A.id}`),i==null||i()},Y=async A=>{d(A.id),A.platform&&await v(e,A.id);const H=A.platform?A.platform:A.id;l(`/${e}/chats/${H}`),i==null||i()};return a?r.jsx("div",{className:"flex flex-col items-center gap-2 p-2",children:r.jsx("button",{onClick:L,className:"flex h-10 w-10 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:r.jsx(Ta,{className:"h-4 w-4"})})}):r.jsxs("div",{className:"flex h-full flex-col",children:[r.jsxs("div",{className:"flex gap-2 p-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Aa,{className:"absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),r.jsx("input",{type:"text",placeholder:"Search chats...",value:k,onChange:A=>z(A.target.value),className:"h-9 w-full rounded-lg border border-zinc-300 bg-white pl-9 pr-3 text-sm text-zinc-900 placeholder-zinc-500 outline-none focus:border-cachi-500 focus:ring-1 focus:ring-cachi-500 dark:border-zinc-700 dark:bg-zinc-800/50 dark:text-zinc-100"})]}),r.jsx("button",{onClick:L,className:"flex h-9 w-9 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:r.jsx(Ta,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"flex-1 overflow-y-auto px-2 pb-2",children:D.length===0?r.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:k?"No chats found":"No chats yet"}):r.jsx("div",{className:"space-y-1",children:D.map(A=>r.jsxs("div",{className:"group relative",children:[r.jsxs("button",{onClick:()=>Y(A),className:ie("flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors",u===A.id?"bg-zinc-200 text-zinc-900 dark:bg-zinc-800 dark:text-zinc-100":"text-zinc-700 hover:bg-zinc-200/50 dark:text-zinc-300 dark:hover:bg-zinc-800/50"),children:[E(A),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"truncate text-sm font-medium",children:A.title}),A.pinned&&r.jsx(Sb,{className:"h-3 w-3 flex-shrink-0 text-cachi-500"}),A.platform&&r.jsx("span",{className:"rounded bg-zinc-300 px-1 py-0.5 text-[10px] uppercase text-zinc-600 dark:bg-zinc-700 dark:text-zinc-400",children:A.platform})]}),A.lastMessage&&r.jsx("p",{className:"truncate text-xs text-zinc-500",children:A.lastMessage})]})]}),r.jsx("button",{onClick:H=>{H.stopPropagation(),N(j===A.id?null:A.id)},className:ie("absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded text-zinc-500 opacity-0 transition-opacity hover:bg-zinc-200 group-hover:opacity-100 dark:text-zinc-400 dark:hover:bg-zinc-700",j===A.id&&"opacity-100"),children:r.jsx(z1,{className:"h-4 w-4"})}),j===A.id&&r.jsxs("div",{className:"absolute right-0 top-8 z-10 w-48 rounded-lg border border-zinc-300 bg-white py-1 shadow-xl dark:border-zinc-700 dark:bg-zinc-800",children:[r.jsxs("button",{onClick:()=>{p(A.id,{pinned:!A.pinned}),N(null)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700",children:[r.jsx(Sb,{className:"h-4 w-4"}),A.pinned?"Unpin":"Pin"]}),A.platform?r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:async()=>{N(null);try{await X1(e,A.id),g(A.id),Xe.success("Messages cleared")}catch{Xe.error("Failed to clear messages")}},className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700",children:[r.jsx(RN,{className:"h-4 w-4"}),"Clear Messages"]}),r.jsxs("button",{onClick:async()=>{N(null);try{await y(e,A.id),Xe.success("Chat archived")}catch{Xe.error("Failed to archive chat")}},className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700",children:[r.jsx(Ih,{className:"h-4 w-4"}),"Archive Chat"]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>{p(A.id,{archived:!0}),N(null)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700",children:[r.jsx(Ih,{className:"h-4 w-4"}),"Archive"]}),r.jsx("div",{className:"my-1 h-px bg-zinc-300 dark:bg-zinc-700"}),r.jsxs("button",{onClick:()=>{h(A.id),N(null)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-red-500 hover:bg-zinc-100 dark:text-red-400 dark:hover:bg-zinc-700",children:[r.jsx(ea,{className:"h-4 w-4"}),"Delete"]})]})]})]},A.id))})})]})}function m5({botId:e,collapsed:a,onNavigate:i}){const{getTasksByBot:l,activeTaskId:o,setActiveTask:u,addTask:d,updateTask:f}=Il(),p=l(e),h=b=>{switch(b){case"todo":return"border-zinc-600 bg-zinc-800";case"in_progress":return"border-blue-500 bg-blue-500/10";case"done":return"border-green-500 bg-green-500/10";case"blocked":return"border-red-500 bg-red-500/10"}},g=()=>{const b={id:crypto.randomUUID(),botId:e,title:"New Task",status:"todo",priority:"medium",tags:[],createdAt:new Date().toISOString()};d(b),u(b.id),i==null||i()};if(a){const b=p.filter(v=>v.status==="todo").length;return r.jsxs("div",{className:"flex flex-col items-center gap-2 p-2",children:[r.jsx("button",{onClick:g,className:"flex h-10 w-10 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:r.jsx(Ta,{className:"h-4 w-4"})}),b>0&&r.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-zinc-800 text-xs font-bold text-zinc-300",children:b})]})}return r.jsxs("div",{className:"flex h-full flex-col",children:[r.jsx("div",{className:"p-3",children:r.jsxs("button",{onClick:g,className:"flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-zinc-700 py-2 text-sm text-zinc-400 transition-colors hover:border-cachi-500 hover:text-cachi-400",children:[r.jsx(Ta,{className:"h-4 w-4"}),"Add Task"]})}),r.jsx("div",{className:"flex-1 overflow-y-auto px-2 pb-2",children:p.length===0?r.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:"No tasks yet"}):r.jsx("div",{className:"space-y-2",children:p.map(b=>r.jsxs("button",{onClick:()=>{u(b.id),i==null||i()},className:ie("flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors",o===b.id&&"ring-1 ring-cachi-500",h(b.status)),children:[r.jsx("button",{onClick:v=>{v.stopPropagation(),f(b.id,{status:b.status==="done"?"todo":"done",completedAt:b.status==="done"?void 0:new Date().toISOString()})},className:ie("mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border transition-colors",b.status==="done"?"border-green-500 bg-green-500 text-white":"border-zinc-500 hover:border-cachi-500"),children:b.status==="done"&&"✓"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:ie("text-sm",b.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:b.title}),b.tags.length>0&&r.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:b.tags.map(v=>r.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:v},v))})]})]},b.id))})})]})}const Ob=[{id:"overview",label:"Overview",icon:bm},{id:"active",label:"Active",icon:zu},{id:"completed",label:"Completed",icon:Rl},{id:"history",label:"History",icon:VN}];function p5({botId:e,collapsed:a}){const{workSection:i,setWorkSection:l}=It(),{getWorkByBot:o,getActiveWork:u}=Am(),d=o(e),f=u(e);return a?r.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:Ob.map(p=>r.jsx("button",{onClick:()=>l(p.id),className:ie("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",i===p.id?"bg-blue-600/20 text-blue-400":"text-zinc-400 hover:bg-zinc-800"),title:p.label,children:r.jsx(p.icon,{className:"h-5 w-5"})},p.id))}):r.jsx("div",{className:"flex h-full flex-col p-3",children:r.jsx("div",{className:"space-y-1",children:Ob.map(p=>{let h;return p.id==="active"&&(h=f.length),p.id==="completed"&&(h=d.filter(g=>g.status==="completed").length),p.id==="history"&&(h=d.length),r.jsxs("button",{onClick:()=>l(p.id),className:ie("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",i===p.id?"bg-blue-600/20 text-blue-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[r.jsx(p.icon,{className:"h-5 w-5"}),r.jsx("span",{className:"flex-1 text-sm",children:p.label}),h!==void 0&&h>0&&r.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:h})]},p.id)})})})}const Rb=[{id:"all",label:"All Schedules",icon:v1},{id:"enabled",label:"Enabled",icon:zu},{id:"disabled",label:"Disabled",icon:E1},{id:"create",label:"Create New",icon:Ta}];function x5({botId:e,collapsed:a}){const{scheduleSection:i,setScheduleSection:l}=It(),{getSchedulesByBot:o,getEnabledSchedules:u}=ev(),d=o(e),f=u(e);return a?r.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:Rb.map(p=>r.jsx("button",{onClick:()=>l(p.id),className:ie("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",i===p.id?"bg-purple-600/20 text-purple-400":"text-zinc-400 hover:bg-zinc-800"),title:p.label,children:r.jsx(p.icon,{className:"h-5 w-5"})},p.id))}):r.jsx("div",{className:"flex h-full flex-col p-3",children:r.jsx("div",{className:"space-y-1",children:Rb.map(p=>{let h;return p.id==="all"&&(h=d.length),p.id==="enabled"&&(h=f.length),p.id==="disabled"&&(h=d.length-f.length),r.jsxs("button",{onClick:()=>l(p.id),className:ie("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",i===p.id?"bg-purple-600/20 text-purple-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[r.jsx(p.icon,{className:"h-5 w-5"}),r.jsx("span",{className:"flex-1 text-sm",children:p.label}),h!==void 0&&h>0&&r.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:h})]},p.id)})})})}function g5({collapsed:e}){const{getActiveBot:a}=Dt(),i=a(),l=(i==null?void 0:i.tools)||[];return e?r.jsx("div",{className:"flex flex-col items-center p-2",children:r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-zinc-800 text-sm font-bold text-zinc-400",children:l.length})}):r.jsx("div",{className:"flex h-full flex-col p-3",children:r.jsx("div",{className:"space-y-2",children:l.map(o=>r.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-700 bg-zinc-800/30 p-3",children:[r.jsx(Om,{toolId:o,className:"h-5 w-5 text-zinc-400"}),r.jsx("span",{className:"text-sm capitalize text-zinc-300",children:o.replace(/_/g," ")})]},o))})})}const _b=[{id:"general",label:"General",icon:ii},{id:"knowledge",label:"Knowledge",icon:EN},{id:"skills",label:"Skills",icon:Kn},{id:"connections",label:"Connections",icon:ym},{id:"advanced",label:"Advanced",icon:Nu},{id:"danger",label:"Danger Zone",icon:Bl,danger:!0}];function b5({collapsed:e}){const{settingsSection:a,setSettingsSection:i}=It();return e?r.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:_b.map(l=>r.jsx("button",{onClick:()=>i(l.id),className:ie("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",a===l.id?"bg-cachi-600/20 text-cachi-400":l.danger?"text-red-400/70 hover:bg-red-500/10":"text-zinc-400 hover:bg-zinc-800"),title:l.label,children:r.jsx(l.icon,{className:"h-5 w-5"})},l.id))}):r.jsx("div",{className:"flex h-full flex-col p-3",children:r.jsx("div",{className:"space-y-1",children:_b.map(l=>r.jsxs("button",{onClick:()=>i(l.id),className:ie("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",a===l.id?"bg-cachi-600/20 text-cachi-400":l.danger?"text-red-400/70 hover:bg-red-500/10 hover:text-red-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[r.jsx(l.icon,{className:"h-5 w-5"}),r.jsx("span",{className:"text-sm",children:l.label})]},l.id))})})}const Hc={name:null,nameSuggestions:[],purposeCategory:null,purposeDescription:null,communicationStyle:null,useEmojis:null,detectedLanguage:null},y5=_t()(tn((e,a)=>({step:"idle",data:{...Hc},flowChatId:null,isLoadingNames:!1,createdBotId:null,startFlow:i=>{e({step:"name",data:{...Hc},flowChatId:i,isLoadingNames:!1})},setName:i=>{const l=Dt.getState().bots,o=i.toLowerCase().trim();if(l.some(d=>d.name.toLowerCase()===o))throw new Error(`A bot named "${i}" already exists. Please choose a different name.`);e(d=>({step:"purpose-category",data:{...d.data,name:i.trim()}}))},setNameSuggestions:i=>{e(l=>({data:{...l.data,nameSuggestions:i}}))},setPurposeCategory:i=>{e(l=>({step:"purpose-description",data:{...l.data,purposeCategory:i}}))},setPurposeDescription:i=>{e(l=>({step:"style",data:{...l.data,purposeDescription:i}}))},setStyle:i=>{e(l=>({step:"emoji",data:{...l.data,communicationStyle:i}}))},setEmoji:i=>{e(l=>({step:"summary",data:{...l.data,useEmojis:i}}))},setDetectedLanguage:i=>{e(l=>({data:{...l.data,detectedLanguage:i}}))},confirmAndCreate:()=>a().data,completeFlow:i=>{e({step:"idle",data:{...Hc},flowChatId:null,isLoadingNames:!1,createdBotId:i||null})},cancelFlow:()=>{e({step:"idle",data:{...Hc},flowChatId:null,isLoadingNames:!1,createdBotId:null})},setLoadingNames:i=>{e({isLoadingNames:i})},getFlowData:()=>({...a().data})}),{name:"cachibot-creation-flow",partialize:e=>({step:e.step,data:e.data,flowChatId:e.flowChatId})}));function v5(e,a){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const w5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,j5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,z5={};function Lb(e,a){return(z5.jsx?j5:w5).test(e)}const k5=/[ \t\n\f\r]/g;function N5(e){return typeof e=="object"?e.type==="text"?Bb(e.value):!1:Bb(e)}function Bb(e){return e.replace(k5,"")===""}class yo{constructor(a,i,l){this.normal=i,this.property=a,l&&(this.space=l)}}yo.prototype.normal={};yo.prototype.property={};yo.prototype.space=void 0;function ov(e,a){const i={},l={};for(const o of e)Object.assign(i,o.property),Object.assign(l,o.normal);return new yo(i,l,a)}function Gh(e){return e.toLowerCase()}class jn{constructor(a,i){this.attribute=i,this.property=a}}jn.prototype.attribute="";jn.prototype.booleanish=!1;jn.prototype.boolean=!1;jn.prototype.commaOrSpaceSeparated=!1;jn.prototype.commaSeparated=!1;jn.prototype.defined=!1;jn.prototype.mustUseProperty=!1;jn.prototype.number=!1;jn.prototype.overloadedBoolean=!1;jn.prototype.property="";jn.prototype.spaceSeparated=!1;jn.prototype.space=void 0;let S5=0;const Le=Cr(),Mt=Cr(),Yh=Cr(),he=Cr(),ht=Cr(),Nl=Cr(),On=Cr();function Cr(){return 2**++S5}const Qh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Le,booleanish:Mt,commaOrSpaceSeparated:On,commaSeparated:Nl,number:he,overloadedBoolean:Yh,spaceSeparated:ht},Symbol.toStringTag,{value:"Module"})),rh=Object.keys(Qh);class Rm extends jn{constructor(a,i,l,o){let u=-1;if(super(a,i),Ub(this,"space",o),typeof l=="number")for(;++u<rh.length;){const d=rh[u];Ub(this,rh[u],(l&Qh[d])===Qh[d])}}}Rm.prototype.defined=!0;function Ub(e,a,i){i&&(e[a]=i)}function Yl(e){const a={},i={};for(const[l,o]of Object.entries(e.properties)){const u=new Rm(l,e.transform(e.attributes||{},l),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),a[l]=u,i[Gh(l)]=l,i[Gh(u.attribute)]=l}return new yo(a,i,e.space)}const cv=Yl({properties:{ariaActiveDescendant:null,ariaAtomic:Mt,ariaAutoComplete:null,ariaBusy:Mt,ariaChecked:Mt,ariaColCount:he,ariaColIndex:he,ariaColSpan:he,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:Mt,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:Mt,ariaFlowTo:ht,ariaGrabbed:Mt,ariaHasPopup:null,ariaHidden:Mt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:he,ariaLive:null,ariaModal:Mt,ariaMultiLine:Mt,ariaMultiSelectable:Mt,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:he,ariaPressed:Mt,ariaReadOnly:Mt,ariaRelevant:null,ariaRequired:Mt,ariaRoleDescription:ht,ariaRowCount:he,ariaRowIndex:he,ariaRowSpan:he,ariaSelected:Mt,ariaSetSize:he,ariaSort:null,ariaValueMax:he,ariaValueMin:he,ariaValueNow:he,ariaValueText:null,role:null},transform(e,a){return a==="role"?a:"aria-"+a.slice(4).toLowerCase()}});function uv(e,a){return a in e?e[a]:a}function dv(e,a){return uv(e,a.toLowerCase())}const C5=Yl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Nl,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:ht,autoFocus:Le,autoPlay:Le,blocking:ht,capture:null,charSet:null,checked:Le,cite:null,className:ht,cols:he,colSpan:null,content:null,contentEditable:Mt,controls:Le,controlsList:ht,coords:he|Nl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:Yh,draggable:Mt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:ht,height:he,hidden:Yh,high:he,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:ht,itemRef:ht,itemScope:Le,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:he,manifest:null,max:null,maxLength:he,media:null,method:null,min:null,minLength:he,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,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:Le,optimum:he,pattern:null,ping:ht,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:ht,required:Le,reversed:Le,rows:he,rowSpan:he,sandbox:ht,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shape:null,size:he,sizes:null,slot:null,span:he,spellCheck:Mt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:he,step:null,style:null,tabIndex:he,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:Mt,width:he,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ht,axis:null,background:null,bgColor:null,border:he,borderColor:null,bottomMargin:he,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:he,leftMargin:he,link:null,longDesc:null,lowSrc:null,marginHeight:he,marginWidth:he,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:he,rules:null,scheme:null,scrolling:Mt,standby:null,summary:null,text:null,topMargin:he,valueType:null,version:null,vAlign:null,vLink:null,vSpace:he,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Le,disableRemotePlayback:Le,prefix:null,property:null,results:he,security:null,unselectable:null},space:"html",transform:dv}),E5=Yl({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:On,accentHeight:he,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:he,amplitude:he,arabicForm:null,ascent:he,attributeName:null,attributeType:null,azimuth:he,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:he,by:null,calcMode:null,capHeight:he,className:ht,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:he,diffuseConstant:he,direction:null,display:null,dur:null,divisor:he,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:he,enableBackground:null,end:null,event:null,exponent:he,externalResourcesRequired:null,fill:null,fillOpacity:he,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:Nl,g2:Nl,glyphName:Nl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:he,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:he,horizOriginX:he,horizOriginY:he,id:null,ideographic:he,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:he,k:he,k1:he,k2:he,k3:he,k4:he,kernelMatrix:On,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:he,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:he,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:he,overlineThickness:he,paintOrder:null,panose1:null,path:null,pathLength:he,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ht,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:he,pointsAtY:he,pointsAtZ:he,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:On,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:On,rev:On,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:On,requiredFeatures:On,requiredFonts:On,requiredFormats:On,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:he,specularExponent:he,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:he,strikethroughThickness:he,string:null,stroke:null,strokeDashArray:On,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:he,strokeOpacity:he,strokeWidth:null,style:null,surfaceScale:he,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:On,tabIndex:he,tableValues:null,target:null,targetX:he,targetY:he,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:On,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:he,underlineThickness:he,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:he,values:null,vAlphabetic:he,vMathematical:he,vectorEffect:null,vHanging:he,vIdeographic:he,version:null,vertAdvY:he,vertOriginX:he,vertOriginY:he,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:he,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:uv}),fv=Yl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,a){return"xlink:"+a.slice(5).toLowerCase()}}),hv=Yl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:dv}),mv=Yl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,a){return"xml:"+a.slice(3).toLowerCase()}}),T5={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"},A5=/[A-Z]/g,Ib=/-[a-z]/g,M5=/^data[-\w.:]+$/i;function D5(e,a){const i=Gh(a);let l=a,o=jn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&M5.test(a)){if(a.charAt(4)==="-"){const u=a.slice(5).replace(Ib,R5);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=a.slice(4);if(!Ib.test(u)){let d=u.replace(A5,O5);d.charAt(0)!=="-"&&(d="-"+d),a="data"+d}}o=Rm}return new o(l,a)}function O5(e){return"-"+e.toLowerCase()}function R5(e){return e.charAt(1).toUpperCase()}const _5=ov([cv,C5,fv,hv,mv],"html"),_m=ov([cv,E5,fv,hv,mv],"svg");function L5(e){return e.join(" ").trim()}var pl={},lh,Hb;function B5(){if(Hb)return lh;Hb=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,a=/\n/g,i=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,p=`
`,h="/",g="*",b="",v="comment",y="declaration";function k(j,N){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];N=N||{};var D=1,E=1;function L(V){var te=V.match(a);te&&(D+=te.length);var B=V.lastIndexOf(p);E=~B?V.length-B:E+V.length}function Y(){var V={line:D,column:E};return function(te){return te.position=new A(V),ee(),te}}function A(V){this.start=V,this.end={line:D,column:E},this.source=N.source}A.prototype.content=j;function H(V){var te=new Error(N.source+":"+D+":"+E+": "+V);if(te.reason=V,te.filename=N.source,te.line=D,te.column=E,te.source=j,!N.silent)throw te}function ae(V){var te=V.exec(j);if(te){var B=te[0];return L(B),j=j.slice(B.length),te}}function ee(){ae(i)}function O(V){var te;for(V=V||[];te=U();)te!==!1&&V.push(te);return V}function U(){var V=Y();if(!(h!=j.charAt(0)||g!=j.charAt(1))){for(var te=2;b!=j.charAt(te)&&(g!=j.charAt(te)||h!=j.charAt(te+1));)++te;if(te+=2,b===j.charAt(te-1))return H("End of comment missing");var B=j.slice(2,te-2);return E+=2,L(B),j=j.slice(te),E+=2,V({type:v,comment:B})}}function $(){var V=Y(),te=ae(l);if(te){if(U(),!ae(o))return H("property missing ':'");var B=ae(u),X=V({type:y,property:z(te[0].replace(e,b)),value:B?z(B[0].replace(e,b)):b});return ae(d),X}}function me(){var V=[];O(V);for(var te;te=$();)te!==!1&&(V.push(te),O(V));return V}return ee(),me()}function z(j){return j?j.replace(f,b):b}return lh=k,lh}var qb;function U5(){if(qb)return pl;qb=1;var e=pl&&pl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(pl,"__esModule",{value:!0}),pl.default=i;const a=e(B5());function i(l,o){let u=null;if(!l||typeof l!="string")return u;const d=(0,a.default)(l),f=typeof o=="function";return d.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;f?o(h,g,p):g&&(u=u||{},u[h]=g)}),u}return pl}var Ys={},Fb;function I5(){if(Fb)return Ys;Fb=1,Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,a=/-([a-z])/g,i=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||i.test(h)||e.test(h)},d=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),u(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(o,f):h=h.replace(l,f),h.replace(a,d))};return Ys.camelCase=p,Ys}var Qs,Pb;function H5(){if(Pb)return Qs;Pb=1;var e=Qs&&Qs.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},a=e(U5()),i=I5();function l(o,u){var d={};return!o||typeof o!="string"||(0,a.default)(o,function(f,p){f&&p&&(d[(0,i.camelCase)(f,u)]=p)}),d}return l.default=l,Qs=l,Qs}var q5=H5();const F5=hu(q5),pv=xv("end"),Lm=xv("start");function xv(e){return a;function a(i){const l=i&&i.position&&i.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function P5(e){const a=Lm(e),i=pv(e);if(a&&i)return{start:a,end:i}}function eo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?$b(e.position):"start"in e||"end"in e?$b(e):"line"in e||"column"in e?Xh(e):""}function Xh(e){return Vb(e&&e.line)+":"+Vb(e&&e.column)}function $b(e){return Xh(e&&e.start)+"-"+Xh(e&&e.end)}function Vb(e){return e&&typeof e=="number"?e:1}class nn extends Error{constructor(a,i,l){super(),typeof i=="string"&&(l=i,i=void 0);let o="",u={},d=!1;if(i&&("line"in i&&"column"in i?u={place:i}:"start"in i&&"end"in i?u={place:i}:"type"in i?u={ancestors:[i],place:i.position}:u={...i}),typeof a=="string"?o=a:!u.cause&&a&&(d=!0,o=a.message,u.cause=a),!u.ruleId&&!u.source&&typeof l=="string"){const p=l.indexOf(":");p===-1?u.ruleId=l:(u.source=l.slice(0,p),u.ruleId=l.slice(p+1))}if(!u.place&&u.ancestors&&u.ancestors){const p=u.ancestors[u.ancestors.length-1];p&&(u.place=p.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=eo(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}nn.prototype.file="";nn.prototype.name="";nn.prototype.reason="";nn.prototype.message="";nn.prototype.stack="";nn.prototype.column=void 0;nn.prototype.line=void 0;nn.prototype.ancestors=void 0;nn.prototype.cause=void 0;nn.prototype.fatal=void 0;nn.prototype.place=void 0;nn.prototype.ruleId=void 0;nn.prototype.source=void 0;const Bm={}.hasOwnProperty,$5=new Map,V5=/[A-Z]/g,G5=new Set(["table","tbody","thead","tfoot","tr"]),Y5=new Set(["td","th"]),gv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Q5(e,a){if(!a||a.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=a.filePath||void 0;let l;if(a.development){if(typeof a.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=n3(i,a.jsxDEV)}else{if(typeof a.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof a.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");l=t3(i,a.jsx,a.jsxs)}const o={Fragment:a.Fragment,ancestors:[],components:a.components||{},create:l,elementAttributeNameCase:a.elementAttributeNameCase||"react",evaluater:a.createEvaluater?a.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:a.ignoreInvalidStyle||!1,passKeys:a.passKeys!==!1,passNode:a.passNode||!1,schema:a.space==="svg"?_m:_5,stylePropertyNameCase:a.stylePropertyNameCase||"dom",tableCellAlignToStyle:a.tableCellAlignToStyle!==!1},u=bv(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function bv(e,a,i){if(a.type==="element")return X5(e,a,i);if(a.type==="mdxFlowExpression"||a.type==="mdxTextExpression")return J5(e,a);if(a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement")return K5(e,a,i);if(a.type==="mdxjsEsm")return Z5(e,a);if(a.type==="root")return W5(e,a,i);if(a.type==="text")return e3(e,a)}function X5(e,a,i){const l=e.schema;let o=l;a.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=_m,e.schema=o),e.ancestors.push(a);const u=vv(e,a.tagName,!1),d=a3(e,a);let f=Im(e,a);return G5.has(a.tagName)&&(f=f.filter(function(p){return typeof p=="string"?!N5(p):!0})),yv(e,d,u,a),Um(d,f),e.ancestors.pop(),e.schema=l,e.create(a,u,d,i)}function J5(e,a){if(a.data&&a.data.estree&&e.evaluater){const l=a.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}so(e,a.position)}function Z5(e,a){if(a.data&&a.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(a.data.estree);so(e,a.position)}function K5(e,a,i){const l=e.schema;let o=l;a.name==="svg"&&l.space==="html"&&(o=_m,e.schema=o),e.ancestors.push(a);const u=a.name===null?e.Fragment:vv(e,a.name,!0),d=i3(e,a),f=Im(e,a);return yv(e,d,u,a),Um(d,f),e.ancestors.pop(),e.schema=l,e.create(a,u,d,i)}function W5(e,a,i){const l={};return Um(l,Im(e,a)),e.create(a,e.Fragment,l,i)}function e3(e,a){return a.value}function yv(e,a,i,l){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(a.node=l)}function Um(e,a){if(a.length>0){const i=a.length>1?a:a[0];i&&(e.children=i)}}function t3(e,a,i){return l;function l(o,u,d,f){const h=Array.isArray(d.children)?i:a;return f?h(u,d,f):h(u,d)}}function n3(e,a){return i;function i(l,o,u,d){const f=Array.isArray(u.children),p=Lm(l);return a(o,u,d,f,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function a3(e,a){const i={};let l,o;for(o in a.properties)if(o!=="children"&&Bm.call(a.properties,o)){const u=r3(e,o,a.properties[o]);if(u){const[d,f]=u;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&Y5.has(a.tagName)?l=f:i[d]=f}}if(l){const u=i.style||(i.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return i}function i3(e,a){const i={};for(const l of a.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const u=l.data.estree.body[0];u.type;const d=u.expression;d.type;const f=d.properties[0];f.type,Object.assign(i,e.evaluater.evaluateExpression(f.argument))}else so(e,a.position);else{const o=l.name;let u;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const f=l.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else so(e,a.position);else u=l.value===null?!0:l.value;i[o]=u}return i}function Im(e,a){const i=[];let l=-1;const o=e.passKeys?new Map:$5;for(;++l<a.children.length;){const u=a.children[l];let d;if(e.passKeys){const p=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(p){const h=o.get(p)||0;d=p+"-"+h,o.set(p,h+1)}}const f=bv(e,u,d);f!==void 0&&i.push(f)}return i}function r3(e,a,i){const l=D5(e.schema,a);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=l.commaSeparated?v5(i):L5(i)),l.property==="style"){let o=typeof i=="object"?i:l3(e,String(i));return e.stylePropertyNameCase==="css"&&(o=s3(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&l.space?T5[l.property]||l.property:l.attribute,i]}}function l3(e,a){try{return F5(a,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const l=i,o=new nn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=gv+"#cannot-parse-style-attribute",o}}function vv(e,a,i){let l;if(!i)l={type:"Literal",value:a};else if(a.includes(".")){const o=a.split(".");let u=-1,d;for(;++u<o.length;){const f=Lb(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}l=d}else l=Lb(a)&&!/^[a-z]/.test(a)?{type:"Identifier",name:a}:{type:"Literal",value:a};if(l.type==="Literal"){const o=l.value;return Bm.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(l);so(e)}function so(e,a){const i=new nn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:a,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=gv+"#cannot-handle-mdx-estrees-without-createevaluater",i}function s3(e){const a={};let i;for(i in e)Bm.call(e,i)&&(a[o3(i)]=e[i]);return a}function o3(e){let a=e.replace(V5,c3);return a.slice(0,3)==="ms-"&&(a="-"+a),a}function c3(e){return"-"+e.toLowerCase()}const sh={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"]},u3={};function Hm(e,a){const i=u3,l=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,o=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return wv(e,l,o)}function wv(e,a,i){if(d3(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(a&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Gb(e.children,a,i)}return Array.isArray(e)?Gb(e,a,i):""}function Gb(e,a,i){const l=[];let o=-1;for(;++o<e.length;)l[o]=wv(e[o],a,i);return l.join("")}function d3(e){return!!(e&&typeof e=="object")}const Yb=document.createElement("i");function qm(e){const a="&"+e+";";Yb.innerHTML=a;const i=Yb.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===a?!1:i}function _n(e,a,i,l){const o=e.length;let u=0,d;if(a<0?a=-a>o?0:o+a:a=a>o?o:a,i=i>0?i:0,l.length<1e4)d=Array.from(l),d.unshift(a,i),e.splice(...d);else for(i&&e.splice(a,i);u<l.length;)d=l.slice(u,u+1e4),d.unshift(a,0),e.splice(...d),u+=1e4,a+=1e4}function Zn(e,a){return e.length>0?(_n(e,e.length,0,a),e):a}const Qb={}.hasOwnProperty;function jv(e){const a={};let i=-1;for(;++i<e.length;)f3(a,e[i]);return a}function f3(e,a){let i;for(i in a){const o=(Qb.call(e,i)?e[i]:void 0)||(e[i]={}),u=a[i];let d;if(u)for(d in u){Qb.call(o,d)||(o[d]=[]);const f=u[d];h3(o[d],Array.isArray(f)?f:f?[f]:[])}}}function h3(e,a){let i=-1;const l=[];for(;++i<a.length;)(a[i].add==="after"?e:l).push(a[i]);_n(e,0,0,l)}function zv(e,a){const i=Number.parseInt(e,a);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function da(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cn=Gi(/[A-Za-z]/),en=Gi(/[\dA-Za-z]/),m3=Gi(/[#-'*+\--9=?A-Z^-~]/);function ou(e){return e!==null&&(e<32||e===127)}const Jh=Gi(/\d/),p3=Gi(/[\dA-Fa-f]/),x3=Gi(/[!-/:-@[-`{-~]/);function Se(e){return e!==null&&e<-2}function dt(e){return e!==null&&(e<0||e===32)}function Fe(e){return e===-2||e===-1||e===32}const Au=Gi(new RegExp("\\p{P}|\\p{S}","u")),Sr=Gi(/\s/);function Gi(e){return a;function a(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Ql(e){const a=[];let i=-1,l=0,o=0;for(;++i<e.length;){const u=e.charCodeAt(i);let d="";if(u===37&&en(e.charCodeAt(i+1))&&en(e.charCodeAt(i+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(i+1);u<56320&&f>56319&&f<57344?(d=String.fromCharCode(u,f),o=1):d="�"}else d=String.fromCharCode(u);d&&(a.push(e.slice(l,i),encodeURIComponent(d)),l=i+o+1,d=""),o&&(i+=o,o=0)}return a.join("")+e.slice(l)}function Je(e,a,i,l){const o=l?l-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(p){return Fe(p)?(e.enter(i),f(p)):a(p)}function f(p){return Fe(p)&&u++<o?(e.consume(p),f):(e.exit(i),a(p))}}const g3={tokenize:b3};function b3(e){const a=e.attempt(this.parser.constructs.contentInitial,l,o);let i;return a;function l(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Je(e,a,"linePrefix")}function o(f){return e.enter("paragraph"),u(f)}function u(f){const p=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=p),i=p,d(f)}function d(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Se(f)?(e.consume(f),e.exit("chunkText"),u):(e.consume(f),d)}}const y3={tokenize:v3},Xb={tokenize:w3};function v3(e){const a=this,i=[];let l=0,o,u,d;return f;function f(E){if(l<i.length){const L=i[l];return a.containerState=L[1],e.attempt(L[0].continuation,p,h)(E)}return h(E)}function p(E){if(l++,a.containerState._closeFlow){a.containerState._closeFlow=void 0,o&&D();const L=a.events.length;let Y=L,A;for(;Y--;)if(a.events[Y][0]==="exit"&&a.events[Y][1].type==="chunkFlow"){A=a.events[Y][1].end;break}N(l);let H=L;for(;H<a.events.length;)a.events[H][1].end={...A},H++;return _n(a.events,Y+1,0,a.events.slice(L)),a.events.length=H,h(E)}return f(E)}function h(E){if(l===i.length){if(!o)return v(E);if(o.currentConstruct&&o.currentConstruct.concrete)return k(E);a.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return a.containerState={},e.check(Xb,g,b)(E)}function g(E){return o&&D(),N(l),v(E)}function b(E){return a.parser.lazy[a.now().line]=l!==i.length,d=a.now().offset,k(E)}function v(E){return a.containerState={},e.attempt(Xb,y,k)(E)}function y(E){return l++,i.push([a.currentConstruct,a.containerState]),v(E)}function k(E){if(E===null){o&&D(),N(0),e.consume(E);return}return o=o||a.parser.flow(a.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),z(E)}function z(E){if(E===null){j(e.exit("chunkFlow"),!0),N(0),e.consume(E);return}return Se(E)?(e.consume(E),j(e.exit("chunkFlow")),l=0,a.interrupt=void 0,f):(e.consume(E),z)}function j(E,L){const Y=a.sliceStream(E);if(L&&Y.push(null),E.previous=u,u&&(u.next=E),u=E,o.defineSkip(E.start),o.write(Y),a.parser.lazy[E.start.line]){let A=o.events.length;for(;A--;)if(o.events[A][1].start.offset<d&&(!o.events[A][1].end||o.events[A][1].end.offset>d))return;const H=a.events.length;let ae=H,ee,O;for(;ae--;)if(a.events[ae][0]==="exit"&&a.events[ae][1].type==="chunkFlow"){if(ee){O=a.events[ae][1].end;break}ee=!0}for(N(l),A=H;A<a.events.length;)a.events[A][1].end={...O},A++;_n(a.events,ae+1,0,a.events.slice(H)),a.events.length=A}}function N(E){let L=i.length;for(;L-- >E;){const Y=i[L];a.containerState=Y[1],Y[0].exit.call(a,e)}i.length=E}function D(){o.write([null]),u=void 0,o=void 0,a.containerState._closeFlow=void 0}}function w3(e,a,i){return Je(e,e.attempt(this.parser.constructs.document,a,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Hl(e){if(e===null||dt(e)||Sr(e))return 1;if(Au(e))return 2}function Mu(e,a,i){const l=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!l.includes(u)&&(a=u(a,i),l.push(u))}return a}const Zh={name:"attention",resolveAll:j3,tokenize:z3};function j3(e,a){let i=-1,l,o,u,d,f,p,h,g;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(l=i;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&a.sliceSerialize(e[l][1]).charCodeAt(0)===a.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[l][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;p=e[l][1].end.offset-e[l][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const b={...e[l][1].end},v={...e[i][1].start};Jb(b,-p),Jb(v,p),d={type:p>1?"strongSequence":"emphasisSequence",start:b,end:{...e[l][1].end}},f={type:p>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:v},u={type:p>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[i][1].start}},o={type:p>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[l][1].end={...d.start},e[i][1].start={...f.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=Zn(h,[["enter",e[l][1],a],["exit",e[l][1],a]])),h=Zn(h,[["enter",o,a],["enter",d,a],["exit",d,a],["enter",u,a]]),h=Zn(h,Mu(a.parser.constructs.insideSpan.null,e.slice(l+1,i),a)),h=Zn(h,[["exit",u,a],["enter",f,a],["exit",f,a],["exit",o,a]]),e[i][1].end.offset-e[i][1].start.offset?(g=2,h=Zn(h,[["enter",e[i][1],a],["exit",e[i][1],a]])):g=0,_n(e,l-1,i-l+3,h),i=l+h.length-g-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function z3(e,a){const i=this.parser.constructs.attentionMarkers.null,l=this.previous,o=Hl(l);let u;return d;function d(p){return u=p,e.enter("attentionSequence"),f(p)}function f(p){if(p===u)return e.consume(p),f;const h=e.exit("attentionSequence"),g=Hl(p),b=!g||g===2&&o||i.includes(p),v=!o||o===2&&g||i.includes(l);return h._open=!!(u===42?b:b&&(o||!v)),h._close=!!(u===42?v:v&&(g||!b)),a(p)}}function Jb(e,a){e.column+=a,e.offset+=a,e._bufferIndex+=a}const k3={name:"autolink",tokenize:N3};function N3(e,a,i){let l=0;return o;function o(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(y){return cn(y)?(e.consume(y),d):y===64?i(y):h(y)}function d(y){return y===43||y===45||y===46||en(y)?(l=1,f(y)):h(y)}function f(y){return y===58?(e.consume(y),l=0,p):(y===43||y===45||y===46||en(y))&&l++<32?(e.consume(y),f):(l=0,h(y))}function p(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),a):y===null||y===32||y===60||ou(y)?i(y):(e.consume(y),p)}function h(y){return y===64?(e.consume(y),g):m3(y)?(e.consume(y),h):i(y)}function g(y){return en(y)?b(y):i(y)}function b(y){return y===46?(e.consume(y),l=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),a):v(y)}function v(y){if((y===45||en(y))&&l++<63){const k=y===45?v:b;return e.consume(y),k}return i(y)}}const vo={partial:!0,tokenize:S3};function S3(e,a,i){return l;function l(u){return Fe(u)?Je(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||Se(u)?a(u):i(u)}}const kv={continuation:{tokenize:E3},exit:T3,name:"blockQuote",tokenize:C3};function C3(e,a,i){const l=this;return o;function o(d){if(d===62){const f=l.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return i(d)}function u(d){return Fe(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),a):(e.exit("blockQuotePrefix"),a(d))}}function E3(e,a,i){const l=this;return o;function o(d){return Fe(d)?Je(e,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(kv,a,i)(d)}}function T3(e){e.exit("blockQuote")}const Nv={name:"characterEscape",tokenize:A3};function A3(e,a,i){return l;function l(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return x3(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),a):i(u)}}const Sv={name:"characterReference",tokenize:M3};function M3(e,a,i){const l=this;let o=0,u,d;return f;function f(b){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),p}function p(b){return b===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(b),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),u=31,d=en,g(b))}function h(b){return b===88||b===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(b),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=p3,g):(e.enter("characterReferenceValue"),u=7,d=Jh,g(b))}function g(b){if(b===59&&o){const v=e.exit("characterReferenceValue");return d===en&&!qm(l.sliceSerialize(v))?i(b):(e.enter("characterReferenceMarker"),e.consume(b),e.exit("characterReferenceMarker"),e.exit("characterReference"),a)}return d(b)&&o++<u?(e.consume(b),g):i(b)}}const Zb={partial:!0,tokenize:O3},Kb={concrete:!0,name:"codeFenced",tokenize:D3};function D3(e,a,i){const l=this,o={partial:!0,tokenize:Y};let u=0,d=0,f;return p;function p(A){return h(A)}function h(A){const H=l.events[l.events.length-1];return u=H&&H[1].type==="linePrefix"?H[2].sliceSerialize(H[1],!0).length:0,f=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(A)}function g(A){return A===f?(d++,e.consume(A),g):d<3?i(A):(e.exit("codeFencedFenceSequence"),Fe(A)?Je(e,b,"whitespace")(A):b(A))}function b(A){return A===null||Se(A)?(e.exit("codeFencedFence"),l.interrupt?a(A):e.check(Zb,z,L)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(A))}function v(A){return A===null||Se(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),b(A)):Fe(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Je(e,y,"whitespace")(A)):A===96&&A===f?i(A):(e.consume(A),v)}function y(A){return A===null||Se(A)?b(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(A))}function k(A){return A===null||Se(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),b(A)):A===96&&A===f?i(A):(e.consume(A),k)}function z(A){return e.attempt(o,L,j)(A)}function j(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),N}function N(A){return u>0&&Fe(A)?Je(e,D,"linePrefix",u+1)(A):D(A)}function D(A){return A===null||Se(A)?e.check(Zb,z,L)(A):(e.enter("codeFlowValue"),E(A))}function E(A){return A===null||Se(A)?(e.exit("codeFlowValue"),D(A)):(e.consume(A),E)}function L(A){return e.exit("codeFenced"),a(A)}function Y(A,H,ae){let ee=0;return O;function O(te){return A.enter("lineEnding"),A.consume(te),A.exit("lineEnding"),U}function U(te){return A.enter("codeFencedFence"),Fe(te)?Je(A,$,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):$(te)}function $(te){return te===f?(A.enter("codeFencedFenceSequence"),me(te)):ae(te)}function me(te){return te===f?(ee++,A.consume(te),me):ee>=d?(A.exit("codeFencedFenceSequence"),Fe(te)?Je(A,V,"whitespace")(te):V(te)):ae(te)}function V(te){return te===null||Se(te)?(A.exit("codeFencedFence"),H(te)):ae(te)}}}function O3(e,a,i){const l=this;return o;function o(d){return d===null?i(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return l.parser.lazy[l.now().line]?i(d):a(d)}}const oh={name:"codeIndented",tokenize:_3},R3={partial:!0,tokenize:L3};function _3(e,a,i){const l=this;return o;function o(h){return e.enter("codeIndented"),Je(e,u,"linePrefix",5)(h)}function u(h){const g=l.events[l.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(h):i(h)}function d(h){return h===null?p(h):Se(h)?e.attempt(R3,d,p)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Se(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function p(h){return e.exit("codeIndented"),a(h)}}function L3(e,a,i){const l=this;return o;function o(d){return l.parser.lazy[l.now().line]?i(d):Se(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):Je(e,u,"linePrefix",5)(d)}function u(d){const f=l.events[l.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(d):Se(d)?o(d):i(d)}}const B3={name:"codeText",previous:I3,resolve:U3,tokenize:H3};function U3(e){let a=e.length-4,i=3,l,o;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[a][1].type==="lineEnding"||e[a][1].type==="space")){for(l=i;++l<a;)if(e[l][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[a][1].type="codeTextPadding",i+=2,a-=2;break}}for(l=i-1,a++;++l<=a;)o===void 0?l!==a&&e[l][1].type!=="lineEnding"&&(o=l):(l===a||e[l][1].type==="lineEnding")&&(e[o][1].type="codeTextData",l!==o+2&&(e[o][1].end=e[l-1][1].end,e.splice(o+2,l-o-2),a-=l-o-2,l=o+2),o=void 0);return e}function I3(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function H3(e,a,i){let l=0,o,u;return d;function d(b){return e.enter("codeText"),e.enter("codeTextSequence"),f(b)}function f(b){return b===96?(e.consume(b),l++,f):(e.exit("codeTextSequence"),p(b))}function p(b){return b===null?i(b):b===32?(e.enter("space"),e.consume(b),e.exit("space"),p):b===96?(u=e.enter("codeTextSequence"),o=0,g(b)):Se(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),p):(e.enter("codeTextData"),h(b))}function h(b){return b===null||b===32||b===96||Se(b)?(e.exit("codeTextData"),p(b)):(e.consume(b),h)}function g(b){return b===96?(e.consume(b),o++,g):o===l?(e.exit("codeTextSequence"),e.exit("codeText"),a(b)):(u.type="codeTextData",h(b))}}class q3{constructor(a){this.left=a?[...a]:[],this.right=[]}get(a){if(a<0||a>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+a+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return a<this.left.length?this.left[a]:this.right[this.right.length-a+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(a,i){const l=i??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(a,l):a>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-a+this.left.length).reverse():this.left.slice(a).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(a,i,l){const o=i||0;this.setCursor(Math.trunc(a));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&Xs(this.left,l),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(a){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(a)}pushMany(a){this.setCursor(Number.POSITIVE_INFINITY),Xs(this.left,a)}unshift(a){this.setCursor(0),this.right.push(a)}unshiftMany(a){this.setCursor(0),Xs(this.right,a.reverse())}setCursor(a){if(!(a===this.left.length||a>this.left.length&&this.right.length===0||a<0&&this.left.length===0))if(a<this.left.length){const i=this.left.splice(a,Number.POSITIVE_INFINITY);Xs(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-a,Number.POSITIVE_INFINITY);Xs(this.left,i.reverse())}}}function Xs(e,a){let i=0;if(a.length<1e4)e.push(...a);else for(;i<a.length;)e.push(...a.slice(i,i+1e4)),i+=1e4}function Cv(e){const a={};let i=-1,l,o,u,d,f,p,h;const g=new q3(e);for(;++i<g.length;){for(;i in a;)i=a[i];if(l=g.get(i),i&&l[1].type==="chunkFlow"&&g.get(i-1)[1].type==="listItemPrefix"&&(p=l[1]._tokenizer.events,u=0,u<p.length&&p[u][1].type==="lineEndingBlank"&&(u+=2),u<p.length&&p[u][1].type==="content"))for(;++u<p.length&&p[u][1].type!=="content";)p[u][1].type==="chunkText"&&(p[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(a,F3(g,i)),i=a[i],h=!0);else if(l[1]._container){for(u=i,o=void 0;u--;)if(d=g.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(l[1].end={...g.get(o)[1].start},f=g.slice(o,i),f.unshift(l),g.splice(o,i-o+1,f))}}return _n(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function F3(e,a){const i=e.get(a)[1],l=e.get(a)[2];let o=a-1;const u=[];let d=i._tokenizer;d||(d=l.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,p=[],h={};let g,b,v=-1,y=i,k=0,z=0;const j=[z];for(;y;){for(;e.get(++o)[1]!==y;);u.push(o),y._tokenizer||(g=l.sliceStream(y),y.next||g.push(null),b&&d.defineSkip(y.start),y._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),y._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),b=y,y=y.next}for(y=i;++v<f.length;)f[v][0]==="exit"&&f[v-1][0]==="enter"&&f[v][1].type===f[v-1][1].type&&f[v][1].start.line!==f[v][1].end.line&&(z=v+1,j.push(z),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(d.events=[],y?(y._tokenizer=void 0,y.previous=void 0):j.pop(),v=j.length;v--;){const N=f.slice(j[v],j[v+1]),D=u.pop();p.push([D,D+N.length-1]),e.splice(D,2,N)}for(p.reverse(),v=-1;++v<p.length;)h[k+p[v][0]]=k+p[v][1],k+=p[v][1]-p[v][0]-1;return h}const P3={resolve:V3,tokenize:G3},$3={partial:!0,tokenize:Y3};function V3(e){return Cv(e),e}function G3(e,a){let i;return l;function l(f){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?u(f):Se(f)?e.check($3,d,u)(f):(e.consume(f),o)}function u(f){return e.exit("chunkContent"),e.exit("content"),a(f)}function d(f){return e.consume(f),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,o}}function Y3(e,a,i){const l=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Je(e,u,"linePrefix")}function u(d){if(d===null||Se(d))return i(d);const f=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(d):e.interrupt(l.parser.constructs.flow,i,a)(d)}}function Ev(e,a,i,l,o,u,d,f,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return b;function b(N){return N===60?(e.enter(l),e.enter(o),e.enter(u),e.consume(N),e.exit(u),v):N===null||N===32||N===41||ou(N)?i(N):(e.enter(l),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),z(N))}function v(N){return N===62?(e.enter(u),e.consume(N),e.exit(u),e.exit(o),e.exit(l),a):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===62?(e.exit("chunkString"),e.exit(f),v(N)):N===null||N===60||Se(N)?i(N):(e.consume(N),N===92?k:y)}function k(N){return N===60||N===62||N===92?(e.consume(N),y):y(N)}function z(N){return!g&&(N===null||N===41||dt(N))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(l),a(N)):g<h&&N===40?(e.consume(N),g++,z):N===41?(e.consume(N),g--,z):N===null||N===32||N===40||ou(N)?i(N):(e.consume(N),N===92?j:z)}function j(N){return N===40||N===41||N===92?(e.consume(N),z):z(N)}}function Tv(e,a,i,l,o,u){const d=this;let f=0,p;return h;function h(y){return e.enter(l),e.enter(o),e.consume(y),e.exit(o),e.enter(u),g}function g(y){return f>999||y===null||y===91||y===93&&!p||y===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?i(y):y===93?(e.exit(u),e.enter(o),e.consume(y),e.exit(o),e.exit(l),a):Se(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),b(y))}function b(y){return y===null||y===91||y===93||Se(y)||f++>999?(e.exit("chunkString"),g(y)):(e.consume(y),p||(p=!Fe(y)),y===92?v:b)}function v(y){return y===91||y===92||y===93?(e.consume(y),f++,b):b(y)}}function Av(e,a,i,l,o,u){let d;return f;function f(v){return v===34||v===39||v===40?(e.enter(l),e.enter(o),e.consume(v),e.exit(o),d=v===40?41:v,p):i(v)}function p(v){return v===d?(e.enter(o),e.consume(v),e.exit(o),e.exit(l),a):(e.enter(u),h(v))}function h(v){return v===d?(e.exit(u),p(d)):v===null?i(v):Se(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Je(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===d||v===null||Se(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?b:g)}function b(v){return v===d||v===92?(e.consume(v),g):g(v)}}function to(e,a){let i;return l;function l(o){return Se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i=!0,l):Fe(o)?Je(e,l,i?"linePrefix":"lineSuffix")(o):a(o)}}const Q3={name:"definition",tokenize:J3},X3={partial:!0,tokenize:Z3};function J3(e,a,i){const l=this;let o;return u;function u(y){return e.enter("definition"),d(y)}function d(y){return Tv.call(l,e,f,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return o=da(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),p):i(y)}function p(y){return dt(y)?to(e,h)(y):h(y)}function h(y){return Ev(e,g,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(X3,b,b)(y)}function b(y){return Fe(y)?Je(e,v,"whitespace")(y):v(y)}function v(y){return y===null||Se(y)?(e.exit("definition"),l.parser.defined.push(o),a(y)):i(y)}}function Z3(e,a,i){return l;function l(f){return dt(f)?to(e,o)(f):i(f)}function o(f){return Av(e,u,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return Fe(f)?Je(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Se(f)?a(f):i(f)}}const K3={name:"hardBreakEscape",tokenize:W3};function W3(e,a,i){return l;function l(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return Se(u)?(e.exit("hardBreakEscape"),a(u)):i(u)}}const eC={name:"headingAtx",resolve:tC,tokenize:nC};function tC(e,a){let i=e.length-2,l=3,o,u;return e[l][1].type==="whitespace"&&(l+=2),i-2>l&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(l===i-1||i-4>l&&e[i-2][1].type==="whitespace")&&(i-=l+1===i?2:4),i>l&&(o={type:"atxHeadingText",start:e[l][1].start,end:e[i][1].end},u={type:"chunkText",start:e[l][1].start,end:e[i][1].end,contentType:"text"},_n(e,l,i-l+1,[["enter",o,a],["enter",u,a],["exit",u,a],["exit",o,a]])),e}function nC(e,a,i){let l=0;return o;function o(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&l++<6?(e.consume(g),d):g===null||dt(g)?(e.exit("atxHeadingSequence"),f(g)):i(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||Se(g)?(e.exit("atxHeading"),a(g)):Fe(g)?Je(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function p(g){return g===35?(e.consume(g),p):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||dt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const aC=["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"],Wb=["pre","script","style","textarea"],iC={concrete:!0,name:"htmlFlow",resolveTo:sC,tokenize:oC},rC={partial:!0,tokenize:uC},lC={partial:!0,tokenize:cC};function sC(e){let a=e.length;for(;a--&&!(e[a][0]==="enter"&&e[a][1].type==="htmlFlow"););return a>1&&e[a-2][1].type==="linePrefix"&&(e[a][1].start=e[a-2][1].start,e[a+1][1].start=e[a-2][1].start,e.splice(a-2,2)),e}function oC(e,a,i){const l=this;let o,u,d,f,p;return h;function h(T){return g(T)}function g(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),b}function b(T){return T===33?(e.consume(T),v):T===47?(e.consume(T),u=!0,z):T===63?(e.consume(T),o=3,l.interrupt?a:M):cn(T)?(e.consume(T),d=String.fromCharCode(T),j):i(T)}function v(T){return T===45?(e.consume(T),o=2,y):T===91?(e.consume(T),o=5,f=0,k):cn(T)?(e.consume(T),o=4,l.interrupt?a:M):i(T)}function y(T){return T===45?(e.consume(T),l.interrupt?a:M):i(T)}function k(T){const F="CDATA[";return T===F.charCodeAt(f++)?(e.consume(T),f===F.length?l.interrupt?a:$:k):i(T)}function z(T){return cn(T)?(e.consume(T),d=String.fromCharCode(T),j):i(T)}function j(T){if(T===null||T===47||T===62||dt(T)){const F=T===47,ge=d.toLowerCase();return!F&&!u&&Wb.includes(ge)?(o=1,l.interrupt?a(T):$(T)):aC.includes(d.toLowerCase())?(o=6,F?(e.consume(T),N):l.interrupt?a(T):$(T)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?i(T):u?D(T):E(T))}return T===45||en(T)?(e.consume(T),d+=String.fromCharCode(T),j):i(T)}function N(T){return T===62?(e.consume(T),l.interrupt?a:$):i(T)}function D(T){return Fe(T)?(e.consume(T),D):O(T)}function E(T){return T===47?(e.consume(T),O):T===58||T===95||cn(T)?(e.consume(T),L):Fe(T)?(e.consume(T),E):O(T)}function L(T){return T===45||T===46||T===58||T===95||en(T)?(e.consume(T),L):Y(T)}function Y(T){return T===61?(e.consume(T),A):Fe(T)?(e.consume(T),Y):E(T)}function A(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(e.consume(T),p=T,H):Fe(T)?(e.consume(T),A):ae(T)}function H(T){return T===p?(e.consume(T),p=null,ee):T===null||Se(T)?i(T):(e.consume(T),H)}function ae(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||dt(T)?Y(T):(e.consume(T),ae)}function ee(T){return T===47||T===62||Fe(T)?E(T):i(T)}function O(T){return T===62?(e.consume(T),U):i(T)}function U(T){return T===null||Se(T)?$(T):Fe(T)?(e.consume(T),U):i(T)}function $(T){return T===45&&o===2?(e.consume(T),B):T===60&&o===1?(e.consume(T),X):T===62&&o===4?(e.consume(T),R):T===63&&o===3?(e.consume(T),M):T===93&&o===5?(e.consume(T),ue):Se(T)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(rC,P,me)(T)):T===null||Se(T)?(e.exit("htmlFlowData"),me(T)):(e.consume(T),$)}function me(T){return e.check(lC,V,P)(T)}function V(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),te}function te(T){return T===null||Se(T)?me(T):(e.enter("htmlFlowData"),$(T))}function B(T){return T===45?(e.consume(T),M):$(T)}function X(T){return T===47?(e.consume(T),d="",ce):$(T)}function ce(T){if(T===62){const F=d.toLowerCase();return Wb.includes(F)?(e.consume(T),R):$(T)}return cn(T)&&d.length<8?(e.consume(T),d+=String.fromCharCode(T),ce):$(T)}function ue(T){return T===93?(e.consume(T),M):$(T)}function M(T){return T===62?(e.consume(T),R):T===45&&o===2?(e.consume(T),M):$(T)}function R(T){return T===null||Se(T)?(e.exit("htmlFlowData"),P(T)):(e.consume(T),R)}function P(T){return e.exit("htmlFlow"),a(T)}}function cC(e,a,i){const l=this;return o;function o(d){return Se(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):i(d)}function u(d){return l.parser.lazy[l.now().line]?i(d):a(d)}}function uC(e,a,i){return l;function l(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(vo,a,i)}}const dC={name:"htmlText",tokenize:fC};function fC(e,a,i){const l=this;let o,u,d;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),p}function p(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),Y):M===63?(e.consume(M),E):cn(M)?(e.consume(M),ae):i(M)}function h(M){return M===45?(e.consume(M),g):M===91?(e.consume(M),u=0,k):cn(M)?(e.consume(M),D):i(M)}function g(M){return M===45?(e.consume(M),y):i(M)}function b(M){return M===null?i(M):M===45?(e.consume(M),v):Se(M)?(d=b,X(M)):(e.consume(M),b)}function v(M){return M===45?(e.consume(M),y):b(M)}function y(M){return M===62?B(M):M===45?v(M):b(M)}function k(M){const R="CDATA[";return M===R.charCodeAt(u++)?(e.consume(M),u===R.length?z:k):i(M)}function z(M){return M===null?i(M):M===93?(e.consume(M),j):Se(M)?(d=z,X(M)):(e.consume(M),z)}function j(M){return M===93?(e.consume(M),N):z(M)}function N(M){return M===62?B(M):M===93?(e.consume(M),N):z(M)}function D(M){return M===null||M===62?B(M):Se(M)?(d=D,X(M)):(e.consume(M),D)}function E(M){return M===null?i(M):M===63?(e.consume(M),L):Se(M)?(d=E,X(M)):(e.consume(M),E)}function L(M){return M===62?B(M):E(M)}function Y(M){return cn(M)?(e.consume(M),A):i(M)}function A(M){return M===45||en(M)?(e.consume(M),A):H(M)}function H(M){return Se(M)?(d=H,X(M)):Fe(M)?(e.consume(M),H):B(M)}function ae(M){return M===45||en(M)?(e.consume(M),ae):M===47||M===62||dt(M)?ee(M):i(M)}function ee(M){return M===47?(e.consume(M),B):M===58||M===95||cn(M)?(e.consume(M),O):Se(M)?(d=ee,X(M)):Fe(M)?(e.consume(M),ee):B(M)}function O(M){return M===45||M===46||M===58||M===95||en(M)?(e.consume(M),O):U(M)}function U(M){return M===61?(e.consume(M),$):Se(M)?(d=U,X(M)):Fe(M)?(e.consume(M),U):ee(M)}function $(M){return M===null||M===60||M===61||M===62||M===96?i(M):M===34||M===39?(e.consume(M),o=M,me):Se(M)?(d=$,X(M)):Fe(M)?(e.consume(M),$):(e.consume(M),V)}function me(M){return M===o?(e.consume(M),o=void 0,te):M===null?i(M):Se(M)?(d=me,X(M)):(e.consume(M),me)}function V(M){return M===null||M===34||M===39||M===60||M===61||M===96?i(M):M===47||M===62||dt(M)?ee(M):(e.consume(M),V)}function te(M){return M===47||M===62||dt(M)?ee(M):i(M)}function B(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),a):i(M)}function X(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),ce}function ce(M){return Fe(M)?Je(e,ue,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ue(M)}function ue(M){return e.enter("htmlTextData"),d(M)}}const Fm={name:"labelEnd",resolveAll:xC,resolveTo:gC,tokenize:bC},hC={tokenize:yC},mC={tokenize:vC},pC={tokenize:wC};function xC(e){let a=-1;const i=[];for(;++a<e.length;){const l=e[a][1];if(i.push(e[a]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const o=l.type==="labelImage"?4:2;l.type="data",a+=o}}return e.length!==i.length&&_n(e,0,e.length,i),e}function gC(e,a){let i=e.length,l=0,o,u,d,f;for(;i--;)if(o=e[i][1],u){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[i][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[i][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(u=i,o.type!=="labelLink")){l=2;break}}else o.type==="labelEnd"&&(d=i);const p={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[u][1].start},end:{...e[d][1].end}},g={type:"labelText",start:{...e[u+l+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",p,a],["enter",h,a]],f=Zn(f,e.slice(u+1,u+l+3)),f=Zn(f,[["enter",g,a]]),f=Zn(f,Mu(a.parser.constructs.insideSpan.null,e.slice(u+l+4,d-3),a)),f=Zn(f,[["exit",g,a],e[d-2],e[d-1],["exit",h,a]]),f=Zn(f,e.slice(d+1)),f=Zn(f,[["exit",p,a]]),_n(e,u,e.length,f),e}function bC(e,a,i){const l=this;let o=l.events.length,u,d;for(;o--;)if((l.events[o][1].type==="labelImage"||l.events[o][1].type==="labelLink")&&!l.events[o][1]._balanced){u=l.events[o][1];break}return f;function f(v){return u?u._inactive?b(v):(d=l.parser.defined.includes(da(l.sliceSerialize({start:u.end,end:l.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),p):i(v)}function p(v){return v===40?e.attempt(hC,g,d?g:b)(v):v===91?e.attempt(mC,g,d?h:b)(v):d?g(v):b(v)}function h(v){return e.attempt(pC,g,b)(v)}function g(v){return a(v)}function b(v){return u._balanced=!0,i(v)}}function yC(e,a,i){return l;function l(b){return e.enter("resource"),e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),o}function o(b){return dt(b)?to(e,u)(b):u(b)}function u(b){return b===41?g(b):Ev(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(b)}function d(b){return dt(b)?to(e,p)(b):g(b)}function f(b){return i(b)}function p(b){return b===34||b===39||b===40?Av(e,h,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(b):g(b)}function h(b){return dt(b)?to(e,g)(b):g(b)}function g(b){return b===41?(e.enter("resourceMarker"),e.consume(b),e.exit("resourceMarker"),e.exit("resource"),a):i(b)}}function vC(e,a,i){const l=this;return o;function o(f){return Tv.call(l,e,u,d,"reference","referenceMarker","referenceString")(f)}function u(f){return l.parser.defined.includes(da(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?a(f):i(f)}function d(f){return i(f)}}function wC(e,a,i){return l;function l(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),a):i(u)}}const jC={name:"labelStartImage",resolveAll:Fm.resolveAll,tokenize:zC};function zC(e,a,i){const l=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),d):i(f)}function d(f){return f===94&&"_hiddenFootnoteSupport"in l.parser.constructs?i(f):a(f)}}const kC={name:"labelStartLink",resolveAll:Fm.resolveAll,tokenize:NC};function NC(e,a,i){const l=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in l.parser.constructs?i(d):a(d)}}const ch={name:"lineEnding",tokenize:SC};function SC(e,a){return i;function i(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Je(e,a,"linePrefix")}}const Kc={name:"thematicBreak",tokenize:CC};function CC(e,a,i){let l=0,o;return u;function u(h){return e.enter("thematicBreak"),d(h)}function d(h){return o=h,f(h)}function f(h){return h===o?(e.enter("thematicBreakSequence"),p(h)):l>=3&&(h===null||Se(h))?(e.exit("thematicBreak"),a(h)):i(h)}function p(h){return h===o?(e.consume(h),l++,p):(e.exit("thematicBreakSequence"),Fe(h)?Je(e,f,"whitespace")(h):f(h))}}const yn={continuation:{tokenize:MC},exit:OC,name:"list",tokenize:AC},EC={partial:!0,tokenize:RC},TC={partial:!0,tokenize:DC};function AC(e,a,i){const l=this,o=l.events[l.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return f;function f(y){const k=l.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!l.containerState.marker||y===l.containerState.marker:Jh(y)){if(l.containerState.type||(l.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Kc,i,h)(y):h(y);if(!l.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(y)}return i(y)}function p(y){return Jh(y)&&++d<10?(e.consume(y),p):(!l.interrupt||d<2)&&(l.containerState.marker?y===l.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),h(y)):i(y)}function h(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),l.containerState.marker=l.containerState.marker||y,e.check(vo,l.interrupt?i:g,e.attempt(EC,v,b))}function g(y){return l.containerState.initialBlankLine=!0,u++,v(y)}function b(y){return Fe(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),v):i(y)}function v(y){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,a(y)}}function MC(e,a,i){const l=this;return l.containerState._closeFlow=void 0,e.check(vo,o,u);function o(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,Je(e,a,"listItemIndent",l.containerState.size+1)(f)}function u(f){return l.containerState.furtherBlankLines||!Fe(f)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,d(f)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(TC,a,d)(f))}function d(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,Je(e,e.attempt(yn,a,i),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function DC(e,a,i){const l=this;return Je(e,o,"listItemIndent",l.containerState.size+1);function o(u){const d=l.events[l.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===l.containerState.size?a(u):i(u)}}function OC(e){e.exit(this.containerState.type)}function RC(e,a,i){const l=this;return Je(e,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const d=l.events[l.events.length-1];return!Fe(u)&&d&&d[1].type==="listItemPrefixWhitespace"?a(u):i(u)}}const ey={name:"setextUnderline",resolveTo:_C,tokenize:LC};function _C(e,a){let i=e.length,l,o,u;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){l=i;break}e[i][1].type==="paragraph"&&(o=i)}else e[i][1].type==="content"&&e.splice(i,1),!u&&e[i][1].type==="definition"&&(u=i);const d={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",d,a]),e.splice(u+1,0,["exit",e[l][1],a]),e[l][1].end={...e[u][1].end}):e[l][1]=d,e.push(["exit",d,a]),e}function LC(e,a,i){const l=this;let o;return u;function u(h){let g=l.events.length,b;for(;g--;)if(l.events[g][1].type!=="lineEnding"&&l.events[g][1].type!=="linePrefix"&&l.events[g][1].type!=="content"){b=l.events[g][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.interrupt||b)?(e.enter("setextHeadingLine"),o=h,d(h)):i(h)}function d(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===o?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),Fe(h)?Je(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||Se(h)?(e.exit("setextHeadingLine"),a(h)):i(h)}}const BC={tokenize:UC};function UC(e){const a=this,i=e.attempt(vo,l,e.attempt(this.parser.constructs.flowInitial,o,Je(e,e.attempt(this.parser.constructs.flow,o,e.attempt(P3,o)),"linePrefix")));return i;function l(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),a.currentConstruct=void 0,i}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a.currentConstruct=void 0,i}}const IC={resolveAll:Dv()},HC=Mv("string"),qC=Mv("text");function Mv(e){return{resolveAll:Dv(e==="text"?FC:void 0),tokenize:a};function a(i){const l=this,o=this.parser.constructs[e],u=i.attempt(o,d,f);return d;function d(g){return h(g)?u(g):f(g)}function f(g){if(g===null){i.consume(g);return}return i.enter("data"),i.consume(g),p}function p(g){return h(g)?(i.exit("data"),u(g)):(i.consume(g),p)}function h(g){if(g===null)return!0;const b=o[g];let v=-1;if(b)for(;++v<b.length;){const y=b[v];if(!y.previous||y.previous.call(l,l.previous))return!0}return!1}}}function Dv(e){return a;function a(i,l){let o=-1,u;for(;++o<=i.length;)u===void 0?i[o]&&i[o][1].type==="data"&&(u=o,o++):(!i[o]||i[o][1].type!=="data")&&(o!==u+2&&(i[u][1].end=i[o-1][1].end,i.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(i,l):i}}function FC(e,a){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const l=e[i-1][1],o=a.sliceStream(l);let u=o.length,d=-1,f=0,p;for(;u--;){const h=o[u];if(typeof h=="string"){for(d=h.length;h.charCodeAt(d-1)===32;)f++,d--;if(d)break;d=-1}else if(h===-2)p=!0,f++;else if(h!==-1){u++;break}}if(a._contentTypeTextTrailing&&i===e.length&&(f=0),f){const h={type:i===e.length||p||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:l.start._bufferIndex+d,_index:l.start._index+u,line:l.end.line,column:l.end.column-f,offset:l.end.offset-f},end:{...l.end}};l.end={...h.start},l.start.offset===l.end.offset?Object.assign(l,h):(e.splice(i,0,["enter",h,a],["exit",h,a]),i+=2)}i++}return e}const PC={42:yn,43:yn,45:yn,48:yn,49:yn,50:yn,51:yn,52:yn,53:yn,54:yn,55:yn,56:yn,57:yn,62:kv},$C={91:Q3},VC={[-2]:oh,[-1]:oh,32:oh},GC={35:eC,42:Kc,45:[ey,Kc],60:iC,61:ey,95:Kc,96:Kb,126:Kb},YC={38:Sv,92:Nv},QC={[-5]:ch,[-4]:ch,[-3]:ch,33:jC,38:Sv,42:Zh,60:[k3,dC],91:kC,92:[K3,Nv],93:Fm,95:Zh,96:B3},XC={null:[Zh,IC]},JC={null:[42,95]},ZC={null:[]},KC=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:JC,contentInitial:$C,disable:ZC,document:PC,flow:GC,flowInitial:VC,insideSpan:XC,string:YC,text:QC},Symbol.toStringTag,{value:"Module"}));function WC(e,a,i){let l={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const o={},u=[];let d=[],f=[];const p={attempt:H(Y),check:H(A),consume:D,enter:E,exit:L,interrupt:H(A,{interrupt:!0})},h={code:null,containerState:{},defineSkip:z,events:[],now:k,parser:e,previous:null,sliceSerialize:v,sliceStream:y,write:b};let g=a.tokenize.call(h,p);return a.resolveAll&&u.push(a),h;function b(U){return d=Zn(d,U),j(),d[d.length-1]!==null?[]:(ae(a,0),h.events=Mu(u,h.events,h),h.events)}function v(U,$){return tE(y(U),$)}function y(U){return eE(d,U)}function k(){const{_bufferIndex:U,_index:$,line:me,column:V,offset:te}=l;return{_bufferIndex:U,_index:$,line:me,column:V,offset:te}}function z(U){o[U.line]=U.column,O()}function j(){let U;for(;l._index<d.length;){const $=d[l._index];if(typeof $=="string")for(U=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===U&&l._bufferIndex<$.length;)N($.charCodeAt(l._bufferIndex));else N($)}}function N(U){g=g(U)}function D(U){Se(U)?(l.line++,l.column=1,l.offset+=U===-3?2:1,O()):U!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===d[l._index].length&&(l._bufferIndex=-1,l._index++)),h.previous=U}function E(U,$){const me=$||{};return me.type=U,me.start=k(),h.events.push(["enter",me,h]),f.push(me),me}function L(U){const $=f.pop();return $.end=k(),h.events.push(["exit",$,h]),$}function Y(U,$){ae(U,$.from)}function A(U,$){$.restore()}function H(U,$){return me;function me(V,te,B){let X,ce,ue,M;return Array.isArray(V)?P(V):"tokenize"in V?P([V]):R(V);function R(ye){return Z;function Z(de){const Ne=de!==null&&ye[de],it=de!==null&&ye.null,yt=[...Array.isArray(Ne)?Ne:Ne?[Ne]:[],...Array.isArray(it)?it:it?[it]:[]];return P(yt)(de)}}function P(ye){return X=ye,ce=0,ye.length===0?B:T(ye[ce])}function T(ye){return Z;function Z(de){return M=ee(),ue=ye,ye.partial||(h.currentConstruct=ye),ye.name&&h.parser.constructs.disable.null.includes(ye.name)?ge():ye.tokenize.call($?Object.assign(Object.create(h),$):h,p,F,ge)(de)}}function F(ye){return U(ue,M),te}function ge(ye){return M.restore(),++ce<X.length?T(X[ce]):B}}}function ae(U,$){U.resolveAll&&!u.includes(U)&&u.push(U),U.resolve&&_n(h.events,$,h.events.length-$,U.resolve(h.events.slice($),h)),U.resolveTo&&(h.events=U.resolveTo(h.events,h))}function ee(){const U=k(),$=h.previous,me=h.currentConstruct,V=h.events.length,te=Array.from(f);return{from:V,restore:B};function B(){l=U,h.previous=$,h.currentConstruct=me,h.events.length=V,f=te,O()}}function O(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function eE(e,a){const i=a.start._index,l=a.start._bufferIndex,o=a.end._index,u=a.end._bufferIndex;let d;if(i===o)d=[e[i].slice(l,u)];else{if(d=e.slice(i,o),l>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(l):d.shift()}u>0&&d.push(e[o].slice(0,u))}return d}function tE(e,a){let i=-1;const l=[];let o;for(;++i<e.length;){const u=e[i];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
`;break}case-3:{d=`\r
`;break}case-2:{d=a?" ":"	";break}case-1:{if(!a&&o)continue;d=" ";break}default:d=String.fromCharCode(u)}o=u===-2,l.push(d)}return l.join("")}function nE(e){const l={constructs:jv([KC,...(e||{}).extensions||[]]),content:o(g3),defined:[],document:o(y3),flow:o(BC),lazy:{},string:o(HC),text:o(qC)};return l;function o(u){return d;function d(f){return WC(l,u,f)}}}function aE(e){for(;!Cv(e););return e}const ty=/[\0\t\n\r]/g;function iE(){let e=1,a="",i=!0,l;return o;function o(u,d,f){const p=[];let h,g,b,v,y;for(u=a+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),b=0,a="",i&&(u.charCodeAt(0)===65279&&b++,i=void 0);b<u.length;){if(ty.lastIndex=b,h=ty.exec(u),v=h&&h.index!==void 0?h.index:u.length,y=u.charCodeAt(v),!h){a=u.slice(b);break}if(y===10&&b===v&&l)p.push(-3),l=void 0;else switch(l&&(p.push(-5),l=void 0),b<v&&(p.push(u.slice(b,v)),e+=v-b),y){case 0:{p.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,p.push(-2);e++<g;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:l=!0,e=1}b=v+1}return f&&(l&&p.push(-5),a&&p.push(a),p.push(null)),p}}const rE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function lE(e){return e.replace(rE,sE)}function sE(e,a,i){if(a)return a;if(i.charCodeAt(0)===35){const o=i.charCodeAt(1),u=o===120||o===88;return zv(i.slice(u?2:1),u?16:10)}return qm(i)||e}const Ov={}.hasOwnProperty;function oE(e,a,i){return typeof a!="string"&&(i=a,a=void 0),cE(i)(aE(nE(i).document().write(iE()(e,a,!0))))}function cE(e){const a={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(ve),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:u(Un),blockQuote:u(it),characterEscape:ee,characterReference:ee,codeFenced:u(yt),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(yt,d),codeText:u(un,d),codeTextData:ee,data:ee,codeFlowValue:ee,definition:u(Da),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(zn),hardBreakEscape:u(kn),hardBreakTrailing:u(kn),htmlFlow:u(Oa,d),htmlFlowData:ee,htmlText:u(Oa,d),htmlTextData:ee,image:u(xe),label:d,link:u(ve),listItem:u(ze),listItemValue:v,listOrdered:u(Me,b),listUnordered:u(Me),paragraph:u(Be),reference:T,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(Un),strong:u(Ie),thematicBreak:u(Nt)},exit:{atxHeading:p(),atxHeadingSequence:Y,autolink:p(),autolinkEmail:Ne,autolinkProtocol:de,blockQuote:p(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:ye,characterReference:Z,codeFenced:p(j),codeFencedFence:z,codeFencedFenceInfo:y,codeFencedFenceMeta:k,codeFlowValue:O,codeIndented:p(N),codeText:p(te),codeTextData:O,data:O,definition:p(),definitionDestinationString:L,definitionLabelString:D,definitionTitleString:E,emphasis:p(),hardBreakEscape:p($),hardBreakTrailing:p($),htmlFlow:p(me),htmlFlowData:O,htmlText:p(V),htmlTextData:O,image:p(X),label:ue,labelText:ce,lineEnding:U,link:p(B),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:F,resourceDestinationString:M,resourceTitleString:R,resource:P,setextHeading:p(ae),setextHeadingLineSequence:H,setextHeadingText:A,strong:p(),thematicBreak:p()}};Rv(a,(e||{}).mdastExtensions||[]);const i={};return l;function l(K){let fe={type:"root",children:[]};const Ee={stack:[fe],tokenStack:[],config:a,enter:f,exit:h,buffer:d,resume:g,data:i},Ue=[];let Ve=-1;for(;++Ve<K.length;)if(K[Ve][1].type==="listOrdered"||K[Ve][1].type==="listUnordered")if(K[Ve][0]==="enter")Ue.push(Ve);else{const an=Ue.pop();Ve=o(K,an,Ve)}for(Ve=-1;++Ve<K.length;){const an=a[K[Ve][0]];Ov.call(an,K[Ve][1].type)&&an[K[Ve][1].type].call(Object.assign({sliceSerialize:K[Ve][2].sliceSerialize},Ee),K[Ve][1])}if(Ee.tokenStack.length>0){const an=Ee.tokenStack[Ee.tokenStack.length-1];(an[1]||ny).call(Ee,void 0,an[0])}for(fe.position={start:_i(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:_i(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},Ve=-1;++Ve<a.transforms.length;)fe=a.transforms[Ve](fe)||fe;return fe}function o(K,fe,Ee){let Ue=fe-1,Ve=-1,an=!1,In,Ot,ft,Ht;for(;++Ue<=Ee;){const Qe=K[Ue];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?Ve++:Ve--,Ht=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(In&&!Ht&&!Ve&&!ft&&(ft=Ue),Ht=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ht=void 0}if(!Ve&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||Ve===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(In){let ba=Ue;for(Ot=void 0;ba--;){const Nn=K[ba];if(Nn[1].type==="lineEnding"||Nn[1].type==="lineEndingBlank"){if(Nn[0]==="exit")continue;Ot&&(K[Ot][1].type="lineEndingBlank",an=!0),Nn[1].type="lineEnding",Ot=ba}else if(!(Nn[1].type==="linePrefix"||Nn[1].type==="blockQuotePrefix"||Nn[1].type==="blockQuotePrefixWhitespace"||Nn[1].type==="blockQuoteMarker"||Nn[1].type==="listItemIndent"))break}ft&&(!Ot||ft<Ot)&&(In._spread=!0),In.end=Object.assign({},Ot?K[Ot][1].start:Qe[1].end),K.splice(Ot||Ue,0,["exit",In,Qe[2]]),Ue++,Ee++}if(Qe[1].type==="listItemPrefix"){const ba={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};In=ba,K.splice(Ue,0,["enter",ba,Qe[2]]),Ue++,Ee++,ft=void 0,Ht=!0}}}return K[fe][1]._spread=an,Ee}function u(K,fe){return Ee;function Ee(Ue){f.call(this,K(Ue),Ue),fe&&fe.call(this,Ue)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(K,fe,Ee){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([fe,Ee||void 0]),K.position={start:_i(fe.start),end:void 0}}function p(K){return fe;function fe(Ee){K&&K.call(this,Ee),h.call(this,Ee)}}function h(K,fe){const Ee=this.stack.pop(),Ue=this.tokenStack.pop();if(Ue)Ue[0].type!==K.type&&(fe?fe.call(this,K,Ue[0]):(Ue[1]||ny).call(this,K,Ue[0]));else throw new Error("Cannot close `"+K.type+"` ("+eo({start:K.start,end:K.end})+"): it’s not open");Ee.position.end=_i(K.end)}function g(){return Hm(this.stack.pop())}function b(){this.data.expectingFirstListItemValue=!0}function v(K){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function y(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=K}function k(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=K}function z(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.value=K.replace(/(\r?\n|\r)$/g,"")}function D(K){const fe=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=fe,Ee.identifier=da(this.sliceSerialize(K)).toLowerCase()}function E(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.title=K}function L(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.url=K}function Y(K){const fe=this.stack[this.stack.length-1];if(!fe.depth){const Ee=this.sliceSerialize(K).length;fe.depth=Ee}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function H(K){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function ae(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(K){const Ee=this.stack[this.stack.length-1].children;let Ue=Ee[Ee.length-1];(!Ue||Ue.type!=="text")&&(Ue=et(),Ue.position={start:_i(K.start),end:void 0},Ee.push(Ue)),this.stack.push(Ue)}function O(K){const fe=this.stack.pop();fe.value+=this.sliceSerialize(K),fe.position.end=_i(K.end)}function U(K){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ee=fe.children[fe.children.length-1];Ee.position.end=_i(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&a.canContainEols.includes(fe.type)&&(ee.call(this,K),O.call(this,K))}function $(){this.data.atHardBreak=!0}function me(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.value=K}function V(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.value=K}function te(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.value=K}function B(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=fe,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function X(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=fe,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function ce(K){const fe=this.sliceSerialize(K),Ee=this.stack[this.stack.length-2];Ee.label=lE(fe),Ee.identifier=da(fe).toLowerCase()}function ue(){const K=this.stack[this.stack.length-1],fe=this.resume(),Ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ee.type==="link"){const Ue=K.children;Ee.children=Ue}else Ee.alt=fe}function M(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.url=K}function R(){const K=this.resume(),fe=this.stack[this.stack.length-1];fe.title=K}function P(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function F(K){const fe=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=fe,Ee.identifier=da(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function ge(K){this.data.characterReferenceType=K.type}function ye(K){const fe=this.sliceSerialize(K),Ee=this.data.characterReferenceType;let Ue;Ee?(Ue=zv(fe,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ue=qm(fe);const Ve=this.stack[this.stack.length-1];Ve.value+=Ue}function Z(K){const fe=this.stack.pop();fe.position.end=_i(K.end)}function de(K){O.call(this,K);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(K)}function Ne(K){O.call(this,K);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(K)}function it(){return{type:"blockquote",children:[]}}function yt(){return{type:"code",lang:null,meta:null,value:""}}function un(){return{type:"inlineCode",value:""}}function Da(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function zn(){return{type:"emphasis",children:[]}}function Un(){return{type:"heading",depth:0,children:[]}}function kn(){return{type:"break"}}function Oa(){return{type:"html",value:""}}function xe(){return{type:"image",title:null,url:"",alt:null}}function ve(){return{type:"link",title:null,url:"",children:[]}}function Me(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function ze(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Be(){return{type:"paragraph",children:[]}}function Ie(){return{type:"strong",children:[]}}function et(){return{type:"text",value:""}}function Nt(){return{type:"thematicBreak"}}}function _i(e){return{line:e.line,column:e.column,offset:e.offset}}function Rv(e,a){let i=-1;for(;++i<a.length;){const l=a[i];Array.isArray(l)?Rv(e,l):uE(e,l)}}function uE(e,a){let i;for(i in a)if(Ov.call(a,i))switch(i){case"canContainEols":{const l=a[i];l&&e[i].push(...l);break}case"transforms":{const l=a[i];l&&e[i].push(...l);break}case"enter":case"exit":{const l=a[i];l&&Object.assign(e[i],l);break}}}function ny(e,a){throw e?new Error("Cannot close `"+e.type+"` ("+eo({start:e.start,end:e.end})+"): a different token (`"+a.type+"`, "+eo({start:a.start,end:a.end})+") is open"):new Error("Cannot close document, a token (`"+a.type+"`, "+eo({start:a.start,end:a.end})+") is still open")}function dE(e){const a=this;a.parser=i;function i(l){return oE(l,{...a.data("settings"),...e,extensions:a.data("micromarkExtensions")||[],mdastExtensions:a.data("fromMarkdownExtensions")||[]})}}function fE(e,a){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(a),!0)};return e.patch(a,i),e.applyData(a,i)}function hE(e,a){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(a,i),[e.applyData(a,i),{type:"text",value:`
`}]}function mE(e,a){const i=a.value?a.value+`
`:"",l={},o=a.lang?a.lang.split(/\s+/):[];o.length>0&&(l.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:l,children:[{type:"text",value:i}]};return a.meta&&(u.data={meta:a.meta}),e.patch(a,u),u=e.applyData(a,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(a,u),u}function pE(e,a){const i={type:"element",tagName:"del",properties:{},children:e.all(a)};return e.patch(a,i),e.applyData(a,i)}function xE(e,a){const i={type:"element",tagName:"em",properties:{},children:e.all(a)};return e.patch(a,i),e.applyData(a,i)}function gE(e,a){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(a.identifier).toUpperCase(),o=Ql(l.toLowerCase()),u=e.footnoteOrder.indexOf(l);let d,f=e.footnoteCounts.get(l);f===void 0?(f=0,e.footnoteOrder.push(l),d=e.footnoteOrder.length):d=u+1,f+=1,e.footnoteCounts.set(l,f);const p={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+o,id:i+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(a,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(a,h),e.applyData(a,h)}function bE(e,a){const i={type:"element",tagName:"h"+a.depth,properties:{},children:e.all(a)};return e.patch(a,i),e.applyData(a,i)}function yE(e,a){if(e.options.allowDangerousHtml){const i={type:"raw",value:a.value};return e.patch(a,i),e.applyData(a,i)}}function _v(e,a){const i=a.referenceType;let l="]";if(i==="collapsed"?l+="[]":i==="full"&&(l+="["+(a.label||a.identifier)+"]"),a.type==="imageReference")return[{type:"text",value:"!["+a.alt+l}];const o=e.all(a),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=l:o.push({type:"text",value:l}),o}function vE(e,a){const i=String(a.identifier).toUpperCase(),l=e.definitionById.get(i);if(!l)return _v(e,a);const o={src:Ql(l.url||""),alt:a.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const u={type:"element",tagName:"img",properties:o,children:[]};return e.patch(a,u),e.applyData(a,u)}function wE(e,a){const i={src:Ql(a.url)};a.alt!==null&&a.alt!==void 0&&(i.alt=a.alt),a.title!==null&&a.title!==void 0&&(i.title=a.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(a,l),e.applyData(a,l)}function jE(e,a){const i={type:"text",value:a.value.replace(/\r?\n|\r/g," ")};e.patch(a,i);const l={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(a,l),e.applyData(a,l)}function zE(e,a){const i=String(a.identifier).toUpperCase(),l=e.definitionById.get(i);if(!l)return _v(e,a);const o={href:Ql(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const u={type:"element",tagName:"a",properties:o,children:e.all(a)};return e.patch(a,u),e.applyData(a,u)}function kE(e,a){const i={href:Ql(a.url)};a.title!==null&&a.title!==void 0&&(i.title=a.title);const l={type:"element",tagName:"a",properties:i,children:e.all(a)};return e.patch(a,l),e.applyData(a,l)}function NE(e,a,i){const l=e.all(a),o=i?SE(i):Lv(a),u={},d=[];if(typeof a.checked=="boolean"){const g=l[0];let b;g&&g.type==="element"&&g.tagName==="p"?b=g:(b={type:"element",tagName:"p",properties:{},children:[]},l.unshift(b)),b.children.length>0&&b.children.unshift({type:"text",value:" "}),b.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:a.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<l.length;){const g=l[f];(o||f!==0||g.type!=="element"||g.tagName!=="p")&&d.push({type:"text",value:`
`}),g.type==="element"&&g.tagName==="p"&&!o?d.push(...g.children):d.push(g)}const p=l[l.length-1];p&&(o||p.type!=="element"||p.tagName!=="p")&&d.push({type:"text",value:`
`});const h={type:"element",tagName:"li",properties:u,children:d};return e.patch(a,h),e.applyData(a,h)}function SE(e){let a=!1;if(e.type==="list"){a=e.spread||!1;const i=e.children;let l=-1;for(;!a&&++l<i.length;)a=Lv(i[l])}return a}function Lv(e){const a=e.spread;return a??e.children.length>1}function CE(e,a){const i={},l=e.all(a);let o=-1;for(typeof a.start=="number"&&a.start!==1&&(i.start=a.start);++o<l.length;){const d=l[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const u={type:"element",tagName:a.ordered?"ol":"ul",properties:i,children:e.wrap(l,!0)};return e.patch(a,u),e.applyData(a,u)}function EE(e,a){const i={type:"element",tagName:"p",properties:{},children:e.all(a)};return e.patch(a,i),e.applyData(a,i)}function TE(e,a){const i={type:"root",children:e.wrap(e.all(a))};return e.patch(a,i),e.applyData(a,i)}function AE(e,a){const i={type:"element",tagName:"strong",properties:{},children:e.all(a)};return e.patch(a,i),e.applyData(a,i)}function ME(e,a){const i=e.all(a),l=i.shift(),o=[];if(l){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([l],!0)};e.patch(a.children[0],d),o.push(d)}if(i.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},f=Lm(a.children[1]),p=pv(a.children[a.children.length-1]);f&&p&&(d.position={start:f,end:p}),o.push(d)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(a,u),e.applyData(a,u)}function DE(e,a,i){const l=i?i.children:void 0,u=(l?l.indexOf(a):1)===0?"th":"td",d=i&&i.type==="table"?i.align:void 0,f=d?d.length:a.children.length;let p=-1;const h=[];for(;++p<f;){const b=a.children[p],v={},y=d?d[p]:void 0;y&&(v.align=y);let k={type:"element",tagName:u,properties:v,children:[]};b&&(k.children=e.all(b),e.patch(b,k),k=e.applyData(b,k)),h.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(a,g),e.applyData(a,g)}function OE(e,a){const i={type:"element",tagName:"td",properties:{},children:e.all(a)};return e.patch(a,i),e.applyData(a,i)}const ay=9,iy=32;function RE(e){const a=String(e),i=/\r?\n|\r/g;let l=i.exec(a),o=0;const u=[];for(;l;)u.push(ry(a.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=i.exec(a);return u.push(ry(a.slice(o),o>0,!1)),u.join("")}function ry(e,a,i){let l=0,o=e.length;if(a){let u=e.codePointAt(l);for(;u===ay||u===iy;)l++,u=e.codePointAt(l)}if(i){let u=e.codePointAt(o-1);for(;u===ay||u===iy;)o--,u=e.codePointAt(o-1)}return o>l?e.slice(l,o):""}function _E(e,a){const i={type:"text",value:RE(String(a.value))};return e.patch(a,i),e.applyData(a,i)}function LE(e,a){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(a,i),e.applyData(a,i)}const BE={blockquote:fE,break:hE,code:mE,delete:pE,emphasis:xE,footnoteReference:gE,heading:bE,html:yE,imageReference:vE,image:wE,inlineCode:jE,linkReference:zE,link:kE,listItem:NE,list:CE,paragraph:EE,root:TE,strong:AE,table:ME,tableCell:OE,tableRow:DE,text:_E,thematicBreak:LE,toml:qc,yaml:qc,definition:qc,footnoteDefinition:qc};function qc(){}const Bv=-1,Du=0,no=1,cu=2,Pm=3,$m=4,Vm=5,Gm=6,Uv=7,Iv=8,ly=typeof self=="object"?self:globalThis,UE=(e,a)=>{const i=(o,u)=>(e.set(u,o),o),l=o=>{if(e.has(o))return e.get(o);const[u,d]=a[o];switch(u){case Du:case Bv:return i(d,o);case no:{const f=i([],o);for(const p of d)f.push(l(p));return f}case cu:{const f=i({},o);for(const[p,h]of d)f[l(p)]=l(h);return f}case Pm:return i(new Date(d),o);case $m:{const{source:f,flags:p}=d;return i(new RegExp(f,p),o)}case Vm:{const f=i(new Map,o);for(const[p,h]of d)f.set(l(p),l(h));return f}case Gm:{const f=i(new Set,o);for(const p of d)f.add(l(p));return f}case Uv:{const{name:f,message:p}=d;return i(new ly[f](p),o)}case Iv:return i(BigInt(d),o);case"BigInt":return i(Object(BigInt(d)),o);case"ArrayBuffer":return i(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:f}=new Uint8Array(d);return i(new DataView(f),d)}}return i(new ly[u](d),o)};return l},sy=e=>UE(new Map,e)(0),xl="",{toString:IE}={},{keys:HE}=Object,Js=e=>{const a=typeof e;if(a!=="object"||!e)return[Du,a];const i=IE.call(e).slice(8,-1);switch(i){case"Array":return[no,xl];case"Object":return[cu,xl];case"Date":return[Pm,xl];case"RegExp":return[$m,xl];case"Map":return[Vm,xl];case"Set":return[Gm,xl];case"DataView":return[no,i]}return i.includes("Array")?[no,i]:i.includes("Error")?[Uv,i]:[cu,i]},Fc=([e,a])=>e===Du&&(a==="function"||a==="symbol"),qE=(e,a,i,l)=>{const o=(d,f)=>{const p=l.push(d)-1;return i.set(f,p),p},u=d=>{if(i.has(d))return i.get(d);let[f,p]=Js(d);switch(f){case Du:{let g=d;switch(p){case"bigint":f=Iv,g=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return o([Bv],d)}return o([f,g],d)}case no:{if(p){let v=d;return p==="DataView"?v=new Uint8Array(d.buffer):p==="ArrayBuffer"&&(v=new Uint8Array(d)),o([p,[...v]],d)}const g=[],b=o([f,g],d);for(const v of d)g.push(u(v));return b}case cu:{if(p)switch(p){case"BigInt":return o([p,d.toString()],d);case"Boolean":case"Number":case"String":return o([p,d.valueOf()],d)}if(a&&"toJSON"in d)return u(d.toJSON());const g=[],b=o([f,g],d);for(const v of HE(d))(e||!Fc(Js(d[v])))&&g.push([u(v),u(d[v])]);return b}case Pm:return o([f,d.toISOString()],d);case $m:{const{source:g,flags:b}=d;return o([f,{source:g,flags:b}],d)}case Vm:{const g=[],b=o([f,g],d);for(const[v,y]of d)(e||!(Fc(Js(v))||Fc(Js(y))))&&g.push([u(v),u(y)]);return b}case Gm:{const g=[],b=o([f,g],d);for(const v of d)(e||!Fc(Js(v)))&&g.push(u(v));return b}}const{message:h}=d;return o([f,{name:p,message:h}],d)};return u},oy=(e,{json:a,lossy:i}={})=>{const l=[];return qE(!(a||i),!!a,new Map,l)(e),l},uu=typeof structuredClone=="function"?(e,a)=>a&&("json"in a||"lossy"in a)?sy(oy(e,a)):structuredClone(e):(e,a)=>sy(oy(e,a));function FE(e,a){const i=[{type:"text",value:"↩"}];return a>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(a)}]}),i}function PE(e,a){return"Back to reference "+(e+1)+(a>1?"-"+a:"")}function $E(e){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||FE,l=e.options.footnoteBackLabel||PE,o=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let p=-1;for(;++p<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[p]);if(!h)continue;const g=e.all(h),b=String(h.identifier).toUpperCase(),v=Ql(b.toLowerCase());let y=0;const k=[],z=e.footnoteCounts.get(b);for(;z!==void 0&&++y<=z;){k.length>0&&k.push({type:"text",value:" "});let D=typeof i=="string"?i:i(p,y);typeof D=="string"&&(D={type:"text",value:D}),k.push({type:"element",tagName:"a",properties:{href:"#"+a+"fnref-"+v+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(p,y),className:["data-footnote-backref"]},children:Array.isArray(D)?D:[D]})}const j=g[g.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const D=j.children[j.children.length-1];D&&D.type==="text"?D.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...k)}else g.push(...k);const N={type:"element",tagName:"li",properties:{id:a+"fn-"+v},children:e.wrap(g,!0)};e.patch(h,N),f.push(N)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...uu(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
`}]}}const Ou=(function(e){if(e==null)return QE;if(typeof e=="function")return Ru(e);if(typeof e=="object")return Array.isArray(e)?VE(e):GE(e);if(typeof e=="string")return YE(e);throw new Error("Expected function, string, or object as test")});function VE(e){const a=[];let i=-1;for(;++i<e.length;)a[i]=Ou(e[i]);return Ru(l);function l(...o){let u=-1;for(;++u<a.length;)if(a[u].apply(this,o))return!0;return!1}}function GE(e){const a=e;return Ru(i);function i(l){const o=l;let u;for(u in e)if(o[u]!==a[u])return!1;return!0}}function YE(e){return Ru(a);function a(i){return i&&i.type===e}}function Ru(e){return a;function a(i,l,o){return!!(XE(i)&&e.call(this,i,typeof l=="number"?l:void 0,o||void 0))}}function QE(){return!0}function XE(e){return e!==null&&typeof e=="object"&&"type"in e}const Hv=[],JE=!0,Kh=!1,ZE="skip";function qv(e,a,i,l){let o;typeof a=="function"&&typeof i!="function"?(l=i,i=a):o=a;const u=Ou(o),d=l?-1:1;f(e,void 0,[])();function f(p,h,g){const b=p&&typeof p=="object"?p:{};if(typeof b.type=="string"){const y=typeof b.tagName=="string"?b.tagName:typeof b.name=="string"?b.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(p.type+(y?"<"+y+">":""))+")"})}return v;function v(){let y=Hv,k,z,j;if((!a||u(p,h,g[g.length-1]||void 0))&&(y=KE(i(p,g)),y[0]===Kh))return y;if("children"in p&&p.children){const N=p;if(N.children&&y[0]!==ZE)for(z=(l?N.children.length:-1)+d,j=g.concat(N);z>-1&&z<N.children.length;){const D=N.children[z];if(k=f(D,z,j)(),k[0]===Kh)return k;z=typeof k[1]=="number"?k[1]:z+d}}return y}}}function KE(e){return Array.isArray(e)?e:typeof e=="number"?[JE,e]:e==null?Hv:[e]}function Ym(e,a,i,l){let o,u,d;typeof a=="function"&&typeof i!="function"?(u=void 0,d=a,o=i):(u=a,d=i,o=l),qv(e,u,f,o);function f(p,h){const g=h[h.length-1],b=g?g.children.indexOf(p):void 0;return d(p,b,g)}}const Wh={}.hasOwnProperty,WE={};function eT(e,a){const i=a||WE,l=new Map,o=new Map,u=new Map,d={...BE,...i.handlers},f={all:h,applyData:nT,definitionById:l,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:d,one:p,options:i,patch:tT,wrap:iT};return Ym(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const b=g.type==="definition"?l:o,v=String(g.identifier).toUpperCase();b.has(v)||b.set(v,g)}}),f;function p(g,b){const v=g.type,y=f.handlers[v];if(Wh.call(f.handlers,v)&&y)return y(f,g,b);if(f.options.passThrough&&f.options.passThrough.includes(v)){if("children"in g){const{children:z,...j}=g,N=uu(j);return N.children=f.all(g),N}return uu(g)}return(f.options.unknownHandler||aT)(f,g,b)}function h(g){const b=[];if("children"in g){const v=g.children;let y=-1;for(;++y<v.length;){const k=f.one(v[y],g);if(k){if(y&&v[y-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=cy(k.value)),!Array.isArray(k)&&k.type==="element")){const z=k.children[0];z&&z.type==="text"&&(z.value=cy(z.value))}Array.isArray(k)?b.push(...k):b.push(k)}}}return b}}function tT(e,a){e.position&&(a.position=P5(e))}function nT(e,a){let i=a;if(e&&e.data){const l=e.data.hName,o=e.data.hChildren,u=e.data.hProperties;if(typeof l=="string")if(i.type==="element")i.tagName=l;else{const d="children"in i?i.children:[i];i={type:"element",tagName:l,properties:{},children:d}}i.type==="element"&&u&&Object.assign(i.properties,uu(u)),"children"in i&&i.children&&o!==null&&o!==void 0&&(i.children=o)}return i}function aT(e,a){const i=a.data||{},l="value"in a&&!(Wh.call(i,"hProperties")||Wh.call(i,"hChildren"))?{type:"text",value:a.value}:{type:"element",tagName:"div",properties:{},children:e.all(a)};return e.patch(a,l),e.applyData(a,l)}function iT(e,a){const i=[];let l=-1;for(a&&i.push({type:"text",value:`
`});++l<e.length;)l&&i.push({type:"text",value:`
`}),i.push(e[l]);return a&&e.length>0&&i.push({type:"text",value:`
`}),i}function cy(e){let a=0,i=e.charCodeAt(a);for(;i===9||i===32;)a++,i=e.charCodeAt(a);return e.slice(a)}function uy(e,a){const i=eT(e,a),l=i.one(e,void 0),o=$E(i),u=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
`},o),u}function rT(e,a){return e&&"run"in e?async function(i,l){const o=uy(i,{file:l,...a});await e.run(o,l)}:function(i,l){return uy(i,{file:l,...e||a})}}function dy(e){if(e)throw e}var uh,fy;function lT(){if(fy)return uh;fy=1;var e=Object.prototype.hasOwnProperty,a=Object.prototype.toString,i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):a.call(h)==="[object Array]"},u=function(h){if(!h||a.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),b=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!b)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},d=function(h,g){i&&g.name==="__proto__"?i(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(l)return l(h,g).value}else return;return h[g]};return uh=function p(){var h,g,b,v,y,k,z=arguments[0],j=1,N=arguments.length,D=!1;for(typeof z=="boolean"&&(D=z,z=arguments[1]||{},j=2),(z==null||typeof z!="object"&&typeof z!="function")&&(z={});j<N;++j)if(h=arguments[j],h!=null)for(g in h)b=f(z,g),v=f(h,g),z!==v&&(D&&v&&(u(v)||(y=o(v)))?(y?(y=!1,k=b&&o(b)?b:[]):k=b&&u(b)?b:{},d(z,{name:g,newValue:p(D,k,v)})):typeof v<"u"&&d(z,{name:g,newValue:v}));return z},uh}var sT=lT();const dh=hu(sT);function em(e){if(typeof e!="object"||e===null)return!1;const a=Object.getPrototypeOf(e);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function oT(){const e=[],a={run:i,use:l};return a;function i(...o){let u=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);f(null,...o);function f(p,...h){const g=e[++u];let b=-1;if(p){d(p);return}for(;++b<o.length;)(h[b]===null||h[b]===void 0)&&(h[b]=o[b]);o=h,g?cT(g,f)(...h):d(null,...h)}}function l(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),a}}function cT(e,a){let i;return l;function l(...d){const f=e.length>d.length;let p;f&&d.push(o);try{p=e.apply(this,d)}catch(h){const g=h;if(f&&i)throw g;return o(g)}f||(p&&p.then&&typeof p.then=="function"?p.then(u,o):p instanceof Error?o(p):u(p))}function o(d,...f){i||(i=!0,a(d,...f))}function u(d){o(null,d)}}const Na={basename:uT,dirname:dT,extname:fT,join:hT,sep:"/"};function uT(e,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');wo(e);let i=0,l=-1,o=e.length,u;if(a===void 0||a.length===0||a.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){i=o+1;break}}else l<0&&(u=!0,l=o+1);return l<0?"":e.slice(i,l)}if(a===e)return"";let d=-1,f=a.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){i=o+1;break}}else d<0&&(u=!0,d=o+1),f>-1&&(e.codePointAt(o)===a.codePointAt(f--)?f<0&&(l=o):(f=-1,l=d));return i===l?l=d:l<0&&(l=e.length),e.slice(i,l)}function dT(e){if(wo(e),e.length===0)return".";let a=-1,i=e.length,l;for(;--i;)if(e.codePointAt(i)===47){if(l){a=i;break}}else l||(l=!0);return a<0?e.codePointAt(0)===47?"/":".":a===1&&e.codePointAt(0)===47?"//":e.slice(0,a)}function fT(e){wo(e);let a=e.length,i=-1,l=0,o=-1,u=0,d;for(;a--;){const f=e.codePointAt(a);if(f===47){if(d){l=a+1;break}continue}i<0&&(d=!0,i=a+1),f===46?o<0?o=a:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||i<0||u===0||u===1&&o===i-1&&o===l+1?"":e.slice(o,i)}function hT(...e){let a=-1,i;for(;++a<e.length;)wo(e[a]),e[a]&&(i=i===void 0?e[a]:i+"/"+e[a]);return i===void 0?".":mT(i)}function mT(e){wo(e);const a=e.codePointAt(0)===47;let i=pT(e,!a);return i.length===0&&!a&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),a?"/"+i:i}function pT(e,a){let i="",l=0,o=-1,u=0,d=-1,f,p;for(;++d<=e.length;){if(d<e.length)f=e.codePointAt(d);else{if(f===47)break;f=47}if(f===47){if(!(o===d-1||u===1))if(o!==d-1&&u===2){if(i.length<2||l!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(p=i.lastIndexOf("/"),p!==i.length-1){p<0?(i="",l=0):(i=i.slice(0,p),l=i.length-1-i.lastIndexOf("/")),o=d,u=0;continue}}else if(i.length>0){i="",l=0,o=d,u=0;continue}}a&&(i=i.length>0?i+"/..":"..",l=2)}else i.length>0?i+="/"+e.slice(o+1,d):i=e.slice(o+1,d),l=d-o-1;o=d,u=0}else f===46&&u>-1?u++:u=-1}return i}function wo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const xT={cwd:gT};function gT(){return"/"}function tm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function bT(e){if(typeof e=="string")e=new URL(e);else if(!tm(e)){const a=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw a.code="ERR_INVALID_ARG_TYPE",a}if(e.protocol!=="file:"){const a=new TypeError("The URL must be of scheme file");throw a.code="ERR_INVALID_URL_SCHEME",a}return yT(e)}function yT(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const a=e.pathname;let i=-1;for(;++i<a.length;)if(a.codePointAt(i)===37&&a.codePointAt(i+1)===50){const l=a.codePointAt(i+2);if(l===70||l===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(a)}const fh=["history","path","basename","stem","extname","dirname"];class Fv{constructor(a){let i;a?tm(a)?i={path:a}:typeof a=="string"||vT(a)?i={value:a}:i=a:i={},this.cwd="cwd"in i?"":xT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<fh.length;){const u=fh[l];u in i&&i[u]!==void 0&&i[u]!==null&&(this[u]=u==="history"?[...i[u]]:i[u])}let o;for(o in i)fh.includes(o)||(this[o]=i[o])}get basename(){return typeof this.path=="string"?Na.basename(this.path):void 0}set basename(a){mh(a,"basename"),hh(a,"basename"),this.path=Na.join(this.dirname||"",a)}get dirname(){return typeof this.path=="string"?Na.dirname(this.path):void 0}set dirname(a){hy(this.basename,"dirname"),this.path=Na.join(a||"",this.basename)}get extname(){return typeof this.path=="string"?Na.extname(this.path):void 0}set extname(a){if(hh(a,"extname"),hy(this.dirname,"extname"),a){if(a.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(a.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Na.join(this.dirname,this.stem+(a||""))}get path(){return this.history[this.history.length-1]}set path(a){tm(a)&&(a=bT(a)),mh(a,"path"),this.path!==a&&this.history.push(a)}get stem(){return typeof this.path=="string"?Na.basename(this.path,this.extname):void 0}set stem(a){mh(a,"stem"),hh(a,"stem"),this.path=Na.join(this.dirname||"",a+(this.extname||""))}fail(a,i,l){const o=this.message(a,i,l);throw o.fatal=!0,o}info(a,i,l){const o=this.message(a,i,l);return o.fatal=void 0,o}message(a,i,l){const o=new nn(a,i,l);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(a){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(a||void 0).decode(this.value)}}function hh(e,a){if(e&&e.includes(Na.sep))throw new Error("`"+a+"` cannot be a path: did not expect `"+Na.sep+"`")}function mh(e,a){if(!e)throw new Error("`"+a+"` cannot be empty")}function hy(e,a){if(!e)throw new Error("Setting `"+a+"` requires `path` to be set too")}function vT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const wT=(function(e){const l=this.constructor.prototype,o=l[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,l),u}),jT={}.hasOwnProperty;class Qm extends wT{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=oT()}copy(){const a=new Qm;let i=-1;for(;++i<this.attachers.length;){const l=this.attachers[i];a.use(...l)}return a.data(dh(!0,{},this.namespace)),a}data(a,i){return typeof a=="string"?arguments.length===2?(gh("data",this.frozen),this.namespace[a]=i,this):jT.call(this.namespace,a)&&this.namespace[a]||void 0:a?(gh("data",this.frozen),this.namespace=a,this):this.namespace}freeze(){if(this.frozen)return this;const a=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const o=i.call(a,...l);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(a){this.freeze();const i=Pc(a),l=this.parser||this.Parser;return ph("parse",l),l(String(i),i)}process(a,i){const l=this;return this.freeze(),ph("process",this.parser||this.Parser),xh("process",this.compiler||this.Compiler),i?o(void 0,i):new Promise(o);function o(u,d){const f=Pc(a),p=l.parse(f);l.run(p,f,function(g,b,v){if(g||!b||!v)return h(g);const y=b,k=l.stringify(y,v);NT(k)?v.value=k:v.result=k,h(g,v)});function h(g,b){g||!b?d(g):u?u(b):i(void 0,b)}}}processSync(a){let i=!1,l;return this.freeze(),ph("processSync",this.parser||this.Parser),xh("processSync",this.compiler||this.Compiler),this.process(a,o),py("processSync","process",i),l;function o(u,d){i=!0,dy(u),l=d}}run(a,i,l){my(a),this.freeze();const o=this.transformers;return!l&&typeof i=="function"&&(l=i,i=void 0),l?u(void 0,l):new Promise(u);function u(d,f){const p=Pc(i);o.run(a,p,h);function h(g,b,v){const y=b||a;g?f(g):d?d(y):l(void 0,y,v)}}}runSync(a,i){let l=!1,o;return this.run(a,i,u),py("runSync","run",l),o;function u(d,f){dy(d),o=f,l=!0}}stringify(a,i){this.freeze();const l=Pc(i),o=this.compiler||this.Compiler;return xh("stringify",o),my(a),o(a,l)}use(a,...i){const l=this.attachers,o=this.namespace;if(gh("use",this.frozen),a!=null)if(typeof a=="function")p(a,i);else if(typeof a=="object")Array.isArray(a)?f(a):d(a);else throw new TypeError("Expected usable value, not `"+a+"`");return this;function u(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...b]=h;p(g,b)}else d(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function d(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&&(o.settings=dh(!0,o.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const b=h[g];u(b)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let b=-1,v=-1;for(;++b<l.length;)if(l[b][0]===h){v=b;break}if(v===-1)l.push([h,...g]);else if(g.length>0){let[y,...k]=g;const z=l[v][1];em(z)&&em(y)&&(y=dh(!0,z,y)),l[v]=[h,y,...k]}}}}const zT=new Qm().freeze();function ph(e,a){if(typeof a!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function xh(e,a){if(typeof a!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function gh(e,a){if(a)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function my(e){if(!em(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function py(e,a,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+a+"` instead")}function Pc(e){return kT(e)?e:new Fv(e)}function kT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function NT(e){return typeof e=="string"||ST(e)}function ST(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const CT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",xy=[],gy={allowDangerousHtml:!0},ET=/^(https?|ircs?|mailto|xmpp)$/i,TT=[{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 AT(e){const a=MT(e),i=DT(e);return OT(a.runSync(a.parse(i),i),e)}function MT(e){const a=e.rehypePlugins||xy,i=e.remarkPlugins||xy,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...gy}:gy;return zT().use(dE).use(i).use(rT,l).use(a)}function DT(e){const a=e.children||"",i=new Fv;return typeof a=="string"&&(i.value=a),i}function OT(e,a){const i=a.allowedElements,l=a.allowElement,o=a.components,u=a.disallowedElements,d=a.skipHtml,f=a.unwrapDisallowed,p=a.urlTransform||RT;for(const g of TT)Object.hasOwn(a,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+CT+g.id,void 0);return Ym(e,h),Q5(e,{Fragment:r.Fragment,components:o,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function h(g,b,v){if(g.type==="raw"&&v&&typeof b=="number")return d?v.children.splice(b,1):v.children[b]={type:"text",value:g.value},b;if(g.type==="element"){let y;for(y in sh)if(Object.hasOwn(sh,y)&&Object.hasOwn(g.properties,y)){const k=g.properties[y],z=sh[y];(z===null||z.includes(g.tagName))&&(g.properties[y]=p(String(k||""),y,g))}}if(g.type==="element"){let y=i?!i.includes(g.tagName):u?u.includes(g.tagName):!1;if(!y&&l&&typeof b=="number"&&(y=!l(g,b,v)),y&&v&&typeof b=="number")return f&&g.children?v.children.splice(b,1,...g.children):v.children.splice(b,1),b}}}function RT(e){const a=e.indexOf(":"),i=e.indexOf("?"),l=e.indexOf("#"),o=e.indexOf("/");return a===-1||o!==-1&&a>o||i!==-1&&a>i||l!==-1&&a>l||ET.test(e.slice(0,a))?e:""}function by(e,a){const i=String(e);if(typeof a!="string")throw new TypeError("Expected character");let l=0,o=i.indexOf(a);for(;o!==-1;)l++,o=i.indexOf(a,o+a.length);return l}function _T(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function LT(e,a,i){const o=Ou((i||{}).ignore||[]),u=BT(a);let d=-1;for(;++d<u.length;)qv(e,"text",f);function f(h,g){let b=-1,v;for(;++b<g.length;){const y=g[b],k=v?v.children:void 0;if(o(y,k?k.indexOf(y):void 0,v))return;v=y}if(v)return p(h,g)}function p(h,g){const b=g[g.length-1],v=u[d][0],y=u[d][1];let k=0;const j=b.children.indexOf(h);let N=!1,D=[];v.lastIndex=0;let E=v.exec(h.value);for(;E;){const L=E.index,Y={index:E.index,input:E.input,stack:[...g,h]};let A=y(...E,Y);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?v.lastIndex=L+1:(k!==L&&D.push({type:"text",value:h.value.slice(k,L)}),Array.isArray(A)?D.push(...A):A&&D.push(A),k=L+E[0].length,N=!0),!v.global)break;E=v.exec(h.value)}return N?(k<h.value.length&&D.push({type:"text",value:h.value.slice(k)}),b.children.splice(j,1,...D)):D=[h],j+D.length}}function BT(e){const a=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let l=-1;for(;++l<i.length;){const o=i[l];a.push([UT(o[0]),IT(o[1])])}return a}function UT(e){return typeof e=="string"?new RegExp(_T(e),"g"):e}function IT(e){return typeof e=="function"?e:function(){return e}}const bh="phrasing",yh=["autolink","link","image","label"];function HT(){return{transforms:[YT],enter:{literalAutolink:FT,literalAutolinkEmail:vh,literalAutolinkHttp:vh,literalAutolinkWww:vh},exit:{literalAutolink:GT,literalAutolinkEmail:VT,literalAutolinkHttp:PT,literalAutolinkWww:$T}}}function qT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:bh,notInConstruct:yh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:bh,notInConstruct:yh},{character:":",before:"[ps]",after:"\\/",inConstruct:bh,notInConstruct:yh}]}}function FT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function vh(e){this.config.enter.autolinkProtocol.call(this,e)}function PT(e){this.config.exit.autolinkProtocol.call(this,e)}function $T(e){this.config.exit.data.call(this,e);const a=this.stack[this.stack.length-1];a.type,a.url="http://"+this.sliceSerialize(e)}function VT(e){this.config.exit.autolinkEmail.call(this,e)}function GT(e){this.exit(e)}function YT(e){LT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,QT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),XT]],{ignore:["link","linkReference"]})}function QT(e,a,i,l,o){let u="";if(!Pv(o)||(/^w/i.test(a)&&(i=a+i,a="",u="http://"),!JT(i)))return!1;const d=ZT(i+l);if(!d[0])return!1;const f={type:"link",title:null,url:u+a+d[0],children:[{type:"text",value:a+d[0]}]};return d[1]?[f,{type:"text",value:d[1]}]:f}function XT(e,a,i,l){return!Pv(l,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+a+"@"+i,children:[{type:"text",value:a+"@"+i}]}}function JT(e){const a=e.split(".");return!(a.length<2||a[a.length-1]&&(/_/.test(a[a.length-1])||!/[a-zA-Z\d]/.test(a[a.length-1]))||a[a.length-2]&&(/_/.test(a[a.length-2])||!/[a-zA-Z\d]/.test(a[a.length-2])))}function ZT(e){const a=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!a)return[e,void 0];e=e.slice(0,a.index);let i=a[0],l=i.indexOf(")");const o=by(e,"(");let u=by(e,")");for(;l!==-1&&o>u;)e+=i.slice(0,l+1),i=i.slice(l+1),l=i.indexOf(")"),u++;return[e,i]}function Pv(e,a){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Sr(i)||Au(i))&&(!a||i!==47)}$v.peek=l6;function KT(){this.buffer()}function WT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function e6(){this.buffer()}function t6(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function n6(e){const a=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=da(this.sliceSerialize(e)).toLowerCase(),i.label=a}function a6(e){this.exit(e)}function i6(e){const a=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=da(this.sliceSerialize(e)).toLowerCase(),i.label=a}function r6(e){this.exit(e)}function l6(){return"["}function $v(e,a,i,l){const o=i.createTracker(l);let u=o.move("[^");const d=i.enter("footnoteReference"),f=i.enter("reference");return u+=o.move(i.safe(i.associationId(e),{after:"]",before:u})),f(),d(),u+=o.move("]"),u}function s6(){return{enter:{gfmFootnoteCallString:KT,gfmFootnoteCall:WT,gfmFootnoteDefinitionLabelString:e6,gfmFootnoteDefinition:t6},exit:{gfmFootnoteCallString:n6,gfmFootnoteCall:a6,gfmFootnoteDefinitionLabelString:i6,gfmFootnoteDefinition:r6}}}function o6(e){let a=!1;return e&&e.firstLineBlank&&(a=!0),{handlers:{footnoteDefinition:i,footnoteReference:$v},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(l,o,u,d){const f=u.createTracker(d);let p=f.move("[^");const h=u.enter("footnoteDefinition"),g=u.enter("label");return p+=f.move(u.safe(u.associationId(l),{before:p,after:"]"})),g(),p+=f.move("]:"),l.children&&l.children.length>0&&(f.shift(4),p+=f.move((a?`
`:" ")+u.indentLines(u.containerFlow(l,f.current()),a?Vv:c6))),h(),p}}function c6(e,a,i){return a===0?e:Vv(e,a,i)}function Vv(e,a,i){return(i?"":"    ")+e}const u6=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Gv.peek=p6;function d6(){return{canContainEols:["delete"],enter:{strikethrough:h6},exit:{strikethrough:m6}}}function f6(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:u6}],handlers:{delete:Gv}}}function h6(e){this.enter({type:"delete",children:[]},e)}function m6(e){this.exit(e)}function Gv(e,a,i,l){const o=i.createTracker(l),u=i.enter("strikethrough");let d=o.move("~~");return d+=i.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),u(),d}function p6(){return"~"}function x6(e){return e.length}function g6(e,a){const i=a||{},l=(i.align||[]).concat(),o=i.stringLength||x6,u=[],d=[],f=[],p=[];let h=0,g=-1;for(;++g<e.length;){const z=[],j=[];let N=-1;for(e[g].length>h&&(h=e[g].length);++N<e[g].length;){const D=b6(e[g][N]);if(i.alignDelimiters!==!1){const E=o(D);j[N]=E,(p[N]===void 0||E>p[N])&&(p[N]=E)}z.push(D)}d[g]=z,f[g]=j}let b=-1;if(typeof l=="object"&&"length"in l)for(;++b<h;)u[b]=yy(l[b]);else{const z=yy(l);for(;++b<h;)u[b]=z}b=-1;const v=[],y=[];for(;++b<h;){const z=u[b];let j="",N="";z===99?(j=":",N=":"):z===108?j=":":z===114&&(N=":");let D=i.alignDelimiters===!1?1:Math.max(1,p[b]-j.length-N.length);const E=j+"-".repeat(D)+N;i.alignDelimiters!==!1&&(D=j.length+D+N.length,D>p[b]&&(p[b]=D),y[b]=D),v[b]=E}d.splice(1,0,v),f.splice(1,0,y),g=-1;const k=[];for(;++g<d.length;){const z=d[g],j=f[g];b=-1;const N=[];for(;++b<h;){const D=z[b]||"";let E="",L="";if(i.alignDelimiters!==!1){const Y=p[b]-(j[b]||0),A=u[b];A===114?E=" ".repeat(Y):A===99?Y%2?(E=" ".repeat(Y/2+.5),L=" ".repeat(Y/2-.5)):(E=" ".repeat(Y/2),L=E):L=" ".repeat(Y)}i.delimiterStart!==!1&&!b&&N.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&D==="")&&(i.delimiterStart!==!1||b)&&N.push(" "),i.alignDelimiters!==!1&&N.push(E),N.push(D),i.alignDelimiters!==!1&&N.push(L),i.padding!==!1&&N.push(" "),(i.delimiterEnd!==!1||b!==h-1)&&N.push("|")}k.push(i.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return k.join(`
`)}function b6(e){return e==null?"":String(e)}function yy(e){const a=typeof e=="string"?e.codePointAt(0):0;return a===67||a===99?99:a===76||a===108?108:a===82||a===114?114:0}function y6(e,a,i,l){const o=i.enter("blockquote"),u=i.createTracker(l);u.move("> "),u.shift(2);const d=i.indentLines(i.containerFlow(e,u.current()),v6);return o(),d}function v6(e,a,i){return">"+(i?"":" ")+e}function w6(e,a){return vy(e,a.inConstruct,!0)&&!vy(e,a.notInConstruct,!1)}function vy(e,a,i){if(typeof a=="string"&&(a=[a]),!a||a.length===0)return i;let l=-1;for(;++l<a.length;)if(e.includes(a[l]))return!0;return!1}function wy(e,a,i,l){let o=-1;for(;++o<i.unsafe.length;)if(i.unsafe[o].character===`
`&&w6(i.stack,i.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
`}function j6(e,a){const i=String(e);let l=i.indexOf(a),o=l,u=0,d=0;if(typeof a!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===o?++u>d&&(d=u):u=1,o=l+a.length,l=i.indexOf(a,o);return d}function z6(e,a){return!!(a.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function k6(e){const a=e.options.fence||"`";if(a!=="`"&&a!=="~")throw new Error("Cannot serialize code with `"+a+"` for `options.fence`, expected `` ` `` or `~`");return a}function N6(e,a,i,l){const o=k6(i),u=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(z6(e,i)){const b=i.enter("codeIndented"),v=i.indentLines(u,S6);return b(),v}const f=i.createTracker(l),p=o.repeat(Math.max(j6(u,o)+1,3)),h=i.enter("codeFenced");let g=f.move(p);if(e.lang){const b=i.enter(`codeFencedLang${d}`);g+=f.move(i.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),b()}if(e.lang&&e.meta){const b=i.enter(`codeFencedMeta${d}`);g+=f.move(" "),g+=f.move(i.safe(e.meta,{before:g,after:`
`,encode:["`"],...f.current()})),b()}return g+=f.move(`
`),u&&(g+=f.move(u+`
`)),g+=f.move(p),h(),g}function S6(e,a,i){return(i?"":"    ")+e}function Xm(e){const a=e.options.quote||'"';if(a!=='"'&&a!=="'")throw new Error("Cannot serialize title with `"+a+"` for `options.quote`, expected `\"`, or `'`");return a}function C6(e,a,i,l){const o=Xm(i),u=o==='"'?"Quote":"Apostrophe",d=i.enter("definition");let f=i.enter("label");const p=i.createTracker(l);let h=p.move("[");return h+=p.move(i.safe(i.associationId(e),{before:h,after:"]",...p.current()})),h+=p.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=i.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(i.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=i.enter("destinationRaw"),h+=p.move(i.safe(e.url,{before:h,after:e.title?" ":`
`,...p.current()}))),f(),e.title&&(f=i.enter(`title${u}`),h+=p.move(" "+o),h+=p.move(i.safe(e.title,{before:h,after:o,...p.current()})),h+=p.move(o),f()),d(),h}function E6(e){const a=e.options.emphasis||"*";if(a!=="*"&&a!=="_")throw new Error("Cannot serialize emphasis with `"+a+"` for `options.emphasis`, expected `*`, or `_`");return a}function oo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function du(e,a,i){const l=Hl(e),o=Hl(a);return l===void 0?o===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Yv.peek=T6;function Yv(e,a,i,l){const o=E6(i),u=i.enter("emphasis"),d=i.createTracker(l),f=d.move(o);let p=d.move(i.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=p.charCodeAt(0),g=du(l.before.charCodeAt(l.before.length-1),h,o);g.inside&&(p=oo(h)+p.slice(1));const b=p.charCodeAt(p.length-1),v=du(l.after.charCodeAt(0),b,o);v.inside&&(p=p.slice(0,-1)+oo(b));const y=d.move(o);return u(),i.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},f+p+y}function T6(e,a,i){return i.options.emphasis||"*"}function A6(e,a){let i=!1;return Ym(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return i=!0,Kh}),!!((!e.depth||e.depth<3)&&Hm(e)&&(a.options.setext||i))}function M6(e,a,i,l){const o=Math.max(Math.min(6,e.depth||1),1),u=i.createTracker(l);if(A6(e,i)){const g=i.enter("headingSetext"),b=i.enter("phrasing"),v=i.containerPhrasing(e,{...u.current(),before:`
`,after:`
`});return b(),g(),v+`
`+(o===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
`))+1))}const d="#".repeat(o),f=i.enter("headingAtx"),p=i.enter("phrasing");u.move(d+" ");let h=i.containerPhrasing(e,{before:"# ",after:`
`,...u.current()});return/^[\t ]/.test(h)&&(h=oo(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,i.options.closeAtx&&(h+=" "+d),p(),f(),h}Qv.peek=D6;function Qv(e){return e.value||""}function D6(){return"<"}Xv.peek=O6;function Xv(e,a,i,l){const o=Xm(i),u=o==='"'?"Quote":"Apostrophe",d=i.enter("image");let f=i.enter("label");const p=i.createTracker(l);let h=p.move("![");return h+=p.move(i.safe(e.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=i.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(i.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(f=i.enter("destinationRaw"),h+=p.move(i.safe(e.url,{before:h,after:e.title?" ":")",...p.current()}))),f(),e.title&&(f=i.enter(`title${u}`),h+=p.move(" "+o),h+=p.move(i.safe(e.title,{before:h,after:o,...p.current()})),h+=p.move(o),f()),h+=p.move(")"),d(),h}function O6(){return"!"}Jv.peek=R6;function Jv(e,a,i,l){const o=e.referenceType,u=i.enter("imageReference");let d=i.enter("label");const f=i.createTracker(l);let p=f.move("![");const h=i.safe(e.alt,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),d();const g=i.stack;i.stack=[],d=i.enter("reference");const b=i.safe(i.associationId(e),{before:p,after:"]",...f.current()});return d(),i.stack=g,u(),o==="full"||!h||h!==b?p+=f.move(b+"]"):o==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function R6(){return"!"}Zv.peek=_6;function Zv(e,a,i){let l=e.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(l);)o+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++u<i.unsafe.length;){const d=i.unsafe[u],f=i.compilePattern(d);let p;if(d.atBreak)for(;p=f.exec(l);){let h=p.index;l.charCodeAt(h)===10&&l.charCodeAt(h-1)===13&&h--,l=l.slice(0,h)+" "+l.slice(p.index+1)}}return o+l+o}function _6(){return"`"}function Kv(e,a){const i=Hm(e);return!!(!a.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Wv.peek=L6;function Wv(e,a,i,l){const o=Xm(i),u=o==='"'?"Quote":"Apostrophe",d=i.createTracker(l);let f,p;if(Kv(e,i)){const g=i.stack;i.stack=[],f=i.enter("autolink");let b=d.move("<");return b+=d.move(i.containerPhrasing(e,{before:b,after:">",...d.current()})),b+=d.move(">"),f(),i.stack=g,b}f=i.enter("link"),p=i.enter("label");let h=d.move("[");return h+=d.move(i.containerPhrasing(e,{before:h,after:"](",...d.current()})),h+=d.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=i.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(i.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(p=i.enter("destinationRaw"),h+=d.move(i.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),p(),e.title&&(p=i.enter(`title${u}`),h+=d.move(" "+o),h+=d.move(i.safe(e.title,{before:h,after:o,...d.current()})),h+=d.move(o),p()),h+=d.move(")"),f(),h}function L6(e,a,i){return Kv(e,i)?"<":"["}e2.peek=B6;function e2(e,a,i,l){const o=e.referenceType,u=i.enter("linkReference");let d=i.enter("label");const f=i.createTracker(l);let p=f.move("[");const h=i.containerPhrasing(e,{before:p,after:"]",...f.current()});p+=f.move(h+"]["),d();const g=i.stack;i.stack=[],d=i.enter("reference");const b=i.safe(i.associationId(e),{before:p,after:"]",...f.current()});return d(),i.stack=g,u(),o==="full"||!h||h!==b?p+=f.move(b+"]"):o==="shortcut"?p=p.slice(0,-1):p+=f.move("]"),p}function B6(){return"["}function Jm(e){const a=e.options.bullet||"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bullet`, expected `*`, `+`, or `-`");return a}function U6(e){const a=Jm(e),i=e.options.bulletOther;if(!i)return a==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===a)throw new Error("Expected `bullet` (`"+a+"`) and `bulletOther` (`"+i+"`) to be different");return i}function I6(e){const a=e.options.bulletOrdered||".";if(a!=="."&&a!==")")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOrdered`, expected `.` or `)`");return a}function t2(e){const a=e.options.rule||"*";if(a!=="*"&&a!=="-"&&a!=="_")throw new Error("Cannot serialize rules with `"+a+"` for `options.rule`, expected `*`, `-`, or `_`");return a}function H6(e,a,i,l){const o=i.enter("list"),u=i.bulletCurrent;let d=e.ordered?I6(i):Jm(i);const f=e.ordered?d==="."?")":".":U6(i);let p=a&&i.bulletLastUsed?d===i.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&g&&(!g.children||!g.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(p=!0),t2(i)===d&&g){let b=-1;for(;++b<e.children.length;){const v=e.children[b];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(d=f),i.bulletCurrent=d;const h=i.containerFlow(e,l);return i.bulletLastUsed=d,i.bulletCurrent=u,o(),h}function q6(e){const a=e.options.listItemIndent||"one";if(a!=="tab"&&a!=="one"&&a!=="mixed")throw new Error("Cannot serialize items with `"+a+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return a}function F6(e,a,i,l){const o=q6(i);let u=i.bulletCurrent||Jm(i);a&&a.type==="list"&&a.ordered&&(u=(typeof a.start=="number"&&a.start>-1?a.start:1)+(i.options.incrementListMarker===!1?0:a.children.indexOf(e))+u);let d=u.length+1;(o==="tab"||o==="mixed"&&(a&&a.type==="list"&&a.spread||e.spread))&&(d=Math.ceil(d/4)*4);const f=i.createTracker(l);f.move(u+" ".repeat(d-u.length)),f.shift(d);const p=i.enter("listItem"),h=i.indentLines(i.containerFlow(e,f.current()),g);return p(),h;function g(b,v,y){return v?(y?"":" ".repeat(d))+b:(y?u:u+" ".repeat(d-u.length))+b}}function P6(e,a,i,l){const o=i.enter("paragraph"),u=i.enter("phrasing"),d=i.containerPhrasing(e,l);return u(),o(),d}const $6=Ou(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function V6(e,a,i,l){return(e.children.some(function(d){return $6(d)})?i.containerPhrasing:i.containerFlow).call(i,e,l)}function G6(e){const a=e.options.strong||"*";if(a!=="*"&&a!=="_")throw new Error("Cannot serialize strong with `"+a+"` for `options.strong`, expected `*`, or `_`");return a}n2.peek=Y6;function n2(e,a,i,l){const o=G6(i),u=i.enter("strong"),d=i.createTracker(l),f=d.move(o+o);let p=d.move(i.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=p.charCodeAt(0),g=du(l.before.charCodeAt(l.before.length-1),h,o);g.inside&&(p=oo(h)+p.slice(1));const b=p.charCodeAt(p.length-1),v=du(l.after.charCodeAt(0),b,o);v.inside&&(p=p.slice(0,-1)+oo(b));const y=d.move(o+o);return u(),i.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},f+p+y}function Y6(e,a,i){return i.options.strong||"*"}function Q6(e,a,i,l){return i.safe(e.value,l)}function X6(e){const a=e.options.ruleRepetition||3;if(a<3)throw new Error("Cannot serialize rules with repetition `"+a+"` for `options.ruleRepetition`, expected `3` or more");return a}function J6(e,a,i){const l=(t2(i)+(i.options.ruleSpaces?" ":"")).repeat(X6(i));return i.options.ruleSpaces?l.slice(0,-1):l}const a2={blockquote:y6,break:wy,code:N6,definition:C6,emphasis:Yv,hardBreak:wy,heading:M6,html:Qv,image:Xv,imageReference:Jv,inlineCode:Zv,link:Wv,linkReference:e2,list:H6,listItem:F6,paragraph:P6,root:V6,strong:n2,text:Q6,thematicBreak:J6};function Z6(){return{enter:{table:K6,tableData:jy,tableHeader:jy,tableRow:e8},exit:{codeText:t8,table:W6,tableData:wh,tableHeader:wh,tableRow:wh}}}function K6(e){const a=e._align;this.enter({type:"table",align:a.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function W6(e){this.exit(e),this.data.inTable=void 0}function e8(e){this.enter({type:"tableRow",children:[]},e)}function wh(e){this.exit(e)}function jy(e){this.enter({type:"tableCell",children:[]},e)}function t8(e){let a=this.resume();this.data.inTable&&(a=a.replace(/\\([\\|])/g,n8));const i=this.stack[this.stack.length-1];i.type,i.value=a,this.exit(e)}function n8(e,a){return a==="|"?a:e}function a8(e){const a=e||{},i=a.tableCellPadding,l=a.tablePipeAlign,o=a.stringLength,u=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[	 :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:d,tableCell:p,tableRow:f}};function d(y,k,z,j){return h(g(y,z,j),y.align)}function f(y,k,z,j){const N=b(y,z,j),D=h([N]);return D.slice(0,D.indexOf(`
`))}function p(y,k,z,j){const N=z.enter("tableCell"),D=z.enter("phrasing"),E=z.containerPhrasing(y,{...j,before:u,after:u});return D(),N(),E}function h(y,k){return g6(y,{align:k,alignDelimiters:l,padding:i,stringLength:o})}function g(y,k,z){const j=y.children;let N=-1;const D=[],E=k.enter("table");for(;++N<j.length;)D[N]=b(j[N],k,z);return E(),D}function b(y,k,z){const j=y.children;let N=-1;const D=[],E=k.enter("tableRow");for(;++N<j.length;)D[N]=p(j[N],y,k,z);return E(),D}function v(y,k,z){let j=a2.inlineCode(y,k,z);return z.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function i8(){return{exit:{taskListCheckValueChecked:zy,taskListCheckValueUnchecked:zy,paragraph:l8}}}function r8(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:s8}}}function zy(e){const a=this.stack[this.stack.length-2];a.type,a.checked=e.type==="taskListCheckValueChecked"}function l8(e){const a=this.stack[this.stack.length-2];if(a&&a.type==="listItem"&&typeof a.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const l=i.children[0];if(l&&l.type==="text"){const o=a.children;let u=-1,d;for(;++u<o.length;){const f=o[u];if(f.type==="paragraph"){d=f;break}}d===i&&(l.value=l.value.slice(1),l.value.length===0?i.children.shift():i.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,i.position.start=Object.assign({},l.position.start)))}}this.exit(e)}function s8(e,a,i,l){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",f=i.createTracker(l);u&&f.move(d);let p=a2.listItem(e,a,i,{...l,...f.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+d}}function o8(){return[HT(),s6(),d6(),Z6(),i8()]}function c8(e){return{extensions:[qT(),o6(e),f6(),a8(e),r8()]}}const u8={tokenize:x8,partial:!0},i2={tokenize:g8,partial:!0},r2={tokenize:b8,partial:!0},l2={tokenize:y8,partial:!0},d8={tokenize:v8,partial:!0},s2={name:"wwwAutolink",tokenize:m8,previous:c2},o2={name:"protocolAutolink",tokenize:p8,previous:u2},si={name:"emailAutolink",tokenize:h8,previous:d2},Ma={};function f8(){return{text:Ma}}let fr=48;for(;fr<123;)Ma[fr]=si,fr++,fr===58?fr=65:fr===91&&(fr=97);Ma[43]=si;Ma[45]=si;Ma[46]=si;Ma[95]=si;Ma[72]=[si,o2];Ma[104]=[si,o2];Ma[87]=[si,s2];Ma[119]=[si,s2];function h8(e,a,i){const l=this;let o,u;return d;function d(b){return!nm(b)||!d2.call(l,l.previous)||Zm(l.events)?i(b):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(b))}function f(b){return nm(b)?(e.consume(b),f):b===64?(e.consume(b),p):i(b)}function p(b){return b===46?e.check(d8,g,h)(b):b===45||b===95||en(b)?(u=!0,e.consume(b),p):g(b)}function h(b){return e.consume(b),o=!0,p}function g(b){return u&&o&&cn(l.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),a(b)):i(b)}}function m8(e,a,i){const l=this;return o;function o(d){return d!==87&&d!==119||!c2.call(l,l.previous)||Zm(l.events)?i(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(u8,e.attempt(i2,e.attempt(r2,u),i),i)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),a(d)}}function p8(e,a,i){const l=this;let o="",u=!1;return d;function d(b){return(b===72||b===104)&&u2.call(l,l.previous)&&!Zm(l.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(b),e.consume(b),f):i(b)}function f(b){if(cn(b)&&o.length<5)return o+=String.fromCodePoint(b),e.consume(b),f;if(b===58){const v=o.toLowerCase();if(v==="http"||v==="https")return e.consume(b),p}return i(b)}function p(b){return b===47?(e.consume(b),u?h:(u=!0,p)):i(b)}function h(b){return b===null||ou(b)||dt(b)||Sr(b)||Au(b)?i(b):e.attempt(i2,e.attempt(r2,g),i)(b)}function g(b){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),a(b)}}function x8(e,a,i){let l=0;return o;function o(d){return(d===87||d===119)&&l<3?(l++,e.consume(d),o):d===46&&l===3?(e.consume(d),u):i(d)}function u(d){return d===null?i(d):a(d)}}function g8(e,a,i){let l,o,u;return d;function d(h){return h===46||h===95?e.check(l2,p,f)(h):h===null||dt(h)||Sr(h)||h!==45&&Au(h)?p(h):(u=!0,e.consume(h),d)}function f(h){return h===95?l=!0:(o=l,l=void 0),e.consume(h),d}function p(h){return o||l||!u?i(h):a(h)}}function b8(e,a){let i=0,l=0;return o;function o(d){return d===40?(i++,e.consume(d),o):d===41&&l<i?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(l2,a,u)(d):d===null||dt(d)||Sr(d)?a(d):(e.consume(d),o)}function u(d){return d===41&&l++,e.consume(d),o}}function y8(e,a,i){return l;function l(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),l):f===38?(e.consume(f),u):f===93?(e.consume(f),o):f===60||f===null||dt(f)||Sr(f)?a(f):i(f)}function o(f){return f===null||f===40||f===91||dt(f)||Sr(f)?a(f):l(f)}function u(f){return cn(f)?d(f):i(f)}function d(f){return f===59?(e.consume(f),l):cn(f)?(e.consume(f),d):i(f)}}function v8(e,a,i){return l;function l(u){return e.consume(u),o}function o(u){return en(u)?i(u):a(u)}}function c2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||dt(e)}function u2(e){return!cn(e)}function d2(e){return!(e===47||nm(e))}function nm(e){return e===43||e===45||e===46||e===95||en(e)}function Zm(e){let a=e.length,i=!1;for(;a--;){const l=e[a][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){i=!0;break}if(l._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const w8={tokenize:T8,partial:!0};function j8(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:S8,continuation:{tokenize:C8},exit:E8}},text:{91:{name:"gfmFootnoteCall",tokenize:N8},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:z8,resolveTo:k8}}}}function z8(e,a,i){const l=this;let o=l.events.length;const u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d;for(;o--;){const p=l.events[o][1];if(p.type==="labelImage"){d=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return f;function f(p){if(!d||!d._balanced)return i(p);const h=da(l.sliceSerialize({start:d.end,end:l.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?i(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),a(p))}}function k8(e,a){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const l={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[i+1],e[i+2],["enter",l,a],e[i+3],e[i+4],["enter",o,a],["exit",o,a],["enter",u,a],["enter",d,a],["exit",d,a],["exit",u,a],e[e.length-2],e[e.length-1],["exit",l,a]];return e.splice(i,e.length-i+1,...f),e}function N8(e,a,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u=0,d;return f;function f(b){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(b),e.exit("gfmFootnoteCallLabelMarker"),p}function p(b){return b!==94?i(b):(e.enter("gfmFootnoteCallMarker"),e.consume(b),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(b){if(u>999||b===93&&!d||b===null||b===91||dt(b))return i(b);if(b===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return o.includes(da(l.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(b),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),a):i(b)}return dt(b)||(d=!0),u++,e.consume(b),b===92?g:h}function g(b){return b===91||b===92||b===93?(e.consume(b),u++,h):h(b)}}function S8(e,a,i){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u,d=0,f;return p;function p(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",g):i(k)}function g(k){if(d>999||k===93&&!f||k===null||k===91||dt(k))return i(k);if(k===93){e.exit("chunkString");const z=e.exit("gfmFootnoteDefinitionLabelString");return u=da(l.sliceSerialize(z)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return dt(k)||(f=!0),d++,e.consume(k),k===92?b:g}function b(k){return k===91||k===92||k===93?(e.consume(k),d++,g):g(k)}function v(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),o.includes(u)||o.push(u),Je(e,y,"gfmFootnoteDefinitionWhitespace")):i(k)}function y(k){return a(k)}}function C8(e,a,i){return e.check(vo,a,e.attempt(w8,a,i))}function E8(e){e.exit("gfmFootnoteDefinition")}function T8(e,a,i){const l=this;return Je(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const d=l.events[l.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?a(u):i(u)}}function A8(e){let i=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:u,resolveAll:o};return i==null&&(i=!0),{text:{126:l},insideSpan:{null:[l]},attentionMarkers:{null:[126]}};function o(d,f){let p=-1;for(;++p<d.length;)if(d[p][0]==="enter"&&d[p][1].type==="strikethroughSequenceTemporary"&&d[p][1]._close){let h=p;for(;h--;)if(d[h][0]==="exit"&&d[h][1].type==="strikethroughSequenceTemporary"&&d[h][1]._open&&d[p][1].end.offset-d[p][1].start.offset===d[h][1].end.offset-d[h][1].start.offset){d[p][1].type="strikethroughSequence",d[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},d[h][1].start),end:Object.assign({},d[p][1].end)},b={type:"strikethroughText",start:Object.assign({},d[h][1].end),end:Object.assign({},d[p][1].start)},v=[["enter",g,f],["enter",d[h][1],f],["exit",d[h][1],f],["enter",b,f]],y=f.parser.constructs.insideSpan.null;y&&_n(v,v.length,0,Mu(y,d.slice(h+1,p),f)),_n(v,v.length,0,[["exit",b,f],["enter",d[p][1],f],["exit",d[p][1],f],["exit",g,f]]),_n(d,h-1,p-h+3,v),p=h+v.length-2;break}}for(p=-1;++p<d.length;)d[p][1].type==="strikethroughSequenceTemporary"&&(d[p][1].type="data");return d}function u(d,f,p){const h=this.previous,g=this.events;let b=0;return v;function v(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(k):(d.enter("strikethroughSequenceTemporary"),y(k))}function y(k){const z=Hl(h);if(k===126)return b>1?p(k):(d.consume(k),b++,y);if(b<2&&!i)return p(k);const j=d.exit("strikethroughSequenceTemporary"),N=Hl(k);return j._open=!N||N===2&&!!z,j._close=!z||z===2&&!!N,f(k)}}}class M8{constructor(){this.map=[]}add(a,i,l){D8(this,a,i,l)}consume(a){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let i=this.map.length;const l=[];for(;i>0;)i-=1,l.push(a.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),a.length=this.map[i][0];l.push(a.slice()),a.length=0;let o=l.pop();for(;o;){for(const u of o)a.push(u);o=l.pop()}this.map.length=0}}function D8(e,a,i,l){let o=0;if(!(i===0&&l.length===0)){for(;o<e.map.length;){if(e.map[o][0]===a){e.map[o][1]+=i,e.map[o][2].push(...l);return}o+=1}e.map.push([a,i,l])}}function O8(e,a){let i=!1;const l=[];for(;a<e.length;){const o=e[a];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&l.push(e[a+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[a-1][1].type==="tableDelimiterMarker"){const u=l.length-1;l[u]=l[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(i=!0);a+=1}return l}function R8(){return{flow:{null:{name:"table",tokenize:_8,resolveAll:L8}}}}function _8(e,a,i){const l=this;let o=0,u=0,d;return f;function f(O){let U=l.events.length-1;for(;U>-1;){const V=l.events[U][1].type;if(V==="lineEnding"||V==="linePrefix")U--;else break}const $=U>-1?l.events[U][1].type:null,me=$==="tableHead"||$==="tableRow"?A:p;return me===A&&l.parser.lazy[l.now().line]?i(O):me(O)}function p(O){return e.enter("tableHead"),e.enter("tableRow"),h(O)}function h(O){return O===124||(d=!0,u+=1),g(O)}function g(O){return O===null?i(O):Se(O)?u>1?(u=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),y):i(O):Fe(O)?Je(e,g,"whitespace")(O):(u+=1,d&&(d=!1,o+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),d=!0,g):(e.enter("data"),b(O)))}function b(O){return O===null||O===124||dt(O)?(e.exit("data"),g(O)):(e.consume(O),O===92?v:b)}function v(O){return O===92||O===124?(e.consume(O),b):b(O)}function y(O){return l.interrupt=!1,l.parser.lazy[l.now().line]?i(O):(e.enter("tableDelimiterRow"),d=!1,Fe(O)?Je(e,k,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):k(O))}function k(O){return O===45||O===58?j(O):O===124?(d=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),z):Y(O)}function z(O){return Fe(O)?Je(e,j,"whitespace")(O):j(O)}function j(O){return O===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),N):O===45?(u+=1,N(O)):O===null||Se(O)?L(O):Y(O)}function N(O){return O===45?(e.enter("tableDelimiterFiller"),D(O)):Y(O)}function D(O){return O===45?(e.consume(O),D):O===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(O))}function E(O){return Fe(O)?Je(e,L,"whitespace")(O):L(O)}function L(O){return O===124?k(O):O===null||Se(O)?!d||o!==u?Y(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),a(O)):Y(O)}function Y(O){return i(O)}function A(O){return e.enter("tableRow"),H(O)}function H(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),H):O===null||Se(O)?(e.exit("tableRow"),a(O)):Fe(O)?Je(e,H,"whitespace")(O):(e.enter("data"),ae(O))}function ae(O){return O===null||O===124||dt(O)?(e.exit("data"),H(O)):(e.consume(O),O===92?ee:ae)}function ee(O){return O===92||O===124?(e.consume(O),ae):ae(O)}}function L8(e,a){let i=-1,l=!0,o=0,u=[0,0,0,0],d=[0,0,0,0],f=!1,p=0,h,g,b;const v=new M8;for(;++i<e.length;){const y=e[i],k=y[1];y[0]==="enter"?k.type==="tableHead"?(f=!1,p!==0&&(ky(v,a,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(i,0,[["enter",h,a]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(l=!0,b=void 0,u=[0,0,0,0],d=[0,i+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(i,0,[["enter",g,a]])),o=k.type==="tableDelimiterRow"?2:g?3:1):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(l=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],b=$c(v,a,u,o,void 0,b),u=[0,0,0,0]),d[2]=i)):k.type==="tableCellDivider"&&(l?l=!1:(u[1]!==0&&(d[0]=d[1],b=$c(v,a,u,o,void 0,b)),u=d,d=[u[1],i,0,0])):k.type==="tableHead"?(f=!0,p=i):k.type==="tableRow"||k.type==="tableDelimiterRow"?(p=i,u[1]!==0?(d[0]=d[1],b=$c(v,a,u,o,i,b)):d[1]!==0&&(b=$c(v,a,d,o,i,b)),o=0):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(d[3]=i)}for(p!==0&&ky(v,a,p,h,g),v.consume(a.events),i=-1;++i<a.events.length;){const y=a.events[i];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=O8(a.events,i))}return e}function $c(e,a,i,l,o,u){const d=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",f="tableContent";i[0]!==0&&(u.end=Object.assign({},jl(a.events,i[0])),e.add(i[0],0,[["exit",u,a]]));const p=jl(a.events,i[1]);if(u={type:d,start:Object.assign({},p),end:Object.assign({},p)},e.add(i[1],0,[["enter",u,a]]),i[2]!==0){const h=jl(a.events,i[2]),g=jl(a.events,i[3]),b={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(i[2],0,[["enter",b,a]]),l!==2){const v=a.events[i[2]],y=a.events[i[3]];if(v[1].end=Object.assign({},y[1].end),v[1].type="chunkText",v[1].contentType="text",i[3]>i[2]+1){const k=i[2]+1,z=i[3]-i[2]-1;e.add(k,z,[])}}e.add(i[3]+1,0,[["exit",b,a]])}return o!==void 0&&(u.end=Object.assign({},jl(a.events,o)),e.add(o,0,[["exit",u,a]]),u=void 0),u}function ky(e,a,i,l,o){const u=[],d=jl(a.events,i);o&&(o.end=Object.assign({},d),u.push(["exit",o,a])),l.end=Object.assign({},d),u.push(["exit",l,a]),e.add(i+1,0,u)}function jl(e,a){const i=e[a],l=i[0]==="enter"?"start":"end";return i[1][l]}const B8={name:"tasklistCheck",tokenize:I8};function U8(){return{text:{91:B8}}}function I8(e,a,i){const l=this;return o;function o(p){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?i(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),u)}function u(p){return dt(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),d):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),d):i(p)}function d(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):i(p)}function f(p){return Se(p)?a(p):Fe(p)?e.check({tokenize:H8},a,i)(p):i(p)}}function H8(e,a,i){return Je(e,l,"whitespace");function l(o){return o===null?i(o):a(o)}}function q8(e){return jv([f8(),j8(),A8(e),R8(),U8()])}const F8={};function P8(e){const a=this,i=e||F8,l=a.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),u=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(q8(i)),u.push(o8()),d.push(c8(i))}const $8={h1:({children:e})=>r.jsx("h1",{className:"mb-4 mt-6 text-xl font-bold text-zinc-100 first:mt-0",children:e}),h2:({children:e})=>r.jsx("h2",{className:"mb-3 mt-5 text-lg font-bold text-zinc-100 first:mt-0",children:e}),h3:({children:e})=>r.jsx("h3",{className:"mb-2 mt-4 text-base font-bold text-zinc-100 first:mt-0",children:e}),p:({children:e})=>r.jsx("p",{className:"mb-3 leading-relaxed text-zinc-100 last:mb-0",children:e}),a:({href:e,children:a})=>r.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-cachi-400 underline decoration-cachi-400/50 underline-offset-2 hover:text-cachi-300 hover:decoration-cachi-300",children:a}),ul:({children:e})=>r.jsx("ul",{className:"mb-3 ml-4 list-disc space-y-1 text-zinc-100 last:mb-0",children:e}),ol:({children:e})=>r.jsx("ol",{className:"mb-3 ml-4 list-decimal space-y-1 text-zinc-100 last:mb-0",children:e}),li:({children:e})=>r.jsx("li",{className:"text-zinc-100",children:e}),code:({className:e,children:a,...i})=>{if(!e)return r.jsx("code",{className:"rounded bg-zinc-700/50 px-1.5 py-0.5 font-mono text-sm text-cachi-300",children:a});const o=/language-(\w+)/.exec(e||""),u=o?o[1]:"";return r.jsxs("div",{className:"relative my-3",children:[u&&r.jsx("div",{className:"absolute right-2 top-2 rounded bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:u}),r.jsx("pre",{className:"overflow-x-auto rounded-lg bg-zinc-900 p-4",children:r.jsx("code",{className:ie("font-mono text-sm text-zinc-300",e),...i,children:a})})]})},pre:({children:e})=>r.jsx(r.Fragment,{children:e}),blockquote:({children:e})=>r.jsx("blockquote",{className:"my-3 border-l-4 border-cachi-500/50 pl-4 italic text-zinc-400",children:e}),hr:()=>r.jsx("hr",{className:"my-4 border-zinc-700"}),strong:({children:e})=>r.jsx("strong",{className:"font-bold text-zinc-100",children:e}),em:({children:e})=>r.jsx("em",{className:"italic text-zinc-200",children:e}),del:({children:e})=>r.jsx("del",{className:"text-zinc-500 line-through",children:e}),table:({children:e})=>r.jsx("div",{className:"my-3 overflow-x-auto",children:r.jsx("table",{className:"min-w-full border-collapse text-sm",children:e})}),thead:({children:e})=>r.jsx("thead",{className:"border-b border-zinc-700 bg-zinc-800/50",children:e}),tbody:({children:e})=>r.jsx("tbody",{children:e}),tr:({children:e})=>r.jsx("tr",{className:"border-b border-zinc-800",children:e}),th:({children:e})=>r.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-300",children:e}),td:({children:e})=>r.jsx("td",{className:"px-3 py-2 text-zinc-100",children:e})};function V8({content:e,className:a}){return r.jsx("div",{className:ie("prose prose-invert prose-sm max-w-none",a),children:r.jsx(AT,{remarkPlugins:[P8],components:$8,children:e})})}const G8={es:{words:[/\b(el|la|los|las|un|una|que|de|en|es|por|para|con|como|pero|este|esta)\b/gi],chars:/[ñáéíóúü]/i},pt:{words:[/\b(o|a|os|as|um|uma|que|de|em|por|para|com|como|mas|este|esta|isso|nao|não)\b/gi],chars:/[ãõç]/i},fr:{words:[/\b(le|la|les|un|une|que|de|en|est|pour|avec|comme|mais|ce|cette|je|tu|il)\b/gi],chars:/[éèêëàâîïôùûç]/i},de:{words:[/\b(der|die|das|ein|eine|und|ist|mit|für|aber|ich|du|sie|wir)\b/gi],chars:/[äöüß]/i},it:{words:[/\b(il|la|lo|gli|le|un|una|che|di|in|per|con|come|ma|questo|questa)\b/gi]},en:{words:[/\b(the|a|an|is|are|was|were|be|been|have|has|had|do|does|did|will|would|could|should|can|may|might|must|shall|this|that|these|those|i|you|he|she|it|we|they)\b/gi]}};function jh(e){const a=e.join(" ").toLowerCase();if(a.length<10)return null;const i={};for(const[u,{words:d,chars:f}]of Object.entries(G8)){let p=0;f&&f.test(a)&&(p+=3);for(const h of d){const g=a.match(h);g&&(p+=g.length)}i[u]=p}let l=null,o=0;for(const[u,d]of Object.entries(i))d>o&&(o=d,l=u);return o>=2?l:null}const Y8={Professional:"Maintain a professional, business-appropriate tone. Be clear, concise, and focused.",Casual:"Be friendly and approachable. Use everyday language and a warm conversational style.",Playful:"Be fun and lighthearted. Bring energy and enthusiasm to conversations.",Technical:"Be precise and detailed. Use domain-specific terminology when appropriate."},Q8={yes:"Feel free to use emojis to express yourself and add personality.",no:"Do not use emojis in your responses. Keep text-only.",sometimes:"Use emojis sparingly, only when they genuinely add value to the message."},X8={en:"English",es:"Spanish",pt:"Portuguese",fr:"French",de:"German",it:"Italian"};function J8(e){const a=[];if(a.push(`You are ${e.name}, an AI assistant.`),e.purposeDescription&&a.push(`Your purpose: ${e.purposeDescription}`),e.purposeCategory&&e.purposeCategory!=="Other"&&a.push(`You specialize in ${e.purposeCategory.toLowerCase()}-related tasks.`),e.communicationStyle){const i=Y8[e.communicationStyle];i?a.push(i):a.push(`Communication style: ${e.communicationStyle}`)}if(e.useEmojis&&a.push(Q8[e.useEmojis]),e.detectedLanguage&&e.detectedLanguage!=="en"){const i=X8[e.detectedLanguage]||e.detectedLanguage;a.push(`Always respond in ${i} unless the user explicitly requests another language.`)}return a.push("Be helpful, honest, and stay true to your personality."),a.join(`

`)}class Z8{constructor(a){la(this,"ws",null);la(this,"url");la(this,"reconnectAttempts",0);la(this,"maxReconnectAttempts",5);la(this,"reconnectDelay",1e3);la(this,"isIntentionalClose",!1);la(this,"messageHandlers",[]);la(this,"connectHandlers",[]);la(this,"disconnectHandlers",[]);la(this,"errorHandlers",[]);const i=window.location.protocol==="https:"?"wss:":"ws:",l=window.location.host;this.url=a||`${i}//${l}/ws`}connect(){var l,o;if(((l=this.ws)==null?void 0:l.readyState)===WebSocket.OPEN||((o=this.ws)==null?void 0:o.readyState)===WebSocket.CONNECTING)return;const{accessToken:a}=ga.getState();if(!a){console.error("Cannot connect WebSocket: not authenticated");return}this.isIntentionalClose=!1;const i=`${this.url}?token=${encodeURIComponent(a)}`;this.ws=new WebSocket(i),this.ws.onopen=()=>{this.reconnectAttempts=0,this.connectHandlers.forEach(u=>u())},this.ws.onmessage=u=>{try{const d=JSON.parse(u.data);this.messageHandlers.forEach(f=>f(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}},this.ws.onclose=()=>{this.disconnectHandlers.forEach(u=>u()),this.attemptReconnect()},this.ws.onerror=u=>{this.errorHandlers.forEach(d=>d(u))}}disconnect(){this.isIntentionalClose=!0,this.ws&&(this.ws.close(),this.ws=null)}attemptReconnect(){if(this.isIntentionalClose)return;if(this.reconnectAttempts>=this.maxReconnectAttempts){console.error("Max reconnect attempts reached");return}this.reconnectAttempts++;const a=this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);setTimeout(()=>{this.isIntentionalClose||(console.log(`Reconnecting... (attempt ${this.reconnectAttempts})`),this.connect())},a)}send(a,i={}){var l;if(((l=this.ws)==null?void 0:l.readyState)!==WebSocket.OPEN){console.error("WebSocket is not connected");return}this.ws.send(JSON.stringify({type:a,payload:i}))}sendChat(a,i){this.send("chat",{message:a,systemPrompt:i==null?void 0:i.systemPrompt,botId:i==null?void 0:i.botId,chatId:i==null?void 0:i.chatId,capabilities:i==null?void 0:i.capabilities,toolConfigs:i==null?void 0:i.toolConfigs,enabledSkills:i==null?void 0:i.enabledSkills})}sendCancel(){this.send("cancel")}sendApproval(a,i){this.send("approval",{id:a,approved:i})}onMessage(a){return this.messageHandlers.push(a),()=>{this.messageHandlers=this.messageHandlers.filter(i=>i!==a)}}onConnect(a){return this.connectHandlers.push(a),()=>{this.connectHandlers=this.connectHandlers.filter(i=>i!==a)}}onDisconnect(a){return this.disconnectHandlers.push(a),()=>{this.disconnectHandlers=this.disconnectHandlers.filter(i=>i!==a)}}onError(a){return this.errorHandlers.push(a),()=>{this.errorHandlers=this.errorHandlers.filter(i=>i!==a)}}get isConnected(){var a;return((a=this.ws)==null?void 0:a.readyState)===WebSocket.OPEN}}const Wa=new Z8,K8=_t()(tn((e,a)=>({connections:[],activeConnectionId:null,addConnection:i=>e(l=>({connections:[...l.connections,i]})),updateConnection:(i,l)=>e(o=>({connections:o.connections.map(u=>u.id===i?{...u,...l}:u)})),deleteConnection:i=>e(l=>({connections:l.connections.filter(o=>o.id!==i),activeConnectionId:l.activeConnectionId===i?null:l.activeConnectionId})),setActiveConnection:i=>e({activeConnectionId:i}),getConnectionsByBot:i=>a().connections.filter(o=>o.botId===i),getConnectionsByPlatform:i=>a().connections.filter(o=>o.platform===i)}),{name:"cachibot-connections"})),Ny={totalMessages:0,totalTokens:0,totalCost:0,byModel:{},byBot:{},daily:[]},fu=_t()(tn(e=>({stats:Ny,recordUsage:({botId:a,model:i,tokens:l,cost:o})=>e(u=>{var p,h,g,b,v,y;const d=new Date().toISOString().split("T")[0],f=u.stats.daily.find(k=>k.date===d);return{stats:{totalMessages:u.stats.totalMessages+1,totalTokens:u.stats.totalTokens+l,totalCost:u.stats.totalCost+o,byModel:{...u.stats.byModel,[i]:{tokens:(((p=u.stats.byModel[i])==null?void 0:p.tokens)||0)+l,cost:(((h=u.stats.byModel[i])==null?void 0:h.cost)||0)+o,messages:(((g=u.stats.byModel[i])==null?void 0:g.messages)||0)+1}},byBot:{...u.stats.byBot,[a]:{tokens:(((b=u.stats.byBot[a])==null?void 0:b.tokens)||0)+l,cost:(((v=u.stats.byBot[a])==null?void 0:v.cost)||0)+o,messages:(((y=u.stats.byBot[a])==null?void 0:y.messages)||0)+1}},daily:f?u.stats.daily.map(k=>k.date===d?{...k,tokens:k.tokens+l,cost:k.cost+o,messages:k.messages+1}:k):[...u.stats.daily.slice(-29),{date:d,tokens:l,cost:o,messages:1}]}}}),resetStats:()=>e({stats:Ny}),clearBotStats:a=>e(i=>{const l=i.stats.byBot[a];if(!l)return i;const{[a]:o,...u}=i.stats.byBot;return{stats:{...i.stats,totalMessages:Math.max(0,i.stats.totalMessages-l.messages),totalTokens:Math.max(0,i.stats.totalTokens-l.tokens),totalCost:Math.max(0,i.stats.totalCost-l.cost),byBot:u}}})}),{name:"cachibot-usage"}));let f2=null,Wc=[];function W8(){return f2}function Sy(e){f2=e,Wc.forEach(a=>a(e))}function eA(e){return Wc.push(e),()=>{Wc=Wc.filter(a=>a!==e)}}let Ws=null;function tA(e){Ws=e}function nA(){const[e,a]=C.useState(!1),{addMessage:i,setThinking:l,addToolCall:o,updateToolCall:u,clearToolCalls:d,setLoading:f,setError:p,updateLastAssistantMessageMetadata:h}=Rn(),g=C.useRef(null);C.useEffect(()=>{const z=Rn.subscribe(j=>{g.current=j.activeChatId});return g.current=Rn.getState().activeChatId,z},[]);const b=C.useCallback(z=>{switch(z.type){case"thinking":{const j=z.payload;l(j.content);break}case"tool_start":{const j=z.payload;o({id:j.id,tool:j.tool,args:j.args});break}case"tool_end":{const j=z.payload;u(j.id,j.result,j.success);break}case"message":{const j=z.payload,N=g.current||Ws;console.log("[WS] Message received:",{role:j.role,chatId:N,refValue:g.current,pendingChatId:Ws}),N?i(N,{id:j.messageId||`msg-${Date.now()}`,role:j.role,content:j.content,timestamp:new Date().toISOString()}):console.warn("[WS] No chatId available for message, dropping:",j),j.role==="assistant"&&l(null);break}case"approval_needed":{const j=z.payload;Sy(j);break}case"platform_message":{const j=z.payload;if(i(j.chatId,{id:j.messageId,role:j.role,content:j.content,timestamp:new Date().toISOString(),metadata:{platform:j.platform,...j.metadata}}),j.role==="assistant"&&j.metadata){const N=j.metadata.tokens,D=j.metadata.cost,E=j.metadata.model;N!==void 0&&D!==void 0&&fu.getState().recordUsage({botId:j.botId,model:E||"unknown",tokens:N,cost:D})}break}case"usage":{const j=z.payload,N=Dt.getState().activeBotId,D=Dt.getState().getActiveBot(),E=g.current||Ws;fu.getState().recordUsage({botId:N||"unknown",model:(D==null?void 0:D.model)||"unknown",tokens:j.totalTokens,cost:j.totalCost}),E&&h(E,{tokens:j.totalTokens,promptTokens:j.promptTokens,completionTokens:j.completionTokens,cost:j.totalCost,model:D==null?void 0:D.model,iterations:j.iterations,elapsedMs:j.elapsedMs,tokensPerSecond:j.tokensPerSecond});break}case"error":{const j=z.payload;p(j.message),f(!1),l(null);break}case"done":{f(!1),l(null),d(),Ws=null;break}}},[i,l,o,u,d,f,p,h]);C.useEffect(()=>{const z=Wa.onMessage(b),j=Wa.onConnect(()=>a(!0)),N=Wa.onDisconnect(()=>a(!1)),D=Wa.onError(()=>{p("WebSocket connection error")}),E=setTimeout(()=>{Wa.connect()},100);return()=>{clearTimeout(E),z(),j(),N(),D(),Wa.disconnect()}},[b,p]);const v=C.useCallback((z,j)=>{const{setLoading:N,setError:D,clearToolCalls:E}=Rn.getState();N(!0),D(null),E(),Wa.sendChat(z,j)},[]),y=C.useCallback(()=>{Wa.sendCancel(),f(!1),l(null)},[f,l]),k=C.useCallback((z,j)=>{Wa.sendApproval(z,j),Sy(null)},[]);return{isConnected:e,sendMessage:v,cancel:y,approve:k}}function aA(){const{setCreateBotOpen:e,setSettingsOpen:a,setSidebarCollapsed:i}=It(),{bots:l}=Dt(),{addMessage:o,activeChatId:u}=Rn(),d=C.useCallback(h=>h.trim().startsWith("/"),[]),f=C.useCallback(h=>{u&&o(u,{id:crypto.randomUUID(),role:"assistant",content:h,timestamp:new Date().toISOString()})},[u,o]),p=C.useCallback(h=>{const g=h.trim();if(!g.startsWith("/"))return{handled:!1};const v=g.slice(1).split(/\s+/)[0].toLowerCase();switch(v){case"new":case"create":return e(!0),{handled:!0};case"settings":return a(!0),{handled:!0};case"list":case"bots":i(!1);const y=l.length>0?l.map((k,z)=>`${z+1}. **${k.name}**${k.description?` - ${k.description}`:""}`).join(`
`):"No bots yet. Use `/new` to create your first bot!";return f(`**Your Bots:**

${y}`),{handled:!0};case"help":return f("**Available Commands:**\n\n`/new` or `/create` - Create a new bot\n`/list` or `/bots` - View all your bots\n`/settings` - Open settings\n`/help` - Show this help message\n\nYou can also just type your message to chat with the active bot!"),{handled:!0,message:"help"};case"start":return f(`Welcome to CachiBot! I'm your AI assistant platform.

Here's what you can do:
- \`/new\` - Create a new bot
- \`/list\` - See your bots
- \`/help\` - Show all commands

Or just type a message to start chatting!`),{handled:!0,message:"start"};case"cancel":return{handled:!1};default:return f(`Unknown command: \`/${v}\`

Type \`/help\` to see available commands.`),{handled:!0,message:"unknown"}}},[e,a,i,l,f]);return{isCommand:d,handleCommand:p}}const Cy=["bot","brain","zap","sparkles","rocket","star","gem","flame"],Ey=["#3b82f6","#8b5cf6","#ec4899","#f97316","#22c55e","#06b6d4"];function iA(){return Cy[Math.floor(Math.random()*Cy.length)]}function rA(){return Ey[Math.floor(Math.random()*Ey.length)]}function Ty({onSendMessage:e,onCancel:a,isConnected:i}){const l=wn(),{activeChatId:o,getMessages:u,thinking:d,toolCalls:f,isLoading:p,addMessage:h,addChat:g,setActiveChat:b}=Rn(),{getActiveBot:v,activeBotId:y,bots:k,addBot:z,setActiveBot:j,setActiveView:N}=Dt(),{showThinking:D}=It(),E=y5(),{sendMessage:L,cancel:Y,isConnected:A}=nA(),{isCommand:H,handleCommand:ae}=aA(),ee=i??A,O=a??Y,[U,$]=C.useState(""),[me,V]=C.useState([]),[te,B]=C.useState(!1),[X,ce]=C.useState(0),ue=C.useRef(null),M=C.useRef(null),R=[{name:"new",description:"Create a new bot",icon:"✨"},{name:"list",description:"View all your bots",icon:"📋"},{name:"help",description:"Show available commands",icon:"❓"},{name:"settings",description:"Open settings",icon:"⚙️"},{name:"start",description:"Welcome message",icon:"👋"}],P=U.startsWith("/")?R.filter(xe=>xe.name.toLowerCase().startsWith(U.slice(1).toLowerCase())):[];C.useEffect(()=>{U==="/"||U.startsWith("/")&&U.length>1&&P.length>0?(B(!0),ce(0)):B(!1)},[U,P.length]);const T=o?u(o):[],F=v(),ge=E.step!=="idle",ye=k.map(xe=>xe.name),Z=C.useCallback(xe=>xe.map((ve,Me)=>`${Me+1}. ${ve}`).join(`
`),[]),de=C.useCallback(async xe=>{E.setLoadingNames(!0);try{const ve=await I1(ye);E.setNameSuggestions(ve),h(xe,{id:crypto.randomUUID(),role:"assistant",content:`Here are some name ideas:

${Z(ve)}

Type a number to pick one, your own name, or "more" for new suggestions.`,timestamp:new Date().toISOString()})}catch{h(xe,{id:crypto.randomUUID(),role:"assistant",content:"I had trouble generating names. Please type a name for your new bot:",timestamp:new Date().toISOString()})}finally{E.setLoadingNames(!1)}},[E,ye,Z,h]),Ne=C.useCallback((xe,ve)=>{const Me=xe.trim();if(Me.toLowerCase()==="more")return h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()}),de(ve),!0;const Be=parseInt(Me),Ie=E.data.nameSuggestions;if(!isNaN(Be)&&Be>=1&&Be<=Ie.length){const K=Ie[Be-1];h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});try{E.setName(K),h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Great, ${K} it is!

What kind of bot is this? Pick a category:

1. Work - Professional tasks, productivity, business
2. Personal - Daily life, reminders, personal assistant
3. Creative - Writing, art, brainstorming, ideas
4. Learning - Education, research, studying
5. Other - Something else entirely

Just type the number or describe it in your own words.`,timestamp:new Date().toISOString()})}catch{h(ve,{id:crypto.randomUUID(),role:"assistant",content:'That name is already taken. Please choose another name or type "more" for new suggestions.',timestamp:new Date().toISOString()})}return!0}const et=Me.toLowerCase(),Nt=ye.some(K=>K.toLowerCase()===et);if(h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()}),Nt)return h(ve,{id:crypto.randomUUID(),role:"assistant",content:'That name is already taken. Please choose a different name or type "more" for new suggestions.',timestamp:new Date().toISOString()}),!0;try{E.setName(Me),h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Great, ${Me} it is!

What kind of bot is this? Pick a category:

1. Work - Professional tasks, productivity, business
2. Personal - Daily life, reminders, personal assistant
3. Creative - Writing, art, brainstorming, ideas
4. Learning - Education, research, studying
5. Other - Something else entirely

Just type the number or describe it in your own words.`,timestamp:new Date().toISOString()})}catch{h(ve,{id:crypto.randomUUID(),role:"assistant",content:"Something went wrong. Please try a different name.",timestamp:new Date().toISOString()})}return!0},[E,ye,de,h]),it=C.useCallback((xe,ve)=>{const Me=xe.trim(),ze=E.data.name||"your bot";h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});const Be=[...me,Me];V(Be);const Ie=jh(Be);Ie&&E.setDetectedLanguage(Ie);const Nt={1:"Work",2:"Personal",3:"Creative",4:"Learning",5:"Other"}[Me]||Me;return E.setPurposeCategory(Nt),h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Got it! Now, describe what ${ze} should help you with.

For example: "Help me write professional emails" or "Be my coding buddy for Python projects"

Be as specific as you like - this helps shape ${ze}'s personality.`,timestamp:new Date().toISOString()}),!0},[E,me,h]),yt=C.useCallback((xe,ve)=>{const Me=xe.trim(),ze=E.data.name||"your bot";h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});const Be=[...me,Me];V(Be);const Ie=jh(Be);return Ie&&E.setDetectedLanguage(Ie),E.setPurposeDescription(Me),h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Nice! How should ${ze} communicate?

1. Professional - Business-appropriate, clear and concise
2. Casual - Friendly and approachable, everyday language
3. Playful - Fun, energetic, lighthearted
4. Technical - Precise, detailed, uses domain terminology

Or describe the style you want in your own words, like "Warm but concise" or "Like a patient teacher"`,timestamp:new Date().toISOString()}),!0},[E,me,h]),un=C.useCallback((xe,ve)=>{const Me=xe.trim(),ze=E.data.name||"your bot";h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});const Be=[...me,Me];V(Be);const Ie=jh(Be);Ie&&E.setDetectedLanguage(Ie);const Nt={1:"Professional",2:"Casual",3:"Playful",4:"Technical"}[Me]||Me;return E.setStyle(Nt),h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Almost done! Should ${ze} use emojis?

1. Yes - Express yourself freely with emojis
2. No - Keep it emoji-free
3. Sometimes - Use them sparingly when they add value

Type 1, 2, or 3.`,timestamp:new Date().toISOString()}),!0},[E,me,h]),Da=C.useCallback((xe,ve)=>{const Me=xe.trim(),ze=Me.toLowerCase(),Be=E.data.name||"your bot";h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});let Ie="sometimes";ze==="1"||ze==="yes"||ze==="y"?Ie="yes":ze==="2"||ze==="no"||ze==="n"?Ie="no":(ze==="3"||ze==="sometimes"||ze==="sparingly")&&(Ie="sometimes"),E.setEmoji(Ie);const et=E.data,Nt=Ie==="yes"?"Yes":Ie==="no"?"No":"Sometimes";return h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Perfect! Here's a summary of ${Be}:

**Name:** ${et.name}
**Category:** ${et.purposeCategory}
**Purpose:** ${et.purposeDescription}
**Style:** ${et.communicationStyle}
**Emojis:** ${Nt}

Type "confirm" to create ${Be}, or "back" to make changes.`,timestamp:new Date().toISOString()}),!0},[E,h]),zn=C.useCallback((xe,ve)=>{const Me=xe.trim(),ze=Me.toLowerCase(),Be=E.data,Ie=Be.name||"your bot";if(h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()}),ze==="cancel"||ze==="no"||ze==="n")return E.cancelFlow(),V([]),h(ve,{id:crypto.randomUUID(),role:"assistant",content:"No worries! Type /create when you're ready to try again.",timestamp:new Date().toISOString()}),!0;if(ze==="confirm"||ze==="yes"||ze==="y"||ze==="create"){const et=J8(Be),Nt={id:crypto.randomUUID(),name:Be.name,description:Be.purposeDescription||`A ${Be.purposeCategory} assistant`,icon:iA(),color:rA(),model:"moonshot/kimi-k2.5",systemPrompt:et,tools:["file_read","file_write","python_execute"],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),personality:{purposeCategory:Be.purposeCategory,purposeDescription:Be.purposeDescription,communicationStyle:Be.communicationStyle,useEmojis:Be.useEmojis}};z(Nt),j(Nt.id),E.confirmAndCreate(),E.completeFlow(),V([]);const K=crypto.randomUUID(),fe={id:K,botId:Nt.id,title:`Chat with ${Nt.name}`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};return g(fe),b(K),h(K,{id:crypto.randomUUID(),role:"assistant",content:`**${Nt.name}** has been created! You're now chatting with your new bot.

Say hello to see ${Nt.name}'s personality in action!`,timestamp:new Date().toISOString()}),!0}return h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Type "confirm" to create ${Ie}, or "cancel" to start over.`,timestamp:new Date().toISOString()}),!0},[E,me,h,z,j,g,b]);C.useEffect(()=>{var xe;(xe=ue.current)==null||xe.scrollIntoView({behavior:"smooth"})},[T,d,f]),C.useEffect(()=>{M.current&&(M.current.style.height="auto",M.current.style.height=Math.min(M.current.scrollHeight,200)+"px")},[U]);const Un=xe=>{if(xe.preventDefault(),!U.trim()||p)return;const ve=U.trim(),Me=ve.toLowerCase();if(H(ve)&&Me!=="/create"&&!ge&&(o&&h(o,{id:crypto.randomUUID(),role:"user",content:ve,timestamp:new Date().toISOString()}),ae(ve).handled)){$("");return}if(Me==="/create"){let ze=o;if(!ze&&y){const Be={id:crypto.randomUUID(),botId:y,title:"New Bot Creation",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};g(Be),b(Be.id),ze=Be.id}ze&&(E.startFlow(ze),V([]),h(ze,{id:crypto.randomUUID(),role:"user",content:"/create",timestamp:new Date().toISOString()}),h(ze,{id:crypto.randomUUID(),role:"assistant",content:"Let's create a new bot! I'm generating some name ideas...",timestamp:new Date().toISOString()}),de(ze)),$("");return}if(ge&&Me==="cancel"){E.cancelFlow(),V([]),o&&(h(o,{id:crypto.randomUUID(),role:"user",content:"cancel",timestamp:new Date().toISOString()}),h(o,{id:crypto.randomUUID(),role:"assistant",content:"Bot creation cancelled. Type /create to start again.",timestamp:new Date().toISOString()})),$("");return}if(ge&&o){let ze=!1;switch(E.step){case"name":ze=Ne(ve,o);break;case"purpose-category":ze=it(ve,o);break;case"purpose-description":ze=yt(ve,o);break;case"style":ze=un(ve,o);break;case"emoji":ze=Da(ve,o);break;case"summary":ze=zn(ve,o);break}if(ze){$("");return}}if(e)e(ve);else{let ze=o;if(!ze&&y){const Ie=crypto.randomUUID(),et={id:Ie,botId:y,title:ve.slice(0,50)+(ve.length>50?"...":""),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};g(et),b(Ie),ze=Ie,tA(Ie),l(`/${y}/chats/${Ie}`)}const Be={webSearch:!1,codeExecution:!0,fileOperations:!0,contacts:!1};L(ve,{systemPrompt:F==null?void 0:F.systemPrompt,botId:F==null?void 0:F.id,chatId:ze??void 0,capabilities:(F==null?void 0:F.capabilities)||Be,toolConfigs:F==null?void 0:F.toolConfigs})}$("")},kn=xe=>{var ve;$(`/${xe}`),B(!1),(ve=M.current)==null||ve.focus()},Oa=xe=>{if(te&&P.length>0){if(xe.key==="ArrowDown"){xe.preventDefault(),ce(ve=>ve<P.length-1?ve+1:0);return}if(xe.key==="ArrowUp"){xe.preventDefault(),ce(ve=>ve>0?ve-1:P.length-1);return}if(xe.key==="Tab"||xe.key==="Enter"&&!xe.shiftKey){xe.preventDefault(),kn(P[X].name);return}if(xe.key==="Escape"){xe.preventDefault(),B(!1);return}}xe.key==="Enter"&&!xe.shiftKey&&(xe.preventDefault(),Un(xe))};return o?r.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full",style:{backgroundColor:((F==null?void 0:F.color)||"#22c55e")+"30"},children:r.jsx(ta,{icon:(F==null?void 0:F.icon)||"shield",size:18,className:"text-zinc-100"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:(F==null?void 0:F.name)||"CachiBot"}),r.jsx("p",{className:"text-xs text-zinc-500",children:(F==null?void 0:F.model)||"moonshot/kimi-k2.5"})]})]}),r.jsx("button",{onClick:()=>N("settings"),className:"flex h-8 w-8 items-center justify-center rounded-lg text-zinc-500 transition-colors hover:bg-zinc-200 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200",title:"Bot settings",children:r.jsx(xo,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs("div",{className:"mx-auto max-w-3xl px-3 py-4 sm:px-4 sm:py-6",children:[T.length===0?r.jsxs("div",{className:"py-12 text-center",children:[r.jsx(Kn,{className:"mx-auto mb-4 h-8 w-8 text-cachi-500"}),r.jsx("p",{className:"text-zinc-400",children:"Start the conversation..."})]}):r.jsx("div",{className:"space-y-6",children:T.map(xe=>r.jsx(lA,{message:xe,botIcon:F==null?void 0:F.icon,botColor:F==null?void 0:F.color},xe.id))}),f.length>0&&r.jsx("div",{className:"mt-6 space-y-2",children:f.map(xe=>r.jsx(sA,{call:xe},xe.id))}),p&&!d&&f.length===0&&r.jsx("div",{className:"mt-6",children:r.jsx(cA,{botColor:F==null?void 0:F.color})}),d&&D&&r.jsx("div",{className:"mt-6",children:r.jsx(oA,{content:d})}),r.jsx("div",{ref:ue})]})}),r.jsx("div",{className:"border-t border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-3 sm:p-4",children:r.jsxs("form",{onSubmit:Un,className:"mx-auto max-w-3xl",children:[r.jsxs("div",{className:"relative rounded-2xl border border-zinc-300 bg-white shadow-lg transition-colors focus-within:border-cachi-500 dark:border-zinc-700 dark:bg-zinc-800/50",children:[te&&P.length>0&&r.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 overflow-hidden rounded-xl border border-zinc-300 bg-white shadow-xl dark:border-zinc-700 dark:bg-zinc-800",children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-zinc-500 border-b border-zinc-300 dark:text-zinc-400 dark:border-zinc-700",children:"Commands"}),r.jsx("div",{className:"max-h-48 overflow-y-auto",children:P.map((xe,ve)=>r.jsxs("button",{type:"button",onClick:()=>kn(xe.name),className:ie("flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors",ve===X?"bg-cachi-600/20 text-zinc-900 dark:text-zinc-100":"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-700/50"),children:[r.jsx("span",{className:"text-lg",children:xe.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium",children:["/",xe.name]}),r.jsx("div",{className:"text-xs text-zinc-500 truncate",children:xe.description})]}),ve===X&&r.jsx("span",{className:"text-xs text-zinc-500",children:"↵"})]},xe.name))})]}),r.jsx("textarea",{ref:M,value:U,onChange:xe=>$(xe.target.value),onKeyDown:Oa,placeholder:E.step==="name"?'Type a number (1-4), your own name, or "more"...':`Message ${(F==null?void 0:F.name)||"CachiBot"} or type / for commands...`,disabled:!ee||p||E.isLoadingNames,rows:1,className:"block w-full resize-none bg-transparent px-4 py-3 pr-24 text-zinc-900 placeholder-zinc-500 outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:text-zinc-100"}),r.jsxs("div",{className:"absolute bottom-2 right-2 flex items-center gap-1",children:[r.jsx("button",{type:"button",className:"flex h-8 w-8 items-center justify-center rounded-lg text-zinc-500 transition-colors hover:bg-zinc-200 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-700 dark:hover:text-zinc-200",title:"Attach file",children:r.jsx(Nb,{className:"h-4 w-4"})}),p?r.jsx("button",{type:"button",onClick:O,className:"flex h-8 w-8 items-center justify-center rounded-lg bg-red-600 text-white transition-colors hover:bg-red-500",title:"Stop",children:r.jsx(o4,{className:"h-4 w-4"})}):r.jsx("button",{type:"submit",disabled:!U.trim()||!ee,className:"flex h-8 w-8 items-center justify-center rounded-lg bg-cachi-600 text-white transition-colors hover:bg-cachi-500 disabled:cursor-not-allowed disabled:opacity-50",title:"Send message",children:r.jsx(Hh,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-zinc-500",children:[r.jsxs("div",{className:"flex items-center gap-2 sm:gap-4",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:ie("h-2 w-2 rounded-full",ee?"bg-green-500":"bg-red-500")}),r.jsx("span",{className:"hidden xs:inline",children:ee?"Connected":"Disconnected"})]}),r.jsx("span",{className:"truncate max-w-[120px] sm:max-w-none",children:F==null?void 0:F.model})]}),r.jsx("span",{className:"hidden sm:inline",children:"Press Enter to send, Shift+Enter for new line"})]}),ge&&r.jsx("div",{className:"mt-2 flex items-center justify-center gap-2 rounded-lg bg-cachi-900/30 px-3 py-1.5 text-xs text-cachi-400",children:E.isLoadingNames?r.jsxs(r.Fragment,{children:[r.jsx(ot,{className:"h-3 w-3 animate-spin"}),r.jsx("span",{children:"Generating name suggestions..."})]}):r.jsxs(r.Fragment,{children:[r.jsx(Kn,{className:"h-3 w-3"}),r.jsxs("span",{children:["Creating a new bot (Step: ",E.step,")... Type 'cancel' to stop"]})]})})]})})]}):r.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[r.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:r.jsxs("div",{className:"max-w-md text-center",children:[r.jsx("div",{className:"mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-2xl",style:{backgroundColor:((F==null?void 0:F.color)||"#22c55e")+"30"},children:r.jsx(ta,{icon:(F==null?void 0:F.icon)||"shield",size:48,className:"text-zinc-100"})}),r.jsxs("h2",{className:"mb-2 text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:["Welcome to ",(F==null?void 0:F.name)||"CachiBot"]}),r.jsx("p",{className:"mb-8 text-zinc-500 dark:text-zinc-400",children:(F==null?void 0:F.description)||"Start a new chat to begin working with your AI assistant."}),r.jsx("div",{className:"grid gap-3",children:["Write a Python script","Analyze this codebase","Help me debug an error"].map(xe=>r.jsxs("button",{onClick:()=>{var ve;$(xe),(ve=M.current)==null||ve.focus()},className:"flex items-center gap-3 rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 px-4 py-3 text-left text-sm text-zinc-300 transition-colors hover:border-zinc-700 hover:bg-zinc-800/50",children:[r.jsx(Kn,{className:"h-4 w-4 text-cachi-500"}),xe]},xe))})]})}),r.jsx("div",{className:"border-t border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-4",children:r.jsxs("form",{onSubmit:Un,className:"mx-auto max-w-3xl",children:[r.jsxs("div",{className:"relative rounded-2xl border border-zinc-300 bg-white shadow-lg transition-colors focus-within:border-cachi-500 dark:border-zinc-700 dark:bg-zinc-800/50",children:[te&&P.length>0&&r.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-2 overflow-hidden rounded-xl border border-zinc-300 bg-white shadow-xl dark:border-zinc-700 dark:bg-zinc-800",children:[r.jsx("div",{className:"px-3 py-2 text-xs font-medium text-zinc-500 border-b border-zinc-300 dark:text-zinc-400 dark:border-zinc-700",children:"Commands"}),r.jsx("div",{className:"max-h-48 overflow-y-auto",children:P.map((xe,ve)=>r.jsxs("button",{type:"button",onClick:()=>kn(xe.name),className:ie("flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors",ve===X?"bg-cachi-600/20 text-zinc-100":"text-zinc-300 hover:bg-zinc-700/50"),children:[r.jsx("span",{className:"text-lg",children:xe.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium",children:["/",xe.name]}),r.jsx("div",{className:"text-xs text-zinc-500 truncate",children:xe.description})]}),ve===X&&r.jsx("span",{className:"text-xs text-zinc-500",children:"↵"})]},xe.name))})]}),r.jsx("textarea",{ref:M,value:U,onChange:xe=>$(xe.target.value),onKeyDown:Oa,placeholder:`Message ${(F==null?void 0:F.name)||"CachiBot"} or type / for commands...`,disabled:!ee||p,rows:1,className:"block w-full resize-none bg-transparent px-4 py-3 pr-24 text-zinc-900 placeholder-zinc-500 outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:text-zinc-100"}),r.jsxs("div",{className:"absolute bottom-2 right-2 flex items-center gap-1",children:[r.jsx("button",{type:"button",className:"flex h-8 w-8 items-center justify-center rounded-lg text-zinc-500 transition-colors hover:bg-zinc-200 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-700 dark:hover:text-zinc-200",title:"Attach file",children:r.jsx(Nb,{className:"h-4 w-4"})}),r.jsx("button",{type:"submit",disabled:!U.trim()||!ee,className:"flex h-8 w-8 items-center justify-center rounded-lg bg-cachi-600 text-white transition-colors hover:bg-cachi-500 disabled:cursor-not-allowed disabled:opacity-50",title:"Send message",children:r.jsx(Hh,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-zinc-500",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:ie("h-2 w-2 rounded-full",ee?"bg-green-500":"bg-red-500")}),ee?"Connected":"Disconnected"]}),r.jsx("span",{children:"Press Enter to send, Shift+Enter for new line"})]})]})})]})}function lA({message:e,botIcon:a,botColor:i}){var v,y,k,z,j,N;const l=e.role==="user",[o,u]=C.useState(!1),[d,f]=C.useState(!1),{accentColor:p}=It(),h=Mm[p].palette[600],g=()=>{navigator.clipboard.writeText(e.content),u(!0),setTimeout(()=>u(!1),2e3)},b=!l&&e.metadata&&(e.metadata.tokens!==void 0||e.metadata.cost!==void 0||e.metadata.model!==void 0);return r.jsxs("div",{className:ie("group flex gap-4",l&&"flex-row-reverse"),children:[r.jsx("div",{className:ie("flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full",l?"text-white":"bg-zinc-800"),style:l?{backgroundColor:h}:i?{backgroundColor:i+"30"}:void 0,children:l?r.jsx(Eu,{className:"h-5 w-5"}):r.jsx(ta,{icon:a||"shield",size:20})}),r.jsxs("div",{className:ie("flex max-w-[80%] flex-col gap-1",l&&"items-end"),children:[r.jsxs("div",{className:ie("rounded-2xl px-4 py-3",l?"text-white":"bg-zinc-800/80 text-zinc-100"),style:l?{backgroundColor:h}:void 0,children:[l?r.jsx("div",{className:"whitespace-pre-wrap",children:e.content}):r.jsx(V8,{content:e.content}),d&&b&&r.jsx("div",{className:"mt-3 rounded-lg border border-zinc-700 bg-zinc-900 p-3 text-xs",children:r.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-zinc-400",children:[((v=e.metadata)==null?void 0:v.model)&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"Model:"}),r.jsx("span",{className:"text-zinc-200",children:String(e.metadata.model)})]}),((y=e.metadata)==null?void 0:y.tokens)!==void 0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"Tokens:"}),r.jsxs("span",{className:"text-zinc-200",children:[Number(e.metadata.tokens).toLocaleString(),(e.metadata.promptTokens!==void 0||e.metadata.completionTokens!==void 0)&&r.jsxs("span",{className:"text-zinc-500 ml-1",children:["(",Number(e.metadata.promptTokens||0).toLocaleString()," in / ",Number(e.metadata.completionTokens||0).toLocaleString()," out)"]})]})]}),((k=e.metadata)==null?void 0:k.cost)!==void 0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"Cost:"}),r.jsxs("span",{className:"text-zinc-200",children:["$",Number(e.metadata.cost).toFixed(6)]})]}),((z=e.metadata)==null?void 0:z.iterations)!==void 0&&Number(e.metadata.iterations)>1&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"Iterations:"}),r.jsx("span",{className:"text-zinc-200",children:Number(e.metadata.iterations)})]}),((j=e.metadata)==null?void 0:j.elapsedMs)!==void 0&&Number(e.metadata.elapsedMs)>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"Time:"}),r.jsx("span",{className:"text-zinc-200",children:Number(e.metadata.elapsedMs)<1e3?`${Math.round(Number(e.metadata.elapsedMs))}ms`:`${(Number(e.metadata.elapsedMs)/1e3).toFixed(1)}s`})]}),((N=e.metadata)==null?void 0:N.tokensPerSecond)!==void 0&&Number(e.metadata.tokensPerSecond)>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"Speed:"}),r.jsxs("span",{className:"text-zinc-200",children:[Number(e.metadata.tokensPerSecond).toFixed(1)," tok/s"]})]})]})})]}),r.jsxs("div",{className:"flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[r.jsxs("button",{onClick:g,className:"flex h-6 items-center gap-1 rounded px-2 text-xs text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300",children:[o?r.jsx(gm,{className:"h-3 w-3"}):r.jsx(DN,{className:"h-3 w-3"}),o?"Copied":"Copy"]}),b&&r.jsxs("button",{onClick:()=>f(!d),className:ie("flex h-6 items-center gap-1 rounded px-2 text-xs text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300",d&&"bg-zinc-800 text-zinc-300"),children:[r.jsx(wu,{className:"h-3 w-3"}),"Info"]}),!l&&r.jsxs("button",{className:"flex h-6 items-center gap-1 rounded px-2 text-xs text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300",children:[r.jsx(lu,{className:"h-3 w-3"}),"Retry"]})]})]})]})}function sA({call:e}){const[a,i]=C.useState(!1),l=e.endTime!==void 0,o=e.success===!0;return r.jsxs("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",children:[r.jsxs("button",{onClick:()=>i(!a),className:"flex w-full items-center gap-3 px-4 py-3 text-left",children:[l?o?r.jsx(gm,{className:"h-4 w-4 text-green-400"}):r.jsx(_l,{className:"h-4 w-4 text-red-400"}):r.jsx(ot,{className:"h-4 w-4 animate-spin text-blue-400"}),r.jsx($l,{className:"h-4 w-4 text-zinc-500"}),r.jsx("span",{className:"flex-1 font-mono text-sm text-zinc-300",children:e.tool}),r.jsx(po,{className:ie("h-4 w-4 text-zinc-500 transition-transform",a&&"rotate-180")})]}),a&&r.jsx("div",{className:"border-t border-zinc-800 bg-zinc-950/50 p-4",children:r.jsxs("div",{className:"space-y-3 font-mono text-xs",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-zinc-500",children:"Arguments:"}),r.jsx("pre",{className:"mt-1 overflow-x-auto rounded bg-zinc-900 p-2 text-zinc-300",children:JSON.stringify(e.args,null,2)})]}),e.result!==void 0&&r.jsxs("div",{children:[r.jsx("span",{className:"text-zinc-500",children:"Result:"}),r.jsx("pre",{className:"mt-1 overflow-x-auto rounded bg-zinc-900 p-2 text-zinc-300",children:typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2)})]})]})})]})}function oA({content:e}){return r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-purple-600/20",children:r.jsx(Vl,{className:"h-5 w-5 animate-pulse text-purple-400"})}),r.jsxs("div",{className:"flex-1 rounded-2xl bg-purple-900/20 px-4 py-3",children:[r.jsx("div",{className:"mb-1 text-xs font-medium text-purple-400",children:"Thinking..."}),r.jsx("div",{className:"text-sm text-zinc-400",children:e})]})]})}function cA({botColor:e}){return r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full animate-pulse",style:{backgroundColor:(e||"#22c55e")+"30"},children:r.jsx(ot,{className:"h-5 w-5 animate-spin",style:{color:e||"#22c55e"}})}),r.jsx("div",{className:"flex-1 rounded-2xl bg-zinc-800/50 px-4 py-3",children:r.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[r.jsx("span",{children:"Generating response"}),r.jsxs("span",{className:"flex gap-1",children:[r.jsx("span",{className:"animate-pulse",style:{animationDelay:"0ms"},children:"."}),r.jsx("span",{className:"animate-pulse",style:{animationDelay:"200ms"},children:"."}),r.jsx("span",{className:"animate-pulse",style:{animationDelay:"400ms"},children:"."})]})]})})]})}function uA(){const{getActiveBot:e}=Dt(),{getTasksByBot:a,addTask:i,updateTask:l,deleteTask:o,filter:u,setFilter:d}=Il(),[f,p]=C.useState("kanban"),[h,g]=C.useState(""),[b,v]=C.useState(!1),y=e();if(!y)return null;const z=a(y.id).filter(E=>!h||E.title.toLowerCase().includes(h.toLowerCase())),j=(E,L="todo")=>{const Y={id:crypto.randomUUID(),botId:y.id,title:E,status:L,priority:"medium",tags:[],createdAt:new Date().toISOString()};i(Y),v(!1)},N=(E,L)=>{l(E,{status:L,completedAt:L==="done"?new Date().toISOString():void 0})},D={todo:z.filter(E=>E.status==="todo").length,in_progress:z.filter(E=>E.status==="in_progress").length,done:z.filter(E=>E.status==="done").length,blocked:z.filter(E=>E.status==="blocked").length};return r.jsxs("div",{className:"flex h-full flex-col bg-zinc-950",children:[r.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Tasks"}),r.jsxs("p",{className:"text-sm text-zinc-500",children:[D.done,"/",z.length," completed"]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"flex items-center rounded-lg border border-zinc-700 bg-zinc-800/50 p-1",children:[r.jsx("button",{onClick:()=>p("kanban"),className:ie("rounded-md p-1.5 transition-colors",f==="kanban"?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:r.jsx(XN,{className:"h-4 w-4"})}),r.jsx("button",{onClick:()=>p("list"),className:ie("rounded-md p-1.5 transition-colors",f==="list"?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:r.jsx(KN,{className:"h-4 w-4"})})]}),r.jsxs("button",{onClick:()=>v(!0),className:"flex items-center gap-2 rounded-lg bg-cachi-600 px-4 py-2 text-sm font-medium text-white hover:bg-cachi-500",children:[r.jsx(Ta,{className:"h-4 w-4"}),"Add Task"]})]})]}),r.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-md",children:[r.jsx(Aa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),r.jsx("input",{type:"text",placeholder:"Search tasks...",value:h,onChange:E=>g(E.target.value),className:"h-9 w-full rounded-lg border border-zinc-700 bg-zinc-800/50 pl-10 pr-4 text-sm text-zinc-100 placeholder-zinc-500 outline-none focus:border-cachi-500"})]}),r.jsxs("select",{value:u.priority,onChange:E=>d({priority:E.target.value}),className:"h-9 rounded-lg border border-zinc-700 bg-zinc-800/50 px-3 text-sm text-zinc-300 outline-none focus:border-cachi-500",children:[r.jsx("option",{value:"all",children:"All priorities"}),r.jsx("option",{value:"high",children:"High"}),r.jsx("option",{value:"medium",children:"Medium"}),r.jsx("option",{value:"low",children:"Low"})]})]})]}),r.jsx("div",{className:"flex-1 overflow-hidden p-6",children:f==="kanban"?r.jsx(dA,{tasks:z,onMoveTask:N,onDeleteTask:o,onAddTask:j}):r.jsx(hA,{tasks:z,onMoveTask:N,onDeleteTask:o})}),b&&r.jsx(mA,{onClose:()=>v(!1),onSave:j})]})}const Km=[{id:"todo",label:"To Do",icon:MN,color:"text-zinc-400"},{id:"in_progress",label:"In Progress",icon:Nr,color:"text-blue-400"},{id:"blocked",label:"Blocked",icon:kr,color:"text-red-400"},{id:"done",label:"Done",icon:Rl,color:"text-green-400"}];function dA({tasks:e,onMoveTask:a,onDeleteTask:i,onAddTask:l}){const o=C.useMemo(()=>{const u={todo:[],in_progress:[],blocked:[],done:[]};return e.forEach(d=>{u[d.status].push(d)}),u},[e]);return r.jsx("div",{className:"flex h-full gap-4 overflow-x-auto pb-4",children:Km.map(u=>r.jsxs("div",{className:"flex w-80 flex-shrink-0 flex-col rounded-xl border border-zinc-800 bg-zinc-900/30",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-zinc-800 px-4 py-3",children:[r.jsx(u.icon,{className:ie("h-5 w-5",u.color)}),r.jsx("span",{className:"font-medium text-zinc-200",children:u.label}),r.jsx("span",{className:"ml-auto rounded-full bg-zinc-800 px-2 py-0.5 text-xs text-zinc-400",children:o[u.id].length})]}),r.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:[o[u.id].map(d=>r.jsx(fA,{task:d,onMove:a,onDelete:i},d.id)),u.id==="todo"&&r.jsxs("button",{onClick:()=>{const d=prompt("Task title:");d&&l(d,u.id)},className:"flex w-full items-center gap-2 rounded-lg border border-dashed border-zinc-700 p-3 text-sm text-zinc-500 transition-colors hover:border-cachi-500 hover:text-cachi-400",children:[r.jsx(Ta,{className:"h-4 w-4"}),"Add task"]})]})]},u.id))})}function fA({task:e,onMove:a,onDelete:i}){const[l,o]=C.useState(!1),d={high:{color:"text-red-400",bg:"bg-red-500/10"},medium:{color:"text-yellow-400",bg:"bg-yellow-500/10"},low:{color:"text-zinc-400",bg:"bg-zinc-700"}}[e.priority];return r.jsxs("div",{className:ie("group relative rounded-lg border bg-zinc-800/50 p-3 transition-all hover:border-zinc-600",e.status==="done"?"border-green-500/30":"border-zinc-700"),children:[r.jsx("div",{className:"absolute left-0 top-3 h-5 w-1 rounded-r-full bg-gradient-to-b",style:{background:e.priority==="high"?"linear-gradient(to bottom, #ef4444, #f87171)":e.priority==="medium"?"linear-gradient(to bottom, #eab308, #facc15)":"linear-gradient(to bottom, #71717a, #a1a1aa)"}}),r.jsxs("div",{className:"ml-2",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("span",{className:ie("text-sm font-medium",e.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:e.title}),r.jsx("button",{onClick:()=>o(!l),className:"flex-shrink-0 rounded p-1 text-zinc-500 opacity-0 transition-opacity hover:bg-zinc-700 group-hover:opacity-100",children:r.jsx(z1,{className:"h-4 w-4"})})]}),e.description&&r.jsx("p",{className:"mt-1 text-xs text-zinc-500 line-clamp-2",children:e.description}),e.tags.length>0&&r.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:e.tags.map(f=>r.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:f},f))}),r.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[r.jsxs("div",{className:ie("flex items-center gap-1 rounded px-1.5 py-0.5 text-xs",d.bg,d.color),children:[r.jsx(UN,{className:"h-3 w-3"}),e.priority]}),e.dueDate&&r.jsxs("div",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[r.jsx(xm,{className:"h-3 w-3"}),new Date(e.dueDate).toLocaleDateString()]})]})]}),l&&r.jsxs("div",{className:"absolute right-0 top-8 z-10 w-48 rounded-lg border border-zinc-700 bg-zinc-800 py-1 shadow-xl",children:[Km.filter(f=>f.id!==e.status).map(f=>r.jsxs("button",{onClick:()=>{a(e.id,f.id),o(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-zinc-300 hover:bg-zinc-700",children:[r.jsx(y1,{className:"h-4 w-4"}),"Move to ",f.label]},f.id)),r.jsx("div",{className:"my-1 h-px bg-zinc-700"}),r.jsxs("button",{onClick:()=>{i(e.id),o(!1)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-red-400 hover:bg-zinc-700",children:[r.jsx(ea,{className:"h-4 w-4"}),"Delete"]})]})]})}function hA({tasks:e,onMoveTask:a,onDeleteTask:i}){return r.jsxs("div",{className:"space-y-1",children:[e.map(l=>r.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-zinc-800 bg-zinc-900/30 px-4 py-3",children:[r.jsx("button",{onClick:()=>a(l.id,l.status==="done"?"todo":"done"),className:ie("flex h-5 w-5 items-center justify-center rounded border transition-colors",l.status==="done"?"border-green-500 bg-green-500 text-white":"border-zinc-600 hover:border-cachi-500"),children:l.status==="done"&&r.jsx(Rl,{className:"h-4 w-4"})}),r.jsx("span",{className:ie("flex-1",l.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:l.title}),r.jsx("div",{className:"flex items-center gap-2",children:l.tags.map(o=>r.jsx("span",{className:"rounded bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:o},o))}),r.jsx("div",{className:ie("rounded px-2 py-0.5 text-xs font-medium",l.priority==="high"&&"bg-red-500/20 text-red-400",l.priority==="medium"&&"bg-yellow-500/20 text-yellow-400",l.priority==="low"&&"bg-zinc-700 text-zinc-400"),children:l.priority}),r.jsx("select",{value:l.status,onChange:o=>a(l.id,o.target.value),className:"rounded-lg border border-zinc-700 bg-zinc-800 px-2 py-1 text-xs text-zinc-300 outline-none",children:Km.map(o=>r.jsx("option",{value:o.id,children:o.label},o.id))}),r.jsx("button",{onClick:()=>i(l.id),className:"rounded p-1 text-zinc-500 hover:bg-zinc-800 hover:text-red-400",children:r.jsx(ea,{className:"h-4 w-4"})})]},l.id)),e.length===0&&r.jsx("div",{className:"py-12 text-center text-zinc-500",children:"No tasks yet"})]})}function mA({onClose:e,onSave:a}){const[i,l]=C.useState(""),o=u=>{u.preventDefault(),i.trim()&&a(i.trim(),"todo")};return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-zinc-800 bg-zinc-900 p-6 shadow-2xl",children:[r.jsx("h2",{className:"mb-4 text-lg font-bold text-zinc-100",children:"New Task"}),r.jsxs("form",{onSubmit:o,children:[r.jsx("input",{type:"text",placeholder:"Task title...",value:i,onChange:u=>l(u.target.value),autoFocus:!0,className:"mb-4 h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 placeholder-zinc-500 outline-none focus:border-cachi-500"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:e,className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!i.trim(),className:"rounded-lg bg-cachi-600 px-4 py-2 text-sm font-medium text-white hover:bg-cachi-500 disabled:opacity-50",children:"Create Task"})]})]})]})})}const gl={timeoutSeconds:30,maxOutputLength:1e4},bl={maxFileSizeKb:1024,restrictToWorkspace:!0},zh={timeoutSeconds:30};function pA({tool:e,botId:a,currentConfigs:i,isOpen:l,onClose:o}){const{updateBot:u}=Dt(),[d,f]=C.useState(gl.timeoutSeconds),[p,h]=C.useState(gl.maxOutputLength),[g,b]=C.useState(bl.maxFileSizeKb),[v,y]=C.useState(bl.restrictToWorkspace),[k,z]=C.useState(zh.timeoutSeconds);C.useEffect(()=>{if(l){if(e.id==="python_execute"){const H=i==null?void 0:i.python_execute;f((H==null?void 0:H.timeoutSeconds)??gl.timeoutSeconds),h((H==null?void 0:H.maxOutputLength)??gl.maxOutputLength)}else if(["file_read","file_write","file_list"].includes(e.id)){const H=i==null?void 0:i[e.id];b((H==null?void 0:H.maxFileSizeKb)??bl.maxFileSizeKb),y((H==null?void 0:H.restrictToWorkspace)??bl.restrictToWorkspace)}else if(e.id==="shell_run"){const H=i==null?void 0:i.shell_run;z((H==null?void 0:H.timeoutSeconds)??zh.timeoutSeconds)}}},[l,e.id,i]);const j=()=>{const H={...i};if(e.id==="python_execute")H.python_execute={timeoutSeconds:d,maxOutputLength:p};else if(["file_read","file_write","file_list"].includes(e.id)){const ae={maxFileSizeKb:g,restrictToWorkspace:v};H[e.id]=ae}else e.id==="shell_run"&&(H.shell_run={timeoutSeconds:k});u(a,{toolConfigs:H}),o()},N=()=>{e.id==="python_execute"?(f(gl.timeoutSeconds),h(gl.maxOutputLength)):["file_read","file_write","file_list"].includes(e.id)?(b(bl.maxFileSizeKb),y(bl.restrictToWorkspace)):e.id==="shell_run"&&z(zh.timeoutSeconds)};if(!l)return null;const D=()=>r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx(Nr,{className:"h-4 w-4 text-zinc-500"}),"Timeout"]}),r.jsxs("span",{className:"text-sm text-zinc-400",children:[d,"s"]})]}),r.jsx("input",{type:"range",min:5,max:120,step:5,value:d,onChange:H=>f(Number(H.target.value)),className:"w-full accent-cachi-500"}),r.jsxs("div",{className:"flex justify-between text-xs text-zinc-500",children:[r.jsx("span",{children:"5s"}),r.jsx("span",{children:"120s"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:"Maximum execution time before the code is terminated."})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx(Ll,{className:"h-4 w-4 text-zinc-500"}),"Max Output Length"]}),r.jsxs("span",{className:"text-sm text-zinc-400",children:[(p/1e3).toFixed(0),"k chars"]})]}),r.jsx("input",{type:"range",min:1e3,max:5e4,step:1e3,value:p,onChange:H=>h(Number(H.target.value)),className:"w-full accent-cachi-500"}),r.jsxs("div",{className:"flex justify-between text-xs text-zinc-500",children:[r.jsx("span",{children:"1k"}),r.jsx("span",{children:"50k"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:"Maximum characters of output to capture from code execution."})]})]}),E=()=>r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx(Ll,{className:"h-4 w-4 text-zinc-500"}),"Max File Size"]}),r.jsxs("span",{className:"text-sm text-zinc-400",children:[g," KB"]})]}),r.jsx("input",{type:"range",min:64,max:10240,step:64,value:g,onChange:H=>b(Number(H.target.value)),className:"w-full accent-cachi-500"}),r.jsxs("div",{className:"flex justify-between text-xs text-zinc-500",children:[r.jsx("span",{children:"64 KB"}),r.jsx("span",{children:"10 MB"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:"Maximum file size that can be read or written."})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 p-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(HN,{className:"h-5 w-5 text-zinc-400"}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-zinc-200",children:"Restrict to Workspace"}),r.jsx("p",{className:"text-xs text-zinc-500",children:"Only allow operations within the workspace folder"})]})]}),r.jsx("button",{onClick:()=>y(!v),className:ie("relative h-6 w-11 rounded-full transition-colors",v?"bg-cachi-600":"bg-zinc-700"),children:r.jsx("span",{className:ie("absolute top-0.5 h-5 w-5 rounded-full bg-white transition-transform",v?"left-[22px]":"left-0.5")})})]})]}),L=()=>r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("label",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx(Nr,{className:"h-4 w-4 text-zinc-500"}),"Timeout"]}),r.jsxs("span",{className:"text-sm text-zinc-400",children:[k,"s"]})]}),r.jsx("input",{type:"range",min:5,max:120,step:5,value:k,onChange:H=>z(Number(H.target.value)),className:"w-full accent-cachi-500"}),r.jsxs("div",{className:"flex justify-between text-xs text-zinc-500",children:[r.jsx("span",{children:"5s"}),r.jsx("span",{children:"120s"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:"Maximum execution time before the shell command is terminated."})]})}),Y=()=>{switch(e.id){case"python_execute":return D();case"file_read":case"file_write":case"file_list":return E();case"shell_run":return L();default:return r.jsx("div",{className:"py-8 text-center text-zinc-500",children:"No configuration options available for this tool."})}},A=["python_execute","file_read","file_write","file_list","shell_run"].includes(e.id);return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-xl bg-zinc-900 shadow-xl",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 p-4",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold text-zinc-100",children:["Configure ",e.name]}),r.jsx("p",{className:"text-sm text-zinc-500",children:e.description})]}),r.jsx("button",{onClick:o,className:"rounded-lg p-2 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:r.jsx(xa,{className:"h-5 w-5"})})]}),r.jsx("div",{className:"p-4",children:Y()}),r.jsxs("div",{className:"flex justify-between border-t border-zinc-800 p-4",children:[r.jsxs("button",{onClick:N,disabled:!A,className:"flex items-center gap-2 rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-800 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(lu,{className:"h-4 w-4"}),"Reset to Defaults"]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("button",{onClick:o,className:"rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-800",children:"Cancel"}),r.jsxs("button",{onClick:j,disabled:!A,className:"flex items-center gap-2 rounded-lg bg-cachi-600 px-4 py-2 text-sm font-medium text-white hover:bg-cachi-500 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(vm,{className:"h-4 w-4"}),"Save"]})]})]})]})})}const xA=[{id:"file_read",name:"File Read",description:"Read contents of files in the workspace",category:"filesystem",icon:"file-text",enabled:!0,riskLevel:"safe"},{id:"file_write",name:"File Write",description:"Create or modify files in the workspace",category:"filesystem",icon:"file-pen",enabled:!0,riskLevel:"moderate"},{id:"file_delete",name:"File Delete",description:"Delete files from the workspace",category:"filesystem",icon:"trash",enabled:!1,riskLevel:"dangerous"},{id:"python_execute",name:"Python Execute",description:"Execute Python code in a sandboxed environment",category:"code",icon:"code",enabled:!0,riskLevel:"moderate"},{id:"shell_run",name:"Shell Run",description:"Run shell commands (restricted)",category:"system",icon:"terminal",enabled:!0,riskLevel:"dangerous"},{id:"web_fetch",name:"Web Fetch",description:"Fetch content from URLs",category:"web",icon:"globe",enabled:!1,riskLevel:"moderate"},{id:"web_search",name:"Web Search",description:"Search the web for information",category:"web",icon:"search",enabled:!1,riskLevel:"safe"},{id:"database_query",name:"Database Query",description:"Execute SQL queries on connected databases",category:"data",icon:"database",enabled:!1,riskLevel:"dangerous"}],eu={filesystem:{label:"Filesystem",icon:Ll},code:{label:"Code Execution",icon:$l},web:{label:"Web",icon:S1},system:{label:"System",icon:zm},data:{label:"Data",icon:yu},custom:{label:"Custom",icon:A1}};function gA(){const{getActiveBot:e,updateBot:a}=Dt(),[i,l]=C.useState(""),[o,u]=C.useState("all"),[d,f]=C.useState(null),[p,h]=C.useState(null),g=e();if(!g)return null;const b=xA.filter(z=>!(i&&!z.name.toLowerCase().includes(i.toLowerCase())||o!=="all"&&z.category!==o)),v=z=>{const j=g.tools,N=j.includes(z)?j.filter(D=>D!==z):[...j,z];a(g.id,{tools:N})},y=z=>g.tools.includes(z),k=b.reduce((z,j)=>(z[j.category]||(z[j.category]=[]),z[j.category].push(j),z),{});return r.jsxs("div",{className:"flex h-full bg-zinc-950",children:[r.jsxs("div",{className:"flex-1 overflow-y-auto",children:[r.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Tools"}),r.jsxs("p",{className:"text-sm text-zinc-500",children:[g.tools.length," tools enabled for ",g.name]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(pa,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-zinc-400",children:"Safe"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ku,{className:"h-4 w-4 text-yellow-500"}),r.jsx("span",{className:"text-zinc-400",children:"Moderate"})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(wm,{className:"h-4 w-4 text-red-500"}),r.jsx("span",{className:"text-zinc-400",children:"Dangerous"})]})]})]}),r.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Aa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),r.jsx("input",{type:"text",placeholder:"Search tools...",value:i,onChange:z=>l(z.target.value),className:"h-9 w-full rounded-lg border border-zinc-700 bg-zinc-800/50 pl-10 pr-4 text-sm text-zinc-100 placeholder-zinc-500 outline-none focus:border-cachi-500"})]}),r.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-zinc-700 bg-zinc-800/50 p-1",children:[r.jsx("button",{onClick:()=>u("all"),className:ie("rounded-md px-3 py-1 text-xs font-medium transition-colors",o==="all"?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:"All"}),Object.entries(eu).map(([z,j])=>r.jsx("button",{onClick:()=>u(z),className:ie("rounded-md px-3 py-1 text-xs font-medium transition-colors",o===z?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:j.label},z))]})]})]}),r.jsxs("div",{className:"p-6",children:[Object.entries(k).map(([z,j])=>{var N;return r.jsxs("div",{className:"mb-8",children:[r.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[(()=>{var E;const D=((E=eu[z])==null?void 0:E.icon)||A1;return r.jsx(D,{className:"h-5 w-5 text-zinc-500"})})(),r.jsx("h2",{className:"text-sm font-semibold text-zinc-300",children:((N=eu[z])==null?void 0:N.label)||z}),r.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-xs text-zinc-500",children:j.length})]}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:j.map(D=>r.jsx(bA,{tool:D,enabled:y(D.id),onToggle:()=>v(D.id),onSelect:()=>f(D),onConfigure:()=>h(D)},D.id))})]},z)}),b.length===0&&r.jsx("div",{className:"py-12 text-center text-zinc-500",children:"No tools match your search"})]})]}),d&&r.jsx(yA,{tool:d,enabled:y(d.id),onToggle:()=>v(d.id),onClose:()=>f(null)}),p&&r.jsx(pA,{tool:p,botId:g.id,currentConfigs:g.toolConfigs,isOpen:!!p,onClose:()=>h(null)})]})}function bA({tool:e,enabled:a,onToggle:i,onSelect:l,onConfigure:o}){const d={safe:{icon:pa,color:"text-green-500",bg:"bg-green-500/10"},moderate:{icon:ku,color:"text-yellow-500",bg:"bg-yellow-500/10"},dangerous:{icon:wm,color:"text-red-500",bg:"bg-red-500/10"}}[e.riskLevel],f=d.icon;return r.jsxs("div",{className:ie("group relative rounded-xl border p-4 transition-all",a?"border-cachi-500/50 bg-cachi-500/5":"border-zinc-800 bg-zinc-900/30 hover:border-zinc-700"),children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-zinc-800",children:r.jsx(Om,{toolId:e.id,className:"h-5 w-5 text-zinc-300"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium text-zinc-200",children:e.name}),r.jsxs("div",{className:ie("flex items-center gap-1 text-xs",d.color),children:[r.jsx(f,{className:"h-3 w-3"}),e.riskLevel]})]})]}),r.jsx("button",{onClick:p=>{p.stopPropagation(),i()},className:ie("transition-colors",a?"text-cachi-500":"text-zinc-600"),children:a?r.jsx(bo,{className:"h-6 w-6"}):r.jsx(go,{className:"h-6 w-6"})})]}),r.jsx("p",{className:"mt-3 text-sm text-zinc-500 line-clamp-2",children:e.description}),r.jsxs("div",{className:"mt-3 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[r.jsxs("button",{onClick:l,className:"flex items-center gap-1 rounded px-2 py-1 text-xs text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:[r.jsx(wu,{className:"h-3 w-3"}),"Details"]}),r.jsxs("button",{onClick:p=>{p.stopPropagation(),o()},className:"flex items-center gap-1 rounded px-2 py-1 text-xs text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:[r.jsx(xo,{className:"h-3 w-3"}),"Configure"]})]})]})}function yA({tool:e,enabled:a,onToggle:i,onClose:l}){var f;const u={safe:{icon:pa,color:"text-green-500",bg:"bg-green-500/10",border:"border-green-500/30"},moderate:{icon:ku,color:"text-yellow-500",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},dangerous:{icon:wm,color:"text-red-500",bg:"bg-red-500/10",border:"border-red-500/30"}}[e.riskLevel],d=u.icon;return r.jsxs("div",{className:"w-96 flex-shrink-0 border-l border-zinc-800 bg-zinc-900/50",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-4 py-3",children:[r.jsx("h2",{className:"font-semibold text-zinc-100",children:"Tool Details"}),r.jsx("button",{onClick:l,className:"rounded p-1 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:"×"})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[r.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl bg-zinc-800",children:r.jsx(Om,{toolId:e.id,className:"h-7 w-7 text-zinc-300"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-bold text-zinc-100",children:e.name}),r.jsx("p",{className:"text-sm text-zinc-500",children:((f=eu[e.category])==null?void 0:f.label)||e.category})]})]}),r.jsxs("div",{className:ie("mb-6 rounded-lg border p-4",u.bg,u.border),children:[r.jsxs("div",{className:ie("flex items-center gap-2",u.color),children:[r.jsx(d,{className:"h-5 w-5"}),r.jsxs("span",{className:"font-medium capitalize",children:[e.riskLevel," Risk"]})]}),r.jsxs("p",{className:"mt-2 text-sm text-zinc-400",children:[e.riskLevel==="safe"&&"This tool is safe to use and cannot modify system resources.",e.riskLevel==="moderate"&&"This tool can modify files or execute code. Actions may require approval.",e.riskLevel==="dangerous"&&"This tool can perform system-level operations. Use with caution."]})]}),r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Description"}),r.jsx("p",{className:"text-sm text-zinc-500",children:e.description})]}),e.parameters&&e.parameters.length>0&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h4",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Parameters"}),r.jsx("div",{className:"space-y-2",children:e.parameters.map(p=>r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono text-cachi-400",children:p.name}),r.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 text-xs text-zinc-500",children:p.type}),p.required&&r.jsx("span",{className:"rounded bg-red-500/20 px-1.5 py-0.5 text-xs text-red-400",children:"required"})]}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:p.description})]},p.name))})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:i,className:ie("flex flex-1 items-center justify-center gap-2 rounded-lg py-2 text-sm font-medium transition-colors",a?"bg-red-600/20 text-red-400 hover:bg-red-600/30":"bg-cachi-600 text-white hover:bg-cachi-500"),children:a?r.jsxs(r.Fragment,{children:[r.jsx(go,{className:"h-4 w-4"}),"Disable"]}):r.jsxs(r.Fragment,{children:[r.jsx(bo,{className:"h-4 w-4"}),"Enable"]})}),r.jsxs("button",{className:"flex items-center justify-center gap-2 rounded-lg bg-zinc-800 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-700",children:[r.jsx(zu,{className:"h-4 w-4"}),"Test"]})]})]})]})}const vA="modulepreload",wA=function(e){return"/"+e},Ay={},am=function(a,i,l){let o=Promise.resolve();if(i&&i.length>0){let d=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),p=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=d(i.map(h=>{if(h=wA(h),h in Ay)return;Ay[h]=!0;const g=h.endsWith(".css"),b=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${b}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":vA,g||(v.as="script"),v.crossOrigin="",v.href=h,p&&v.setAttribute("nonce",p),document.head.appendChild(v),g)return new Promise((y,k)=>{v.addEventListener("load",y),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return o.then(d=>{for(const f of d||[])f.status==="rejected"&&u(f.reason);return a().catch(u)})},Wm="/api";async function jA(){const e=await fetch(`${Wm}/models`);if(!e.ok)throw new Error(`Failed to fetch models: ${e.statusText}`);return(await e.json()).groups||{}}async function zA(){const e=await fetch(`${Wm}/models/default`);if(!e.ok)throw new Error(`Failed to fetch default model: ${e.statusText}`);return(await e.json()).model}async function kA(e){const a=await fetch(`${Wm}/models/default`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:e})});if(!a.ok)throw new Error(`Failed to set default model: ${a.statusText}`)}const jo=_t((e,a)=>({groups:{},defaultModel:"",loading:!0,error:null,get models(){return Object.values(a().groups).flat()},refresh:async()=>{e({loading:!0,error:null});try{const[i,l]=await Promise.all([jA(),zA()]);e({groups:i,defaultModel:l,loading:!1})}catch(i){e({error:i instanceof Error?i.message:"Failed to load models",loading:!1})}},updateDefaultModel:async i=>{try{await kA(i),e({defaultModel:i})}catch(l){e({error:l instanceof Error?l.message:"Failed to update default model"})}}})),NA={openai:"OpenAI",anthropic:"Anthropic",google:"Google",groq:"Groq",grok:"xAI Grok",openrouter:"OpenRouter",moonshot:"Moonshot AI",ollama:"Ollama",lmstudio:"LM Studio",azure:"Azure OpenAI"};function SA(e){return e?e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}K`:String(e):null}function CA(e){return NA[e]||e.charAt(0).toUpperCase()+e.slice(1)}function _u({value:e,onChange:a,placeholder:i="System Default",className:l=""}){const{groups:o,refresh:u,loading:d}=jo(),[f,p]=C.useState(!1),[h,g]=C.useState(""),[b,v]=C.useState(!1),[y,k]=C.useState(""),z=C.useRef(null),j=C.useRef(null),N=C.useRef(null),D=C.useRef(null),[E,L]=C.useState({top:0,left:0,width:0});C.useEffect(()=>{u()},[u]);const Y=C.useCallback(()=>{if(z.current){const ee=z.current.getBoundingClientRect();L({top:ee.bottom+4,left:ee.left,width:ee.width})}},[]);C.useEffect(()=>{if(!f)return;const ee=O=>{z.current&&!z.current.contains(O.target)&&j.current&&!j.current.contains(O.target)&&(p(!1),v(!1))};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[f]),C.useEffect(()=>{if(f)return Y(),window.addEventListener("scroll",Y,!0),window.addEventListener("resize",Y),()=>{window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",Y)}},[f,Y]),C.useEffect(()=>{f&&!b&&N.current&&N.current.focus()},[f,b]),C.useEffect(()=>{b&&D.current&&D.current.focus()},[b]);const A=C.useMemo(()=>{const ee=h.toLowerCase().trim();if(!ee)return o;const O={};for(const[U,$]of Object.entries(o)){const me=$.filter(V=>V.id.toLowerCase().includes(ee)||U.toLowerCase().includes(ee));me.length>0&&(O[U]=me)}return O},[o,h]),H=Object.values(A).reduce((ee,O)=>ee+O.length,0),ae=()=>{const ee=y.trim();ee&&a(ee),p(!1),v(!1),k("")};return r.jsxs("div",{className:ie("relative",l),children:[r.jsxs("button",{ref:z,type:"button",onClick:()=>{p(!f),g(""),v(!1)},className:"w-full bg-white border border-zinc-300 text-sm rounded-lg py-2 px-3 pr-8 focus:border-cachi-500 focus:outline-none text-left flex items-center justify-between gap-2 dark:bg-zinc-900 dark:border-zinc-700",children:[r.jsx("span",{className:ie("truncate",e?"text-zinc-900 font-mono text-xs dark:text-zinc-100":"text-zinc-500"),children:e||i}),r.jsx(po,{className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 h-4 w-4 pointer-events-none"})]}),f&&hm.createPortal(r.jsx("div",{ref:j,className:"fixed z-[9999] bg-white border border-zinc-300 rounded-lg shadow-xl overflow-hidden dark:bg-zinc-900 dark:border-zinc-700",style:{top:E.top,left:E.left,width:Math.max(E.width,300)},children:b?r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"text-[10px] text-zinc-500 mb-1.5 px-1",children:"Enter model in provider/model format"}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsx("input",{ref:D,type:"text",value:y,onChange:ee=>k(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&ae(),ee.key==="Escape"&&(v(!1),k(""))},placeholder:"openrouter/moonshotai/kimi-k2.5",className:"flex-1 bg-zinc-100 border border-zinc-300 text-zinc-900 text-xs font-mono rounded-md py-1.5 px-2 focus:border-cachi-500 focus:outline-none dark:bg-zinc-950 dark:border-zinc-700 dark:text-zinc-100"}),r.jsx("button",{type:"button",onClick:ae,disabled:!y.trim(),className:"bg-cachi-600 hover:bg-cachi-500 disabled:opacity-50 text-white px-2.5 py-1.5 rounded-md text-xs font-medium transition-colors",children:"Set"})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"p-2 border-b border-zinc-200 dark:border-zinc-800",children:r.jsxs("div",{className:"relative",children:[r.jsx(Aa,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-zinc-500 h-3.5 w-3.5"}),r.jsx("input",{ref:N,type:"text",value:h,onChange:ee=>g(ee.target.value),placeholder:"Search models...",className:"w-full bg-zinc-100 border border-zinc-300 text-zinc-900 text-xs rounded-md py-1.5 pl-8 pr-3 focus:border-cachi-500 focus:outline-none dark:bg-zinc-950 dark:border-zinc-700 dark:text-zinc-100"})]})}),r.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[d&&r.jsx("div",{className:"px-3 py-6 text-center text-xs text-zinc-500",children:"Discovering models..."}),!h&&!d&&r.jsxs("button",{type:"button",onClick:()=>{a(""),p(!1)},className:ie("w-full text-left px-3 py-2 text-sm hover:bg-zinc-100 transition-colors flex items-center justify-between dark:hover:bg-zinc-800",e?"text-zinc-600 dark:text-zinc-400":"text-cachi-600 dark:text-cachi-400"),children:[r.jsx("span",{children:i}),!e&&r.jsx(Wn,{className:"h-3.5 w-3.5 text-cachi-500"})]}),!d&&Object.entries(A).sort(([ee],[O])=>ee.localeCompare(O)).map(([ee,O])=>r.jsxs("div",{children:[r.jsxs("div",{className:"px-3 py-1.5 text-[10px] font-semibold text-zinc-500 uppercase tracking-wider bg-zinc-100/50 sticky top-0 dark:bg-zinc-950/50",children:[CA(ee),r.jsx("span",{className:"ml-1.5 text-zinc-400 dark:text-zinc-600",children:O.length})]}),O.map(U=>{const $=e===U.id,me=SA(U.context_window);return r.jsxs("button",{type:"button",onClick:()=>{a(U.id),p(!1)},className:ie("w-full text-left px-3 py-1.5 text-sm hover:bg-zinc-100 transition-colors flex items-center justify-between gap-2 dark:hover:bg-zinc-800",$?"text-cachi-600 bg-cachi-500/5 dark:text-cachi-400":"text-zinc-700 dark:text-zinc-300"),children:[r.jsx("span",{className:"truncate font-mono text-xs",children:U.id}),r.jsxs("span",{className:"flex items-center gap-2 shrink-0",children:[me&&r.jsx("span",{className:"text-[10px] text-zinc-500 dark:text-zinc-600",children:me}),U.supports_vision&&r.jsx("span",{className:"text-[9px] bg-zinc-200 text-zinc-600 px-1 rounded dark:bg-zinc-800 dark:text-zinc-400",children:"vision"}),U.is_reasoning&&r.jsx("span",{className:"text-[9px] bg-purple-100 text-purple-600 px-1 rounded dark:bg-purple-900/40 dark:text-purple-400",children:"reasoning"}),$&&r.jsx(Wn,{className:"h-3.5 w-3.5 text-cachi-500"})]})]},U.id)})]},ee)),!d&&H===0&&r.jsx("div",{className:"px-3 py-6 text-center text-xs text-zinc-500",children:Object.keys(o).length===0?"No models available. Configure API keys first.":"No models match your search."})]}),r.jsx("div",{className:"border-t border-zinc-200 dark:border-zinc-800",children:r.jsxs("button",{type:"button",onClick:()=>{k(e||""),v(!0)},className:"w-full text-left px-3 py-2 text-xs text-zinc-500 hover:text-zinc-700 hover:bg-zinc-100 transition-colors flex items-center gap-2 dark:hover:text-zinc-300 dark:hover:bg-zinc-800",children:[r.jsx(T1,{className:"h-3 w-3"}),"Enter manually"]})})]})}),document.body)]})}const Er="/api/bots";async function EA(e,a){const i=new FormData;i.append("file",a);const l=await fetch(`${Er}/${e}/documents/`,{method:"POST",body:i});if(!l.ok){const o=await l.json().catch(()=>({detail:"Upload failed"}));throw new Error(o.detail||`Upload failed: ${l.status}`)}return l.json()}async function TA(e){const a=await fetch(`${Er}/${e}/documents/`);if(!a.ok)throw new Error(`Failed to list documents: ${a.status}`);return a.json()}async function AA(e,a){const i=await fetch(`${Er}/${e}/documents/${a}`);if(!i.ok)throw new Error(`Failed to get document: ${i.status}`);return i.json()}async function MA(e,a){const i=await fetch(`${Er}/${e}/documents/${a}`,{method:"DELETE"});if(!i.ok)throw new Error(`Failed to delete document: ${i.status}`)}async function DA(e){const a=await fetch(`${Er}/${e}/instructions/`);if(!a.ok)throw new Error(`Failed to get instructions: ${a.status}`);return a.json()}async function OA(e,a){const i=await fetch(`${Er}/${e}/instructions/`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:a})});if(!i.ok)throw new Error(`Failed to update instructions: ${i.status}`);return i.json()}async function RA(e){const a=await fetch(`${Er}/${e}/instructions/`,{method:"DELETE"});if(!a.ok)throw new Error(`Failed to delete instructions: ${a.status}`)}const hr={documents:{upload:EA,list:TA,get:AA,delete:MA},instructions:{get:DA,update:OA,delete:RA}},e0=_t()(tn((e,a)=>({documents:{},instructions:{},loadingDocuments:{},loadingInstructions:{},uploadingBots:new Set,error:null,loadDocuments:async i=>{e(l=>({loadingDocuments:{...l.loadingDocuments,[i]:!0},error:null}));try{const l=await hr.documents.list(i);e(o=>({documents:{...o.documents,[i]:l},loadingDocuments:{...o.loadingDocuments,[i]:!1}}))}catch(l){e(o=>({loadingDocuments:{...o.loadingDocuments,[i]:!1},error:l instanceof Error?l.message:"Failed to load documents"}))}},uploadDocument:async(i,l)=>{e(o=>({uploadingBots:new Set([...o.uploadingBots,i]),error:null}));try{const o=await hr.documents.upload(i,l);return await a().loadDocuments(i),e(u=>{const d=new Set(u.uploadingBots);return d.delete(i),{uploadingBots:d}}),o.document_id}catch(o){throw e(u=>{const d=new Set(u.uploadingBots);return d.delete(i),{uploadingBots:d,error:o instanceof Error?o.message:"Upload failed"}}),o}},deleteDocument:async(i,l)=>{try{await hr.documents.delete(i,l),e(o=>({documents:{...o.documents,[i]:(o.documents[i]||[]).filter(u=>u.id!==l)}}))}catch(o){throw e({error:o instanceof Error?o.message:"Delete failed"}),o}},refreshDocument:async(i,l)=>{try{const o=await hr.documents.get(i,l);e(u=>({documents:{...u.documents,[i]:(u.documents[i]||[]).map(d=>d.id===l?o:d)}}))}catch{}},getDocuments:i=>a().documents[i]||[],loadInstructions:async i=>{e(l=>({loadingInstructions:{...l.loadingInstructions,[i]:!0},error:null}));try{const l=await hr.instructions.get(i);e(o=>({instructions:{...o.instructions,[i]:l.content},loadingInstructions:{...o.loadingInstructions,[i]:!1}}))}catch(l){e(o=>({loadingInstructions:{...o.loadingInstructions,[i]:!1},error:l instanceof Error?l.message:"Failed to load instructions"}))}},updateInstructions:async(i,l)=>{try{await hr.instructions.update(i,l),e(o=>({instructions:{...o.instructions,[i]:l}}))}catch(o){throw e({error:o instanceof Error?o.message:"Update failed"}),o}},deleteInstructions:async i=>{try{await hr.instructions.delete(i),e(l=>({instructions:{...l.instructions,[i]:""}}))}catch(l){throw e({error:l instanceof Error?l.message:"Delete failed"}),l}},getInstructions:i=>a().instructions[i]||"",clearError:()=>e({error:null})}),{name:"cachibot-knowledge",partialize:e=>({documents:e.documents,instructions:e.instructions})})),kh=[".pdf",".txt",".md"],Nh=10;function _A({botId:e}){const{uploadDocument:a,uploadingBots:i,error:l,clearError:o}=e0(),[u,d]=C.useState(!1),f=i.has(e),p=C.useCallback(async y=>{var z;const k="."+((z=y.name.split(".").pop())==null?void 0:z.toLowerCase());if(!kh.includes(k)){alert(`File type not allowed. Allowed: ${kh.join(", ")}`);return}if(y.size>Nh*1024*1024){alert(`File too large. Maximum: ${Nh}MB`);return}o();try{await a(e,y)}catch{}},[e,a,o]),h=C.useCallback(y=>{y.preventDefault(),d(!1);const k=y.dataTransfer.files[0];k&&p(k)},[p]),g=C.useCallback(y=>{y.preventDefault(),d(!0)},[]),b=C.useCallback(y=>{y.preventDefault(),d(!1)},[]),v=C.useCallback(()=>{const y=document.createElement("input");y.type="file",y.accept=kh.join(","),y.onchange=k=>{var j;const z=(j=k.target.files)==null?void 0:j[0];z&&p(z)},y.click()},[p]);return r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{onClick:f?void 0:v,onDrop:f?void 0:h,onDragOver:g,onDragLeave:b,className:`
          border-2 border-dashed rounded-lg p-6 text-center transition-colors
          ${u?"border-green-500 bg-green-500/10":"border-zinc-700"}
          ${f?"opacity-50 cursor-wait":"cursor-pointer hover:border-zinc-500"}
        `,children:f?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-green-500 border-t-transparent"}),r.jsx("p",{className:"text-sm text-zinc-400",children:"Uploading..."})]}):r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Cu,{className:"h-8 w-8 text-zinc-500"}),r.jsx("p",{className:"text-sm text-zinc-300",children:u?"Drop file here":"Drag & drop or click to upload"}),r.jsxs("p",{className:"text-xs text-zinc-500",children:["PDF, TXT, or MD files up to ",Nh,"MB"]})]})}),l&&r.jsxs("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[r.jsx(kr,{className:"h-4 w-4"}),l]})]})}function LA(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function BA(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function UA({status:e}){switch(e){case"processing":return r.jsx(Nr,{className:"h-4 w-4 text-yellow-500 animate-pulse"});case"ready":return r.jsx(gm,{className:"h-4 w-4 text-green-500"});case"failed":return r.jsx(_l,{className:"h-4 w-4 text-red-500"})}}function IA({botId:e}){const{loadDocuments:a,deleteDocument:i,refreshDocument:l,getDocuments:o,loadingDocuments:u}=e0(),d=o(e),f=u[e];return C.useEffect(()=>{a(e)},[e,a]),C.useEffect(()=>{const p=d.filter(g=>g.status==="processing");if(p.length===0)return;const h=setInterval(()=>{p.forEach(g=>{l(e,g.id)})},3e3);return()=>clearInterval(h)},[e,d,l]),f&&d.length===0?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vi,{className:"h-5 w-5 animate-spin text-zinc-500"})}):d.length===0?r.jsxs("div",{className:"text-center py-8 text-zinc-500",children:[r.jsx(Ll,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No documents uploaded yet"})]}):r.jsx("div",{className:"space-y-2",children:d.map(p=>r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-zinc-800/50 rounded-lg",children:[r.jsx(Ll,{className:"h-5 w-5 text-zinc-400 flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm text-zinc-200 truncate",children:p.filename}),r.jsxs("p",{className:"text-xs text-zinc-500",children:[LA(p.file_size),p.chunk_count>0&&` - ${p.chunk_count} chunks`," - ",BA(p.uploaded_at)]})]}),r.jsx(UA,{status:p.status}),r.jsx("button",{onClick:()=>i(e,p.id),className:"p-1.5 rounded hover:bg-zinc-700 text-zinc-400 hover:text-red-400 transition-colors",title:"Delete document",children:r.jsx(ea,{className:"h-4 w-4"})})]},p.id))})}function HA({botId:e}){const{loadInstructions:a,updateInstructions:i,getInstructions:l,loadingInstructions:o}=e0(),u=l(e),d=o[e],[f,p]=C.useState(u),[h,g]=C.useState(!1),[b,v]=C.useState(null);C.useEffect(()=>{a(e)},[e,a]),C.useEffect(()=>{p(u)},[u]);const y=f!==u,k=C.useCallback(async()=>{if(y){g(!0);try{await i(e,f),v(new Date)}catch{}finally{g(!1)}}},[e,f,y,i]);return C.useEffect(()=>{if(!y)return;const z=setTimeout(()=>{k()},2e3);return()=>clearTimeout(z)},[f,y,k]),d&&!u?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Vi,{className:"h-5 w-5 animate-spin text-zinc-500"})}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"Custom Instructions"}),r.jsxs("div",{className:"flex items-center gap-2",children:[h&&r.jsx("span",{className:"text-xs text-zinc-500",children:"Saving..."}),!h&&b&&r.jsxs("span",{className:"text-xs text-zinc-500",children:["Saved ",b.toLocaleTimeString()]}),y&&!h&&r.jsxs("button",{onClick:k,className:"flex items-center gap-1 px-2 py-1 text-xs bg-green-600 hover:bg-green-500 rounded transition-colors",children:[r.jsx(vm,{className:"h-3 w-3"}),"Save"]})]})]}),r.jsx("textarea",{value:f,onChange:z=>p(z.target.value),placeholder:"Add custom instructions that will be included in every conversation with this bot...",className:"w-full h-40 px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-sm text-zinc-200 placeholder:text-zinc-500 focus:outline-none focus:border-green-500 resize-none",maxLength:1e4}),r.jsxs("p",{className:"text-xs text-zinc-500",children:[f.length.toLocaleString()," / 10,000 characters"]})]})}const Xl="/api/bots";function h2(){const{accessToken:e}=ga.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function Jl(e,a={},i=!0){const l=await fetch(e,{headers:{"Content-Type":"application/json",...h2(),...a.headers},...a});if(l.status===401&&i&&await Tu())return Jl(e,a,!1);if(!l.ok){const o=await l.json().catch(()=>({}));throw new Error(o.detail||`Request failed: ${l.statusText}`)}return l.json()}async function m2(e,a={},i=!0){const l=await fetch(e,{headers:{...h2(),...a.headers},...a});if(l.status===401&&i&&await Tu())return m2(e,a,!1);if(!l.ok){const o=await l.json().catch(()=>({}));throw new Error(o.detail||`Request failed: ${l.statusText}`)}}async function qA(e){return Jl(`${Xl}/${e}/connections`)}async function FA(e,a){return Jl(`${Xl}/${e}/connections`,{method:"POST",body:JSON.stringify(a)})}async function PA(e,a,i){return Jl(`${Xl}/${e}/connections/${a}`,{method:"PATCH",body:JSON.stringify(i)})}async function $A(e,a){return m2(`${Xl}/${e}/connections/${a}`,{method:"DELETE"})}async function VA(e,a){return Jl(`${Xl}/${e}/connections/${a}/connect`,{method:"POST"})}async function GA(e,a){return Jl(`${Xl}/${e}/connections/${a}/disconnect`,{method:"POST"})}const yl={telegram:{name:"Telegram",description:"Connect via Telegram Bot API",tokenLabel:"Bot Token (from @BotFather)"},discord:{name:"Discord",description:"Connect via Discord Bot",tokenLabel:"Bot Token (from Discord Developer Portal)"}};function YA({botId:e}){const[a,i]=C.useState([]),[l,o]=C.useState(!0),[u,d]=C.useState(null),[f,p]=C.useState(null),[h,g]=C.useState(!1),[b,v]=C.useState([]),[y,k]=C.useState(!1),[z,j]=C.useState(null),[N,D]=C.useState(!1),[E,L]=C.useState(null),[Y,A]=C.useState("telegram"),[H,ae]=C.useState(""),[ee,O]=C.useState(""),[U,$]=C.useState(!1);C.useEffect(()=>{(async()=>{o(!0);try{const de=await qA(e);i(de)}catch(de){d(de instanceof Error?de.message:"Failed to load connections")}finally{o(!1)}})()},[e]);const me=async()=>{if(!(!H.trim()||!ee.trim())){d(null);try{const Z=await FA(e,{platform:Y,name:H.trim(),config:{token:ee.trim(),strip_markdown:U?"true":"false"}});i(de=>[Z,...de]),M()}catch(Z){d(Z instanceof Error?Z.message:"Failed to create connection")}}},V=async Z=>{if(H.trim()){d(null);try{const de={name:H.trim()},Ne={strip_markdown:U?"true":"false"};ee.trim()&&(Ne.token=ee.trim()),de.config=Ne;const it=await PA(e,Z,de);i(yt=>yt.map(un=>un.id===Z?it:un)),M()}catch(de){d(de instanceof Error?de.message:"Failed to update connection")}}},te=async Z=>{d(null);try{await $A(e,Z),i(de=>de.filter(Ne=>Ne.id!==Z))}catch(de){d(de instanceof Error?de.message:"Failed to delete connection")}},B=async Z=>{d(null),p(Z);try{const de=Dt.getState().bots.find(it=>it.id===e);de&&de.systemPrompt&&await Cm({id:de.id,name:de.name,description:de.description,icon:de.icon,color:de.color,model:de.model,systemPrompt:de.systemPrompt,capabilities:de.capabilities,createdAt:de.createdAt,updatedAt:de.updatedAt});const Ne=await VA(e,Z);i(it=>it.map(yt=>yt.id===Z?Ne:yt))}catch(de){d(de instanceof Error?de.message:"Failed to connect")}finally{p(null)}},X=async Z=>{d(null),p(Z);try{const de=await GA(e,Z);i(Ne=>Ne.map(it=>it.id===Z?de:it))}catch(de){d(de instanceof Error?de.message:"Failed to disconnect")}finally{p(null)}},ce=Z=>{L(Z.id),A(Z.platform),ae(Z.name),O(""),$(Z.strip_markdown??!1),D(!1)},ue=()=>{D(!0),L(null),A("telegram"),ae(""),O(""),$(!1)},M=()=>{D(!1),L(null),ae(""),O(""),$(!1)},R=Z=>{switch(Z){case"connected":return"text-green-400";case"connecting":return"text-yellow-400";case"error":return"text-red-400";default:return"text-zinc-500"}},P=Z=>{switch(Z){case"connected":return"Connected";case"connecting":return"Connecting...";case"error":return"Error";default:return"Disconnected"}},T=async()=>{k(!0);try{const de=(await Z1(e)).filter(Ne=>Ne.archived&&Ne.platform);v(de)}catch(Z){console.error("Failed to load archived chats:",Z)}finally{k(!1)}},F=()=>{const Z=!h;g(Z),Z&&T()},ge=async Z=>{j(Z);try{await Em(e,Z),v(de=>de.filter(Ne=>Ne.id!==Z)),Rn.getState().syncPlatformChats(e)}catch(de){d(de instanceof Error?de.message:"Failed to unarchive chat")}finally{j(null)}},ye=async Z=>{if(confirm("Permanently delete this chat and all its messages? This cannot be undone.")){j(Z);try{await Q1(e,Z),v(de=>de.filter(Ne=>Ne.id!==Z))}catch(de){d(de instanceof Error?de.message:"Failed to delete chat")}finally{j(null)}}};return l?r.jsx("div",{className:"text-sm text-zinc-500",children:"Loading connections..."}):r.jsxs("div",{className:"space-y-4",children:[u&&r.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:u}),r.jsx("div",{className:"space-y-2",children:a.map(Z=>r.jsx("div",{className:"rounded-lg border border-zinc-800 p-3",children:E===Z.id?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs text-zinc-500",children:"Name"}),r.jsx("input",{type:"text",value:H,onChange:de=>ae(de.target.value),placeholder:"Connection name",className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100",autoFocus:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"block text-xs text-zinc-500",children:[yl[Z.platform].tokenLabel," (leave blank to keep current)"]}),r.jsx("input",{type:"password",value:ee,onChange:de=>O(de.target.value),placeholder:"Enter new token to update...",className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100"})]}),r.jsxs("label",{className:"flex cursor-pointer items-center gap-2",children:[r.jsx("input",{type:"checkbox",checked:U,onChange:de=>$(de.target.checked),className:"h-4 w-4 rounded border-zinc-600 bg-zinc-800 text-cachi-500 focus:ring-cachi-500"}),r.jsxs("span",{className:"text-xs text-zinc-400",children:["Strip markdown formatting (send plain text to ",yl[Z.platform].name,")"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:()=>V(Z.id),className:"rounded bg-cachi-600 px-2 py-1 text-xs text-white hover:bg-cachi-500",children:r.jsx(Wn,{className:"h-3 w-3"})}),r.jsx("button",{onClick:M,className:"rounded bg-zinc-700 px-2 py-1 text-xs text-zinc-300 hover:bg-zinc-600",children:r.jsx(xa,{className:"h-3 w-3"})})]})]}):r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-zinc-800",children:r.jsx(lo,{className:"h-5 w-5 text-zinc-400"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-zinc-200",children:Z.name}),r.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 text-xs text-zinc-400",children:yl[Z.platform].name})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsx("span",{className:R(Z.status),children:P(Z.status)}),Z.strip_markdown&&r.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-zinc-400",children:"Plain text"}),Z.message_count>0&&r.jsxs("span",{className:"text-zinc-500",children:[Z.message_count," messages"]})]}),Z.error&&r.jsx("div",{className:"mt-1 text-xs text-red-400",children:Z.error})]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[f===Z.id?r.jsx("div",{className:"p-2",children:r.jsx(ot,{className:"h-4 w-4 animate-spin text-zinc-400"})}):Z.status==="connected"?r.jsx("button",{onClick:()=>X(Z.id),className:"rounded p-2 text-green-400 hover:bg-zinc-800 hover:text-red-400",title:"Disconnect",children:r.jsx(r4,{className:"h-4 w-4"})}):r.jsx("button",{onClick:()=>B(Z.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-green-400",title:"Connect",children:r.jsx(i4,{className:"h-4 w-4"})}),r.jsx("button",{onClick:()=>ce(Z),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300",title:"Edit",children:r.jsx(T1,{className:"h-4 w-4"})}),r.jsx("button",{onClick:()=>te(Z.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-red-400",title:"Delete",children:r.jsx(ea,{className:"h-4 w-4"})})]})]})},Z.id))}),N?r.jsxs("div",{className:"space-y-3 rounded-lg border border-zinc-700 bg-zinc-800/50 p-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs text-zinc-500",children:"Platform"}),r.jsx("select",{value:Y,onChange:Z=>A(Z.target.value),className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100",children:Object.entries(yl).map(([Z,de])=>r.jsxs("option",{value:Z,children:[de.name," - ",de.description]},Z))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs text-zinc-500",children:"Name"}),r.jsx("input",{type:"text",value:H,onChange:Z=>ae(Z.target.value),placeholder:"My Telegram Bot",className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs text-zinc-500",children:yl[Y].tokenLabel}),r.jsx("input",{type:"password",value:ee,onChange:Z=>O(Z.target.value),placeholder:"Enter bot token...",className:"w-full rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-100"})]}),r.jsxs("label",{className:"flex cursor-pointer items-center gap-2",children:[r.jsx("input",{type:"checkbox",checked:U,onChange:Z=>$(Z.target.checked),className:"h-4 w-4 rounded border-zinc-600 bg-zinc-800 text-cachi-500 focus:ring-cachi-500"}),r.jsxs("span",{className:"text-xs text-zinc-400",children:["Strip markdown formatting (send plain text to ",yl[Y].name,")"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("button",{onClick:me,disabled:!H.trim()||!ee.trim(),className:"rounded bg-cachi-600 px-3 py-1 text-xs text-white hover:bg-cachi-500 disabled:opacity-50",children:"Add Connection"}),r.jsx("button",{onClick:M,className:"rounded bg-zinc-700 px-3 py-1 text-xs text-zinc-300 hover:bg-zinc-600",children:"Cancel"})]})]}):r.jsxs("button",{onClick:ue,className:"flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-zinc-700 p-3 text-sm text-zinc-500 hover:border-zinc-600 hover:text-zinc-400",children:[r.jsx(Ta,{className:"h-4 w-4"}),"Add Connection"]}),a.length===0&&!N&&r.jsx("p",{className:"text-center text-sm text-zinc-500",children:"No connections yet. Connect your bot to Telegram or Discord."}),a.length>0&&r.jsxs("div",{className:"mt-6 border-t border-zinc-800 pt-4",children:[r.jsxs("button",{onClick:F,className:"flex w-full items-center gap-2 text-sm text-zinc-400 hover:text-zinc-300",children:[h?r.jsx(po,{className:"h-4 w-4"}):r.jsx(bu,{className:"h-4 w-4"}),r.jsx(Ih,{className:"h-4 w-4"}),r.jsx("span",{children:"Archived Chats"}),b.length>0&&r.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs",children:b.length})]}),h&&r.jsx("div",{className:"mt-3 space-y-2",children:y?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[r.jsx(ot,{className:"h-4 w-4 animate-spin"}),"Loading archived chats..."]}):b.length===0?r.jsx("p",{className:"text-sm text-zinc-500",children:`No archived chats. Use "Archive" from a chat's menu to hide it from the sidebar.`}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-xs text-zinc-500 mb-2",children:"Archived chats are hidden and won't receive new messages. Unarchive to restore them."}),b.map(Z=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 bg-zinc-800/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-zinc-700",children:r.jsx(lo,{className:"h-4 w-4 text-zinc-400"})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-zinc-300",children:Z.title}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[r.jsx("span",{className:"capitalize",children:Z.platform}),r.jsx("span",{children:"·"}),r.jsx("span",{children:"Archived"})]})]})]}),r.jsx("div",{className:"flex items-center gap-1",children:z===Z.id?r.jsx("div",{className:"p-2",children:r.jsx(ot,{className:"h-4 w-4 animate-spin text-zinc-400"})}):r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:()=>ge(Z.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-700 hover:text-green-400",title:"Unarchive (restore chat)",children:r.jsx(kN,{className:"h-4 w-4"})}),r.jsx("button",{onClick:()=>ye(Z.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-700 hover:text-red-400",title:"Delete permanently",children:r.jsx(ea,{className:"h-4 w-4"})})]})})]},Z.id))]})})]})]})}const QA="/api";class XA extends Error{constructor(a,i,l){super(a),this.status=i,this.data=l,this.name="ApiError"}}function JA(){const{accessToken:e}=ga.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function Yi(e,a={},i=!0){const l=`${QA}${e}`,o=await fetch(l,{headers:{"Content-Type":"application/json",...JA(),...a.headers},...a});if(o.status===401&&i&&await Tu())return Yi(e,a,!1);if(!o.ok){const u=await o.json().catch(()=>({}));throw new XA(u.detail||`Request failed: ${o.statusText}`,o.status,u)}if(o.status!==204)return o.json()}async function ZA(){return Yi("/skills")}async function KA(e){return Yi(`/skills/${e}`,{method:"DELETE"})}async function WA(e){return Yi("/skills/install",{method:"POST",body:JSON.stringify({url:e})})}async function eM(){return Yi("/skills/refresh",{method:"POST"})}async function tM(e){return Yi(`/bots/${e}/skills/ids`)}async function nM(e,a){return Yi(`/bots/${e}/skills`,{method:"POST",body:JSON.stringify({skillId:a})})}async function aM(e,a){return Yi(`/bots/${e}/skills/${a}`,{method:"DELETE"})}const iM=["#22c55e","#3b82f6","#8b5cf6","#ec4899","#f59e0b","#ef4444","#06b6d4","#84cc16"];function rM(){const e=wn(),{getActiveBot:a,updateBot:i,deleteBot:l}=Dt(),{settingsSection:o}=It(),[u,d]=C.useState(!1),[f,p]=C.useState(!1),h=a(),[g,b]=C.useState({name:(h==null?void 0:h.name)||"",description:(h==null?void 0:h.description)||"",icon:h==null?void 0:h.icon,color:h==null?void 0:h.color,model:(h==null?void 0:h.model)||"",systemPrompt:(h==null?void 0:h.systemPrompt)||""});if(C.useEffect(()=>{h&&b({name:h.name,description:h.description,icon:h.icon,color:h.color,model:h.model,systemPrompt:h.systemPrompt})},[h==null?void 0:h.id]),!h)return null;const v=()=>{i(h.id,g),p(!0),setTimeout(()=>p(!1),2e3)},y=()=>{l(h.id),d(!1),e("/dashboard")},k={general:"General",knowledge:"Knowledge",skills:"Skills",connections:"Connections",advanced:"Advanced",danger:"Danger Zone"};return r.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-6 py-3",children:[r.jsx("h1",{className:"text-lg font-semibold text-zinc-100",children:k[o]}),o!=="danger"&&r.jsxs("button",{onClick:v,className:ie("flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors",f?"bg-green-600 text-white":"bg-cachi-600 text-white hover:bg-cachi-500"),children:[r.jsx(vm,{className:"h-4 w-4"}),f?"Saved!":"Save"]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsxs("div",{className:"mx-auto max-w-2xl",children:[o==="general"&&r.jsx(lM,{form:g,setForm:b,onReset:()=>{b({name:pr.name,description:pr.description,icon:pr.icon,color:pr.color,model:pr.model,systemPrompt:pr.systemPrompt})}}),o==="knowledge"&&r.jsx(sM,{botId:h.id}),o==="skills"&&r.jsx(oM,{botId:h.id}),o==="connections"&&r.jsx(dM,{botId:h.id}),o==="advanced"&&r.jsx(fM,{}),o==="danger"&&r.jsx(hM,{botId:h.id,botName:h.name,onDelete:()=>d(!0)})]})}),u&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900 p-6 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[r.jsx(Bl,{className:"h-6 w-6"}),r.jsx("h2",{className:"text-lg font-bold",children:"Delete Bot"})]}),r.jsxs("p",{className:"mb-6 text-zinc-400",children:["Are you sure you want to delete ",r.jsx("strong",{className:"text-zinc-200",children:h.name}),"? This action cannot be undone."]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx("button",{onClick:()=>d(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),r.jsx("button",{onClick:y,className:"rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-500",children:"Delete Bot"})]})]})})]})}function lM({form:e,setForm:a,onReset:i}){const[l,o]=C.useState(!1);return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs("button",{onClick:()=>o(!0),className:"flex items-center gap-2 rounded-lg border border-zinc-700 px-3 py-1.5 text-xs text-zinc-400 transition-colors hover:border-zinc-600 hover:text-zinc-300",children:[r.jsx(lu,{className:"h-3 w-3"}),"Reset to Default"]})}),l&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900 p-6 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3 text-amber-400",children:[r.jsx(lu,{className:"h-6 w-6"}),r.jsx("h2",{className:"text-lg font-bold",children:"Reset General Settings"})]}),r.jsxs("p",{className:"mb-6 text-zinc-400",children:["This will reset the bot's name, description, icon, color, model, and system prompt to their default values.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{className:"text-zinc-200",children:"Connections will not be affected."})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx("button",{onClick:()=>o(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),r.jsx("button",{onClick:()=>{i(),o(!1)},className:"rounded-lg bg-amber-600 px-4 py-2 text-sm font-medium text-white hover:bg-amber-500",children:"Reset Settings"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Name"}),r.jsx("input",{type:"text",value:e.name,onChange:u=>a({...e,name:u.target.value}),className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 outline-none focus:border-cachi-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),r.jsx("textarea",{value:e.description,onChange:u=>a({...e,description:u.target.value}),rows:2,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 py-2 text-zinc-100 outline-none focus:border-cachi-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Model"}),r.jsx(_u,{value:e.model||"",onChange:u=>a({...e,model:u}),placeholder:"Use system default",className:"w-full"}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Leave empty to use the system default model"})]})]}),r.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[r.jsxs("h3",{className:"mb-4 flex items-center gap-2 text-sm font-medium text-zinc-200",children:[r.jsx(ju,{className:"h-4 w-4 text-zinc-400"}),"Appearance"]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-xs text-zinc-500",children:"Icon"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:tv.map(u=>r.jsx("button",{onClick:()=>a({...e,icon:u.id}),title:u.label,className:ie("flex h-10 w-10 items-center justify-center rounded-lg border transition-all",e.icon===u.id?"border-cachi-500 bg-cachi-500/20":"border-zinc-700 bg-zinc-800 hover:border-zinc-600"),children:r.jsx(ta,{icon:u.id,size:20})},u.id))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-xs text-zinc-500",children:"Color"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:iM.map(u=>r.jsx("button",{onClick:()=>a({...e,color:u}),className:ie("h-8 w-8 rounded-lg border-2 transition-all",e.color===u?"border-white scale-110":"border-transparent hover:scale-105"),style:{backgroundColor:u}},u))})]})]})]}),r.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[r.jsxs("h3",{className:"mb-4 flex items-center gap-2 text-sm font-medium text-zinc-200",children:[r.jsx(zr,{className:"h-4 w-4 text-zinc-400"}),"System Prompt"]}),r.jsx("textarea",{value:e.systemPrompt,onChange:u=>a({...e,systemPrompt:u.target.value}),rows:6,placeholder:"Define the bot's personality and behavior...",className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 py-3 font-mono text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"})]})]})}function sM({botId:e}){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-200",children:"Documents"}),r.jsx("p",{className:"mb-4 text-xs text-zinc-500",children:"Upload documents to give your bot specialized knowledge."}),r.jsx(_A,{botId:e}),r.jsx("div",{className:"mt-4",children:r.jsx(IA,{botId:e})})]}),r.jsx("div",{className:"border-t border-zinc-800 pt-6",children:r.jsx(HA,{botId:e})})]})}function oM({botId:e}){const[a,i]=C.useState([]),[l,o]=C.useState(new Set),[u,d]=C.useState(!0),[f,p]=C.useState(!1),[h,g]=C.useState(null),[b,v]=C.useState(""),[y,k]=C.useState(!1),z=C.useCallback(async()=>{try{g(null);const[A,H]=await Promise.all([ZA(),tM(e)]);i(A),o(new Set(H))}catch(A){g(A instanceof Error?A.message:"Failed to load skills")}finally{d(!1)}},[e]);C.useEffect(()=>{z()},[z]);const j=async()=>{p(!0);try{const A=await eM();i(A),g(null)}catch(A){g(A instanceof Error?A.message:"Failed to refresh skills")}finally{p(!1)}},N=async(A,H)=>{try{H?(await nM(e,A),o(ae=>new Set([...ae,A]))):(await aM(e,A),o(ae=>{const ee=new Set(ae);return ee.delete(A),ee}))}catch(ae){g(ae instanceof Error?ae.message:"Failed to toggle skill")}},D=async A=>{if(confirm("Are you sure you want to delete this skill?"))try{await KA(A),i(H=>H.filter(ae=>ae.id!==A)),o(H=>{const ae=new Set(H);return ae.delete(A),ae})}catch(H){g(H instanceof Error?H.message:"Failed to delete skill")}},E=A=>{i(H=>[...H,A]),k(!1)},Y=[...a.filter(A=>{if(!b)return!0;const H=b.toLowerCase();return A.name.toLowerCase().includes(H)||A.description.toLowerCase().includes(H)||A.tags.some(ae=>ae.toLowerCase().includes(H))})].sort((A,H)=>{const ae=l.has(A.id),ee=l.has(H.id);return ae&&!ee?-1:!ae&&ee?1:A.name.localeCompare(H.name)});return u?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"text-sm text-zinc-500",children:"Loading skills..."})}):r.jsxs("div",{className:"space-y-6",children:[h&&r.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:h}),r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx("p",{className:"text-sm text-zinc-400",children:"Activate skills to give your bot specialized behaviors and capabilities."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("button",{onClick:j,disabled:f,className:"flex items-center gap-1.5 rounded-lg border border-zinc-700 px-3 py-1.5 text-xs text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200 disabled:opacity-50",title:"Rescan skill directories",children:[r.jsx(Vi,{className:ie("h-3.5 w-3.5",f&&"animate-spin")}),"Refresh"]}),r.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1.5 rounded-lg bg-cachi-600 px-3 py-1.5 text-xs text-white hover:bg-cachi-500",children:[r.jsx(Pi,{className:"h-3.5 w-3.5"}),"Install"]})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx(Aa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),r.jsx("input",{type:"text",value:b,onChange:A=>v(A.target.value),placeholder:"Search skills...",className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 py-2 pl-9 pr-3 text-sm text-zinc-100 placeholder:text-zinc-500 focus:border-cachi-500 focus:outline-none"})]}),Y.length>0?r.jsx("div",{className:"space-y-3",children:Y.map(A=>r.jsx(cM,{skill:A,isActive:l.has(A.id),onToggle:N,onDelete:D,showDelete:A.source==="local"||A.source==="installed"},A.id))}):b?r.jsx("div",{className:"rounded-lg border border-dashed border-zinc-700 p-8 text-center",children:r.jsx("p",{className:"text-sm text-zinc-500",children:"No skills match your search."})}):r.jsxs("div",{className:"rounded-lg border border-dashed border-zinc-700 p-8 text-center",children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-zinc-800",children:r.jsx(Kn,{className:"h-6 w-6 text-zinc-500"})}),r.jsx("h3",{className:"mb-2 font-medium text-zinc-300",children:"No skills available"}),r.jsxs("p",{className:"mb-4 text-sm text-zinc-500",children:["Create SKILL.md files in ",r.jsx("code",{className:"text-zinc-400",children:"~/.claude/skills/"})," ","or install from a URL."]}),r.jsxs("div",{className:"flex justify-center gap-3",children:[r.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1.5 rounded-lg bg-cachi-600 px-4 py-2 text-sm text-white hover:bg-cachi-500",children:[r.jsx(Pi,{className:"h-4 w-4"}),"Install Skill"]}),r.jsxs("a",{href:"https://skills.sh",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:[r.jsx(k1,{className:"h-4 w-4"}),"Browse skills.sh"]})]})]}),l.size>0&&r.jsxs("div",{className:"text-center text-xs text-zinc-500",children:[l.size," skill",l.size!==1?"s":""," active"]}),y&&r.jsx(uM,{onClose:()=>k(!1),onInstalled:E})]})}function cM({skill:e,isActive:a,onToggle:i,onDelete:l,showDelete:o}){return r.jsx("div",{className:ie("rounded-lg border p-4 transition-colors",a?"border-cachi-500/50 bg-cachi-500/5":"border-zinc-700 bg-zinc-800/30"),children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-medium text-zinc-200",children:e.name}),e.version&&r.jsxs("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:["v",e.version]}),r.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-500",children:e.source})]}),r.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:e.description}),e.tags.length>0&&r.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:e.tags.map(u=>r.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 text-xs text-zinc-500",children:u},u))}),e.requiresTools.length>0&&r.jsxs("div",{className:"mt-2 text-xs text-zinc-500",children:["Requires: ",e.requiresTools.join(", ")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[o&&r.jsx("button",{onClick:()=>l(e.id),className:"rounded p-1 text-zinc-500 hover:bg-zinc-700 hover:text-red-400",title:"Delete skill",children:r.jsx(xa,{className:"h-4 w-4"})}),r.jsx("button",{onClick:()=>i(e.id,!a),className:a?"text-cachi-500":"text-zinc-600",children:a?r.jsx(bo,{className:"h-8 w-8"}):r.jsx(go,{className:"h-8 w-8"})})]})]})})}function uM({onClose:e,onInstalled:a}){const[i,l]=C.useState(""),[o,u]=C.useState(!1),[d,f]=C.useState(null),p=async()=>{if(i.trim()){u(!0),f(null);try{const h=await WA(i.trim());a(h)}catch(h){f(h instanceof Error?h.message:"Failed to install skill")}finally{u(!1)}}};return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:r.jsxs("div",{className:"w-full max-w-md rounded-xl bg-zinc-900 shadow-xl",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 p-4",children:[r.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Install Skill"}),r.jsx("button",{onClick:e,className:"rounded-lg p-2 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:r.jsx(xa,{className:"h-5 w-5"})})]}),r.jsxs("div",{className:"p-4 space-y-4",children:[d&&r.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:d}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Skill URL or skills.sh identifier"}),r.jsx("input",{type:"text",value:i,onChange:h=>l(h.target.value),placeholder:"https://... or skills.sh/skill-name",className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 placeholder:text-zinc-500 focus:border-cachi-500 focus:outline-none"}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Enter a URL to a skill markdown file or a skills.sh identifier."})]})]}),r.jsxs("div",{className:"flex justify-end gap-3 border-t border-zinc-800 p-4",children:[r.jsx("button",{onClick:e,className:"rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-800",children:"Cancel"}),r.jsx("button",{onClick:p,disabled:!i.trim()||o,className:"flex items-center gap-2 rounded-lg bg-cachi-600 px-4 py-2 text-sm font-medium text-white hover:bg-cachi-500 disabled:opacity-50",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Vi,{className:"h-4 w-4 animate-spin"}),"Installing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Pi,{className:"h-4 w-4"}),"Install"]})})]})]})})}function dM({botId:e}){return r.jsx("div",{className:"space-y-6",children:r.jsxs("div",{children:[r.jsx("p",{className:"mb-4 text-sm text-zinc-400",children:"Connect your bot to messaging platforms like Telegram and Discord to send and receive messages."}),r.jsx(YA,{botId:e})]})})}function fM(){return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Temperature"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",defaultValue:"0.7",className:"flex-1"}),r.jsx("span",{className:"w-12 text-center text-sm text-zinc-400",children:"0.7"})]}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Lower = focused, higher = creative"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Max Iterations"}),r.jsx("input",{type:"number",defaultValue:20,min:1,max:50,className:"h-10 w-32 rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 outline-none focus:border-cachi-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Approval Mode"}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"radio",name:"approval",defaultChecked:!0,className:"text-cachi-500"}),r.jsx("span",{className:"text-sm text-zinc-300",children:"Auto-approve safe actions"})]}),r.jsxs("label",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"radio",name:"approval",className:"text-cachi-500"}),r.jsx("span",{className:"text-sm text-zinc-300",children:"Approve all actions"})]})]})]})]})}function hM({botId:e,botName:a,onDelete:i}){const[l,o]=C.useState(!1),[u,d]=C.useState(null),f=async()=>{o(!0),d(null);try{const{exportBot:p}=await am(async()=>{const{exportBot:y}=await Promise.resolve().then(()=>Ph);return{exportBot:y}},[]),h=await p(e),g=new Blob([JSON.stringify(h,null,2)],{type:"application/json"}),b=URL.createObjectURL(g),v=document.createElement("a");v.href=b,v.download=`${a.toLowerCase().replace(/\s+/g,"-")}-export.json`,document.body.appendChild(v),v.click(),document.body.removeChild(v),URL.revokeObjectURL(b)}catch(p){d(p instanceof Error?p.message:"Failed to export bot")}finally{o(!1)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-900/50 p-6",children:[r.jsx("h3",{className:"text-lg font-semibold text-zinc-200",children:"Export Bot"}),r.jsx("p",{className:"mt-2 text-sm text-zinc-400",children:"Download this bot's configuration as a JSON file. You can import it later to recreate the bot."}),u&&r.jsx("p",{className:"mt-2 text-sm text-red-400",children:u}),r.jsxs("button",{onClick:f,disabled:l,className:"mt-4 flex items-center gap-2 rounded-lg border border-zinc-600 bg-zinc-800 px-4 py-2 text-sm font-medium text-zinc-200 hover:bg-zinc-700 disabled:opacity-50",children:[r.jsx(Pi,{className:"h-4 w-4"}),l?"Exporting...":"Export Configuration"]})]}),r.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-6",children:[r.jsx("h3",{className:"text-lg font-semibold text-red-400",children:"Delete this bot"}),r.jsxs("p",{className:"mt-2 text-sm text-zinc-400",children:["Once you delete ",r.jsx("strong",{className:"text-zinc-200",children:a}),", there is no going back. All chats, jobs, and tasks will be permanently deleted."]}),r.jsxs("button",{onClick:i,className:"mt-4 flex items-center gap-2 rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-500",children:[r.jsx(ea,{className:"h-4 w-4"}),"Delete Bot"]})]})]})}function mM(){var k,z;const[e,a]=C.useState("7d"),{bots:i}=Dt(),{chats:l,messages:o}=Rn(),{jobs:u}=$h(),{tasks:d}=Il(),{stats:f}=fu(),p=Object.values(o).reduce((j,N)=>j+N.length,0),h=u.filter(j=>j.status==="running").length,g=d.filter(j=>j.status==="done").length,b=d.filter(j=>j.status==="todo").length,v=l.length,y=i.map(j=>{const N=l.filter(A=>A.botId===j.id),D=N.reduce((A,H)=>{var ae;return A+(((ae=o[H.id])==null?void 0:ae.length)||0)},0),E=u.filter(A=>A.botId===j.id),L=d.filter(A=>A.botId===j.id),Y=f.byBot[j.id]||{tokens:0,cost:0};return{bot:j,chats:N.length,messages:D,jobs:E.length,activeJobs:E.filter(A=>A.status==="running").length,tasks:L.length,completedTasks:L.filter(A=>A.status==="done").length,connections:N.length,tokens:Y.tokens,cost:Y.cost}});return r.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-200 dark:border-zinc-800 px-6 py-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-900 dark:text-zinc-100",children:"Dashboard"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Overview of your bots and activity"})]}),r.jsx("div",{className:"flex items-center gap-1 rounded-lg bg-zinc-200 dark:bg-zinc-900 p-1",children:["24h","7d","30d","all"].map(j=>r.jsx("button",{onClick:()=>a(j),className:ie("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",e===j?"bg-cachi-600 text-white":"text-zinc-400 hover:text-zinc-200"),children:j==="all"?"All Time":j},j))})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsxs("div",{className:"mx-auto max-w-6xl space-y-6",children:[r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(mr,{icon:ii,label:"Active Bots",value:i.length,trend:"+0",trendUp:!0,color:"green"}),r.jsx(mr,{icon:$i,label:"Total Messages",value:p.toLocaleString(),subValue:`${l.length} chats`,color:"blue"}),r.jsx(mr,{icon:Vl,label:"Tokens Used",value:tu(f.totalTokens),subValue:`${f.totalMessages} API calls`,color:"purple"}),r.jsx(mr,{icon:ON,label:"Total Cost",value:`$${f.totalCost.toFixed(4)}`,subValue:"estimated",color:"amber"})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[r.jsx(mr,{icon:b1,label:"Active Jobs",value:h,subValue:`${u.length} total`,color:"blue",small:!0}),r.jsx(mr,{icon:jm,label:"Tasks Completed",value:g,subValue:`${b} pending`,color:"green",small:!0}),r.jsx(mr,{icon:ym,label:"Connections",value:v,subValue:`${i.length} bots`,color:"cyan",small:!0})]}),r.jsxs("section",{children:[r.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[r.jsx(ii,{className:"h-5 w-5 text-zinc-400"}),"Bot Performance"]}),r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:y.map(({bot:j,chats:N,messages:D,activeJobs:E,completedTasks:L,tokens:Y,cost:A,connections:H})=>r.jsx(pM,{bot:j,chats:N,messages:D,activeJobs:E,completedTasks:L,tokens:Y,cost:A,connections:H},j.id))})]}),r.jsxs("section",{children:[r.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[r.jsx(ru,{className:"h-5 w-5 text-zinc-400"}),"Usage Over Time"]}),r.jsx("div",{className:"rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-6",children:f.daily.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-end gap-1",style:{height:120},children:f.daily.slice(-14).map(j=>{const N=Math.max(...f.daily.map(E=>E.tokens)),D=N>0?Math.max(j.tokens/N*120,5):5;return r.jsxs("div",{className:"group relative h-full flex-1",children:[r.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-t bg-green-600 transition-all hover:bg-green-500",style:{height:D}}),r.jsxs("div",{className:"pointer-events-none absolute -top-8 left-1/2 z-10 -translate-x-1/2 whitespace-nowrap rounded bg-zinc-800 px-2 py-1 text-xs text-zinc-300 opacity-0 transition-opacity group-hover:opacity-100",children:[tu(j.tokens)," tokens"]})]},j.date)})}),r.jsxs("div",{className:"flex justify-between text-xs text-zinc-600",children:[r.jsx("span",{children:(k=f.daily[Math.max(0,f.daily.length-14)])==null?void 0:k.date}),r.jsx("span",{children:(z=f.daily[f.daily.length-1])==null?void 0:z.date})]})]}):r.jsx("div",{className:"flex h-32 items-center justify-center text-zinc-500",children:r.jsxs("div",{className:"text-center",children:[r.jsx(ru,{className:"mx-auto mb-2 h-8 w-8 text-zinc-600"}),r.jsx("p",{children:"No usage data yet"}),r.jsx("p",{className:"text-xs text-zinc-600",children:"Start chatting to see analytics"})]})})})]}),Object.keys(f.byModel).length>0&&r.jsxs("section",{children:[r.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[r.jsx(w1,{className:"h-5 w-5 text-zinc-400"}),"Model Usage"]}),r.jsx("div",{className:"rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",children:r.jsx("div",{className:"divide-y divide-zinc-800",children:Object.entries(f.byModel).sort((j,N)=>N[1].tokens-j[1].tokens).map(([j,N])=>r.jsxs("div",{className:"flex items-center justify-between px-5 py-3",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-zinc-200",children:j}),r.jsxs("p",{className:"text-xs text-zinc-500",children:[N.messages," messages"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"font-mono text-sm text-zinc-200",children:tu(N.tokens)}),r.jsxs("p",{className:"text-xs text-zinc-500",children:["$",N.cost.toFixed(4)]})]})]},j))})})]})]})})]})}function mr({icon:e,label:a,value:i,subValue:l,trend:o,trendUp:u,color:d,small:f}){const p={green:"bg-green-500/10 text-green-400",blue:"bg-blue-500/10 text-blue-400",purple:"bg-purple-500/10 text-purple-400",amber:"bg-amber-500/10 text-amber-400",cyan:"bg-cyan-500/10 text-cyan-400",red:"bg-red-500/10 text-red-400"};return r.jsxs("div",{className:ie("rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",f?"p-4":"p-5"),children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx("div",{className:ie("flex items-center justify-center rounded-lg",p[d],f?"h-9 w-9":"h-10 w-10"),children:r.jsx(e,{className:f?"h-4 w-4":"h-5 w-5"})}),o&&r.jsxs("div",{className:ie("flex items-center gap-0.5 text-xs font-medium",u?"text-green-400":"text-red-400"),children:[o,r.jsx(SN,{className:ie("h-3 w-3",!u&&"rotate-90")})]})]}),r.jsxs("div",{className:f?"mt-3":"mt-4",children:[r.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-zinc-500",children:a}),r.jsx("p",{className:ie("font-bold text-zinc-100",f?"mt-0.5 text-xl":"mt-1 text-2xl"),children:i}),l&&r.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:l})]})]})}function pM({bot:e,chats:a,messages:i,activeJobs:l,completedTasks:o,tokens:u,cost:d,connections:f}){return r.jsxs("div",{className:"rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:r.jsx(ta,{icon:e.icon,size:22,color:e.color})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"truncate font-semibold text-zinc-100",children:e.name}),r.jsx("p",{className:"truncate text-xs text-zinc-500",children:e.model})]})]}),r.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[r.jsx(Vc,{icon:$i,value:i,label:"messages"}),r.jsx(Vc,{icon:Vl,value:tu(u),label:"tokens"}),r.jsx(Vc,{icon:b1,value:l,label:"active jobs"}),r.jsx(Vc,{icon:jm,value:o,label:"completed"})]}),r.jsxs("div",{className:"mt-3 flex items-center justify-between border-t border-zinc-800 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-3 text-xs text-zinc-500",children:[r.jsxs("span",{children:[a," chats"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ym,{className:"h-3 w-3"}),f]})]}),r.jsxs("div",{className:"text-xs font-medium text-zinc-400",children:["$",d.toFixed(4)]})]})]})}function Vc({icon:e,value:a,label:i}){return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(e,{className:"h-3.5 w-3.5 text-zinc-600"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-zinc-200",children:a}),r.jsx("span",{className:"ml-1 text-xs text-zinc-600",children:i})]})]})}function tu(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}const t0=_t(e=>({config:null,setConfig:a=>e({config:a}),updateConfig:a=>e(i=>i.config?{config:{...i.config,agent:{...i.config.agent,...a.model!==void 0&&{model:a.model},...a.maxIterations!==void 0&&{maxIterations:a.maxIterations},...a.approveActions!==void 0&&{approveActions:a.approveActions},...a.temperature!==void 0&&{temperature:a.temperature}},display:{...i.config.display,...a.showThinking!==void 0&&{showThinking:a.showThinking},...a.showCost!==void 0&&{showCost:a.showCost}}}}:i)})),Wt=C.forwardRef(({className:e,variant:a="primary",size:i="md",disabled:l,...o},u)=>r.jsx("button",{ref:u,disabled:l,className:ie("inline-flex items-center justify-center font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cachi-500 focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","rounded-lg",{"bg-cachi-600 text-white hover:bg-cachi-700 active:bg-cachi-800":a==="primary","bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700":a==="secondary","hover:bg-zinc-100 dark:hover:bg-zinc-800":a==="ghost","bg-red-600 text-white hover:bg-red-700 active:bg-red-800":a==="danger"},{"h-8 px-3 text-sm":i==="sm","h-10 px-4 text-sm":i==="md","h-12 px-6 text-base":i==="lg"},e),...o}));Wt.displayName="Button";const xM=["general","appearance","models","advanced","data","users"];function gM(){const{settingsTab:e}=n1(),a=wn(),{theme:i,setTheme:l,accentColor:o,setAccentColor:u,showThinking:d,setShowThinking:f,showCost:p,setShowCost:h,sidebarCollapsed:g,setSidebarCollapsed:b}=It(),{config:v}=t0(),{user:y}=ga(),k=(y==null?void 0:y.role)==="admin",j=!e||!xM.includes(e)||e==="users"&&!k?"general":e;C.useEffect(()=>{e&&j!==e&&a("/settings/general",{replace:!0})},[e,j,a]);const N=E=>{a(`/settings/${E}`)},D=[{id:"general",label:"General",icon:xo},{id:"appearance",label:"Appearance",icon:ju},{id:"models",label:"Models",icon:zr},{id:"advanced",label:"Advanced",icon:Nu},{id:"data",label:"Data & Privacy",icon:yu},...k?[{id:"users",label:"Users",icon:Nm}]:[]];return r.jsxs("div",{className:"flex h-full flex-col bg-zinc-50 dark:bg-zinc-950",children:[r.jsx("div",{className:"flex items-center justify-between border-b border-zinc-300 px-6 py-4 dark:border-zinc-800",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-900 dark:text-zinc-100",children:"Settings"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Configure CachiBot preferences"})]})}),r.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[r.jsx("nav",{className:"w-56 border-r border-zinc-300 p-4 dark:border-zinc-800",children:r.jsx("div",{className:"space-y-1",children:D.map(E=>r.jsxs("button",{onClick:()=>N(E.id),className:ie("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",j===E.id?"bg-accent-600/20 text-accent-600 dark:text-accent-400":"text-zinc-600 hover:bg-zinc-200 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200"),children:[r.jsx(E.icon,{className:"h-4 w-4"}),E.label]},E.id))})}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsxs("div",{className:"mx-auto max-w-2xl space-y-8",children:[j==="general"&&r.jsx(bM,{showThinking:d,setShowThinking:f,showCost:p,setShowCost:h,config:v}),j==="appearance"&&r.jsx(yM,{theme:i,setTheme:l,accentColor:o,setAccentColor:u,sidebarCollapsed:g,setSidebarCollapsed:b}),j==="models"&&r.jsx(vM,{}),j==="advanced"&&r.jsx(wM,{config:v}),j==="data"&&r.jsx(jM,{}),j==="users"&&k&&r.jsx(kM,{currentUser:y})]})})]})]})}function bM({showThinking:e,setShowThinking:a,showCost:i,setShowCost:l,config:o}){return r.jsxs(r.Fragment,{children:[r.jsx(Yt,{icon:vu,title:"Display Options",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(xr,{label:"Show Thinking Process",description:"Display the AI's reasoning and thought process",checked:e,onChange:a}),r.jsx(xr,{label:"Show Token Costs",description:"Display estimated costs for API calls",checked:i,onChange:l})]})}),r.jsx(Yt,{icon:CN,title:"Notifications",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(xr,{label:"Desktop Notifications",description:"Get notified when tasks complete",checked:!1,onChange:()=>{}}),r.jsx(xr,{label:"Sound Effects",description:"Play sounds for important events",checked:!1,onChange:()=>{}})]})}),r.jsx(Yt,{icon:qN,title:"Workspace",children:r.jsx("div",{className:"space-y-4",children:r.jsxs(ni,{label:"Workspace Path",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",value:(o==null?void 0:o.workspacePath)||"./workspace",readOnly:!0,className:"h-10 flex-1 rounded-lg border border-zinc-300 bg-zinc-100 px-4 text-zinc-900 outline-none dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100"}),r.jsx("button",{className:"rounded-lg bg-zinc-200 px-4 text-sm text-zinc-700 hover:bg-zinc-300 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700",children:"Browse"})]}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Directory where bots can read and write files"})]})})})]})}function yM({theme:e,setTheme:a,accentColor:i,setAccentColor:l,sidebarCollapsed:o,setSidebarCollapsed:u}){const d=[{value:"light",label:"Light",icon:c4},{value:"dark",label:"Dark",icon:n4},{value:"system",label:"System",icon:t4}],f=Object.entries(Mm);return r.jsxs(r.Fragment,{children:[r.jsx(Yt,{icon:ju,title:"Theme",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(ni,{label:"Color Theme",children:r.jsx("div",{className:"flex gap-2",children:d.map(p=>r.jsxs("button",{onClick:()=>a(p.value),className:ie("flex flex-1 items-center justify-center gap-2 rounded-lg border py-3 transition-all",e===p.value?"border-accent-500 bg-accent-500/20 text-accent-600 dark:text-accent-400":"border-zinc-300 bg-zinc-100 text-zinc-600 hover:border-zinc-400 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:border-zinc-600"),children:[r.jsx(p.icon,{className:"h-4 w-4"}),p.label]},p.value))})}),r.jsx(ni,{label:"Accent Color",children:r.jsx("div",{className:"grid grid-cols-4 gap-2",children:f.map(([p,{name:h,palette:g}])=>r.jsxs("button",{onClick:()=>l(p),className:ie("flex items-center gap-2 rounded-lg border p-3 transition-all",i===p?"border-2 ring-1 ring-offset-1 ring-offset-zinc-900":"border-zinc-300 hover:border-zinc-400 dark:border-zinc-700 dark:hover:border-zinc-600"),style:{borderColor:i===p?g[500]:void 0,"--tw-ring-color":i===p?g[500]:void 0},children:[r.jsx("div",{className:"h-5 w-5 rounded-full",style:{backgroundColor:g[500]}}),r.jsx("span",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:h})]},p))})})]})}),r.jsx(Yt,{icon:Nu,title:"Layout",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(xr,{label:"Collapse Sidebar by Default",description:"Start with sidebar in compact mode",checked:o,onChange:u}),r.jsx(ni,{label:"Chat Message Style",children:r.jsxs("select",{className:"h-10 w-full rounded-lg border border-zinc-300 bg-zinc-100 px-4 text-zinc-900 outline-none focus:border-accent-500 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100",children:[r.jsx("option",{value:"detailed",children:"Detailed (with metadata)"}),r.jsx("option",{value:"compact",children:"Compact"}),r.jsx("option",{value:"minimal",children:"Minimal"})]})})]})}),r.jsx(Yt,{icon:$l,title:"Code Display",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(ni,{label:"Code Font",children:r.jsxs("select",{className:"h-10 w-full rounded-lg border border-zinc-300 bg-zinc-100 px-4 text-zinc-900 outline-none focus:border-accent-500 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100",children:[r.jsx("option",{value:"jetbrains-mono",children:"JetBrains Mono"}),r.jsx("option",{value:"fira-code",children:"Fira Code"}),r.jsx("option",{value:"monaco",children:"Monaco"}),r.jsx("option",{value:"consolas",children:"Consolas"})]})}),r.jsx(xr,{label:"Enable Ligatures",description:"Display programming ligatures in code",checked:!0,onChange:()=>{}})]})})]})}function vM(){const{defaultModel:e,updateDefaultModel:a,refresh:i}=jo();C.useEffect(()=>{i()},[i]);const l=async o=>{o&&await a(o)};return r.jsxs(r.Fragment,{children:[r.jsx(Yt,{icon:zr,title:"Default Model",children:r.jsx("div",{className:"space-y-4",children:r.jsxs(ni,{label:"System Default Model",children:[r.jsx(_u,{value:e,onChange:l,placeholder:"Select default model...",className:"w-full"}),r.jsx("p",{className:"mt-2 text-xs text-zinc-500",children:"This model will be used when no specific model is configured for a bot. Click the star icon on any model in the Models page to set it as default."})]})})}),r.jsx(Yt,{icon:wu,title:"Model Information",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-300 bg-zinc-100/50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50",children:[r.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Model Discovery"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"CachiBot automatically discovers available models from your configured API keys. Configure API keys for providers like OpenAI, Anthropic, Google, Groq, and more to unlock their models."})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-300 bg-zinc-100/50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50",children:[r.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Model Capabilities"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Each model has different capabilities including vision support, tool use, structured output, and reasoning. Check the Models page for detailed information."})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-300 bg-zinc-100/50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50",children:[r.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Custom Models"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:'You can enter custom model IDs manually using the "Enter manually" option in the model selector. Use the format: provider/model-id'})]})]})})]})}function wM({config:e}){return r.jsxs(r.Fragment,{children:[r.jsx(Yt,{icon:pa,title:"Security",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(xr,{label:"Require Approval for Actions",description:"Ask before executing potentially dangerous operations",checked:(e==null?void 0:e.agent.approveActions)??!0,onChange:()=>{}}),r.jsx(ni,{label:"Sandbox Timeout",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"number",value:(e==null?void 0:e.sandbox.timeoutSeconds)??30,className:"h-10 w-24 rounded-lg border border-zinc-300 bg-zinc-100 px-4 text-zinc-900 outline-none focus:border-cachi-500 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100"}),r.jsx("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"seconds"})]})})]})}),r.jsx(Yt,{icon:Nu,title:"AI Configuration",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs(ni,{label:"Default Temperature",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",defaultValue:(e==null?void 0:e.agent.temperature)??.7,className:"flex-1"}),r.jsx("span",{className:"w-12 text-center text-sm text-zinc-400",children:(e==null?void 0:e.agent.temperature)??.7})]}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Controls randomness in responses (0 = deterministic, 1 = creative)"})]}),r.jsxs(ni,{label:"Max Iterations",children:[r.jsx("input",{type:"number",value:(e==null?void 0:e.agent.maxIterations)??20,min:1,max:100,className:"h-10 w-32 rounded-lg border border-zinc-300 bg-zinc-100 px-4 text-zinc-900 outline-none focus:border-cachi-500 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100"}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Maximum tool calls per conversation turn"})]})]})}),r.jsx(Yt,{icon:GN,title:"Keyboard Shortcuts",children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(vl,{label:"New Chat",shortcut:"Ctrl + N"}),r.jsx(vl,{label:"Toggle Sidebar",shortcut:"Ctrl + B"}),r.jsx(vl,{label:"Command Palette",shortcut:"Ctrl + K"}),r.jsx(vl,{label:"Settings",shortcut:"Ctrl + ,"}),r.jsx(vl,{label:"Send Message",shortcut:"Enter"}),r.jsx(vl,{label:"New Line",shortcut:"Shift + Enter"})]})})]})}function jM(){const[e,a]=C.useState(!1),i=()=>{const o={bots:localStorage.getItem("cachibot-bots"),chats:localStorage.getItem("cachibot-chats"),jobs:localStorage.getItem("cachibot-jobs"),tasks:localStorage.getItem("cachibot-tasks"),connections:localStorage.getItem("cachibot-connections"),ui:localStorage.getItem("cachibot-ui"),usage:localStorage.getItem("cachibot-usage"),exportedAt:new Date().toISOString()},u=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),d=URL.createObjectURL(u),f=document.createElement("a");f.href=d,f.download=`cachibot-backup-${new Date().toISOString().split("T")[0]}.json`,f.click(),URL.revokeObjectURL(d)},l=()=>{localStorage.removeItem("cachibot-bots"),localStorage.removeItem("cachibot-chats"),localStorage.removeItem("cachibot-jobs"),localStorage.removeItem("cachibot-tasks"),localStorage.removeItem("cachibot-connections"),localStorage.removeItem("cachibot-usage"),window.location.reload()};return r.jsxs(r.Fragment,{children:[r.jsx(Yt,{icon:yu,title:"Data Management",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-300 bg-zinc-100/50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Export Data"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Download all your data as a JSON file"})]}),r.jsxs("button",{onClick:i,className:"flex items-center gap-2 rounded-lg bg-cachi-600 px-4 py-2 text-sm font-medium text-white hover:bg-cachi-500",children:[r.jsx(Pi,{className:"h-4 w-4"}),"Export"]})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-300 bg-zinc-100/50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Import Data"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Restore from a previous backup"})]}),r.jsxs("button",{className:"flex items-center gap-2 rounded-lg bg-zinc-300 px-4 py-2 text-sm font-medium text-zinc-800 hover:bg-zinc-400 dark:bg-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-600",children:[r.jsx(Cu,{className:"h-4 w-4"}),"Import"]})]})]})}),r.jsx(zM,{}),r.jsx(Yt,{icon:Vi,title:"Cache",children:r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-300 bg-zinc-100/50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Clear Cache"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Remove cached responses and temporary data"})]}),r.jsxs("button",{className:"flex items-center gap-2 rounded-lg bg-zinc-300 px-4 py-2 text-sm font-medium text-zinc-800 hover:bg-zinc-400 dark:bg-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-600",children:[r.jsx(Vi,{className:"h-4 w-4"}),"Clear"]})]})})}),r.jsx(Yt,{icon:Bl,title:"Danger Zone",danger:!0,children:r.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-4",children:[r.jsx("h4",{className:"font-medium text-red-400",children:"Delete All Data"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Permanently delete all bots, chats, jobs, tasks, and settings. This cannot be undone."}),r.jsxs("button",{onClick:()=>a(!0),className:"mt-3 flex items-center gap-2 rounded-lg bg-red-600/20 px-4 py-2 text-sm text-red-400 hover:bg-red-600/30",children:[r.jsx(ea,{className:"h-4 w-4"}),"Delete Everything"]})]})}),r.jsx(Yt,{icon:wu,title:"About",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Version"}),r.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:"0.1.0"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Build"}),r.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:"dev"})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Documentation"}),r.jsxs("a",{href:"https://github.com/jhd3197/CachiBot",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-cachi-600 hover:text-cachi-500 dark:text-cachi-400 dark:hover:text-cachi-300",children:["GitHub",r.jsx(k1,{className:"h-3 w-3"})]})]})]})}),e&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900 p-6 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[r.jsx(Bl,{className:"h-6 w-6"}),r.jsx("h2",{className:"text-lg font-bold",children:"Delete All Data"})]}),r.jsx("p",{className:"mb-6 text-zinc-400",children:"Are you sure you want to delete all your data? This will remove all bots, chats, jobs, tasks, connections, and settings."}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx("button",{onClick:()=>a(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),r.jsx("button",{onClick:l,className:"rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-500",children:"Delete Everything"})]})]})})]})}function zM(){const{bots:e}=Dt(),{chats:a,messages:i}=Rn(),{jobs:l}=$h(),{tasks:o}=Il(),{connections:u}=K8(),{stats:d,clearBotStats:f}=fu(),[p,h]=C.useState(new Set),[g,b]=C.useState(new Map),[v,y]=C.useState(!1),[k,z]=C.useState(!1),[j,N]=C.useState({}),[D,E]=C.useState(!1);C.useEffect(()=>{(async()=>{E(!0);const te={};for(const B of e)try{const{getPlatformChats:X}=await am(async()=>{const{getPlatformChats:ue}=await Promise.resolve().then(()=>Ph);return{getPlatformChats:ue}},void 0),ce=await X(B.id);te[B.id]=ce.length}catch{te[B.id]=0}N(te),E(!1)})()},[e]);const L=C.useMemo(()=>e.map(V=>{const te=a.filter(F=>F.botId===V.id),B=te.filter(F=>!F.platform),X=te.filter(F=>F.platform),ce=B.reduce((F,ge)=>{var ye;return F+(((ye=i[ge.id])==null?void 0:ye.length)||0)},0),ue=l.filter(F=>F.botId===V.id),M=o.filter(F=>F.botId===V.id),R=!!d.byBot[V.id],P=j[V.id]||0,T=Math.max(P,X.length);return{botId:V.id,botName:V.name,botColor:V.color||"#22c55e",chatsCount:B.length,messagesCount:ce,jobsCount:ue.length,tasksCount:M.length,hasUsageData:R,platformChatsCount:T}}),[e,a,i,l,o,d.byBot,j]),Y=V=>u.filter(te=>te.botId===V).length,A=V=>{h(te=>{const B=new Set(te);return B.has(V)?B.delete(V):B.add(V),B})},H=(V,te)=>{b(B=>{const X=new Map(B),ce=X.get(V)||new Set,ue=new Set(ce);return ue.has(te)?ue.delete(te):ue.add(te),ue.size===0?X.delete(V):X.set(V,ue),X})},ae=(V,te)=>{b(B=>{const X=new Map(B),ce=new Set;return te.chatsCount>0&&ce.add("chats"),te.jobsCount>0&&ce.add("jobs"),te.tasksCount>0&&ce.add("tasks"),te.hasUsageData&&ce.add("usage"),te.platformChatsCount>0&&ce.add("platform"),ce.size>0&&X.set(V,ce),X})},ee=V=>{b(te=>{const B=new Map(te);return B.delete(V),B})},O=g.size>0,U=()=>{let V=0;return g.forEach((te,B)=>{const X=L.find(ce=>ce.botId===B);X&&(te.has("chats")&&(V+=X.chatsCount),te.has("jobs")&&(V+=X.jobsCount),te.has("tasks")&&(V+=X.tasksCount),te.has("usage")&&(V+=1),te.has("platform")&&(V+=X.platformChatsCount))}),V},$=async()=>{z(!0);const V=Rn.getState(),te=$h.getState(),B=Il.getState();for(const[X,ce]of g)if(ce.has("chats")&&a.filter(M=>M.botId===X&&!M.platform).forEach(M=>{V.deleteChat(M.id)}),ce.has("jobs")&&l.filter(M=>M.botId===X).forEach(M=>{te.deleteJob(M.id)}),ce.has("tasks")&&o.filter(M=>M.botId===X).forEach(M=>{B.deleteTask(M.id)}),ce.has("usage")&&f(X),ce.has("platform")){a.filter(M=>M.botId===X&&M.platform).forEach(M=>{V.deleteChat(M.id)});try{const{clearBotPlatformData:M}=await am(async()=>{const{clearBotPlatformData:R}=await Promise.resolve().then(()=>Ph);return{clearBotPlatformData:R}},void 0);await M(X),N(R=>({...R,[X]:0}))}catch(M){console.error("Failed to clear platform data:",M),Xe.error("Failed to clear platform data for bot")}}await new Promise(X=>setTimeout(X,300)),z(!1),y(!1),b(new Map),Xe.success("Selected data cleared successfully")},me={chats:{icon:$i,label:"Local Chats",color:"text-blue-400"},jobs:{icon:TN,label:"Jobs",color:"text-purple-400"},tasks:{icon:M1,label:"Tasks",color:"text-green-400"},usage:{icon:ru,label:"Usage Stats",color:"text-amber-400"},platform:{icon:$i,label:"Platform Messages",color:"text-cyan-400"}};return r.jsxs(Yt,{icon:ii,title:"Bot Data Manager",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-zinc-500",children:["Clear specific data for each bot while keeping bot settings and connections intact.",D&&r.jsxs("span",{className:"ml-2 text-zinc-400",children:[r.jsx(ot,{className:"inline h-3 w-3 animate-spin mr-1"}),"Loading platform data..."]})]}),r.jsx("div",{className:"space-y-2",children:L.map(V=>{const te=p.has(V.botId),B=g.get(V.botId),X=Y(V.botId),ce=V.chatsCount>0||V.jobsCount>0||V.tasksCount>0||V.hasUsageData||V.platformChatsCount>0;return r.jsxs("div",{className:"rounded-lg border border-zinc-300 bg-zinc-100/30 overflow-hidden dark:border-zinc-700 dark:bg-zinc-800/30",children:[r.jsxs("button",{onClick:()=>A(V.botId),className:"flex w-full items-center gap-3 p-3 hover:bg-zinc-200/50 transition-colors dark:hover:bg-zinc-800/50",children:[te?r.jsx(po,{className:"h-4 w-4 text-zinc-500"}):r.jsx(bu,{className:"h-4 w-4 text-zinc-500"}),r.jsx("div",{className:"h-8 w-8 rounded-lg flex items-center justify-center",style:{backgroundColor:V.botColor+"20"},children:r.jsx(ii,{className:"h-4 w-4",style:{color:V.botColor}})}),r.jsxs("div",{className:"flex-1 text-left",children:[r.jsx("div",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:V.botName}),r.jsxs("div",{className:"text-xs text-zinc-500",children:[V.chatsCount," local chats · ",V.jobsCount," jobs · ",V.tasksCount," tasks",V.platformChatsCount>0&&r.jsxs("span",{className:"text-cyan-400",children:[" · ",V.platformChatsCount," platform chats"]}),X>0&&r.jsxs("span",{className:"text-green-400",children:[" · ",X," connections (preserved)"]})]})]}),B&&B.size>0&&r.jsxs("span",{className:"rounded-full bg-red-500/20 px-2 py-0.5 text-xs text-red-400",children:[B.size," selected"]})]}),te&&r.jsx("div",{className:"border-t border-zinc-300 p-3 dark:border-zinc-700",children:ce?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex gap-2 mb-3",children:[r.jsx("button",{onClick:()=>ae(V.botId,V),className:"text-xs text-zinc-500 hover:text-zinc-800 transition-colors dark:text-zinc-400 dark:hover:text-zinc-200",children:"Select all"}),r.jsx("span",{className:"text-zinc-400 dark:text-zinc-600",children:"·"}),r.jsx("button",{onClick:()=>ee(V.botId),className:"text-xs text-zinc-500 hover:text-zinc-800 transition-colors dark:text-zinc-400 dark:hover:text-zinc-200",children:"Clear selection"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[V.chatsCount>0&&r.jsx(Zs,{category:"chats",config:me.chats,count:V.chatsCount,detail:`${V.messagesCount} messages`,selected:(B==null?void 0:B.has("chats"))||!1,onToggle:()=>H(V.botId,"chats")}),V.jobsCount>0&&r.jsx(Zs,{category:"jobs",config:me.jobs,count:V.jobsCount,selected:(B==null?void 0:B.has("jobs"))||!1,onToggle:()=>H(V.botId,"jobs")}),V.tasksCount>0&&r.jsx(Zs,{category:"tasks",config:me.tasks,count:V.tasksCount,selected:(B==null?void 0:B.has("tasks"))||!1,onToggle:()=>H(V.botId,"tasks")}),V.hasUsageData&&r.jsx(Zs,{category:"usage",config:me.usage,count:1,detail:"statistics",selected:(B==null?void 0:B.has("usage"))||!1,onToggle:()=>H(V.botId,"usage")}),V.platformChatsCount>0&&r.jsx(Zs,{category:"platform",config:me.platform,count:V.platformChatsCount,detail:"Telegram/Discord",selected:(B==null?void 0:B.has("platform"))||!1,onToggle:()=>H(V.botId,"platform")})]}),X>0&&r.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-green-400/80",children:[r.jsx(pa,{className:"h-3 w-3"}),r.jsxs("span",{children:[X," connection",X!==1?"s":""," will be preserved"]})]})]}):r.jsx("p",{className:"text-sm text-zinc-500 text-center py-2",children:"No data to clear for this bot"})})]},V.botId)})}),O&&r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-red-500/30 bg-red-500/5 p-3",children:[r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"text-red-400 font-medium",children:U()}),r.jsx("span",{className:"text-zinc-400",children:" items selected for deletion"})]}),r.jsxs("button",{onClick:()=>y(!0),className:"flex items-center gap-2 rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-500 transition-colors",children:[r.jsx(ea,{className:"h-4 w-4"}),"Clear Selected"]})]})]}),v&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900 p-6 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[r.jsx(Bl,{className:"h-6 w-6"}),r.jsx("h2",{className:"text-lg font-bold",children:"Clear Bot Data"})]}),r.jsx("p",{className:"mb-4 text-zinc-400",children:"Are you sure you want to clear the selected data? This action cannot be undone."}),r.jsx("div",{className:"mb-6 rounded-lg border border-zinc-700 bg-zinc-800/50 p-3 space-y-2",children:Array.from(g.entries()).map(([V,te])=>{const B=L.find(X=>X.botId===V);return B?r.jsxs("div",{className:"text-sm",children:[r.jsxs("span",{className:"font-medium text-zinc-200",children:[B.botName,":"]}),r.jsx("span",{className:"text-zinc-400 ml-2",children:Array.from(te).map(X=>me[X].label).join(", ")})]},V):null})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx("button",{onClick:()=>y(!1),disabled:k,className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800 disabled:opacity-50",children:"Cancel"}),r.jsx("button",{onClick:$,disabled:k,className:"flex items-center gap-2 rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-500 disabled:opacity-50",children:k?r.jsxs(r.Fragment,{children:[r.jsx(ot,{className:"h-4 w-4 animate-spin"}),"Clearing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(ea,{className:"h-4 w-4"}),"Clear Data"]})})]})]})})]})}function Zs({config:e,count:a,detail:i,selected:l,onToggle:o}){const u=e.icon;return r.jsxs("button",{onClick:o,className:ie("flex items-center gap-2 rounded-lg border p-2 transition-all text-left",l?"border-red-500/50 bg-red-500/10":"border-zinc-300 bg-zinc-100/50 hover:border-zinc-400 dark:border-zinc-700 dark:bg-zinc-800/50 dark:hover:border-zinc-600"),children:[r.jsx("div",{className:ie("h-6 w-6 rounded flex items-center justify-center transition-colors",l?"bg-red-500/20":"bg-zinc-300 dark:bg-zinc-700"),children:l?r.jsx(Wn,{className:"h-3.5 w-3.5 text-red-400"}):r.jsx(u,{className:ie("h-3.5 w-3.5",e.color)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:ie("text-sm font-medium",l?"text-red-400":"text-zinc-800 dark:text-zinc-200"),children:e.label}),r.jsxs("div",{className:"text-xs text-zinc-500",children:[a," ",i||(a===1?"item":"items")]})]})]})}function kM({currentUser:e}){const[a,i]=C.useState([]),[l,o]=C.useState(!0),[u,d]=C.useState(0),[f,p]=C.useState(!1),[h,g]=C.useState({email:"",username:"",password:"",role:"user"}),[b,v]=C.useState(!1),[y,k]=C.useState(null),[z,j]=C.useState({email:"",username:"",role:"user"}),[N,D]=C.useState(!1),[E,L]=C.useState(null);C.useEffect(()=>{Y()},[]);const Y=async()=>{try{const O=await O1();i(O.users),d(O.total)}catch{Xe.error("Failed to load users")}finally{o(!1)}},A=async O=>{if(O.preventDefault(),!h.email||!h.username||!h.password){Xe.error("All fields are required");return}if(h.password.length<8){Xe.error("Password must be at least 8 characters");return}v(!0);try{const U=await R1(h);i([U,...a]),d(u+1),p(!1),g({email:"",username:"",password:"",role:"user"}),Xe.success("User created successfully")}catch(U){const $=U instanceof Error?U.message:"Failed to create user";Xe.error($)}finally{v(!1)}},H=async O=>{if(O.preventDefault(),!!y){D(!0);try{const U=await _1(y.id,z);i(a.map($=>$.id===U.id?U:$)),k(null),Xe.success("User updated successfully")}catch(U){const $=U instanceof Error?U.message:"Failed to update user";Xe.error($)}finally{D(!1)}}},ae=async O=>{if(confirm("Are you sure you want to deactivate this user?")){try{await L1(O),i(a.map(U=>U.id===O?{...U,is_active:!1}:U)),Xe.success("User deactivated")}catch(U){const $=U instanceof Error?U.message:"Failed to deactivate user";Xe.error($)}L(null)}},ee=O=>{k(O),j({email:O.email,username:O.username,role:O.role}),L(null)};return l?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(ot,{className:"h-8 w-8 animate-spin text-cachi-500"})}):r.jsxs(r.Fragment,{children:[r.jsx(Yt,{icon:Nm,title:"User Management",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("p",{className:"text-sm text-zinc-400",children:[u," user",u!==1?"s":""," total"]}),r.jsxs(Wt,{onClick:()=>p(!0),size:"sm",children:[r.jsx(km,{className:"h-4 w-4 mr-2"}),"Add User"]})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-300 overflow-hidden dark:border-zinc-700",children:[r.jsxs("div",{className:"grid grid-cols-[1fr_1fr_80px_80px_40px] gap-2 px-4 py-2 bg-zinc-100/50 text-xs text-zinc-500 font-medium dark:bg-zinc-800/50 dark:text-zinc-400",children:[r.jsx("div",{children:"User"}),r.jsx("div",{children:"Email"}),r.jsx("div",{children:"Role"}),r.jsx("div",{children:"Status"}),r.jsx("div",{})]}),a.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-zinc-500 text-sm",children:"No users found"}):a.map(O=>r.jsxs("div",{className:"grid grid-cols-[1fr_1fr_80px_80px_40px] gap-2 px-4 py-2.5 border-t border-zinc-300 items-center hover:bg-zinc-100/30 transition-colors dark:border-zinc-700 dark:hover:bg-zinc-800/30",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx("div",{className:"w-7 h-7 rounded-full bg-zinc-300 flex items-center justify-center flex-shrink-0 dark:bg-zinc-700",children:r.jsx(iu,{className:"h-3.5 w-3.5 text-zinc-500 dark:text-zinc-400"})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-medium text-sm truncate text-zinc-800 dark:text-zinc-100",children:O.username}),O.id===(e==null?void 0:e.id)&&r.jsx("div",{className:"text-xs text-cachi-600 dark:text-cachi-400",children:"You"})]})]}),r.jsx("div",{className:"text-zinc-500 text-sm truncate dark:text-zinc-400",children:O.email}),r.jsx("div",{children:r.jsxs("span",{className:ie("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",O.role==="admin"?"bg-purple-500/20 text-purple-300":"bg-zinc-700 text-zinc-300"),children:[O.role==="admin"?r.jsx(pa,{className:"h-3 w-3"}):r.jsx(Eu,{className:"h-3 w-3"}),O.role]})}),r.jsx("div",{children:r.jsxs("span",{className:ie("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",O.is_active?"bg-green-500/20 text-green-300":"bg-red-500/20 text-red-300"),children:[O.is_active?r.jsx(Wn,{className:"h-3 w-3"}):r.jsx(xa,{className:"h-3 w-3"}),O.is_active?"Active":"Off"]})}),r.jsxs("div",{className:"relative",children:[r.jsx("button",{onClick:()=>L(E===O.id?null:O.id),className:"p-1 hover:bg-zinc-200 rounded transition-colors disabled:opacity-50 dark:hover:bg-zinc-700",disabled:O.id===(e==null?void 0:e.id),children:r.jsx(j1,{className:"h-4 w-4 text-zinc-500 dark:text-zinc-400"})}),E===O.id&&r.jsxs("div",{className:"absolute right-0 top-full mt-1 w-36 bg-white border border-zinc-300 rounded-lg shadow-lg py-1 z-20 dark:bg-zinc-800 dark:border-zinc-700",children:[r.jsx("button",{onClick:()=>ee(O),className:"w-full px-3 py-1.5 text-left text-sm hover:bg-zinc-100 transition-colors text-zinc-700 dark:text-zinc-100 dark:hover:bg-zinc-700",children:"Edit User"}),O.is_active&&r.jsx("button",{onClick:()=>ae(O.id),className:"w-full px-3 py-1.5 text-left text-sm text-red-500 hover:bg-zinc-100 transition-colors dark:text-red-400 dark:hover:bg-zinc-700",children:"Deactivate"})]})]})]},O.id))]})]})}),f&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"bg-white rounded-xl border border-zinc-300 p-6 w-full max-w-md mx-4 dark:bg-zinc-900 dark:border-zinc-800",children:[r.jsx("h2",{className:"text-lg font-semibold mb-4 text-zinc-900 dark:text-zinc-100",children:"Create New User"}),r.jsxs("form",{onSubmit:A,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Email"}),r.jsxs("div",{className:"relative",children:[r.jsx(C1,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),r.jsx("input",{type:"email",value:h.email,onChange:O=>g({...h,email:O.target.value}),className:"w-full pl-10 pr-3 py-2 bg-zinc-100 border border-zinc-300 rounded-lg text-zinc-900 focus:outline-none focus:ring-2 focus:ring-cachi-500 dark:bg-zinc-800 dark:border-zinc-700 dark:text-white",required:!0})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Username"}),r.jsxs("div",{className:"relative",children:[r.jsx(iu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),r.jsx("input",{type:"text",value:h.username,onChange:O=>g({...h,username:O.target.value}),className:"w-full pl-10 pr-3 py-2 bg-zinc-100 border border-zinc-300 rounded-lg text-zinc-900 focus:outline-none focus:ring-2 focus:ring-cachi-500 dark:bg-zinc-800 dark:border-zinc-700 dark:text-white",required:!0,minLength:3,maxLength:32})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Password"}),r.jsx("input",{type:"password",value:h.password,onChange:O=>g({...h,password:O.target.value}),className:"w-full px-3 py-2 bg-zinc-100 border border-zinc-300 rounded-lg text-zinc-900 focus:outline-none focus:ring-2 focus:ring-cachi-500 dark:bg-zinc-800 dark:border-zinc-700 dark:text-white",required:!0,minLength:8,placeholder:"Min. 8 characters"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Role"}),r.jsxs("select",{value:h.role,onChange:O=>g({...h,role:O.target.value}),className:"w-full px-3 py-2 bg-zinc-100 border border-zinc-300 rounded-lg text-zinc-900 focus:outline-none focus:ring-2 focus:ring-cachi-500 dark:bg-zinc-800 dark:border-zinc-700 dark:text-white",children:[r.jsx("option",{value:"user",children:"User"}),r.jsx("option",{value:"admin",children:"Admin"})]})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[r.jsx(Wt,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>p(!1),children:"Cancel"}),r.jsx(Wt,{type:"submit",className:"flex-1",disabled:b,children:b?r.jsx(ot,{className:"h-4 w-4 animate-spin"}):"Create User"})]})]})]})}),y&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"bg-white rounded-xl border border-zinc-300 p-6 w-full max-w-md mx-4 dark:bg-zinc-900 dark:border-zinc-800",children:[r.jsx("h2",{className:"text-lg font-semibold mb-4 text-zinc-900 dark:text-zinc-100",children:"Edit User"}),r.jsxs("form",{onSubmit:H,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Email"}),r.jsx("input",{type:"email",value:z.email,onChange:O=>j({...z,email:O.target.value}),className:"w-full px-3 py-2 bg-zinc-100 border border-zinc-300 rounded-lg text-zinc-900 focus:outline-none focus:ring-2 focus:ring-cachi-500 dark:bg-zinc-800 dark:border-zinc-700 dark:text-white",required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Username"}),r.jsx("input",{type:"text",value:z.username,onChange:O=>j({...z,username:O.target.value}),className:"w-full px-3 py-2 bg-zinc-100 border border-zinc-300 rounded-lg text-zinc-900 focus:outline-none focus:ring-2 focus:ring-cachi-500 dark:bg-zinc-800 dark:border-zinc-700 dark:text-white",required:!0,minLength:3,maxLength:32})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Role"}),r.jsxs("select",{value:z.role,onChange:O=>j({...z,role:O.target.value}),className:"w-full px-3 py-2 bg-zinc-100 border border-zinc-300 rounded-lg text-zinc-900 focus:outline-none focus:ring-2 focus:ring-cachi-500 dark:bg-zinc-800 dark:border-zinc-700 dark:text-white",children:[r.jsx("option",{value:"user",children:"User"}),r.jsx("option",{value:"admin",children:"Admin"})]})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[r.jsx(Wt,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>k(null),children:"Cancel"}),r.jsx(Wt,{type:"submit",className:"flex-1",disabled:N,children:N?r.jsx(ot,{className:"h-4 w-4 animate-spin"}):"Save Changes"})]})]})]})}),E&&r.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>L(null)})]})}function Yt({icon:e,title:a,danger:i,children:l}){return r.jsxs("div",{className:"rounded-xl border border-zinc-300 bg-white dark:border-zinc-800 dark:bg-zinc-900/30",children:[r.jsxs("div",{className:ie("flex items-center gap-2 border-b px-5 py-4",i?"border-red-500/30":"border-zinc-300 dark:border-zinc-800"),children:[r.jsx(e,{className:ie("h-5 w-5",i?"text-red-400":"text-zinc-500 dark:text-zinc-400")}),r.jsx("h3",{className:ie("font-semibold",i?"text-red-400":"text-zinc-800 dark:text-zinc-200"),children:a})]}),r.jsx("div",{className:"p-5",children:l})]})}function ni({label:e,children:a}){return r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:e}),a]})}function xr({label:e,description:a,checked:i,onChange:l}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:e}),r.jsx("p",{className:"text-sm text-zinc-500",children:a})]}),r.jsx("button",{onClick:()=>l(!i),className:ie("relative h-6 w-11 rounded-full transition-colors",i?"bg-accent-600":"bg-zinc-300 dark:bg-zinc-700"),children:r.jsx("span",{className:ie("absolute top-1 h-4 w-4 rounded-full bg-white transition-transform",i?"left-6":"left-1")})})]})}function vl({label:e,shortcut:a}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-zinc-700 dark:text-zinc-300",children:e}),r.jsx("kbd",{className:"rounded bg-zinc-200 px-2 py-1 font-mono text-xs text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",children:a})]})}const NM={openai:"OpenAI",anthropic:"Anthropic",google:"Google",groq:"Groq",grok:"xAI Grok",openrouter:"OpenRouter",moonshot:"Moonshot AI",ollama:"Ollama",lmstudio:"LM Studio",azure:"Azure OpenAI",zai:"Z.ai (Zhipu)",modelscope:"ModelScope",local_http:"Local HTTP"};function My(e){return e?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:e.toString():"—"}function Dy(e){return e==null?"—":e===0?"free":e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(4)}`.replace(/0+$/,"")}function Sh({icon:e,label:a,active:i}){return i?r.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded bg-zinc-200 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",children:[r.jsx(e,{className:"h-3 w-3"}),a]}):null}function SM(){const{groups:e,defaultModel:a,loading:i,refresh:l,updateDefaultModel:o}=jo(),[u,d]=C.useState(""),[f,p]=C.useState({});C.useEffect(()=>{l()},[l]);const h={};for(const[z,j]of Object.entries(e)){const N=j.filter(D=>D.id.toLowerCase().includes(u.toLowerCase()));N.length>0&&(h[z]=N)}const g=Object.values(e).reduce((z,j)=>z+j.length,0),b=Object.values(h).reduce((z,j)=>z+j.length,0),v=Object.keys(e).length,y=z=>p(j=>({...j,[z]:!j[z]})),k=async z=>{await o(z)};return r.jsxs("div",{className:"flex h-full flex-col bg-zinc-50 dark:bg-zinc-950",children:[r.jsx("div",{className:"flex items-center justify-between border-b border-zinc-300 px-6 py-4 dark:border-zinc-800",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-900 dark:text-zinc-100",children:"Models"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"All available models from configured providers"})]})}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsxs("div",{className:"mx-auto max-w-5xl space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[r.jsxs("div",{className:"flex items-center gap-3 bg-white border border-zinc-300 rounded-xl px-4 py-3 dark:bg-zinc-900 dark:border-zinc-800",children:[r.jsx("div",{className:"w-9 h-9 rounded-lg bg-cachi-500/10 flex items-center justify-center",children:r.jsx(zr,{className:"h-5 w-5 text-cachi-400"})}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:[g," model",g!==1?"s":""]}),r.jsxs("p",{className:"text-[11px] text-zinc-500",children:[v," provider",v!==1?"s":""," active"]})]})]}),r.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-sm",children:[r.jsx(Aa,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500 h-4 w-4"}),r.jsx("input",{type:"text",placeholder:"Search models...",value:u,onChange:z=>d(z.target.value),className:"w-full bg-white border border-zinc-300 text-zinc-900 text-sm rounded-lg py-2 pl-9 pr-3 focus:border-cachi-500 focus:outline-none dark:bg-zinc-900 dark:border-zinc-800 dark:text-zinc-100"})]}),u&&r.jsxs("span",{className:"text-xs text-zinc-500",children:[b," result",b!==1?"s":""]})]}),i&&r.jsxs("div",{className:"text-sm text-zinc-500 py-12 text-center flex items-center justify-center gap-2",children:[r.jsx(ot,{className:"h-4 w-4 animate-spin"}),"Discovering models..."]}),!i&&g===0&&r.jsxs("div",{className:"text-center py-16 space-y-3",children:[r.jsx(zr,{className:"h-10 w-10 text-zinc-400 dark:text-zinc-700 mx-auto"}),r.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"No models available"}),r.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-600",children:"Configure at least one provider API key to discover models."})]}),!i&&Object.entries(h).sort(([z],[j])=>z.localeCompare(j)).map(([z,j])=>{const N=f[z],D=NM[z]||z.charAt(0).toUpperCase()+z.slice(1);return r.jsxs("div",{className:"bg-white border border-zinc-300 rounded-xl overflow-hidden dark:bg-zinc-900 dark:border-zinc-800",children:[r.jsx("button",{onClick:()=>y(z),className:"w-full flex items-center justify-between px-5 py-3.5 hover:bg-zinc-100/50 transition-colors dark:hover:bg-zinc-800/50",children:r.jsxs("div",{className:"flex items-center gap-3",children:[N?r.jsx(bu,{className:"h-4 w-4 text-zinc-500"}):r.jsx(po,{className:"h-4 w-4 text-zinc-500"}),r.jsx("span",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:D}),r.jsxs("span",{className:"text-[11px] text-zinc-500",children:[j.length," model",j.length!==1?"s":""]})]})}),!N&&r.jsx("div",{className:"border-t border-zinc-300 dark:border-zinc-800",children:j.map(E=>{const L=E.id===a;return r.jsxs("div",{className:ie("flex items-center gap-4 px-5 py-3 border-b border-zinc-200/50 last:border-b-0 hover:bg-zinc-100/30 transition-colors dark:border-zinc-800/50 dark:hover:bg-zinc-800/30",L&&"bg-cachi-500/5"),children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"text-sm text-zinc-900 font-mono truncate dark:text-zinc-100",children:E.id}),L&&r.jsx("span",{className:"text-[10px] text-cachi-600 bg-cachi-500/10 border border-cachi-500/20 px-1.5 py-0.5 rounded shrink-0 dark:text-cachi-400",children:"Default"}),E.is_reasoning&&r.jsx("span",{className:"text-[10px] text-purple-600 bg-purple-500/10 border border-purple-500/20 px-1.5 py-0.5 rounded shrink-0 dark:text-purple-400",children:"Reasoning"})]})}),r.jsxs("div",{className:"hidden md:flex items-center gap-1.5 shrink-0",children:[r.jsx(Sh,{icon:vu,label:"Vision",active:E.supports_vision}),r.jsx(Sh,{icon:Ul,label:"Tools",active:E.supports_tool_use}),r.jsx(Sh,{icon:ZN,label:"Structured",active:E.supports_structured_output})]}),r.jsxs("div",{className:"hidden lg:block text-right shrink-0 w-20",children:[r.jsx("p",{className:"text-[10px] text-zinc-500 dark:text-zinc-600",children:"Context"}),r.jsx("p",{className:"text-xs text-zinc-600 font-mono dark:text-zinc-400",children:My(E.context_window)})]}),r.jsxs("div",{className:"hidden lg:block text-right shrink-0 w-20",children:[r.jsx("p",{className:"text-[10px] text-zinc-500 dark:text-zinc-600",children:"Output"}),r.jsx("p",{className:"text-xs text-zinc-600 font-mono dark:text-zinc-400",children:My(E.max_output_tokens)})]}),r.jsxs("div",{className:"hidden xl:block text-right shrink-0 w-28",children:[r.jsx("p",{className:"text-[10px] text-zinc-500 dark:text-zinc-600",children:"Price / 1M tok"}),E.pricing?r.jsxs("p",{className:"text-xs text-zinc-600 font-mono dark:text-zinc-400",children:[r.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:Dy(E.pricing.input)}),r.jsx("span",{className:"text-zinc-400 mx-0.5 dark:text-zinc-600",children:"/"}),r.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:Dy(E.pricing.output)})]}):r.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-600",children:"—"})]}),!L&&r.jsx("button",{onClick:()=>k(E.id),className:"text-[10px] text-zinc-500 hover:text-cachi-600 hover:bg-cachi-500/10 px-2 py-1 rounded transition-colors shrink-0 dark:hover:text-cachi-400",title:"Set as default model",children:r.jsx(Su,{className:"h-4 w-4"})}),L&&r.jsx("div",{className:"w-[30px] shrink-0"})]},E.id)})})]},z)})]})})]})}function CM(){const{getActiveBot:e}=Dt(),{workSection:a}=It(),i=e();return i?r.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[a==="overview"&&r.jsx(EM,{botId:i.id}),a==="active"&&r.jsx(Ch,{botId:i.id,filter:"active"}),a==="completed"&&r.jsx(Ch,{botId:i.id,filter:"completed"}),a==="history"&&r.jsx(Ch,{botId:i.id,filter:"all"})]}):null}function EM({botId:e}){const{getWorkByBot:a,getActiveWork:i}=Am(),l=a(e),o=i(e),u={total:l.length,active:o.length,pending:l.filter(d=>d.status==="pending").length,completed:l.filter(d=>d.status==="completed").length,failed:l.filter(d=>d.status==="failed").length};return r.jsxs("div",{className:"flex h-full flex-col",children:[r.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Work Overview"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Manage your work items, tasks, and jobs"})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[r.jsxs("div",{className:"mb-8 grid grid-cols-2 gap-4 lg:grid-cols-5",children:[r.jsx(Ks,{label:"Total",value:u.total,color:"zinc"}),r.jsx(Ks,{label:"Active",value:u.active,color:"blue",pulse:!0}),r.jsx(Ks,{label:"Pending",value:u.pending,color:"yellow"}),r.jsx(Ks,{label:"Completed",value:u.completed,color:"green"}),r.jsx(Ks,{label:"Failed",value:u.failed,color:"red"})]}),o.length>0&&r.jsxs("div",{className:"mb-8",children:[r.jsx("h2",{className:"mb-4 text-lg font-semibold text-zinc-200",children:"Active Work"}),r.jsx("div",{className:"space-y-3",children:o.slice(0,5).map(d=>r.jsx(p2,{work:d},d.id))})]}),l.length===0&&r.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[r.jsx("div",{className:"mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-zinc-800",children:r.jsx(bm,{className:"h-8 w-8 text-zinc-500"})}),r.jsx("h3",{className:"mb-2 text-lg font-medium text-zinc-300",children:"No work items yet"}),r.jsx("p",{className:"mb-6 text-center text-sm text-zinc-500",children:"Work items will appear here when created through chat or automations."})]})]})]})}function Ch({botId:e,filter:a}){const i=wn(),{getWorkByBot:l,activeWorkId:o,setActiveWork:u}=Am(),[d,f]=C.useState(""),h=l(e).filter(k=>!(a==="active"&&!["pending","in_progress","paused"].includes(k.status)||a==="completed"&&k.status!=="completed"||d&&!k.title.toLowerCase().includes(d.toLowerCase()))),g=h.find(k=>k.id===o),b={active:"Active Work",completed:"Completed Work",all:"Work History"},v={active:"Work items currently in progress or pending",completed:"Successfully completed work items",all:"All work items including failed and cancelled"},y=k=>{u(k.id),i(`/${e}/work/${k.id}`)};return r.jsxs("div",{className:"flex h-full flex-col",children:[r.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:b[a]}),r.jsx("p",{className:"text-sm text-zinc-500",children:v[a]})]}),r.jsx("div",{className:"border-b border-zinc-800 px-6 py-3",children:r.jsxs("div",{className:"relative",children:[r.jsx(Aa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),r.jsx("input",{type:"text",placeholder:"Search work items...",value:d,onChange:k=>f(k.target.value),className:"h-9 w-full rounded-lg border border-zinc-700 bg-zinc-800/50 pl-10 pr-4 text-sm text-zinc-100 placeholder-zinc-500 outline-none focus:border-blue-500"})]})}),r.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[r.jsx("div",{className:"w-96 flex-shrink-0 overflow-y-auto border-r border-zinc-800 p-4",children:h.length===0?r.jsxs("div",{className:"py-12 text-center",children:[r.jsx(kr,{className:"mx-auto mb-3 h-8 w-8 text-zinc-600"}),r.jsx("p",{className:"text-sm text-zinc-500",children:d?"No work items match your search":"No work items"})]}):r.jsx("div",{className:"space-y-2",children:h.map(k=>r.jsx(p2,{work:k,selected:o===k.id,onClick:()=>y(k),compact:!0},k.id))})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:g?r.jsx(TM,{work:g}):r.jsx("div",{className:"flex h-full items-center justify-center",children:r.jsx("p",{className:"text-zinc-500",children:"Select a work item to view details"})})})]})]})}function Ks({label:e,value:a,color:i,pulse:l}){const o={blue:"border-blue-500/30 bg-blue-500/10 text-blue-400",green:"border-green-500/30 bg-green-500/10 text-green-400",red:"border-red-500/30 bg-red-500/10 text-red-400",yellow:"border-yellow-500/30 bg-yellow-500/10 text-yellow-400",zinc:"border-zinc-700 bg-zinc-800/50 text-zinc-300"};return r.jsxs("div",{className:ie("rounded-xl border p-4",o[i]),children:[r.jsx("div",{className:ie("text-3xl font-bold",l&&a>0&&"animate-pulse"),children:a}),r.jsx("div",{className:"mt-1 text-sm opacity-80",children:e})]})}function p2({work:e,selected:a,onClick:i,compact:l}){const o=f=>{switch(f){case"pending":return r.jsx(Nr,{className:"h-4 w-4 text-zinc-400"});case"in_progress":return r.jsx(zu,{className:"h-4 w-4 text-blue-400"});case"completed":return r.jsx(Rl,{className:"h-4 w-4 text-green-400"});case"failed":return r.jsx(_l,{className:"h-4 w-4 text-red-400"});case"cancelled":return r.jsx(_l,{className:"h-4 w-4 text-zinc-500"});case"paused":return r.jsx(E1,{className:"h-4 w-4 text-yellow-400"})}},u=f=>{switch(f){case"pending":return"border-zinc-700 bg-zinc-800/50";case"in_progress":return"border-blue-500/30 bg-blue-500/10";case"completed":return"border-green-500/30 bg-green-500/10";case"failed":return"border-red-500/30 bg-red-500/10";case"cancelled":return"border-zinc-700 bg-zinc-800/30";case"paused":return"border-yellow-500/30 bg-yellow-500/10"}},d=f=>{const p={urgent:"bg-red-500/20 text-red-400",high:"bg-orange-500/20 text-orange-400",normal:"bg-zinc-500/20 text-zinc-400",low:"bg-zinc-600/20 text-zinc-500"};return p[f]||p.normal};return r.jsx("button",{onClick:i,className:ie("w-full rounded-xl border p-4 text-left transition-all",a&&"ring-1 ring-blue-500",u(e.status),i&&"hover:border-zinc-600"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[o(e.status),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"truncate font-medium text-zinc-200",children:e.title}),e.priority!=="normal"&&r.jsx("span",{className:ie("rounded px-1.5 py-0.5 text-[10px] font-medium uppercase",d(e.priority)),children:e.priority})]}),e.description&&!l&&r.jsx("p",{className:"mt-1 truncate text-sm text-zinc-500",children:e.description}),e.status==="in_progress"&&e.progress>0&&r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-zinc-500",children:[r.jsx("span",{children:"Progress"}),r.jsxs("span",{children:[e.progress,"%"]})]}),r.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-zinc-700",children:r.jsx("div",{className:"h-full rounded-full bg-blue-500 transition-all duration-300",style:{width:`${e.progress}%`}})})]}),e.taskCount!==void 0&&e.taskCount>0&&r.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-zinc-500",children:[r.jsx(Rl,{className:"h-3 w-3"}),e.completedTaskCount||0,"/",e.taskCount," tasks"]})]}),i&&r.jsx(bu,{className:"h-4 w-4 text-zinc-600"})]})})}function TM({work:e}){const a=i=>new Date(i).toLocaleString();return r.jsxs("div",{className:"p-6",children:[r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.title}),e.description&&r.jsx("p",{className:"mt-1 text-zinc-400",children:e.description}),e.goal&&r.jsxs("div",{className:"mt-3 rounded-lg border border-blue-500/30 bg-blue-500/10 p-3",children:[r.jsx("div",{className:"text-xs font-medium uppercase text-blue-400",children:"Goal"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-300",children:e.goal})]})]}),r.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4 lg:grid-cols-4",children:[r.jsx(Gc,{label:"Status",value:e.status.replace("_"," ")}),r.jsx(Gc,{label:"Priority",value:e.priority}),r.jsx(Gc,{label:"Progress",value:`${e.progress}%`}),r.jsx(Gc,{label:"Created",value:a(e.createdAt)})]}),e.status==="in_progress"&&r.jsxs("div",{className:"mb-6",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Progress"}),r.jsxs("span",{className:"font-mono text-zinc-300",children:[e.progress,"%"]})]}),r.jsx("div",{className:"h-3 overflow-hidden rounded-full bg-zinc-800",children:r.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-blue-600 to-blue-400 transition-all duration-300",style:{width:`${e.progress}%`}})})]}),e.error&&r.jsxs("div",{className:"mb-6 rounded-xl border border-red-500/30 bg-red-500/10 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[r.jsx(_l,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:"Error"})]}),r.jsx("pre",{className:"mt-2 overflow-x-auto text-sm text-red-300",children:e.error})]}),e.result!==void 0&&e.result!==null&&r.jsxs("div",{className:"mb-6 rounded-xl border border-green-500/30 bg-green-500/10 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[r.jsx(Rl,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:"Result"})]}),r.jsx("pre",{className:"mt-2 overflow-x-auto text-sm text-green-300",children:typeof e.result=="string"?e.result:String(JSON.stringify(e.result,null,2))})]}),e.tags.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(i=>r.jsx("span",{className:"rounded-full bg-zinc-800 px-3 py-1 text-sm text-zinc-400",children:i},i))})]})}function Gc({label:e,value:a}){return r.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-3",children:[r.jsx("div",{className:"text-xs text-zinc-500",children:e}),r.jsx("div",{className:"mt-1 font-medium capitalize text-zinc-200",children:a})]})}function AM(){const{getActiveBot:e}=Dt(),{scheduleSection:a}=It(),i=e();return i?r.jsxs("div",{className:"flex h-full flex-col bg-zinc-950",children:[a==="all"&&r.jsx(Eh,{botId:i.id,filter:"all"}),a==="enabled"&&r.jsx(Eh,{botId:i.id,filter:"enabled"}),a==="disabled"&&r.jsx(Eh,{botId:i.id,filter:"disabled"}),a==="create"&&r.jsx(MM,{botId:i.id})]}):null}function Eh({botId:e,filter:a}){const i=wn(),{getSchedulesByBot:l,activeScheduleId:o,setActiveSchedule:u,toggleEnabled:d}=ev(),[f,p]=C.useState(""),h=l(e),g=h.filter(j=>!(a==="enabled"&&!j.enabled||a==="disabled"&&j.enabled||f&&!j.name.toLowerCase().includes(f.toLowerCase()))),b=g.find(j=>j.id===o),v={total:h.length,enabled:h.filter(j=>j.enabled).length,disabled:h.filter(j=>!j.enabled).length},y={all:"All Schedules",enabled:"Enabled Schedules",disabled:"Disabled Schedules"},k={all:"Manage automated triggers and scheduled tasks",enabled:"Schedules that are currently active",disabled:"Schedules that are paused or inactive"},z=j=>{u(j.id),i(`/${e}/schedules/${j.id}`)};return r.jsxs("div",{className:"flex h-full flex-col",children:[r.jsx("div",{className:"border-b border-zinc-800 px-6 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:y[a]}),r.jsx("p",{className:"text-sm text-zinc-500",children:k[a]})]}),a==="all"&&r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Th,{label:"Total",value:v.total,color:"zinc"}),r.jsx(Th,{label:"Enabled",value:v.enabled,color:"green"}),r.jsx(Th,{label:"Disabled",value:v.disabled,color:"zinc"})]})]})}),r.jsx("div",{className:"border-b border-zinc-800 px-6 py-3",children:r.jsxs("div",{className:"relative",children:[r.jsx(Aa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),r.jsx("input",{type:"text",placeholder:"Search schedules...",value:f,onChange:j=>p(j.target.value),className:"h-9 w-full rounded-lg border border-zinc-700 bg-zinc-800/50 pl-10 pr-4 text-sm text-zinc-100 placeholder-zinc-500 outline-none focus:border-purple-500"})]})}),r.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[r.jsx("div",{className:"w-96 flex-shrink-0 overflow-y-auto border-r border-zinc-800 p-4",children:g.length===0?r.jsxs("div",{className:"py-12 text-center",children:[r.jsx(kr,{className:"mx-auto mb-3 h-8 w-8 text-zinc-600"}),r.jsx("p",{className:"text-sm text-zinc-500",children:f?"No schedules match your search":"No schedules yet"})]}):r.jsx("div",{className:"space-y-2",children:g.map(j=>r.jsx(DM,{schedule:j,selected:o===j.id,onClick:()=>z(j),onToggle:()=>d(j.id)},j.id))})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:b?r.jsx(OM,{schedule:b}):r.jsx("div",{className:"flex h-full items-center justify-center",children:r.jsx("p",{className:"text-zinc-500",children:"Select a schedule to view details"})})})]})]})}function MM({botId:e}){const{setScheduleSection:a}=It(),[i,l]=C.useState({name:"",description:"",scheduleType:"interval",cronExpression:"",intervalSeconds:3600,runAt:"",eventTrigger:"",enabled:!0}),o=u=>{u.preventDefault(),console.log("Create schedule:",i),a("all")};return r.jsxs("div",{className:"flex h-full flex-col",children:[r.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[r.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Create Schedule"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"Set up a new automated trigger"})]}),r.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:r.jsxs("form",{onSubmit:o,className:"mx-auto max-w-2xl space-y-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Name"}),r.jsx("input",{type:"text",value:i.name,onChange:u=>l({...i,name:u.target.value}),placeholder:"Daily Report",className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 outline-none focus:border-purple-500",required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),r.jsx("textarea",{value:i.description,onChange:u=>l({...i,description:u.target.value}),placeholder:"What does this schedule do?",rows:2,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 py-2 text-zinc-100 outline-none focus:border-purple-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Schedule Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:["cron","interval","once","event"].map(u=>r.jsxs("button",{type:"button",onClick:()=>l({...i,scheduleType:u}),className:ie("flex flex-col items-center gap-2 rounded-lg border p-4 transition-all",i.scheduleType===u?"border-purple-500 bg-purple-500/10":"border-zinc-700 bg-zinc-800/50 hover:border-zinc-600"),children:[u==="cron"&&r.jsx(xm,{className:"h-5 w-5 text-purple-400"}),u==="interval"&&r.jsx(D1,{className:"h-5 w-5 text-blue-400"}),u==="once"&&r.jsx(Nr,{className:"h-5 w-5 text-orange-400"}),u==="event"&&r.jsx(Vl,{className:"h-5 w-5 text-yellow-400"}),r.jsx("span",{className:"text-sm capitalize text-zinc-300",children:u})]},u))})]}),i.scheduleType==="cron"&&r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Cron Expression"}),r.jsx("input",{type:"text",value:i.cronExpression,onChange:u=>l({...i,cronExpression:u.target.value}),placeholder:"0 2 * * *",className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 font-mono text-zinc-100 outline-none focus:border-purple-500"}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:'Format: minute hour day month weekday (e.g., "0 2 * * *" = 2am daily)'})]}),i.scheduleType==="interval"&&r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Interval"}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"number",value:i.intervalSeconds/60,onChange:u=>l({...i,intervalSeconds:parseInt(u.target.value)*60}),min:1,className:"h-10 w-24 rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 outline-none focus:border-purple-500"}),r.jsx("span",{className:"text-zinc-400",children:"minutes"})]})]}),i.scheduleType==="once"&&r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Run At"}),r.jsx("input",{type:"datetime-local",value:i.runAt,onChange:u=>l({...i,runAt:u.target.value}),className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 outline-none focus:border-purple-500"})]}),i.scheduleType==="event"&&r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Event Trigger"}),r.jsx("input",{type:"text",value:i.eventTrigger,onChange:u=>l({...i,eventTrigger:u.target.value}),placeholder:"webhook_received",className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 outline-none focus:border-purple-500"})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-700 bg-zinc-800/50 p-4",children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-zinc-200",children:"Enable immediately"}),r.jsx("div",{className:"text-sm text-zinc-500",children:"Start running this schedule right away"})]}),r.jsx("button",{type:"button",onClick:()=>l({...i,enabled:!i.enabled}),className:i.enabled?"text-purple-400":"text-zinc-600",children:i.enabled?r.jsx(bo,{className:"h-8 w-8"}):r.jsx(go,{className:"h-8 w-8"})})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[r.jsx("button",{type:"button",onClick:()=>a("all"),className:"rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-800",children:"Cancel"}),r.jsxs("button",{type:"submit",className:"flex items-center gap-2 rounded-lg bg-purple-600 px-4 py-2 text-sm font-medium text-white hover:bg-purple-500",children:[r.jsx(Ta,{className:"h-4 w-4"}),"Create Schedule"]})]})]})})]})}function Th({label:e,value:a,color:i}){const l={green:"bg-green-500/20 text-green-400",zinc:"bg-zinc-700 text-zinc-400"};return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:ie("flex h-8 min-w-[2rem] items-center justify-center rounded-lg px-2 text-sm font-bold",l[i]),children:a}),r.jsx("span",{className:"text-xs text-zinc-500",children:e})]})}function DM({schedule:e,selected:a,onClick:i,onToggle:l}){const o=d=>{switch(d){case"cron":return r.jsx(xm,{className:"h-4 w-4 text-purple-400"});case"interval":return r.jsx(D1,{className:"h-4 w-4 text-blue-400"});case"once":return r.jsx(Nr,{className:"h-4 w-4 text-orange-400"});case"event":return r.jsx(Vl,{className:"h-4 w-4 text-yellow-400"})}},u=d=>{switch(d.scheduleType){case"cron":return d.cronExpression||"No cron set";case"interval":return d.intervalSeconds?d.intervalSeconds<60?`Every ${d.intervalSeconds}s`:d.intervalSeconds<3600?`Every ${Math.floor(d.intervalSeconds/60)}m`:d.intervalSeconds<86400?`Every ${Math.floor(d.intervalSeconds/3600)}h`:`Every ${Math.floor(d.intervalSeconds/86400)}d`:"No interval set";case"once":return d.runAt?new Date(d.runAt).toLocaleDateString():"Not scheduled";case"event":return d.eventTrigger||"No event set"}};return r.jsx("button",{onClick:i,className:ie("w-full rounded-xl border p-4 text-left transition-all",a&&"ring-1 ring-purple-500",e.enabled?"border-purple-500/30 bg-purple-500/5":"border-zinc-700 bg-zinc-800/30 opacity-60"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[o(e.scheduleType),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"font-medium text-zinc-200",children:e.name}),e.description&&r.jsx("p",{className:"mt-0.5 truncate text-sm text-zinc-500",children:e.description}),r.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs text-zinc-500",children:r.jsx("span",{className:"rounded bg-zinc-700/50 px-1.5 py-0.5 font-mono",children:u(e)})}),e.runCount>0&&r.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs text-zinc-500",children:r.jsxs("span",{children:[e.runCount," runs"]})})]}),r.jsx("button",{onClick:d=>{d.stopPropagation(),l==null||l()},className:ie("flex-shrink-0 transition-colors",e.enabled?"text-purple-400":"text-zinc-600"),title:e.enabled?"Disable":"Enable",children:e.enabled?r.jsx(bo,{className:"h-6 w-6"}):r.jsx(go,{className:"h-6 w-6"})})]})})}function OM({schedule:e}){const a=l=>l?new Date(l).toLocaleString():"-",i=l=>{switch(l){case"cron":return"Cron Schedule";case"interval":return"Interval Timer";case"once":return"One-Time";case"event":return"Event Trigger"}};return r.jsxs("div",{className:"p-6",children:[r.jsxs("div",{className:"mb-6 flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.name}),r.jsx("span",{className:ie("rounded-full px-2 py-0.5 text-xs font-medium",e.enabled?"bg-green-500/20 text-green-400":"bg-zinc-700 text-zinc-400"),children:e.enabled?"Enabled":"Disabled"})]}),e.description&&r.jsx("p",{className:"mt-1 text-zinc-400",children:e.description})]}),r.jsxs("button",{className:"flex items-center gap-2 rounded-lg bg-red-600/20 px-3 py-2 text-sm text-red-400 hover:bg-red-600/30",children:[r.jsx(ea,{className:"h-4 w-4"}),"Delete"]})]}),r.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4 lg:grid-cols-4",children:[r.jsx(Yc,{label:"Type",value:i(e.scheduleType)}),r.jsx(Yc,{label:"Timezone",value:e.timezone}),r.jsx(Yc,{label:"Run Count",value:String(e.runCount)}),r.jsx(Yc,{label:"Max Concurrent",value:String(e.maxConcurrent)})]}),r.jsxs("div",{className:"mb-6 rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[r.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Schedule"}),r.jsxs("div",{className:"mt-2 font-mono text-lg text-zinc-200",children:[e.scheduleType==="cron"&&e.cronExpression,e.scheduleType==="interval"&&`Every ${e.intervalSeconds} seconds`,e.scheduleType==="once"&&a(e.runAt),e.scheduleType==="event"&&e.eventTrigger]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[r.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Next Run"}),r.jsx("div",{className:"mt-2 text-zinc-200",children:e.nextRunAt?a(e.nextRunAt):"Not scheduled"})]}),r.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[r.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Last Run"}),r.jsx("div",{className:"mt-2 text-zinc-200",children:e.lastRunAt?a(e.lastRunAt):"Never"})]})]})]})}function Yc({label:e,value:a}){return r.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-3",children:[r.jsx("div",{className:"text-xs text-zinc-500",children:e}),r.jsx("div",{className:"mt-1 font-medium text-zinc-200",children:a})]})}const Zl=[{id:"fitness",label:"Fitness & Health",description:"Workouts, nutrition, gym routines, wellness"},{id:"cooking",label:"Cooking & Recipes",description:"Meal planning, recipes, dietary tracking"},{id:"finance",label:"Finance & Budget",description:"Budgeting, savings, expense tracking"},{id:"travel",label:"Travel & Planning",description:"Trip planning, itineraries, recommendations"},{id:"coding",label:"Coding & Dev",description:"Programming help, debugging, code review"},{id:"writing",label:"Writing & Content",description:"Blog posts, copywriting, editing"},{id:"learning",label:"Learning & Study",description:"Tutoring, flashcards, explanations"},{id:"productivity",label:"Productivity",description:"Task management, scheduling, goals"},{id:"creative",label:"Creative Projects",description:"Art, music, design, brainstorming"},{id:"gaming",label:"Gaming & Hobbies",description:"Game guides, tips, hobby tracking"},{id:"social",label:"Social & Dating",description:"Conversation tips, profile help, advice"},{id:"custom",label:"Something Else",description:"Describe your unique use case"}],n0=[{id:"professional",label:"Professional",description:"Formal, precise, business-appropriate"},{id:"friendly",label:"Friendly",description:"Warm, approachable, conversational"},{id:"casual",label:"Casual",description:"Relaxed, informal, easy-going"},{id:"concise",label:"Concise",description:"Brief, to-the-point, efficient"},{id:"detailed",label:"Detailed",description:"Thorough, comprehensive, explanatory"},{id:"playful",label:"Playful",description:"Fun, witty, entertaining"}],Oy={method:null,purposeCategory:"",purposeDescription:"",nameSuggestions:[],selectedNameMeaning:"",followUpQuestions:[],communicationStyle:"friendly",useEmojis:"sometimes",generatedPrompt:"",suggestedName:"",suggestedDescription:"",name:"",description:"",icon:"bot",color:"#3b82f6",model:"",systemPrompt:"",tools:["file_read","file_write","python_execute"]},x2={template:["method-select","template-select","appearance","confirm"],"ai-assisted":["method-select","purpose","name-picker","details","personality","prompt-review","preview","appearance","confirm"],blank:["method-select","appearance","confirm"],import:["method-select","import","appearance","confirm"]};function RM(e,a){if(!e)return null;const i=x2[e],l=i.indexOf(a);return l===-1||l===i.length-1?null:i[l+1]}function _M(e,a){if(!e)return null;const i=x2[e],l=i.indexOf(a);return l<=0?null:i[l-1]}const Bn=_t((e,a)=>({isOpen:!1,currentStep:"method-select",completedSteps:[],form:{...Oy},isGenerating:!1,generationError:null,previewMessages:[],isPreviewLoading:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),reset:()=>e({isOpen:!1,currentStep:"method-select",completedSteps:[],form:{...Oy},isGenerating:!1,generationError:null,previewMessages:[],isPreviewLoading:!1}),setStep:i=>e({currentStep:i}),nextStep:()=>{const{form:i,currentStep:l}=a(),o=RM(i.method,l);o&&e(u=>({currentStep:o,completedSteps:u.completedSteps.includes(l)?u.completedSteps:[...u.completedSteps,l]}))},prevStep:()=>{const{form:i,currentStep:l}=a(),o=_M(i.method,l);o&&e({currentStep:o})},markStepCompleted:i=>e(l=>({completedSteps:l.completedSteps.includes(i)?l.completedSteps:[...l.completedSteps,i]})),setMethod:i=>e(l=>({form:{...l.form,method:i}})),updateForm:i=>e(l=>({form:{...l.form,...i}})),setGenerating:i=>e({isGenerating:i}),setGenerationError:i=>e({generationError:i}),setGeneratedContent:(i,l,o)=>e(u=>({form:{...u.form,generatedPrompt:i,suggestedName:l,suggestedDescription:o,systemPrompt:i,name:u.form.name||l,description:u.form.description||o}})),setNameSuggestions:i=>e(l=>({form:{...l.form,nameSuggestions:i}})),selectName:(i,l)=>e(o=>({form:{...o.form,name:i,selectedNameMeaning:l}})),setFollowUpQuestions:i=>e(l=>({form:{...l.form,followUpQuestions:i}})),updateFollowUpAnswer:(i,l)=>e(o=>({form:{...o.form,followUpQuestions:o.form.followUpQuestions.map(u=>u.id===i?{...u,answer:l}:u)}})),addPreviewMessage:(i,l)=>e(o=>({previewMessages:[...o.previewMessages,{role:i,content:l}]})),clearPreviewMessages:()=>e({previewMessages:[]}),setPreviewLoading:i=>e({isPreviewLoading:i})})),LM={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[90vw]"};function a0({open:e,onClose:a,children:i,size:l="lg",className:o,closeOnBackdrop:u=!0,closeOnEscape:d=!0}){const f=C.useRef(null);if(C.useEffect(()=>{if(!e||!d)return;const h=g=>{g.key==="Escape"&&a()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,d,a]),C.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),!e)return null;const p=h=>{u&&h.target===h.currentTarget&&a()};return hm.createPortal(r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm animate-in fade-in duration-150",onClick:p,children:r.jsx("div",{ref:f,className:ie("w-full rounded-2xl border border-zinc-800 bg-zinc-900 shadow-2xl animate-in zoom-in-95 duration-150",LM[l],o),role:"dialog","aria-modal":"true",children:i})}),document.body)}function i0({title:e,subtitle:a,icon:i,iconClassName:l,onClose:o,className:u,children:d}){return r.jsxs("div",{className:ie("flex items-center justify-between border-b border-zinc-800 px-6 py-4",u),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[i&&r.jsx("div",{className:ie("flex h-10 w-10 items-center justify-center rounded-xl bg-cachi-600/20",l),children:i}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-bold text-zinc-100",children:e}),a&&r.jsx("p",{className:"text-sm text-zinc-500",children:a})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[d,o&&r.jsx("button",{onClick:o,className:"rounded-lg p-2 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200 transition-colors","aria-label":"Close dialog",children:r.jsx(xa,{className:"h-5 w-5"})})]})]})}function r0({children:e,className:a,scrollable:i=!1,maxHeight:l="max-h-[60vh]"}){return r.jsx("div",{className:ie("p-6",i&&`overflow-y-auto ${l}`,a),children:e})}function g2({children:e,className:a,leftContent:i}){return r.jsxs("div",{className:ie("flex items-center justify-between border-t border-zinc-800 px-6 py-4",a),children:[r.jsx("div",{children:i}),r.jsx("div",{className:"flex items-center gap-2",children:e})]})}const BM={primary:"rounded-lg bg-cachi-600 px-6 py-2 text-sm font-medium text-white hover:bg-cachi-500 disabled:opacity-50 disabled:cursor-not-allowed",secondary:"rounded-lg border border-zinc-700 bg-zinc-800 px-6 py-2 text-sm font-medium text-zinc-300 hover:bg-zinc-700 disabled:opacity-50 disabled:cursor-not-allowed",danger:"rounded-lg bg-red-600 px-6 py-2 text-sm font-medium text-white hover:bg-red-500 disabled:opacity-50 disabled:cursor-not-allowed",ghost:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200 disabled:opacity-50 disabled:cursor-not-allowed"};function zl({onClick:e,disabled:a,children:i,variant:l="secondary",className:o,type:u="button"}){return r.jsx("button",{type:u,onClick:e,disabled:a,className:ie(BM[l],o),children:i})}function UM({steps:e,currentStep:a,completedSteps:i=[],onStepClick:l,variant:o="horizontal",className:u}){const d=e.findIndex(f=>f.id===a);return o==="compact"?r.jsx("div",{className:ie("flex items-center gap-1.5",u),children:e.map((f,p)=>{const h=i.includes(f.id),g=f.id===a,b=p<d;return r.jsx("button",{onClick:()=>l==null?void 0:l(f.id),disabled:!l||!h&&!b&&!g,className:ie("h-2 rounded-full transition-all",g?"w-8 bg-cachi-500":h||b?"w-2 bg-cachi-600":"w-2 bg-zinc-700",l&&(h||b||g)?"cursor-pointer hover:opacity-80":"cursor-default"),title:f.label},f.id)})}):o==="vertical"?r.jsx("nav",{className:ie("space-y-2",u),children:e.map((f,p)=>{const h=i.includes(f.id),g=f.id===a,b=p<d;return r.jsxs("button",{onClick:()=>l==null?void 0:l(f.id),disabled:!l||!h&&!b&&!g,className:ie("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",g?"bg-cachi-600/20 text-cachi-400":h||b?"text-zinc-400 hover:bg-zinc-800/50":"text-zinc-600",l&&(h||b||g)?"cursor-pointer":"cursor-default"),children:[r.jsx("div",{className:ie("flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium",g?"bg-cachi-600 text-white":h?"bg-cachi-600/30 text-cachi-400":"bg-zinc-800 text-zinc-500"),children:h?r.jsx(Wn,{className:"h-3.5 w-3.5"}):p+1}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium",children:f.label}),f.description&&r.jsx("div",{className:"text-xs text-zinc-500",children:f.description})]})]},f.id)})}):r.jsx("nav",{className:ie("flex items-center justify-center gap-2",u),children:e.map((f,p)=>{const h=i.includes(f.id),g=f.id===a,b=p<d;return r.jsxs("div",{className:"flex items-center",children:[r.jsxs("button",{onClick:()=>l==null?void 0:l(f.id),disabled:!l||!h&&!b&&!g,className:ie("flex items-center gap-2 rounded-lg px-3 py-1.5 text-sm transition-colors",g?"bg-cachi-600/20 text-cachi-400":h||b?"text-zinc-400 hover:text-zinc-300":"text-zinc-600",l&&(h||b||g)?"cursor-pointer":"cursor-default"),children:[r.jsx("div",{className:ie("flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-medium",g?"bg-cachi-600 text-white":h?"bg-cachi-600/30 text-cachi-400":"bg-zinc-800 text-zinc-500"),children:h?r.jsx(Wn,{className:"h-3 w-3"}):p+1}),r.jsx("span",{className:"hidden sm:inline",children:f.label})]}),p<e.length-1&&r.jsx("div",{className:ie("mx-1 h-px w-4",b?"bg-cachi-600/50":"bg-zinc-700")})]},f.id)})})}function IM(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function b2({template:e,onClick:a}){return r.jsxs("button",{onClick:a,className:"flex flex-col rounded-xl border border-zinc-800 bg-zinc-900/50 p-4 text-left transition-all hover:border-zinc-700 hover:bg-zinc-800/50",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:r.jsx(ta,{icon:e.icon,size:24,color:e.color})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-zinc-100 truncate",children:e.name}),r.jsx("p",{className:"text-xs text-zinc-500 capitalize",children:e.category})]})]}),r.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:e.description}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[e.tags.slice(0,3).map(i=>r.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-[10px] text-zinc-500",children:i},i)),e.tags.length>3&&r.jsxs("span",{className:"text-[10px] text-zinc-600",children:["+",e.tags.length-3]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-between border-t border-zinc-800 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-1 text-amber-400",children:[r.jsx(Su,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"text-xs font-medium",children:e.rating.toFixed(1)})]}),r.jsxs("div",{className:"flex items-center gap-1 text-zinc-500",children:[r.jsx(Pi,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"text-xs",children:IM(e.downloads)})]})]})]})}function HM(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function qM({template:e,onClose:a,onInstalled:i}){const{addBot:l,setActiveBot:o}=Dt(),[u,d]=C.useState(!1),[f,p]=C.useState(null),h=async()=>{if(e){d(!0),p(null);try{const g=await K1(e.id),b={id:g.bot_id,name:e.name,description:e.description,icon:e.icon,color:e.color,model:e.model,systemPrompt:e.system_prompt,tools:e.tools,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};l(b),o(g.bot_id),i(g.bot_id)}catch(g){p(g instanceof Error?g.message:"Failed to install template")}finally{d(!1)}}};return e?r.jsxs(a0,{open:!!e,onClose:a,size:"lg",children:[r.jsx(i0,{title:e.name,subtitle:e.description,icon:r.jsx(ta,{icon:e.icon,size:20,color:e.color}),iconClassName:`bg-[${e.color}20]`,onClose:a}),r.jsx(r0,{scrollable:!0,children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsxs("div",{className:"flex items-center gap-1.5 text-amber-400",children:[r.jsx(Su,{className:"h-4 w-4 fill-current"}),r.jsx("span",{className:"text-sm font-medium",children:e.rating.toFixed(1)}),r.jsx("span",{className:"text-xs text-zinc-500",children:"rating"})]}),r.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-400",children:[r.jsx(Pi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:HM(e.downloads)}),r.jsx("span",{className:"text-xs text-zinc-500",children:"installs"})]}),r.jsx("span",{className:"rounded-full bg-zinc-800 px-2.5 py-1 text-xs text-zinc-400 capitalize",children:e.category})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Tags"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(g=>r.jsx("span",{className:"rounded-full bg-zinc-800 px-3 py-1 text-xs text-zinc-400",children:g},g))})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx(Ul,{className:"h-4 w-4 text-zinc-500"}),"Enabled Tools"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tools.map(g=>r.jsx("span",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 px-2.5 py-1 text-xs text-zinc-300",children:g.replace(/_/g," ")},g))})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx($i,{className:"h-4 w-4 text-zinc-500"}),"System Prompt"]}),r.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:r.jsx("p",{className:"whitespace-pre-wrap text-sm text-zinc-400",children:e.system_prompt})})]}),r.jsxs("div",{children:[r.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Recommended Model"}),r.jsx("span",{className:"rounded-lg bg-zinc-800 px-3 py-1.5 font-mono text-xs text-zinc-300",children:e.model})]}),f&&r.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:r.jsx("p",{className:"text-sm text-red-400",children:f})})]})}),r.jsxs(g2,{children:[r.jsx(zl,{variant:"ghost",onClick:a,children:"Cancel"}),r.jsx(zl,{variant:"primary",onClick:h,disabled:u,children:u?r.jsxs(r.Fragment,{children:[r.jsx(ot,{className:"h-4 w-4 animate-spin mr-2"}),"Installing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Pi,{className:"h-4 w-4 mr-2"}),"Install Template"]})})]})]}):null}function y2({open:e,onClose:a,onInstalled:i}){const[l,o]=C.useState([]),[u,d]=C.useState([]),[f,p]=C.useState(null),[h,g]=C.useState(""),[b,v]=C.useState(!0),[y,k]=C.useState(null),[z,j]=C.useState(null);C.useEffect(()=>{e&&(N(),D())},[e]),C.useEffect(()=>{e&&D()},[f,h]);const N=async()=>{try{const L=await W1();d(L)}catch(L){console.error("Failed to load categories:",L)}},D=async()=>{v(!0),k(null);try{const L=await Tm(f||void 0,h||void 0);o(L.templates)}catch(L){k(L instanceof Error?L.message:"Failed to load templates")}finally{v(!1)}},E=L=>{j(null),i==null||i(L),a()};return r.jsxs(r.Fragment,{children:[r.jsxs(a0,{open:e,onClose:a,size:"xl",children:[r.jsx(i0,{title:"Bot Marketplace",subtitle:"Discover and install bot templates",icon:r.jsx(su,{className:"h-5 w-5 text-cachi-500"}),onClose:a}),r.jsx(r0,{className:"p-0",children:r.jsxs("div",{className:"flex h-[500px]",children:[r.jsx("div",{className:"w-56 shrink-0 border-r border-zinc-800 p-4",children:r.jsxs("nav",{className:"space-y-1",children:[r.jsx("button",{onClick:()=>p(null),className:ie("w-full rounded-lg px-3 py-2 text-left text-sm transition-colors",f===null?"bg-cachi-600/20 text-cachi-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:"All Templates"}),u.map(L=>r.jsxs("button",{onClick:()=>p(L.id),className:ie("w-full rounded-lg px-3 py-2 text-left text-sm transition-colors",f===L.id?"bg-cachi-600/20 text-cachi-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[r.jsx("span",{children:L.name}),r.jsxs("span",{className:"ml-2 text-xs text-zinc-600",children:["(",L.count,")"]})]},L.id))]})}),r.jsxs("div",{className:"flex-1 overflow-hidden",children:[r.jsx("div",{className:"border-b border-zinc-800 p-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(Aa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),r.jsx("input",{type:"text",value:h,onChange:L=>g(L.target.value),placeholder:"Search templates...",className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 pl-10 pr-10 text-sm text-zinc-100 placeholder-zinc-500 outline-none focus:border-cachi-500"}),h&&r.jsx("button",{onClick:()=>g(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:r.jsx(xa,{className:"h-4 w-4"})})]})}),r.jsx("div",{className:"h-[calc(100%-68px)] overflow-y-auto p-4",children:b?r.jsx("div",{className:"flex h-full items-center justify-center",children:r.jsx(ot,{className:"h-8 w-8 animate-spin text-zinc-500"})}):y?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[r.jsx("p",{className:"text-sm text-red-400",children:y}),r.jsx("button",{onClick:D,className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Try again"})]}):l.length===0?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[r.jsx(su,{className:"mb-3 h-10 w-10 text-zinc-600"}),r.jsx("p",{className:"text-sm text-zinc-500",children:"No templates found"}),h&&r.jsx("button",{onClick:()=>g(""),className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Clear search"})]}):r.jsx("div",{className:"grid grid-cols-2 gap-4",children:l.map(L=>r.jsx(b2,{template:L,onClick:()=>j(L)},L.id))})})]})]})})]}),r.jsx(qM,{template:z,onClose:()=>j(null),onInstalled:E})]})}const FM=[{id:"ai-assisted",name:"AI-Assisted",description:"Describe what you want and let AI generate the perfect system prompt",icon:qh,color:"#8b5cf6",badge:"Recommended"},{id:"template",name:"Use Template",description:"Start with a pre-configured template and customize it",icon:JN,color:"#3b82f6"},{id:"blank",name:"Start Blank",description:"Build everything from scratch with full control",icon:_N,color:"#22c55e"},{id:"import",name:"Import",description:"Import a bot configuration from a JSON file",icon:Cu,color:"#f59e0b"}];function Ry(){const{form:e,setMethod:a,nextStep:i,close:l,reset:o}=Bn(),[u,d]=C.useState(!1),f=h=>{a(h),setTimeout(i,150)},p=()=>{l(),setTimeout(o,200)};return r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-2 gap-4",children:FM.map(h=>{const g=h.icon,b=e.method===h.id;return r.jsxs("button",{onClick:()=>f(h.id),className:ie("relative flex flex-col items-start gap-3 rounded-xl border p-5 text-left transition-all",b?"border-cachi-500 bg-cachi-500/10 ring-1 ring-cachi-500":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700 hover:bg-zinc-800/50"),children:[h.badge&&r.jsx("span",{className:"absolute -top-2 right-3 rounded-full bg-cachi-600 px-2 py-0.5 text-[10px] font-medium text-white",children:h.badge}),r.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl",style:{backgroundColor:h.color+"20"},children:r.jsx(g,{className:"h-6 w-6",style:{color:h.color}})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-zinc-200",children:h.name}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:h.description})]})]},h.id)})}),r.jsxs("button",{onClick:()=>d(!0),className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-zinc-700 py-4 text-sm text-zinc-400 transition-colors hover:border-cachi-500 hover:text-cachi-400",children:[r.jsx(su,{className:"h-4 w-4"}),"Browse Bot Marketplace"]}),r.jsx(y2,{open:u,onClose:()=>d(!1),onInstalled:p})]})}function PM(){const{updateForm:e,nextStep:a,close:i,reset:l}=Bn(),[o,u]=C.useState([]),[d,f]=C.useState(!0),[p,h]=C.useState(null),[g,b]=C.useState(!1);C.useEffect(()=>{v()},[]);const v=async()=>{f(!0),h(null);try{const j=[...(await Tm()).templates].sort((N,D)=>D.downloads-N.downloads);u(j.slice(0,6))}catch(z){h(z instanceof Error?z.message:"Failed to load templates")}finally{f(!1)}},y=z=>{e({name:z.name,description:z.description,icon:z.icon,color:z.color,model:z.model,systemPrompt:z.system_prompt,tools:z.tools}),a()},k=()=>{i(),setTimeout(l,200)};return d?r.jsx("div",{className:"flex h-64 items-center justify-center",children:r.jsx(ot,{className:"h-8 w-8 animate-spin text-zinc-500"})}):p?r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center text-center",children:[r.jsx("p",{className:"text-sm text-red-400",children:p}),r.jsx("button",{onClick:v,className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Try again"})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-zinc-500",children:"Select a template to customize, or browse the full marketplace."}),r.jsx("div",{className:"grid grid-cols-2 gap-3",children:o.map(z=>r.jsx(b2,{template:z,onClick:()=>y(z)},z.id))}),r.jsxs("button",{onClick:()=>b(!0),className:"flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-zinc-700 py-3 text-sm text-zinc-400 transition-colors hover:border-cachi-500 hover:text-cachi-400",children:[r.jsx(su,{className:"h-4 w-4"}),"Browse All Templates"]}),r.jsx(y2,{open:g,onClose:()=>b(!1),onInstalled:k})]})}const $M={fitness:"Help me plan my gym workouts, track my progress, and give me nutrition advice to build muscle",cooking:"Help me plan weekly meals, find recipes based on what's in my fridge, and track my calorie intake",finance:"Help me budget my monthly expenses, track spending, and give me tips to save more money",travel:"Help me plan trips, find good deals on flights and hotels, and create day-by-day itineraries",coding:"Help me debug Python code, review my pull requests, and explain complex concepts simply",writing:"Help me write blog posts about technology, improve my drafts, and come up with catchy titles",learning:"Help me study for my exams, explain difficult topics, and create flashcards to memorize",productivity:"Help me organize my tasks, set goals, and stay focused on what matters most",creative:"Help me brainstorm ideas for my art projects, give feedback on my designs, and inspire me",gaming:"Help me improve at competitive games, find the best builds, and discover new games to play",social:"Help me improve my conversation skills, give advice on dating, and be more confident socially",custom:"Describe exactly what you want your bot to help you with..."};function VM(){const{form:e,updateForm:a}=Bn(),i=$M[e.purposeCategory]||"Describe what you want your bot to help you with...";return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"What's your bot for?"}),r.jsx("div",{className:"grid grid-cols-3 gap-2",children:Zl.map(l=>r.jsxs("button",{onClick:()=>a({purposeCategory:l.id}),className:ie("flex flex-col items-start rounded-lg border p-3 text-left transition-all",e.purposeCategory===l.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[r.jsx("span",{className:"text-sm font-medium text-zinc-200",children:l.label}),r.jsx("span",{className:"text-xs text-zinc-500 line-clamp-1",children:l.description})]},l.id))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"What do you want your bot to do?"}),r.jsx("textarea",{value:e.purposeDescription,onChange:l=>a({purposeDescription:l.target.value}),placeholder:i,rows:3,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 py-3 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"}),r.jsx("p",{className:"mt-2 text-xs text-zinc-500",children:"The more specific you are, the better we can personalize your bot."})]})]})}function GM(){const{form:e,updateForm:a,isGenerating:i,setGenerating:l,setGenerationError:o,setNameSuggestions:u,selectName:d}=Bn();C.useEffect(()=>{e.nameSuggestions.length===0&&!i&&f()},[]);const f=async()=>{var h;l(!0),o(null);try{const g=((h=Zl.find(v=>v.id===e.purposeCategory))==null?void 0:h.label)||e.purposeCategory,b=await H1({count:4,purpose:`${g}: ${e.purposeDescription}`});u(b),!e.name&&b.length>0&&d(b[0].name,b[0].meaning)}catch(g){o(g instanceof Error?g.message:"Failed to generate names")}finally{l(!1)}},p=(h,g)=>{d(h,g)};return i&&e.nameSuggestions.length===0?r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),r.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:r.jsx(Kn,{className:"h-8 w-8 text-cachi-400"})})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-lg font-medium text-zinc-200",children:"Finding the perfect name..."}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Each name has a special meaning"})]}),r.jsx(ot,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kn,{className:"h-4 w-4 text-cachi-400"}),r.jsx("span",{className:"text-sm font-medium text-zinc-300",children:"Pick a name that resonates with you"})]}),r.jsxs("button",{onClick:f,disabled:i,className:"flex items-center gap-1.5 text-xs text-cachi-400 hover:text-cachi-300 disabled:opacity-50",children:[r.jsx(Vi,{className:ie("h-3 w-3",i&&"animate-spin")}),"New suggestions"]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-3",children:e.nameSuggestions.map(h=>r.jsxs("button",{onClick:()=>p(h.name,h.meaning),disabled:i,className:ie("group relative rounded-xl border p-4 text-left transition-all",e.name===h.name?"border-cachi-500 bg-cachi-500/10 ring-1 ring-cachi-500/50":"border-zinc-700 bg-zinc-800/50 hover:border-zinc-600 hover:bg-zinc-800"),children:[e.name===h.name&&r.jsx("div",{className:"absolute right-3 top-3",children:r.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-cachi-500",children:r.jsx(Wn,{className:"h-3 w-3 text-white"})})}),r.jsx("h4",{className:ie("mb-2 text-xl font-bold",e.name===h.name?"text-cachi-300":"text-zinc-100"),children:h.name}),r.jsx("p",{className:"text-xs leading-relaxed text-zinc-400",children:h.meaning})]},h.name))}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("div",{className:"w-full border-t border-zinc-800"})}),r.jsx("div",{className:"relative flex justify-center",children:r.jsx("span",{className:"bg-zinc-900 px-3 text-xs text-zinc-600",children:"or use your own"})})]}),r.jsx("input",{type:"text",value:e.name,onChange:h=>a({name:h.target.value,selectedNameMeaning:"A custom name you chose"}),placeholder:"Type a custom name...",className:"h-11 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-center text-lg font-medium text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"}),e.name&&r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4 text-center",children:[r.jsx("p",{className:"text-sm text-zinc-500",children:"Your bot will be called"}),r.jsx("p",{className:"mt-1 text-2xl font-bold text-cachi-400",children:e.name}),e.selectedNameMeaning&&r.jsxs("p",{className:"mt-2 text-xs text-zinc-500 italic",children:['"',e.selectedNameMeaning,'"']})]})]})}function YM(){const{form:e,isGenerating:a,setGenerating:i,setGenerationError:l,setFollowUpQuestions:o,updateFollowUpAnswer:u}=Bn();C.useEffect(()=>{e.followUpQuestions.length===0&&!a&&d()},[]);const d=async()=>{var f;i(!0),l(null);try{const p=((f=Zl.find(g=>g.id===e.purposeCategory))==null?void 0:f.label)||e.purposeCategory,h=await q1({category:p,description:e.purposeDescription});o(h.map(g=>({...g,answer:""})))}catch(p){l(p instanceof Error?p.message:"Failed to generate questions")}finally{i(!1)}};return a&&e.followUpQuestions.length===0?r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),r.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:r.jsx(Kn,{className:"h-8 w-8 text-cachi-400"})})]}),r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"text-lg font-medium text-zinc-200",children:"Getting to know you better..."}),r.jsxs("p",{className:"mt-1 text-sm text-zinc-500",children:["Creating personalized questions for ",e.name]})]}),r.jsx(ot,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"rounded-lg border border-cachi-500/20 bg-cachi-500/5 p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(AN,{className:"mt-0.5 h-5 w-5 shrink-0 text-cachi-400"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:["Help ",e.name," understand you better"]}),r.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"These answers will help create a personalized assistant just for you."})]})]})}),r.jsx("div",{className:"space-y-5",children:e.followUpQuestions.map((f,p)=>r.jsxs("div",{className:"group",children:[r.jsxs("label",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-cachi-600/20 text-xs text-cachi-400",children:p+1}),f.question]}),r.jsx("textarea",{value:f.answer,onChange:h=>u(f.id,h.target.value),placeholder:f.placeholder,rows:2,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 py-3 text-sm text-zinc-100 placeholder-zinc-600 outline-none transition-colors focus:border-cachi-500"})]},f.id))}),r.jsx("p",{className:"text-center text-xs text-zinc-600",children:"Don't worry, you can always refine your bot later"})]})}const QM=[{id:"yes",label:"Yes, often",description:"Use emojis freely",icon:s4},{id:"sometimes",label:"Sometimes",description:"Use sparingly",icon:WN},{id:"no",label:"No emojis",description:"Keep it professional",icon:_l}];function XM(){const{form:e,updateForm:a}=Bn();return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"How should your bot communicate?"}),r.jsx("div",{className:"grid grid-cols-3 gap-2",children:n0.map(i=>r.jsxs("button",{onClick:()=>a({communicationStyle:i.id}),className:ie("flex flex-col items-start rounded-lg border p-3 text-left transition-all",e.communicationStyle===i.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[r.jsx("span",{className:"font-medium text-zinc-200",children:i.label}),r.jsx("span",{className:"text-xs text-zinc-500",children:i.description})]},i.id))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"Should your bot use emojis?"}),r.jsx("div",{className:"flex gap-3",children:QM.map(i=>{const l=i.icon;return r.jsxs("button",{onClick:()=>a({useEmojis:i.id}),className:ie("flex flex-1 flex-col items-center gap-2 rounded-lg border p-4 transition-all",e.useEmojis===i.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[r.jsx(l,{className:ie("h-6 w-6",e.useEmojis===i.id?"text-cachi-400":"text-zinc-500")}),r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"block font-medium text-zinc-200",children:i.label}),r.jsx("span",{className:"text-xs text-zinc-500",children:i.description})]})]},i.id)})})]})]})}function JM(){const{form:e,updateForm:a,isGenerating:i,generationError:l,setGenerating:o,setGenerationError:u,setGeneratedContent:d}=Bn(),[f,p]=C.useState(""),[h,g]=C.useState(!1);C.useEffect(()=>{!e.generatedPrompt&&!i&&b()},[]);const b=async()=>{var y,k;o(!0),u(null);try{const z=((y=Zl.find(D=>D.id===e.purposeCategory))==null?void 0:y.label)||e.purposeCategory,j=((k=n0.find(D=>D.id===e.communicationStyle))==null?void 0:k.label)||e.communicationStyle,N=await F1({name:e.name,name_meaning:e.selectedNameMeaning,purpose_category:z,purpose_description:e.purposeDescription,follow_up_answers:e.followUpQuestions.filter(D=>D.answer.trim()).map(D=>({question:D.question,answer:D.answer})),communication_style:j,use_emojis:e.useEmojis});d(N.system_prompt,N.suggested_name,N.suggested_description)}catch(z){u(z instanceof Error?z.message:"Failed to generate prompt")}finally{o(!1)}},v=async()=>{if(f.trim()){g(!0),u(null);try{const y=await P1({current_prompt:e.systemPrompt,feedback:f});a({systemPrompt:y.system_prompt}),p("")}catch(y){u(y instanceof Error?y.message:"Failed to refine prompt")}finally{g(!1)}}};return i?r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),r.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:r.jsx(Kn,{className:"h-8 w-8 text-cachi-400"})})]}),r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"text-lg font-medium text-zinc-200",children:["Creating ",e.name,"'s personality..."]}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Crafting a unique system prompt just for you"})]}),r.jsx(ot,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):r.jsxs("div",{className:"space-y-4",children:[l&&r.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[r.jsx(kr,{className:"h-5 w-5 text-red-400"}),r.jsx("span",{className:"text-sm text-red-400",children:l}),r.jsx("button",{onClick:b,className:"ml-auto text-sm text-red-400 underline hover:text-red-300",children:"Try again"})]}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 bg-zinc-900/50 px-4 py-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-zinc-500",children:"Personality for"}),r.jsx("p",{className:"text-lg font-bold text-cachi-400",children:e.name})]}),r.jsxs("button",{onClick:b,className:"flex items-center gap-1.5 text-xs text-cachi-400 hover:text-cachi-300",children:[r.jsx(Vi,{className:"h-3 w-3"}),"Regenerate"]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"System Prompt"}),r.jsx("textarea",{value:e.systemPrompt,onChange:y=>a({systemPrompt:y.target.value}),rows:8,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 py-3 font-mono text-xs leading-relaxed text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[r.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[r.jsx(qh,{className:"h-4 w-4 text-cachi-400"}),r.jsx("span",{className:"text-sm font-medium text-zinc-300",children:"Refine with AI"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",value:f,onChange:y=>p(y.target.value),onKeyDown:y=>y.key==="Enter"&&v(),placeholder:"e.g., 'make it more motivating' or 'add more personality'",className:"h-9 flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-3 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"}),r.jsx("button",{onClick:v,disabled:h||!f.trim(),className:"flex h-9 items-center gap-1.5 rounded-lg bg-cachi-600 px-4 text-sm font-medium text-white hover:bg-cachi-500 disabled:cursor-not-allowed disabled:opacity-50",children:h?r.jsx(ot,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(qh,{className:"h-4 w-4"}),"Refine"]})})]})]})]})}function ZM(){var v;const{form:e,previewMessages:a,isPreviewLoading:i,addPreviewMessage:l,clearPreviewMessages:o,setPreviewLoading:u}=Bn(),[d,f]=C.useState(""),p=((v=Zl.find(y=>y.id===e.purposeCategory))==null?void 0:v.label)||"general",h=[`Hey ${e.name}, what can you help me with?`,"What makes you different from other assistants?",`Give me a quick tip about ${p.toLowerCase()}`],g=async y=>{if(!(!y.trim()||i)){l("user",y),f(""),u(!0);try{const k=await $1({system_prompt:e.systemPrompt,test_message:y});l("assistant",k.response)}catch{l("assistant",`Hey! I'm ${e.name}. How can I help you today?`)}finally{u(!1)}}},b=y=>{y.preventDefault(),g(d)};return r.jsxs("div",{className:"flex h-[400px] flex-col",children:[r.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[r.jsx(lo,{className:"h-4 w-4 text-cachi-400"}),r.jsxs("span",{className:"text-sm font-medium text-zinc-300",children:["Chat with ",e.name]})]}),r.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[a.length===0?r.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[r.jsx("div",{className:"mb-3 flex h-14 w-14 items-center justify-center rounded-full bg-cachi-500/10",children:r.jsx(ii,{className:"h-7 w-7 text-cachi-400"})}),r.jsx("p",{className:"text-lg font-medium text-zinc-300",children:e.name}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"See how your bot responds before creating it"})]}):a.map((y,k)=>r.jsxs("div",{className:ie("flex gap-3",y.role==="user"?"justify-end":"justify-start"),children:[y.role==="assistant"&&r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-cachi-600/20",children:r.jsx(ii,{className:"h-4 w-4 text-cachi-400"})}),r.jsx("div",{className:ie("max-w-[80%] rounded-2xl px-4 py-2.5",y.role==="user"?"bg-cachi-600 text-white":"bg-zinc-800 text-zinc-100"),children:r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:y.content})}),y.role==="user"&&r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-zinc-700",children:r.jsx(Eu,{className:"h-4 w-4 text-zinc-300"})})]},k)),i&&r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-cachi-600/20",children:r.jsx(ii,{className:"h-4 w-4 text-cachi-400"})}),r.jsx("div",{className:"rounded-2xl bg-zinc-800 px-4 py-2.5",children:r.jsx(ot,{className:"h-5 w-5 animate-spin text-zinc-400"})})]})]}),a.length===0&&r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:h.map((y,k)=>r.jsx("button",{onClick:()=>g(y),className:"rounded-full border border-zinc-700 bg-zinc-800 px-3 py-1.5 text-xs text-zinc-400 hover:border-zinc-600 hover:text-zinc-300",children:y},k))}),r.jsxs("form",{onSubmit:b,className:"mt-3 flex gap-2",children:[r.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:`Message ${e.name}...`,disabled:i,className:"h-10 flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500 disabled:opacity-50"}),r.jsx("button",{type:"submit",disabled:i||!d.trim(),className:"flex h-10 w-10 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500 disabled:cursor-not-allowed disabled:opacity-50",children:r.jsx(Hh,{className:"h-4 w-4"})})]}),a.length>0&&r.jsx("button",{onClick:o,className:"mt-2 text-xs text-zinc-500 hover:text-zinc-400",children:"Clear conversation"})]})}const KM=["#22c55e","#3b82f6","#8b5cf6","#ec4899","#f59e0b","#ef4444","#06b6d4","#84cc16"];function WM(){const{form:e,updateForm:a}=Bn();return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Bot Name"}),r.jsx("input",{type:"text",value:e.name,onChange:i=>a({name:i.target.value}),placeholder:"My Awesome Bot",className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),r.jsx("input",{type:"text",value:e.description,onChange:i=>a({description:i.target.value}),placeholder:"What does this bot do?",className:"h-10 w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Icon"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:tv.map(i=>r.jsx("button",{onClick:()=>a({icon:i.id}),title:i.label,className:ie("flex h-10 w-10 items-center justify-center rounded-lg border transition-all",e.icon===i.id?"border-cachi-500 bg-cachi-500/20":"border-zinc-700 bg-zinc-800 hover:border-zinc-600"),children:r.jsx(ta,{icon:i.id,size:20})},i.id))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Color"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:KM.map(i=>r.jsx("button",{onClick:()=>a({color:i}),className:ie("h-10 w-10 rounded-lg border-2 transition-all",e.color===i?"border-white scale-110":"border-transparent hover:scale-105"),style:{backgroundColor:i}},i))})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"AI Model"}),r.jsx(_u,{value:e.model,onChange:i=>a({model:i}),placeholder:"Select AI Model"})]}),(e.method==="blank"||!e.generatedPrompt)&&r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"System Prompt"}),r.jsx("textarea",{value:e.systemPrompt,onChange:i=>a({systemPrompt:i.target.value}),placeholder:"Define the bot's personality and behavior...",rows:4,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-4 py-3 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"})]}),r.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[r.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:r.jsx(ta,{icon:e.icon,size:28,color:e.color})}),r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-zinc-100",children:e.name||"Bot Name"}),r.jsx("p",{className:"text-sm text-zinc-500",children:e.description||"Bot description"})]})]})]})}function eD(){var l,o;const{form:e}=Bn(),a=(l=Zl.find(u=>u.id===e.purposeCategory))==null?void 0:l.label,i=(o=n0.find(u=>u.id===e.communicationStyle))==null?void 0:o.label;return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:r.jsx(ta,{icon:e.icon,size:32,color:e.color})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.name||"New Bot"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:e.description||"A new AI assistant"}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.model&&r.jsx("span",{className:"rounded-full bg-zinc-800 px-2.5 py-1 text-xs text-zinc-400",children:e.model}),e.tools.length>0&&r.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-zinc-800 px-2.5 py-1 text-xs text-zinc-400",children:[r.jsx(Ul,{className:"h-3 w-3"}),e.tools.length," tools"]})]})]})]})}),e.method==="ai-assisted"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx(Kn,{className:"h-4 w-4 text-cachi-400"}),"AI-Generated Configuration"]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a&&r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/30 p-3",children:[r.jsx("span",{className:"text-xs text-zinc-500",children:"Purpose"}),r.jsx("p",{className:"mt-0.5 text-sm text-zinc-200",children:a})]}),i&&r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/30 p-3",children:[r.jsx("span",{className:"text-xs text-zinc-500",children:"Style"}),r.jsx("p",{className:"mt-0.5 text-sm text-zinc-200",children:i})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx($i,{className:"h-4 w-4 text-zinc-500"}),"System Prompt"]}),r.jsx("div",{className:"max-h-40 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/30 p-4",children:r.jsx("p",{className:"whitespace-pre-wrap text-sm text-zinc-400",children:e.systemPrompt||"(No system prompt configured)"})})]}),e.tools.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx(Ul,{className:"h-4 w-4 text-zinc-500"}),"Enabled Tools"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:e.tools.map(u=>r.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-zinc-800 px-3 py-1 text-xs text-zinc-300",children:[r.jsx(Wn,{className:"h-3 w-3 text-cachi-400"}),u.replace(/_/g," ")]},u))})]}),r.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-cachi-500/30 bg-cachi-500/10 px-4 py-3",children:[r.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-cachi-600",children:r.jsx(Wn,{className:"h-4 w-4 text-white"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-cachi-400",children:"Ready to create"}),r.jsx("p",{className:"text-xs text-cachi-400/70",children:'Click "Create Bot" to add this bot to your collection'})]})]})]})}function tD(e){const a=[],i=[];if(!e||typeof e!="object")return{valid:!1,errors:["Invalid file format"],warnings:[]};const l=e;if(l.version?l.version!=="1.0"&&a.push(`Unsupported version: ${l.version}`):a.push("Missing version field"),!l.bot||typeof l.bot!="object")return a.push("Missing or invalid bot data"),{valid:!1,errors:a,warnings:i};const o=l.bot;return(!o.name||typeof o.name!="string")&&a.push("Missing bot name"),(!o.model||typeof o.model!="string")&&a.push("Missing model"),(!o.systemPrompt||typeof o.systemPrompt!="string")&&a.push("Missing system prompt"),o.description||i.push("No description provided"),o.icon||i.push("Using default icon"),o.color||i.push("Using default color"),a.length>0?{valid:!1,errors:a,warnings:i}:{valid:!0,errors:[],warnings:i,bot:{name:o.name,description:o.description,icon:o.icon,color:o.color,model:o.model,systemPrompt:o.systemPrompt,tools:o.tools||[]}}}function nD(){const{updateForm:e}=Bn(),a=C.useRef(null),[i,l]=C.useState(!1),[o,u]=C.useState(null),[d,f]=C.useState(null),p=async k=>{if(!k.name.endsWith(".json")){u({valid:!1,errors:["Please select a JSON file"],warnings:[]});return}f(k.name);try{const z=await k.text(),j=JSON.parse(z),N=tD(j);u(N),N.valid&&N.bot&&e({name:N.bot.name,description:N.bot.description||"",icon:N.bot.icon||"bot",color:N.bot.color||"#3b82f6",model:N.bot.model,systemPrompt:N.bot.systemPrompt,tools:N.bot.tools||[]})}catch{u({valid:!1,errors:["Failed to parse JSON file"],warnings:[]})}},h=k=>{var j;const z=(j=k.target.files)==null?void 0:j[0];z&&p(z)},g=k=>{k.preventDefault(),l(!1);const z=k.dataTransfer.files[0];z&&p(z)},b=k=>{k.preventDefault(),l(!0)},v=()=>{l(!1)},y=()=>{u(null),f(null),a.current&&(a.current.value="")};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{onDrop:g,onDragOver:b,onDragLeave:v,onClick:()=>{var k;return(k=a.current)==null?void 0:k.click()},className:ie("flex cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-8 transition-colors",i?"border-cachi-500 bg-cachi-500/10":o!=null&&o.valid?"border-green-500/50 bg-green-500/5":o&&!o.valid?"border-red-500/50 bg-red-500/5":"border-zinc-700 hover:border-zinc-600"),children:[r.jsx("input",{ref:a,type:"file",accept:".json",onChange:h,className:"hidden"}),o!=null&&o.valid?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-green-500/20",children:r.jsx(Wn,{className:"h-7 w-7 text-green-400"})}),r.jsx("p",{className:"mt-4 font-medium text-green-400",children:"File validated successfully"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:d})]}):o&&!o.valid?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-red-500/20",children:r.jsx(kr,{className:"h-7 w-7 text-red-400"})}),r.jsx("p",{className:"mt-4 font-medium text-red-400",children:"Invalid file"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:d})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-zinc-800",children:r.jsx(Cu,{className:"h-7 w-7 text-zinc-500"})}),r.jsx("p",{className:"mt-4 font-medium text-zinc-300",children:"Drop a bot file here or click to browse"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Supports .json export files"})]})]}),o&&r.jsxs("div",{className:"space-y-3",children:[o.errors.length>0&&r.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[r.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-red-400",children:[r.jsx(xa,{className:"h-4 w-4"}),"Errors"]}),r.jsx("ul",{className:"mt-2 space-y-1",children:o.errors.map((k,z)=>r.jsx("li",{className:"text-sm text-red-300",children:k},z))})]}),o.warnings.length>0&&r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-4",children:[r.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-amber-400",children:[r.jsx(kr,{className:"h-4 w-4"}),"Warnings"]}),r.jsx("ul",{className:"mt-2 space-y-1",children:o.warnings.map((k,z)=>r.jsx("li",{className:"text-sm text-amber-300",children:k},z))})]})]}),(o==null?void 0:o.valid)&&o.bot&&r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[r.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[r.jsx(LN,{className:"h-4 w-4 text-zinc-500"}),"Imported Bot Preview"]}),r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-sm text-zinc-500",children:"Name:"}),r.jsx("span",{className:"text-sm text-zinc-200",children:o.bot.name})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-sm text-zinc-500",children:"Model:"}),r.jsx("span",{className:"font-mono text-xs text-zinc-200",children:o.bot.model})]}),o.bot.tools&&o.bot.tools.length>0&&r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-sm text-zinc-500",children:"Tools:"}),r.jsx("span",{className:"text-sm text-zinc-200",children:o.bot.tools.length})]})]})]}),o&&r.jsx("button",{onClick:y,className:"text-sm text-zinc-500 hover:text-zinc-400",children:"Clear and try again"})]})}const _y={"ai-assisted":[{id:"method-select",label:"Start"},{id:"purpose",label:"Purpose"},{id:"name-picker",label:"Name"},{id:"details",label:"Details"},{id:"personality",label:"Style"},{id:"prompt-review",label:"Review"},{id:"preview",label:"Test"},{id:"appearance",label:"Look"},{id:"confirm",label:"Create"}],template:[{id:"method-select",label:"Method"},{id:"template-select",label:"Template"},{id:"appearance",label:"Design"},{id:"confirm",label:"Create"}],blank:[{id:"method-select",label:"Method"},{id:"appearance",label:"Design"},{id:"confirm",label:"Create"}],import:[{id:"method-select",label:"Method"},{id:"import",label:"Import"},{id:"appearance",label:"Design"},{id:"confirm",label:"Create"}]};function aD(e){return{"method-select":"Choose how to create your bot","template-select":"Pick a template to start with",purpose:"What should your bot do?","name-picker":"Give your bot a meaningful name",details:"Help us understand you better",personality:"How should your bot communicate?","prompt-review":"Review your bot's personality",preview:"Chat with your bot before creating",appearance:"Customize the look",confirm:"Ready to create your bot",import:"Import a bot configuration"}[e]||""}function iD(){const{setCreateBotOpen:e}=It(),{addBot:a,setActiveBot:i}=Dt(),{isOpen:l,currentStep:o,completedSteps:u,form:d,isGenerating:f,close:p,reset:h,nextStep:g,prevStep:b}=Bn(),v=()=>{p(),e(!1),setTimeout(h,200)},y=()=>{const E={id:crypto.randomUUID(),name:d.name||"New Bot",description:d.description||"A new AI assistant",icon:d.icon,color:d.color,model:d.model,systemPrompt:d.systemPrompt,tools:d.tools,personality:d.method==="ai-assisted"?{purposeCategory:d.purposeCategory,purposeDescription:d.purposeDescription,communicationStyle:d.communicationStyle,useEmojis:d.useEmojis}:void 0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};a(E),i(E.id),v()},k=()=>{switch(o){case"method-select":return d.method!==null;case"purpose":return d.purposeCategory!==""&&d.purposeDescription.trim()!=="";case"name-picker":return d.name.trim()!=="";case"details":return!0;case"personality":return d.communicationStyle!=="";case"prompt-review":return d.systemPrompt.trim()!=="";case"preview":return!0;case"appearance":return d.name.trim()!=="";case"confirm":return!0;default:return!0}},z=d.method?_y[d.method]:_y["ai-assisted"],j=()=>{switch(o){case"method-select":return r.jsx(Ry,{});case"template-select":return r.jsx(PM,{});case"purpose":return r.jsx(VM,{});case"name-picker":return r.jsx(GM,{});case"details":return r.jsx(YM,{});case"personality":return r.jsx(XM,{});case"prompt-review":return r.jsx(JM,{});case"preview":return r.jsx(ZM,{});case"appearance":return r.jsx(WM,{});case"confirm":return r.jsx(eD,{});case"import":return r.jsx(nD,{});default:return r.jsx(Ry,{})}},N=o!=="method-select",D=o==="confirm";return r.jsxs(a0,{open:l,onClose:v,size:"xl",children:[r.jsx(i0,{title:"Create New Bot",subtitle:aD(o),icon:r.jsx(Kn,{className:"h-5 w-5 text-cachi-500"}),onClose:v,children:d.method&&r.jsx(UM,{steps:z,currentStep:o,completedSteps:u,variant:"compact",className:"mr-4"})}),r.jsx(r0,{scrollable:!0,maxHeight:"max-h-[65vh]",children:j()}),r.jsxs(g2,{leftContent:N?r.jsx(zl,{variant:"ghost",onClick:b,children:"Back"}):null,children:[r.jsx(zl,{variant:"ghost",onClick:v,children:"Cancel"}),D?r.jsx(zl,{variant:"primary",onClick:y,disabled:!k()||f,children:"Create Bot"}):r.jsx(zl,{variant:"primary",onClick:g,disabled:!k()||f,children:f?"Generating...":"Continue"})]})]})}function rD(){const{createBotOpen:e,setCreateBotOpen:a}=It(),{isOpen:i,open:l,close:o,reset:u}=Bn(),d=C.useRef(i);return C.useEffect(()=>{e&&!i?l():!e&&i&&(o(),setTimeout(u,200))},[e,i,l,o,u]),C.useEffect(()=>{d.current&&!i&&e&&a(!1),d.current=i},[i,e,a]),r.jsx(iD,{})}function lD(){const{settingsOpen:e,setSettingsOpen:a,showThinking:i,setShowThinking:l,showCost:o,setShowCost:u}=It(),{config:d,updateConfig:f}=t0(),{defaultModel:p,updateDefaultModel:h}=jo();if(!e)return null;const g=async y=>{await h(y);try{await Zc({model:y})}catch(k){console.error("Failed to update model:",k)}},b=async(y,k)=>{y==="showThinking"?l(k):u(k);try{await Zc({[y==="showThinking"?"show_thinking":"show_cost"]:k})}catch(z){console.error("Failed to update setting:",z)}},v=async y=>{f({approveActions:y});try{await Zc({approve_actions:y})}catch(k){console.error("Failed to update setting:",k)}};return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:r.jsxs("div",{className:"w-full max-w-md rounded-xl bg-white p-6 shadow-xl dark:bg-zinc-900",children:[r.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Settings"}),r.jsx(Wt,{variant:"ghost",size:"sm",onClick:()=>a(!1),children:r.jsx(xa,{className:"h-5 w-5"})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Default Model"}),r.jsx(_u,{value:p,onChange:g,placeholder:"Select a model...",className:"w-full"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ah,{label:"Show thinking",description:"Display the agent's reasoning process",checked:i,onChange:y=>b("showThinking",y)}),r.jsx(Ah,{label:"Show cost",description:"Display token usage and cost information",checked:o,onChange:y=>b("showCost",y)}),r.jsx(Ah,{label:"Require approval",description:"Ask for approval before executing risky operations",checked:(d==null?void 0:d.agent.approveActions)??!1,onChange:v})]}),d&&r.jsxs("div",{children:[r.jsx("label",{className:"mb-1 block text-sm font-medium",children:"Workspace"}),r.jsx("p",{className:"truncate text-sm text-zinc-500 dark:text-zinc-400",children:d.workspacePath})]})]})]})})}function Ah({label:e,description:a,checked:i,onChange:l}){return r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:e}),r.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:a})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":i,onClick:()=>l(!i),className:ie("relative h-6 w-11 rounded-full transition-colors",i?"bg-cachi-600":"bg-zinc-200 dark:bg-zinc-700"),children:r.jsx("span",{className:ie("absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-white transition-transform",i&&"translate-x-5")})})]})}function sD({onApprove:e}){const[a,i]=C.useState(W8());if(C.useEffect(()=>eA(i),[]),!a)return null;const{id:l,tool:o,action:u,details:d}=a,f=d.riskLevel||"UNKNOWN",p=d.reasons||[],h=d.code,g=f==="HIGH"||f==="CRITICAL";return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:r.jsxs("div",{className:"w-full max-w-lg rounded-xl bg-white shadow-xl dark:bg-zinc-900",children:[r.jsxs("div",{className:ie("flex items-center gap-3 rounded-t-xl px-6 py-4",g?"bg-red-50 dark:bg-red-900/20":"bg-amber-50 dark:bg-amber-900/20"),children:[r.jsx("div",{className:ie("flex h-10 w-10 items-center justify-center rounded-full",g?"bg-red-100 text-red-600 dark:bg-red-800 dark:text-red-300":"bg-amber-100 text-amber-600 dark:bg-amber-800 dark:text-amber-300"),children:r.jsx(ku,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"font-semibold",children:"Approval Required"}),r.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:u})]})]}),r.jsxs("div",{className:"max-h-[60vh] overflow-y-auto p-6",children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"Tool"}),r.jsx("p",{className:"font-medium",children:o})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"Risk Level"}),r.jsxs("span",{className:ie("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-sm font-medium",{"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":f==="CRITICAL","bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400":f==="HIGH","bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":f==="MEDIUM","bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":f==="LOW"}),children:[r.jsx(Bl,{className:"h-3 w-3"}),f]})]}),p.length>0&&r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"mb-2 text-sm text-zinc-500 dark:text-zinc-400",children:"Risk Factors"}),r.jsx("ul",{className:"space-y-1",children:p.map((b,v)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx("span",{className:"mt-1 h-1.5 w-1.5 flex-shrink-0 rounded-full bg-amber-500"}),b]},v))})]}),h&&r.jsxs("div",{children:[r.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-sm text-zinc-500 dark:text-zinc-400",children:[r.jsx($l,{className:"h-4 w-4"}),"Code to Execute"]}),r.jsx("pre",{className:"max-h-48 overflow-auto rounded-lg bg-zinc-900 p-4 text-sm text-zinc-100",children:r.jsx("code",{children:h})})]})]}),r.jsxs("div",{className:"flex justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-800",children:[r.jsx(Wt,{variant:"secondary",onClick:()=>e(l,!1),children:"Deny"}),r.jsx(Wt,{variant:g?"danger":"primary",onClick:()=>e(l,!0),children:g?"Allow Anyway":"Approve"})]})]})})}const Mh={"/dashboard":"dashboard","/models":"models","/settings":"settings"};function oD(e){if(Mh[e])return Mh[e];for(const[a,i]of Object.entries(Mh))if(e.startsWith(a+"/"))return i;return null}function sn(){const e=ma(),a=wn(),{botId:i,chatId:l,taskId:o}=n1(),{activeView:u,activeBotId:d,bots:f,setActiveBot:p,setActiveView:h}=Dt(),{activeChatId:g,chats:b,setActiveChat:v}=Rn(),{setActiveTask:y}=Il(),{theme:k,accentColor:z,mobileMenuOpen:j,setMobileMenuOpen:N}=It(),{setConfig:D}=t0(),{refresh:E}=jo(),L=oD(e.pathname),A=e.pathname.split("/").filter(Boolean)[1],ae=A?{chats:"chats",tasks:"tasks",work:"work",schedules:"schedules",tools:"tools",settings:"settings"}[A]:null;C.useEffect(()=>{if(i&&i!==d)if(f.some(U=>U.id===i))p(i);else{a("/",{replace:!0});return}if(ae&&ae!==u&&h(ae),l&&l!==g){let O=b.find(U=>U.id===l);!O&&(l==="telegram"||l==="discord")&&(O=b.find(U=>U.platform===l&&U.botId===i)),O&&O.botId===i&&v(O.id)}o&&y(o)},[i,ae,l,o,f,b,d,g,u,p,h,v,y,a]),C.useEffect(()=>{const O=U=>{U?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};if(k==="system"){const U=window.matchMedia("(prefers-color-scheme: dark)");O(U.matches);const $=me=>O(me.matches);return U.addEventListener("change",$),()=>U.removeEventListener("change",$)}else O(k==="dark")},[k]),C.useEffect(()=>{var U;const O=(U=Mm[z])==null?void 0:U.palette;if(O){const $=document.documentElement;Object.entries(O).forEach(([me,V])=>{$.style.setProperty(`--accent-${me}`,V)})}},[z]),C.useEffect(()=>{async function O(){try{const U=await U1(),$={agent:{model:U.agent.model,maxIterations:U.agent.max_iterations,approveActions:U.agent.approve_actions,temperature:U.agent.temperature},sandbox:{allowedImports:U.sandbox.allowed_imports,timeoutSeconds:U.sandbox.timeout_seconds,maxOutputLength:U.sandbox.max_output_length},display:{showThinking:U.display.show_thinking,showCost:U.display.show_cost,style:U.display.style},workspacePath:U.workspace_path};D($)}catch(U){console.error("Failed to load config:",U)}}O(),E()},[D,E]);const ee=()=>{if(L)switch(L){case"dashboard":return r.jsx(mM,{});case"settings":return r.jsx(gM,{});case"models":return r.jsx(SM,{})}switch(ae||u){case"chats":return r.jsx(Ty,{});case"tasks":return r.jsx(uA,{});case"work":return r.jsx(CM,{});case"schedules":return r.jsx(AM,{});case"tools":return r.jsx(gA,{});case"settings":return r.jsx(rM,{});default:return r.jsx(Ty,{})}};return r.jsxs("div",{className:"flex h-screen bg-zinc-100 text-zinc-900 dark:bg-zinc-950 dark:text-zinc-100",children:[j&&r.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>N(!1)}),r.jsx("div",{className:`
          fixed inset-y-0 left-0 z-50 transition-transform duration-300 lg:static lg:translate-x-0
          ${j?"translate-x-0":"-translate-x-full"}
        `,children:r.jsx(s5,{onNavigate:()=>N(!1)})}),!L&&r.jsx("div",{className:`
            fixed inset-y-0 left-[72px] z-50 transition-transform duration-300 lg:static lg:translate-x-0
            ${j?"translate-x-0":"-translate-x-[calc(100%+72px)]"}
          `,children:r.jsx(d5,{onNavigate:()=>N(!1)})}),r.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden",children:[r.jsxs("div",{className:"flex h-12 items-center gap-3 border-b border-zinc-200 bg-white px-3 dark:border-zinc-800 dark:bg-zinc-900 lg:hidden",children:[r.jsx("button",{onClick:()=>N(!j),className:"flex h-9 w-9 items-center justify-center rounded-lg text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200",children:j?r.jsx(xa,{className:"h-5 w-5"}):r.jsx(e4,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-accent-600",children:r.jsx("span",{className:"text-sm font-bold text-white",children:"C"})}),r.jsx("span",{className:"font-semibold text-zinc-900 dark:text-zinc-100",children:"CachiBot"})]})]}),ee()]}),r.jsx(rD,{}),r.jsx(lD,{}),r.jsx(sD,{onApprove:()=>{}})]})}function cD(){const e=wn(),{login:a,setSetupRequired:i,isLoading:l,setLoading:o}=ga(),[u,d]=C.useState(""),[f,p]=C.useState(""),[h,g]=C.useState(!1),[b,v]=C.useState(!1);C.useEffect(()=>{(async()=>{try{const{setup_required:z}=await Sm();i(z),z&&e("/setup",{replace:!0})}catch(z){console.error("Failed to check setup status:",z)}finally{o(!1)}})()},[i,o,e]);const y=async k=>{if(k.preventDefault(),!u.trim()||!f){Xe.error("Please enter your credentials");return}v(!0);try{const z=await b4({identifier:u.trim(),password:f});a(z.user,z.access_token,z.refresh_token),Xe.success(`Welcome back, ${z.user.username}!`),e("/")}catch(z){const j=z instanceof Error?z.message:"Login failed";Xe.error(j)}finally{v(!1)}};return l?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:r.jsx(ot,{className:"h-8 w-8 animate-spin text-accent-500"})}):r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950 px-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-gradient-to-br from-accent-500 to-accent-600 mb-4",children:r.jsx(pa,{className:"h-8 w-8 text-white"})}),r.jsx("h1",{className:"text-2xl font-bold text-zinc-900 dark:text-white",children:"CachiBot"}),r.jsx("p",{className:"text-zinc-500 dark:text-zinc-400 mt-1",children:"Sign in to continue"})]}),r.jsx("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-6 shadow-sm",children:r.jsxs("form",{onSubmit:y,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{htmlFor:"identifier",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Email or Username"}),r.jsx("input",{id:"identifier",type:"text",value:u,onChange:k=>d(k.target.value),placeholder:"Enter your email or username",className:"w-full px-3 py-2 bg-zinc-100 dark:bg-zinc-800 border border-zinc-300 dark:border-zinc-700 rounded-lg text-zinc-900 dark:text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-accent-500 focus:border-transparent",required:!0,autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"loginPassword",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{id:"loginPassword",type:h?"text":"password",value:f,onChange:k=>p(k.target.value),placeholder:"Enter your password",className:"w-full px-3 py-2 pr-10 bg-zinc-100 dark:bg-zinc-800 border border-zinc-300 dark:border-zinc-700 rounded-lg text-zinc-900 dark:text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-accent-500 focus:border-transparent",required:!0}),r.jsx("button",{type:"button",onClick:()=>g(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300",children:h?r.jsx(N1,{className:"h-4 w-4"}):r.jsx(vu,{className:"h-4 w-4"})})]})]}),r.jsx(Wt,{type:"submit",className:"w-full justify-center",disabled:b,children:b?r.jsxs(r.Fragment,{children:[r.jsx(ot,{className:"h-4 w-4 animate-spin mr-2"}),"Signing in..."]}):"Sign In"})]})}),r.jsx("p",{className:"text-center text-zinc-500 text-sm mt-6",children:"The Armored AI Agent"})]})})}function uD(){const e=wn(),{login:a,setSetupRequired:i,isLoading:l,setLoading:o}=ga(),[u,d]=C.useState(""),[f,p]=C.useState(""),[h,g]=C.useState(""),[b,v]=C.useState(""),[y,k]=C.useState(!1),[z,j]=C.useState(!1),[N,D]=C.useState(null);C.useEffect(()=>{(async()=>{try{const{setup_required:Y}=await Sm();i(Y),D(Y),Y||e("/login",{replace:!0})}catch(Y){console.error("Failed to check setup status:",Y),Xe.error("Failed to check setup status")}finally{o(!1)}})()},[i,o,e]);const E=async L=>{if(L.preventDefault(),!u.trim()||!f.trim()||!h){Xe.error("Please fill in all fields");return}if(h!==b){Xe.error("Passwords do not match");return}if(h.length<8){Xe.error("Password must be at least 8 characters");return}if(f.length<3){Xe.error("Username must be at least 3 characters");return}j(!0);try{const Y=await g4({email:u.trim().toLowerCase(),username:f.trim().toLowerCase(),password:h});a(Y.user,Y.access_token,Y.refresh_token),Xe.success("Admin account created successfully!"),e("/")}catch(Y){const A=Y instanceof Error?Y.message:"Setup failed";Xe.error(A)}finally{j(!1)}};return l||N===null?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:r.jsx(ot,{className:"h-8 w-8 animate-spin text-accent-500"})}):r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950 px-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-gradient-to-br from-accent-500 to-accent-600 mb-4",children:r.jsx(pa,{className:"h-8 w-8 text-white"})}),r.jsx("h1",{className:"text-2xl font-bold text-zinc-900 dark:text-white",children:"CachiBot Setup"}),r.jsx("p",{className:"text-zinc-500 dark:text-zinc-400 mt-1",children:"Create your admin account to get started"})]}),r.jsx("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-6 shadow-sm",children:r.jsxs("form",{onSubmit:E,className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4 p-3 bg-blue-500/10 rounded-lg border border-blue-500/20",children:[r.jsx(km,{className:"h-5 w-5 text-blue-400 flex-shrink-0"}),r.jsx("p",{className:"text-sm text-blue-300",children:"Welcome! Set up your admin account to start using CachiBot."})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),r.jsx("input",{id:"email",type:"email",value:u,onChange:L=>d(L.target.value),placeholder:"admin@example.com",className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",required:!0,autoFocus:!0})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),r.jsx("input",{id:"username",type:"text",value:f,onChange:L=>p(L.target.value),placeholder:"admin",className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",required:!0,minLength:3,maxLength:32})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{id:"password",type:y?"text":"password",value:h,onChange:L=>g(L.target.value),placeholder:"Min. 8 characters",className:"w-full px-3 py-2 pr-10 bg-zinc-800 border border-zinc-700 rounded-lg text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",required:!0,minLength:8}),r.jsx("button",{type:"button",onClick:()=>k(!y),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-zinc-400 hover:text-zinc-300",children:y?r.jsx(N1,{className:"h-4 w-4"}):r.jsx(vu,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{children:[r.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Confirm Password"}),r.jsx("input",{id:"confirmPassword",type:y?"text":"password",value:b,onChange:L=>v(L.target.value),placeholder:"Repeat your password",className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",required:!0})]}),r.jsx(Wt,{type:"submit",className:"w-full justify-center",disabled:z,children:z?r.jsxs(r.Fragment,{children:[r.jsx(ot,{className:"h-4 w-4 animate-spin mr-2"}),"Creating account..."]}):r.jsxs(r.Fragment,{children:["Create Admin Account",r.jsx(y1,{className:"h-4 w-4 ml-2"})]})})]})}),r.jsx("p",{className:"text-center text-zinc-500 text-sm mt-6",children:"The Armored AI Agent"})]})})}function Zt({children:e,requireAdmin:a=!1}){const i=ma(),{isAuthenticated:l,isLoading:o,user:u,setupRequired:d,setUser:f,setSetupRequired:p,setLoading:h,logout:g}=ga(),[b,v]=C.useState(!1);return C.useEffect(()=>{(async()=>{if(d===null)try{const{setup_required:k}=await Sm();if(p(k),k){h(!1),v(!0);return}}catch{p(!1)}if(l)try{const k=await v4();f(k)}catch{g()}h(!1),v(!0)})()},[l,d,f,p,h,g]),o||!b?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:r.jsx(ot,{className:"h-8 w-8 animate-spin text-accent-500"})}):d?r.jsx(Qc,{to:"/setup",state:{from:i},replace:!0}):l?a&&(u==null?void 0:u.role)!=="admin"?r.jsx(Qc,{to:"/",replace:!0}):r.jsx(r.Fragment,{children:e}):r.jsx(Qc,{to:"/login",state:{from:i},replace:!0})}function dD(){const e=wn(),{user:a}=ga(),[i,l]=C.useState([]),[o,u]=C.useState(!0),[d,f]=C.useState(0),[p,h]=C.useState(!1),[g,b]=C.useState({email:"",username:"",password:"",role:"user"}),[v,y]=C.useState(!1),[k,z]=C.useState(null),[j,N]=C.useState({email:"",username:"",role:"user"}),[D,E]=C.useState(!1),[L,Y]=C.useState(null);C.useEffect(()=>{A()},[]);const A=async()=>{try{const U=await O1();l(U.users),f(U.total)}catch{Xe.error("Failed to load users")}finally{u(!1)}},H=async U=>{if(U.preventDefault(),!g.email||!g.username||!g.password){Xe.error("All fields are required");return}if(g.password.length<8){Xe.error("Password must be at least 8 characters");return}y(!0);try{const $=await R1(g);l([$,...i]),f(d+1),h(!1),b({email:"",username:"",password:"",role:"user"}),Xe.success("User created successfully")}catch($){const me=$ instanceof Error?$.message:"Failed to create user";Xe.error(me)}finally{y(!1)}},ae=async U=>{if(U.preventDefault(),!!k){E(!0);try{const $=await _1(k.id,j);l(i.map(me=>me.id===$.id?$:me)),z(null),Xe.success("User updated successfully")}catch($){const me=$ instanceof Error?$.message:"Failed to update user";Xe.error(me)}finally{E(!1)}}},ee=async U=>{if(confirm("Are you sure you want to deactivate this user?")){try{await L1(U),l(i.map($=>$.id===U?{...$,is_active:!1}:$)),Xe.success("User deactivated")}catch($){const me=$ instanceof Error?$.message:"Failed to deactivate user";Xe.error(me)}Y(null)}},O=U=>{z(U),N({email:U.email,username:U.username,role:U.role}),Y(null)};return o?r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-950",children:r.jsx(ot,{className:"h-8 w-8 animate-spin text-blue-500"})}):r.jsxs("div",{className:"min-h-screen bg-zinc-950 text-white",children:[r.jsx("header",{className:"sticky top-0 z-10 bg-zinc-950/80 backdrop-blur-sm border-b border-zinc-800",children:r.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("button",{onClick:()=>e("/"),className:"p-2 hover:bg-zinc-800 rounded-lg transition-colors",children:r.jsx(NN,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Nm,{className:"h-5 w-5 text-blue-400"}),r.jsx("h1",{className:"text-lg font-semibold",children:"User Management"})]})]}),r.jsxs(Wt,{onClick:()=>h(!0),children:[r.jsx(km,{className:"h-4 w-4 mr-2"}),"Add User"]})]})}),r.jsxs("main",{className:"max-w-5xl mx-auto px-4 py-6",children:[r.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 overflow-hidden",children:[r.jsxs("div",{className:"grid grid-cols-[1fr_1fr_100px_100px_48px] gap-4 px-4 py-3 bg-zinc-800/50 text-sm text-zinc-400 font-medium",children:[r.jsx("div",{children:"User"}),r.jsx("div",{children:"Email"}),r.jsx("div",{children:"Role"}),r.jsx("div",{children:"Status"}),r.jsx("div",{})]}),i.length===0?r.jsx("div",{className:"px-4 py-8 text-center text-zinc-500",children:"No users found"}):i.map(U=>r.jsxs("div",{className:"grid grid-cols-[1fr_1fr_100px_100px_48px] gap-4 px-4 py-3 border-t border-zinc-800 items-center hover:bg-zinc-800/30 transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-zinc-700 flex items-center justify-center",children:r.jsx(iu,{className:"h-4 w-4 text-zinc-400"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:U.username}),U.id===(a==null?void 0:a.id)&&r.jsx("div",{className:"text-xs text-blue-400",children:"You"})]})]}),r.jsx("div",{className:"text-zinc-400 truncate",children:U.email}),r.jsx("div",{children:r.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${U.role==="admin"?"bg-purple-500/20 text-purple-300":"bg-zinc-700 text-zinc-300"}`,children:[U.role==="admin"?r.jsx(pa,{className:"h-3 w-3"}):r.jsx(Eu,{className:"h-3 w-3"}),U.role]})}),r.jsx("div",{children:r.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${U.is_active?"bg-green-500/20 text-green-300":"bg-red-500/20 text-red-300"}`,children:[U.is_active?r.jsx(Wn,{className:"h-3 w-3"}):r.jsx(xa,{className:"h-3 w-3"}),U.is_active?"Active":"Inactive"]})}),r.jsxs("div",{className:"relative",children:[r.jsx("button",{onClick:()=>Y(L===U.id?null:U.id),className:"p-1.5 hover:bg-zinc-700 rounded transition-colors",disabled:U.id===(a==null?void 0:a.id),children:r.jsx(j1,{className:"h-4 w-4 text-zinc-400"})}),L===U.id&&r.jsxs("div",{className:"absolute right-0 top-full mt-1 w-40 bg-zinc-800 border border-zinc-700 rounded-lg shadow-lg py-1 z-20",children:[r.jsx("button",{onClick:()=>O(U),className:"w-full px-3 py-2 text-left text-sm hover:bg-zinc-700 transition-colors",children:"Edit User"}),U.is_active&&r.jsx("button",{onClick:()=>ee(U.id),className:"w-full px-3 py-2 text-left text-sm text-red-400 hover:bg-zinc-700 transition-colors",children:"Deactivate"})]})]})]},U.id))]}),r.jsxs("p",{className:"text-sm text-zinc-500 mt-4 text-center",children:[d," user",d!==1?"s":""," total"]})]}),p&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 p-6 w-full max-w-md mx-4",children:[r.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Create New User"}),r.jsxs("form",{onSubmit:H,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),r.jsxs("div",{className:"relative",children:[r.jsx(C1,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),r.jsx("input",{type:"email",value:g.email,onChange:U=>b({...g,email:U.target.value}),className:"w-full pl-10 pr-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),r.jsxs("div",{className:"relative",children:[r.jsx(iu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),r.jsx("input",{type:"text",value:g.username,onChange:U=>b({...g,username:U.target.value}),className:"w-full pl-10 pr-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0,minLength:3,maxLength:32})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Password"}),r.jsx("input",{type:"password",value:g.password,onChange:U=>b({...g,password:U.target.value}),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0,minLength:8,placeholder:"Min. 8 characters"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Role"}),r.jsxs("select",{value:g.role,onChange:U=>b({...g,role:U.target.value}),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"user",children:"User"}),r.jsx("option",{value:"admin",children:"Admin"})]})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[r.jsx(Wt,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>h(!1),children:"Cancel"}),r.jsx(Wt,{type:"submit",className:"flex-1",disabled:v,children:v?r.jsx(ot,{className:"h-4 w-4 animate-spin"}):"Create User"})]})]})]})}),k&&r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:r.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 p-6 w-full max-w-md mx-4",children:[r.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Edit User"}),r.jsxs("form",{onSubmit:ae,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),r.jsx("input",{type:"email",value:j.email,onChange:U=>N({...j,email:U.target.value}),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),r.jsx("input",{type:"text",value:j.username,onChange:U=>N({...j,username:U.target.value}),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0,minLength:3,maxLength:32})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Role"}),r.jsxs("select",{value:j.role,onChange:U=>N({...j,role:U.target.value}),className:"w-full px-3 py-2 bg-zinc-800 border border-zinc-700 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-blue-500",children:[r.jsx("option",{value:"user",children:"User"}),r.jsx("option",{value:"admin",children:"Admin"})]})]}),r.jsxs("div",{className:"flex gap-3 pt-2",children:[r.jsx(Wt,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>z(null),children:"Cancel"}),r.jsx(Wt,{type:"submit",className:"flex-1",disabled:D,children:D?r.jsx(ot,{className:"h-4 w-4 animate-spin"}):"Save Changes"})]})]})]})}),L&&r.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>Y(null)})]})}function fD(){const{theme:e}=It();return C.useEffect(()=>{const a=document.documentElement;e==="dark"||e==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches?a.classList.add("dark"):a.classList.remove("dark")},[e]),r.jsxs(Uz,{children:[r.jsx(At,{path:"/login",element:r.jsx(cD,{})}),r.jsx(At,{path:"/setup",element:r.jsx(uD,{})}),r.jsx(At,{path:"/dashboard",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/models",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/settings",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/settings/:settingsTab",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/users",element:r.jsx(Zt,{requireAdmin:!0,children:r.jsx(dD,{})})}),r.jsx(At,{path:"/:botId/chats",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/chats/:chatId",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/tasks",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/tasks/:taskId",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/work",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/work/:workId",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/schedules",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/schedules/:scheduleId",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/tools",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/:botId/settings",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"/",element:r.jsx(Zt,{children:r.jsx(sn,{})})}),r.jsx(At,{path:"*",element:r.jsx(Qc,{to:"/",replace:!0})})]})}const hD=new Vk({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});qj.createRoot(document.getElementById("root")).render(r.jsx(C.StrictMode,{children:r.jsx(ok,{children:r.jsxs(Yk,{client:hD,children:[r.jsx(fD,{}),r.jsx(vN,{position:"bottom-right",richColors:!0})]})})}));
