var Lz=Object.defineProperty;var Nb=e=>{throw TypeError(e)};var Bz=(e,n,r)=>n in e?Lz(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r;var ma=(e,n,r)=>Bz(e,typeof n!="symbol"?n+"":n,r),hh=(e,n,r)=>n.has(e)||Nb("Cannot "+r);var ie=(e,n,r)=>(hh(e,n,"read from private field"),r?r.call(e):n.get(e)),Xe=(e,n,r)=>n.has(e)?Nb("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(e):n.set(e,r),Ae=(e,n,r,i)=>(hh(e,n,"write to private field"),i?i.call(e,r):n.set(e,r),r),en=(e,n,r)=>(hh(e,n,"access private method"),r);var tu=(e,n,r,i)=>({set _(o){Ae(e,n,o,r)},get _(){return ie(e,n,i)}});(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(o){if(o.ep)return;o.ep=!0;const c=r(o);fetch(o.href,c)}})();function Ou(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mh={exports:{}},Kl={};/**
 * @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 kb;function Uz(){if(kb)return Kl;kb=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(i,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:i,key:d,ref:o!==void 0?o:null,props:c}}return Kl.Fragment=n,Kl.jsx=r,Kl.jsxs=r,Kl}var Sb;function Hz(){return Sb||(Sb=1,mh.exports=Uz()),mh.exports}var s=Hz(),ph={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 Cb;function qz(){if(Cb)return De;Cb=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function y(U){return U===null||typeof U!="object"?null:(U=v&&U[v]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,z={};function j(U,Q,D){this.props=U,this.context=Q,this.refs=z,this.updater=D||k}j.prototype.isReactComponent={},j.prototype.setState=function(U,Q){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,Q,"setState")},j.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function E(){}E.prototype=j.prototype;function N(U,Q,D){this.props=U,this.context=Q,this.refs=z,this.updater=D||k}var M=N.prototype=new E;M.constructor=N,C(M,j.prototype),M.isPureReactComponent=!0;var R=Array.isArray;function A(){}var F={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function Z(U,Q,D){var G=D.ref;return{$$typeof:e,type:U,key:Q,ref:G!==void 0?G:null,props:D}}function L(U,Q){return Z(U.type,Q,U.props)}function P(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function Y(U){var Q={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(D){return Q[D]})}var me=/\/+/g;function _(U,Q){return typeof U=="object"&&U!==null&&U.key!=null?Y(""+U.key):Q.toString(36)}function q(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(A,A):(U.status="pending",U.then(function(Q){U.status==="pending"&&(U.status="fulfilled",U.value=Q)},function(Q){U.status==="pending"&&(U.status="rejected",U.reason=Q)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function B(U,Q,D,G,be){var ye=typeof U;(ye==="undefined"||ye==="boolean")&&(U=null);var W=!1;if(U===null)W=!0;else switch(ye){case"bigint":case"string":case"number":W=!0;break;case"object":switch(U.$$typeof){case e:case n:W=!0;break;case b:return W=U._init,B(W(U._payload),Q,D,G,be)}}if(W)return be=be(U),W=G===""?"."+_(U,0):G,R(be)?(D="",W!=null&&(D=W.replace(me,"$&/")+"/"),B(be,Q,D,"",function(rt){return rt})):be!=null&&(P(be)&&(be=L(be,D+(be.key==null||U&&U.key===be.key?"":(""+be.key).replace(me,"$&/")+"/")+W)),Q.push(be)),1;W=0;var de=G===""?".":G+":";if(R(U))for(var ke=0;ke<U.length;ke++)G=U[ke],ye=de+_(G,ke),W+=B(G,Q,D,ye,be);else if(ke=y(U),typeof ke=="function")for(U=ke.call(U),ke=0;!(G=U.next()).done;)G=G.value,ye=de+_(G,ke++),W+=B(G,Q,D,ye,be);else if(ye==="object"){if(typeof U.then=="function")return B(q(U),Q,D,G,be);throw Q=String(U),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return W}function V(U,Q,D){if(U==null)return U;var G=[],be=0;return B(U,G,"","",function(ye){return Q.call(D,ye,be++)}),G}function oe(U){if(U._status===-1){var Q=U._result;Q=Q(),Q.then(function(D){(U._status===0||U._status===-1)&&(U._status=1,U._result=D)},function(D){(U._status===0||U._status===-1)&&(U._status=2,U._result=D)}),U._status===-1&&(U._status=0,U._result=Q)}if(U._status===1)return U._result.default;throw U._result}var ue=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},O={map:V,forEach:function(U,Q,D){V(U,function(){Q.apply(this,arguments)},D)},count:function(U){var Q=0;return V(U,function(){Q++}),Q},toArray:function(U){return V(U,function(Q){return Q})||[]},only:function(U){if(!P(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return De.Activity=g,De.Children=O,De.Component=j,De.Fragment=r,De.Profiler=o,De.PureComponent=N,De.StrictMode=i,De.Suspense=m,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,De.__COMPILER_RUNTIME={__proto__:null,c:function(U){return F.H.useMemoCache(U)}},De.cache=function(U){return function(){return U.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(U,Q,D){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var G=C({},U.props),be=U.key;if(Q!=null)for(ye in Q.key!==void 0&&(be=""+Q.key),Q)!ee.call(Q,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&Q.ref===void 0||(G[ye]=Q[ye]);var ye=arguments.length-2;if(ye===1)G.children=D;else if(1<ye){for(var W=Array(ye),de=0;de<ye;de++)W[de]=arguments[de+2];G.children=W}return Z(U.type,be,G)},De.createContext=function(U){return U={$$typeof:d,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:c,_context:U},U},De.createElement=function(U,Q,D){var G,be={},ye=null;if(Q!=null)for(G in Q.key!==void 0&&(ye=""+Q.key),Q)ee.call(Q,G)&&G!=="key"&&G!=="__self"&&G!=="__source"&&(be[G]=Q[G]);var W=arguments.length-2;if(W===1)be.children=D;else if(1<W){for(var de=Array(W),ke=0;ke<W;ke++)de[ke]=arguments[ke+2];be.children=de}if(U&&U.defaultProps)for(G in W=U.defaultProps,W)be[G]===void 0&&(be[G]=W[G]);return Z(U,ye,be)},De.createRef=function(){return{current:null}},De.forwardRef=function(U){return{$$typeof:f,render:U}},De.isValidElement=P,De.lazy=function(U){return{$$typeof:b,_payload:{_status:-1,_result:U},_init:oe}},De.memo=function(U,Q){return{$$typeof:h,type:U,compare:Q===void 0?null:Q}},De.startTransition=function(U){var Q=F.T,D={};F.T=D;try{var G=U(),be=F.S;be!==null&&be(D,G),typeof G=="object"&&G!==null&&typeof G.then=="function"&&G.then(A,ue)}catch(ye){ue(ye)}finally{Q!==null&&D.types!==null&&(Q.types=D.types),F.T=Q}},De.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},De.use=function(U){return F.H.use(U)},De.useActionState=function(U,Q,D){return F.H.useActionState(U,Q,D)},De.useCallback=function(U,Q){return F.H.useCallback(U,Q)},De.useContext=function(U){return F.H.useContext(U)},De.useDebugValue=function(){},De.useDeferredValue=function(U,Q){return F.H.useDeferredValue(U,Q)},De.useEffect=function(U,Q){return F.H.useEffect(U,Q)},De.useEffectEvent=function(U){return F.H.useEffectEvent(U)},De.useId=function(){return F.H.useId()},De.useImperativeHandle=function(U,Q,D){return F.H.useImperativeHandle(U,Q,D)},De.useInsertionEffect=function(U,Q){return F.H.useInsertionEffect(U,Q)},De.useLayoutEffect=function(U,Q){return F.H.useLayoutEffect(U,Q)},De.useMemo=function(U,Q){return F.H.useMemo(U,Q)},De.useOptimistic=function(U,Q){return F.H.useOptimistic(U,Q)},De.useReducer=function(U,Q,D){return F.H.useReducer(U,Q,D)},De.useRef=function(U){return F.H.useRef(U)},De.useState=function(U){return F.H.useState(U)},De.useSyncExternalStore=function(U,Q,D){return F.H.useSyncExternalStore(U,Q,D)},De.useTransition=function(){return F.H.useTransition()},De.version="19.2.4",De}var Eb;function Tm(){return Eb||(Eb=1,ph.exports=qz()),ph.exports}var S=Tm();const pe=Ou(S);var xh={exports:{}},Zl={},gh={exports:{}},bh={};/**
 * @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 Tb;function Iz(){return Tb||(Tb=1,(function(e){function n(B,V){var oe=B.length;B.push(V);e:for(;0<oe;){var ue=oe-1>>>1,O=B[ue];if(0<o(O,V))B[ue]=V,B[oe]=O,oe=ue;else break e}}function r(B){return B.length===0?null:B[0]}function i(B){if(B.length===0)return null;var V=B[0],oe=B.pop();if(oe!==V){B[0]=oe;e:for(var ue=0,O=B.length,U=O>>>1;ue<U;){var Q=2*(ue+1)-1,D=B[Q],G=Q+1,be=B[G];if(0>o(D,oe))G<O&&0>o(be,D)?(B[ue]=be,B[G]=oe,ue=G):(B[ue]=D,B[Q]=oe,ue=Q);else if(G<O&&0>o(be,oe))B[ue]=be,B[G]=oe,ue=G;else break e}}return V}function o(B,V){var oe=B.sortIndex-V.sortIndex;return oe!==0?oe:B.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],b=1,g=null,v=3,y=!1,k=!1,C=!1,z=!1,j=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function M(B){for(var V=r(h);V!==null;){if(V.callback===null)i(h);else if(V.startTime<=B)i(h),V.sortIndex=V.expirationTime,n(m,V);else break;V=r(h)}}function R(B){if(C=!1,M(B),!k)if(r(m)!==null)k=!0,A||(A=!0,Y());else{var V=r(h);V!==null&&q(R,V.startTime-B)}}var A=!1,F=-1,ee=5,Z=-1;function L(){return z?!0:!(e.unstable_now()-Z<ee)}function P(){if(z=!1,A){var B=e.unstable_now();Z=B;var V=!0;try{e:{k=!1,C&&(C=!1,E(F),F=-1),y=!0;var oe=v;try{t:{for(M(B),g=r(m);g!==null&&!(g.expirationTime>B&&L());){var ue=g.callback;if(typeof ue=="function"){g.callback=null,v=g.priorityLevel;var O=ue(g.expirationTime<=B);if(B=e.unstable_now(),typeof O=="function"){g.callback=O,M(B),V=!0;break t}g===r(m)&&i(m),M(B)}else i(m);g=r(m)}if(g!==null)V=!0;else{var U=r(h);U!==null&&q(R,U.startTime-B),V=!1}}break e}finally{g=null,v=oe,y=!1}V=void 0}}finally{V?Y():A=!1}}}var Y;if(typeof N=="function")Y=function(){N(P)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,_=me.port2;me.port1.onmessage=P,Y=function(){_.postMessage(null)}}else Y=function(){j(P,0)};function q(B,V){F=j(function(){B(e.unstable_now())},V)}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"):ee=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 V=3;break;default:V=v}var oe=v;v=V;try{return B()}finally{v=oe}},e.unstable_requestPaint=function(){z=!0},e.unstable_runWithPriority=function(B,V){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var oe=v;v=B;try{return V()}finally{v=oe}},e.unstable_scheduleCallback=function(B,V,oe){var ue=e.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?ue+oe:ue):oe=ue,B){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=oe+O,B={id:b++,callback:V,priorityLevel:B,startTime:oe,expirationTime:O,sortIndex:-1},oe>ue?(B.sortIndex=oe,n(h,B),r(m)===null&&B===r(h)&&(C?(E(F),F=-1):C=!0,q(R,oe-ue))):(B.sortIndex=O,n(m,B),k||y||(k=!0,A||(A=!0,Y()))),B},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(B){var V=v;return function(){var oe=v;v=V;try{return B.apply(this,arguments)}finally{v=oe}}}})(bh)),bh}var Ab;function Pz(){return Ab||(Ab=1,gh.exports=Iz()),gh.exports}var yh={exports:{}},tn={};/**
 * @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 Mb;function Fz(){if(Mb)return tn;Mb=1;var e=Tm();function n(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)h+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,h,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:m,containerInfo:h,implementation:b}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return tn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,tn.createPortal=function(m,h){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(n(299));return c(m,h,null,b)},tn.flushSync=function(m){var h=d.T,b=i.p;try{if(d.T=null,i.p=2,m)return m()}finally{d.T=h,i.p=b,i.d.f()}},tn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(m,h))},tn.prefetchDNS=function(m){typeof m=="string"&&i.d.D(m)},tn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var b=h.as,g=f(b,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;b==="style"?i.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:y}):b==="script"&&i.d.X(m,{crossOrigin:g,integrity:v,fetchPriority:y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},tn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var b=f(h.as,h.crossOrigin);i.d.M(m,{crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(m)},tn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var b=h.as,g=f(b,h.crossOrigin);i.d.L(m,b,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},tn.preloadModule=function(m,h){if(typeof m=="string")if(h){var b=f(h.as,h.crossOrigin);i.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(m)},tn.requestFormReset=function(m){i.d.r(m)},tn.unstable_batchedUpdates=function(m,h){return m(h)},tn.useFormState=function(m,h,b){return d.H.useFormState(m,h,b)},tn.useFormStatus=function(){return d.H.useHostTransitionStatus()},tn.version="19.2.4",tn}var Db;function j1(){if(Db)return yh.exports;Db=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(n){console.error(n)}}return e(),yh.exports=Fz(),yh.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 Ob;function $z(){if(Ob)return Zl;Ob=1;var e=Pz(),n=Tm(),r=j1();function i(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+t+"; visit "+a+" 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 c(t){var a=t,l=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(l=a.return),t=a.return;while(t)}return a.tag===3?l:null}function d(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function f(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function m(t){if(c(t)!==t)throw Error(i(188))}function h(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(i(188));return a!==t?null:t}for(var l=t,u=a;;){var p=l.return;if(p===null)break;var x=p.alternate;if(x===null){if(u=p.return,u!==null){l=u;continue}break}if(p.child===x.child){for(x=p.child;x;){if(x===l)return m(p),t;if(x===u)return m(p),a;x=x.sibling}throw Error(i(188))}if(l.return!==u.return)l=p,u=x;else{for(var w=!1,T=p.child;T;){if(T===l){w=!0,l=p,u=x;break}if(T===u){w=!0,u=p,l=x;break}T=T.sibling}if(!w){for(T=x.child;T;){if(T===l){w=!0,l=x,u=p;break}if(T===u){w=!0,u=x,l=p;break}T=T.sibling}if(!w)throw Error(i(189))}}if(l.alternate!==u)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?t:a}function b(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=b(t),a!==null)return a;t=t.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),N=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function Y(t){return t===null||typeof t!="object"?null:(t=P&&t[P]||t["@@iterator"],typeof t=="function"?t:null)}var me=Symbol.for("react.client.reference");function _(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 C:return"Fragment";case j:return"Profiler";case z:return"StrictMode";case R:return"Suspense";case A:return"SuspenseList";case Z:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case k:return"Portal";case N:return t.displayName||"Context";case E:return(t._context.displayName||"Context")+".Consumer";case M:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case F:return a=t.displayName||null,a!==null?a:_(t.type)||"Memo";case ee:a=t._payload,t=t._init;try{return _(t(a))}catch{}}return null}var q=Array.isArray,B=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},ue=[],O=-1;function U(t){return{current:t}}function Q(t){0>O||(t.current=ue[O],ue[O]=null,O--)}function D(t,a){O++,ue[O]=t.current,t.current=a}var G=U(null),be=U(null),ye=U(null),W=U(null);function de(t,a){switch(D(ye,a),D(be,t),D(G,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Yg(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Yg(a),t=Qg(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}Q(G),D(G,t)}function ke(){Q(G),Q(be),Q(ye)}function rt(t){t.memoizedState!==null&&D(W,t);var a=G.current,l=Qg(a,t.type);a!==l&&(D(be,t),D(G,l))}function yt(t){be.current===t&&(Q(G),Q(be)),W.current===t&&(Q(W),Yl._currentValue=oe)}var vn,Fa;function Ln(t){if(vn===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);vn=a&&a[1]||"",Fa=-1<l.stack.indexOf(`
    at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
`+vn+t+Fa}var Xn=!1;function Bn(t,a){if(!t||Xn)return"";Xn=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var ce=function(){throw Error()};if(Object.defineProperty(ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ce,[])}catch(ae){var K=ae}Reflect.construct(t,[],ce)}else{try{ce.call()}catch(ae){K=ae}t.call(ce.prototype)}}else{try{throw Error()}catch(ae){K=ae}(ce=t())&&typeof ce.catch=="function"&&ce.catch(function(){})}}catch(ae){if(ae&&K&&typeof ae.stack=="string")return[ae.stack,K.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=u.DetermineComponentFrameRoot(),w=x[0],T=x[1];if(w&&T){var H=w.split(`
`),J=T.split(`
`);for(p=u=0;u<H.length&&!H[u].includes("DetermineComponentFrameRoot");)u++;for(;p<J.length&&!J[p].includes("DetermineComponentFrameRoot");)p++;if(u===H.length||p===J.length)for(u=H.length-1,p=J.length-1;1<=u&&0<=p&&H[u]!==J[p];)p--;for(;1<=u&&0<=p;u--,p--)if(H[u]!==J[p]){if(u!==1||p!==1)do if(u--,p--,0>p||H[u]!==J[p]){var re=`
`+H[u].replace(" at new "," at ");return t.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",t.displayName)),re}while(1<=u&&0<=p);break}}}finally{Xn=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?Ln(l):""}function $a(t,a){switch(t.tag){case 26:case 27:case 5:return Ln(t.type);case 16:return Ln("Lazy");case 13:return t.child!==a&&a!==null?Ln("Suspense Fallback"):Ln("Suspense");case 19:return Ln("SuspenseList");case 0:case 15:return Bn(t.type,!1);case 11:return Bn(t.type.render,!1);case 1:return Bn(t.type,!0);case 31:return Ln("Activity");default:return""}}function ge(t){try{var a="",l=null;do a+=$a(t,l),l=t,t=t.return;while(t);return a}catch(u){return`
Error generating stack: `+u.message+`
`+u.stack}}var ve=Object.prototype.hasOwnProperty,Me=e.unstable_scheduleCallback,ze=e.unstable_cancelCallback,Ue=e.unstable_shouldYield,qe=e.unstable_requestPaint,tt=e.unstable_now,Ct=e.unstable_getCurrentPriorityLevel,te=e.unstable_ImmediatePriority,fe=e.unstable_UserBlockingPriority,Ee=e.unstable_NormalPriority,He=e.unstable_LowPriority,Ye=e.unstable_IdlePriority,cn=e.log,Jn=e.unstable_setDisableYieldValue,_t=null,ft=null;function $t(t){if(typeof cn=="function"&&Jn(t),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(_t,t)}catch{}}var Je=Math.clz32?Math.clz32:Po,ka=Math.log,Un=Math.LN2;function Po(t){return t>>>=0,t===0?32:31-(ka(t)/Un|0)|0}var ur=256,$r=262144,ws=4194304;function Wt(t){var a=t&42;if(a!==0)return a;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 Vr(t,a,l){var u=t.pendingLanes;if(u===0)return 0;var p=0,x=t.suspendedLanes,w=t.pingedLanes;t=t.warmLanes;var T=u&134217727;return T!==0?(u=T&~x,u!==0?p=Wt(u):(w&=T,w!==0?p=Wt(w):l||(l=T&~t,l!==0&&(p=Wt(l))))):(T=u&~x,T!==0?p=Wt(T):w!==0?p=Wt(w):l||(l=u&~t,l!==0&&(p=Wt(l)))),p===0?0:a!==0&&a!==p&&(a&x)===0&&(x=p&-p,l=a&-a,x>=l||x===32&&(l&4194048)!==0)?a:p}function Te(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function nt(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+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 a+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=ws;return ws<<=1,(ws&62914560)===0&&(ws=4194304),t}function un(t){for(var a=[],l=0;31>l;l++)a.push(t);return a}function Vt(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Sa(t,a,l,u,p,x){var w=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var T=t.entanglements,H=t.expirationTimes,J=t.hiddenUpdates;for(l=w&~l;0<l;){var re=31-Je(l),ce=1<<re;T[re]=0,H[re]=-1;var K=J[re];if(K!==null)for(J[re]=null,re=0;re<K.length;re++){var ae=K[re];ae!==null&&(ae.lane&=-536870913)}l&=~ce}u!==0&&Ca(t,u,0),x!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=x&~(w&~a))}function Ca(t,a,l){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-Je(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|l&261930}function jn(t,a){var l=t.entangledLanes|=a;for(t=t.entanglements;l;){var u=31-Je(l),p=1<<u;p&a|t[u]&a&&(t[u]|=a),l&=~p}}function ua(t,a){var l=a&-a;return l=(l&42)!==0?1:td(l),(l&(t.suspendedLanes|a))!==0?0:l}function td(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 nd(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function D0(){var t=V.p;return t!==0?t:(t=window.event,t===void 0?32:gb(t.type))}function O0(t,a){var l=V.p;try{return V.p=t,a()}finally{V.p=l}}var zs=Math.random().toString(36).slice(2),Gt="__reactFiber$"+zs,wn="__reactProps$"+zs,Gr="__reactContainer$"+zs,ad="__reactEvents$"+zs,kj="__reactListeners$"+zs,Sj="__reactHandles$"+zs,R0="__reactResources$"+zs,ol="__reactMarker$"+zs;function sd(t){delete t[Gt],delete t[wn],delete t[ad],delete t[kj],delete t[Sj]}function Yr(t){var a=t[Gt];if(a)return a;for(var l=t.parentNode;l;){if(a=l[Gr]||l[Gt]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(t=tb(t);t!==null;){if(l=t[Gt])return l;t=tb(t)}return a}t=l,l=t.parentNode}return null}function Qr(t){if(t=t[Gt]||t[Gr]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function cl(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(i(33))}function Xr(t){var a=t[R0];return a||(a=t[R0]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Ht(t){t[ol]=!0}var _0=new Set,L0={};function dr(t,a){Jr(t,a),Jr(t+"Capture",a)}function Jr(t,a){for(L0[t]=a,t=0;t<a.length;t++)_0.add(a[t])}var Cj=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]*$"),B0={},U0={};function Ej(t){return ve.call(U0,t)?!0:ve.call(B0,t)?!1:Cj.test(t)?U0[t]=!0:(B0[t]=!0,!1)}function Fo(t,a,l){if(Ej(a))if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+l)}}function $o(t,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+l)}}function Va(t,a,l,u){if(u===null)t.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(l);return}t.setAttributeNS(a,l,""+u)}}function Kn(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 a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Tj(t,a,l){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,x=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return p.call(this)},set:function(w){l=""+w,x.call(this,w)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(w){l=""+w},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function rd(t){if(!t._valueTracker){var a=H0(t)?"checked":"value";t._valueTracker=Tj(t,a,""+t[a])}}function q0(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var l=a.getValue(),u="";return t&&(u=H0(t)?t.checked?"true":"false":t.value),t=u,t!==l?(a.setValue(t),!0):!1}function Vo(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 Aj=/[\n"\\]/g;function Zn(t){return t.replace(Aj,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function id(t,a,l,u,p,x,w,T){t.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?t.type=w:t.removeAttribute("type"),a!=null?w==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+Kn(a)):t.value!==""+Kn(a)&&(t.value=""+Kn(a)):w!=="submit"&&w!=="reset"||t.removeAttribute("value"),a!=null?ld(t,w,Kn(a)):l!=null?ld(t,w,Kn(l)):u!=null&&t.removeAttribute("value"),p==null&&x!=null&&(t.defaultChecked=!!x),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?t.name=""+Kn(T):t.removeAttribute("name")}function I0(t,a,l,u,p,x,w,T){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(t.type=x),a!=null||l!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){rd(t);return}l=l!=null?""+Kn(l):"",a=a!=null?""+Kn(a):l,T||a===t.value||(t.value=a),t.defaultValue=a}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=T?t.checked:!!u,t.defaultChecked=!!u,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(t.name=w),rd(t)}function ld(t,a,l){a==="number"&&Vo(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function Kr(t,a,l,u){if(t=t.options,a){a={};for(var p=0;p<l.length;p++)a["$"+l[p]]=!0;for(l=0;l<t.length;l++)p=a.hasOwnProperty("$"+t[l].value),t[l].selected!==p&&(t[l].selected=p),p&&u&&(t[l].defaultSelected=!0)}else{for(l=""+Kn(l),a=null,p=0;p<t.length;p++){if(t[p].value===l){t[p].selected=!0,u&&(t[p].defaultSelected=!0);return}a!==null||t[p].disabled||(a=t[p])}a!==null&&(a.selected=!0)}}function P0(t,a,l){if(a!=null&&(a=""+Kn(a),a!==t.value&&(t.value=a),l==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=l!=null?""+Kn(l):""}function F0(t,a,l,u){if(a==null){if(u!=null){if(l!=null)throw Error(i(92));if(q(u)){if(1<u.length)throw Error(i(93));u=u[0]}l=u}l==null&&(l=""),a=l}l=Kn(a),t.defaultValue=l,u=t.textContent,u===l&&u!==""&&u!==null&&(t.value=u),rd(t)}function Zr(t,a){if(a){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=a;return}}t.textContent=a}var Mj=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 $0(t,a,l){var u=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":u?t.setProperty(a,l):typeof l!="number"||l===0||Mj.has(a)?a==="float"?t.cssFloat=l:t[a]=(""+l).trim():t[a]=l+"px"}function V0(t,a,l){if(a!=null&&typeof a!="object")throw Error(i(62));if(t=t.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var p in a)u=a[p],a.hasOwnProperty(p)&&l[p]!==u&&$0(t,p,u)}else for(var x in a)a.hasOwnProperty(x)&&$0(t,x,a[x])}function od(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 Dj=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"]]),Oj=/^[\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 Go(t){return Oj.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Ga(){}var cd=null;function ud(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Wr=null,ei=null;function G0(t){var a=Qr(t);if(a&&(t=a.stateNode)){var l=t[wn]||null;e:switch(t=a.stateNode,a.type){case"input":if(id(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Zn(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var u=l[a];if(u!==t&&u.form===t.form){var p=u[wn]||null;if(!p)throw Error(i(90));id(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<l.length;a++)u=l[a],u.form===t.form&&q0(u)}break e;case"textarea":P0(t,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&Kr(t,!!l.multiple,a,!1)}}}var dd=!1;function Y0(t,a,l){if(dd)return t(a,l);dd=!0;try{var u=t(a);return u}finally{if(dd=!1,(Wr!==null||ei!==null)&&(Oc(),Wr&&(a=Wr,t=ei,ei=Wr=null,G0(a),t)))for(a=0;a<t.length;a++)G0(t[a])}}function ul(t,a){var l=t.stateNode;if(l===null)return null;var u=l[wn]||null;if(u===null)return null;l=u[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(l&&typeof l!="function")throw Error(i(231,a,typeof l));return l}var Ya=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fd=!1;if(Ya)try{var dl={};Object.defineProperty(dl,"passive",{get:function(){fd=!0}}),window.addEventListener("test",dl,dl),window.removeEventListener("test",dl,dl)}catch{fd=!1}var Ns=null,hd=null,Yo=null;function Q0(){if(Yo)return Yo;var t,a=hd,l=a.length,u,p="value"in Ns?Ns.value:Ns.textContent,x=p.length;for(t=0;t<l&&a[t]===p[t];t++);var w=l-t;for(u=1;u<=w&&a[l-u]===p[x-u];u++);return Yo=p.slice(t,1<u?1-u:void 0)}function Qo(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function Xo(){return!0}function X0(){return!1}function zn(t){function a(l,u,p,x,w){this._reactName=l,this._targetInst=p,this.type=u,this.nativeEvent=x,this.target=w,this.currentTarget=null;for(var T in t)t.hasOwnProperty(T)&&(l=t[T],this[T]=l?l(x):x[T]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Xo:X0,this.isPropagationStopped=X0,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Xo)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Xo)},persist:function(){},isPersistent:Xo}),a}var fr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jo=zn(fr),fl=g({},fr,{view:0,detail:0}),Rj=zn(fl),md,pd,hl,Ko=g({},fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gd,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!==hl&&(hl&&t.type==="mousemove"?(md=t.screenX-hl.screenX,pd=t.screenY-hl.screenY):pd=md=0,hl=t),md)},movementY:function(t){return"movementY"in t?t.movementY:pd}}),J0=zn(Ko),_j=g({},Ko,{dataTransfer:0}),Lj=zn(_j),Bj=g({},fl,{relatedTarget:0}),xd=zn(Bj),Uj=g({},fr,{animationName:0,elapsedTime:0,pseudoElement:0}),Hj=zn(Uj),qj=g({},fr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Ij=zn(qj),Pj=g({},fr,{data:0}),K0=zn(Pj),Fj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$j={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"},Vj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gj(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=Vj[t])?!!a[t]:!1}function gd(){return Gj}var Yj=g({},fl,{key:function(t){if(t.key){var a=Fj[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Qo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?$j[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gd,charCode:function(t){return t.type==="keypress"?Qo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Qo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Qj=zn(Yj),Xj=g({},Ko,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Z0=zn(Xj),Jj=g({},fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gd}),Kj=zn(Jj),Zj=g({},fr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wj=zn(Zj),ew=g({},Ko,{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}),tw=zn(ew),nw=g({},fr,{newState:0,oldState:0}),aw=zn(nw),sw=[9,13,27,32],bd=Ya&&"CompositionEvent"in window,ml=null;Ya&&"documentMode"in document&&(ml=document.documentMode);var rw=Ya&&"TextEvent"in window&&!ml,W0=Ya&&(!bd||ml&&8<ml&&11>=ml),ep=" ",tp=!1;function np(t,a){switch(t){case"keyup":return sw.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ap(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ti=!1;function iw(t,a){switch(t){case"compositionend":return ap(a);case"keypress":return a.which!==32?null:(tp=!0,ep);case"textInput":return t=a.data,t===ep&&tp?null:t;default:return null}}function lw(t,a){if(ti)return t==="compositionend"||!bd&&np(t,a)?(t=Q0(),Yo=hd=Ns=null,ti=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return W0&&a.locale!=="ko"?null:a.data;default:return null}}var ow={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 sp(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!ow[t.type]:a==="textarea"}function rp(t,a,l,u){Wr?ei?ei.push(u):ei=[u]:Wr=u,a=qc(a,"onChange"),0<a.length&&(l=new Jo("onChange","change",null,l,u),t.push({event:l,listeners:a}))}var pl=null,xl=null;function cw(t){Ig(t,0)}function Zo(t){var a=cl(t);if(q0(a))return t}function ip(t,a){if(t==="change")return a}var lp=!1;if(Ya){var yd;if(Ya){var vd="oninput"in document;if(!vd){var op=document.createElement("div");op.setAttribute("oninput","return;"),vd=typeof op.oninput=="function"}yd=vd}else yd=!1;lp=yd&&(!document.documentMode||9<document.documentMode)}function cp(){pl&&(pl.detachEvent("onpropertychange",up),xl=pl=null)}function up(t){if(t.propertyName==="value"&&Zo(xl)){var a=[];rp(a,xl,t,ud(t)),Y0(cw,a)}}function uw(t,a,l){t==="focusin"?(cp(),pl=a,xl=l,pl.attachEvent("onpropertychange",up)):t==="focusout"&&cp()}function dw(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Zo(xl)}function fw(t,a){if(t==="click")return Zo(a)}function hw(t,a){if(t==="input"||t==="change")return Zo(a)}function mw(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var Hn=typeof Object.is=="function"?Object.is:mw;function gl(t,a){if(Hn(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var l=Object.keys(t),u=Object.keys(a);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var p=l[u];if(!ve.call(a,p)||!Hn(t[p],a[p]))return!1}return!0}function dp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function fp(t,a){var l=dp(t);t=0;for(var u;l;){if(l.nodeType===3){if(u=t+l.textContent.length,t<=a&&u>=a)return{node:l,offset:a-t};t=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=dp(l)}}function hp(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?hp(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function mp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=Vo(t.document);a instanceof t.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)t=a.contentWindow;else break;a=Vo(t.document)}return a}function jd(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var pw=Ya&&"documentMode"in document&&11>=document.documentMode,ni=null,wd=null,bl=null,zd=!1;function pp(t,a,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;zd||ni==null||ni!==Vo(u)||(u=ni,"selectionStart"in u&&jd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),bl&&gl(bl,u)||(bl=u,u=qc(wd,"onSelect"),0<u.length&&(a=new Jo("onSelect","select",null,a,l),t.push({event:a,listeners:u}),a.target=ni)))}function hr(t,a){var l={};return l[t.toLowerCase()]=a.toLowerCase(),l["Webkit"+t]="webkit"+a,l["Moz"+t]="moz"+a,l}var ai={animationend:hr("Animation","AnimationEnd"),animationiteration:hr("Animation","AnimationIteration"),animationstart:hr("Animation","AnimationStart"),transitionrun:hr("Transition","TransitionRun"),transitionstart:hr("Transition","TransitionStart"),transitioncancel:hr("Transition","TransitionCancel"),transitionend:hr("Transition","TransitionEnd")},Nd={},xp={};Ya&&(xp=document.createElement("div").style,"AnimationEvent"in window||(delete ai.animationend.animation,delete ai.animationiteration.animation,delete ai.animationstart.animation),"TransitionEvent"in window||delete ai.transitionend.transition);function mr(t){if(Nd[t])return Nd[t];if(!ai[t])return t;var a=ai[t],l;for(l in a)if(a.hasOwnProperty(l)&&l in xp)return Nd[t]=a[l];return t}var gp=mr("animationend"),bp=mr("animationiteration"),yp=mr("animationstart"),xw=mr("transitionrun"),gw=mr("transitionstart"),bw=mr("transitioncancel"),vp=mr("transitionend"),jp=new Map,kd="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(" ");kd.push("scrollEnd");function da(t,a){jp.set(t,a),dr(a,[t])}var Wo=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=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(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Wn=[],si=0,Sd=0;function ec(){for(var t=si,a=Sd=si=0;a<t;){var l=Wn[a];Wn[a++]=null;var u=Wn[a];Wn[a++]=null;var p=Wn[a];Wn[a++]=null;var x=Wn[a];if(Wn[a++]=null,u!==null&&p!==null){var w=u.pending;w===null?p.next=p:(p.next=w.next,w.next=p),u.pending=p}x!==0&&wp(l,p,x)}}function tc(t,a,l,u){Wn[si++]=t,Wn[si++]=a,Wn[si++]=l,Wn[si++]=u,Sd|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function Cd(t,a,l,u){return tc(t,a,l,u),nc(t)}function pr(t,a){return tc(t,null,null,a),nc(t)}function wp(t,a,l){t.lanes|=l;var u=t.alternate;u!==null&&(u.lanes|=l);for(var p=!1,x=t.return;x!==null;)x.childLanes|=l,u=x.alternate,u!==null&&(u.childLanes|=l),x.tag===22&&(t=x.stateNode,t===null||t._visibility&1||(p=!0)),t=x,x=x.return;return t.tag===3?(x=t.stateNode,p&&a!==null&&(p=31-Je(l),t=x.hiddenUpdates,u=t[p],u===null?t[p]=[a]:u.push(a),a.lane=l|536870912),x):null}function nc(t){if(50<ql)throw ql=0,Bf=null,Error(i(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var ri={};function yw(t,a,l,u){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qn(t,a,l,u){return new yw(t,a,l,u)}function Ed(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Qa(t,a){var l=t.alternate;return l===null?(l=qn(t.tag,a,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=a,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&65011712,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,a=t.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function zp(t,a){t.flags&=65011714;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,a=l.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function ac(t,a,l,u,p,x){var w=0;if(u=t,typeof t=="function")Ed(t)&&(w=1);else if(typeof t=="string")w=Nz(t,l,G.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Z:return t=qn(31,l,a,p),t.elementType=Z,t.lanes=x,t;case C:return xr(l.children,p,x,a);case z:w=8,p|=24;break;case j:return t=qn(12,l,a,p|2),t.elementType=j,t.lanes=x,t;case R:return t=qn(13,l,a,p),t.elementType=R,t.lanes=x,t;case A:return t=qn(19,l,a,p),t.elementType=A,t.lanes=x,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case N:w=10;break e;case E:w=9;break e;case M:w=11;break e;case F:w=14;break e;case ee:w=16,u=null;break e}w=29,l=Error(i(130,t===null?"null":typeof t,"")),u=null}return a=qn(w,l,a,p),a.elementType=t,a.type=u,a.lanes=x,a}function xr(t,a,l,u){return t=qn(7,t,u,a),t.lanes=l,t}function Td(t,a,l){return t=qn(6,t,null,a),t.lanes=l,t}function Np(t){var a=qn(18,null,null,0);return a.stateNode=t,a}function Ad(t,a,l){return a=qn(4,t.children!==null?t.children:[],t.key,a),a.lanes=l,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var kp=new WeakMap;function ea(t,a){if(typeof t=="object"&&t!==null){var l=kp.get(t);return l!==void 0?l:(a={value:t,source:a,stack:ge(a)},kp.set(t,a),a)}return{value:t,source:a,stack:ge(a)}}var ii=[],li=0,sc=null,yl=0,ta=[],na=0,ks=null,Ea=1,Ta="";function Xa(t,a){ii[li++]=yl,ii[li++]=sc,sc=t,yl=a}function Sp(t,a,l){ta[na++]=Ea,ta[na++]=Ta,ta[na++]=ks,ks=t;var u=Ea;t=Ta;var p=32-Je(u)-1;u&=~(1<<p),l+=1;var x=32-Je(a)+p;if(30<x){var w=p-p%5;x=(u&(1<<w)-1).toString(32),u>>=w,p-=w,Ea=1<<32-Je(a)+p|l<<p|u,Ta=x+t}else Ea=1<<x|l<<p|u,Ta=t}function Md(t){t.return!==null&&(Xa(t,1),Sp(t,1,0))}function Dd(t){for(;t===sc;)sc=ii[--li],ii[li]=null,yl=ii[--li],ii[li]=null;for(;t===ks;)ks=ta[--na],ta[na]=null,Ta=ta[--na],ta[na]=null,Ea=ta[--na],ta[na]=null}function Cp(t,a){ta[na++]=Ea,ta[na++]=Ta,ta[na++]=ks,Ea=a.id,Ta=a.overflow,ks=t}var Yt=null,mt=null,Qe=!1,Ss=null,aa=!1,Od=Error(i(519));function Cs(t){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vl(ea(a,t)),Od}function Ep(t){var a=t.stateNode,l=t.type,u=t.memoizedProps;switch(a[Gt]=t,a[wn]=u,l){case"dialog":Pe("cancel",a),Pe("close",a);break;case"iframe":case"object":case"embed":Pe("load",a);break;case"video":case"audio":for(l=0;l<Pl.length;l++)Pe(Pl[l],a);break;case"source":Pe("error",a);break;case"img":case"image":case"link":Pe("error",a),Pe("load",a);break;case"details":Pe("toggle",a);break;case"input":Pe("invalid",a),I0(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Pe("invalid",a);break;case"textarea":Pe("invalid",a),F0(a,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||u.suppressHydrationWarning===!0||Vg(a.textContent,l)?(u.popover!=null&&(Pe("beforetoggle",a),Pe("toggle",a)),u.onScroll!=null&&Pe("scroll",a),u.onScrollEnd!=null&&Pe("scrollend",a),u.onClick!=null&&(a.onclick=Ga),a=!0):a=!1,a||Cs(t,!0)}function Tp(t){for(Yt=t.return;Yt;)switch(Yt.tag){case 5:case 31:case 13:aa=!1;return;case 27:case 3:aa=!0;return;default:Yt=Yt.return}}function oi(t){if(t!==Yt)return!1;if(!Qe)return Tp(t),Qe=!0,!1;var a=t.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||Zf(t.type,t.memoizedProps)),l=!l),l&&mt&&Cs(t),Tp(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));mt=eb(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(317));mt=eb(t)}else a===27?(a=mt,Is(t.type)?(t=ah,ah=null,mt=t):mt=a):mt=Yt?ra(t.stateNode.nextSibling):null;return!0}function gr(){mt=Yt=null,Qe=!1}function Rd(){var t=Ss;return t!==null&&(Cn===null?Cn=t:Cn.push.apply(Cn,t),Ss=null),t}function vl(t){Ss===null?Ss=[t]:Ss.push(t)}var _d=U(null),br=null,Ja=null;function Es(t,a,l){D(_d,a._currentValue),a._currentValue=l}function Ka(t){t._currentValue=_d.current,Q(_d)}function Ld(t,a,l){for(;t!==null;){var u=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),t===l)break;t=t.return}}function Bd(t,a,l,u){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var x=p.dependencies;if(x!==null){var w=p.child;x=x.firstContext;e:for(;x!==null;){var T=x;x=p;for(var H=0;H<a.length;H++)if(T.context===a[H]){x.lanes|=l,T=x.alternate,T!==null&&(T.lanes|=l),Ld(x.return,l,t),u||(w=null);break e}x=T.next}}else if(p.tag===18){if(w=p.return,w===null)throw Error(i(341));w.lanes|=l,x=w.alternate,x!==null&&(x.lanes|=l),Ld(w,l,t),w=null}else w=p.child;if(w!==null)w.return=p;else for(w=p;w!==null;){if(w===t){w=null;break}if(p=w.sibling,p!==null){p.return=w.return,w=p;break}w=w.return}p=w}}function ci(t,a,l,u){t=null;for(var p=a,x=!1;p!==null;){if(!x){if((p.flags&524288)!==0)x=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var w=p.alternate;if(w===null)throw Error(i(387));if(w=w.memoizedProps,w!==null){var T=p.type;Hn(p.pendingProps.value,w.value)||(t!==null?t.push(T):t=[T])}}else if(p===W.current){if(w=p.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(Yl):t=[Yl])}p=p.return}t!==null&&Bd(a,t,l,u),a.flags|=262144}function rc(t){for(t=t.firstContext;t!==null;){if(!Hn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function yr(t){br=t,Ja=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Qt(t){return Ap(br,t)}function ic(t,a){return br===null&&yr(t),Ap(t,a)}function Ap(t,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},Ja===null){if(t===null)throw Error(i(308));Ja=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else Ja=Ja.next=a;return l}var vw=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(l,u){t.push(u)}};this.abort=function(){a.aborted=!0,t.forEach(function(l){return l()})}},jw=e.unstable_scheduleCallback,ww=e.unstable_NormalPriority,Et={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ud(){return{controller:new vw,data:new Map,refCount:0}}function jl(t){t.refCount--,t.refCount===0&&jw(ww,function(){t.controller.abort()})}var wl=null,Hd=0,ui=0,di=null;function zw(t,a){if(wl===null){var l=wl=[];Hd=0,ui=Ff(),di={status:"pending",value:void 0,then:function(u){l.push(u)}}}return Hd++,a.then(Mp,Mp),a}function Mp(){if(--Hd===0&&wl!==null){di!==null&&(di.status="fulfilled");var t=wl;wl=null,ui=0,di=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function Nw(t,a){var l=[],u={status:"pending",value:null,reason:null,then:function(p){l.push(p)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var p=0;p<l.length;p++)(0,l[p])(a)},function(p){for(u.status="rejected",u.reason=p,p=0;p<l.length;p++)(0,l[p])(void 0)}),u}var Dp=B.S;B.S=function(t,a){pg=tt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&zw(t,a),Dp!==null&&Dp(t,a)};var vr=U(null);function qd(){var t=vr.current;return t!==null?t:ut.pooledCache}function lc(t,a){a===null?D(vr,vr.current):D(vr,a.pool)}function Op(){var t=qd();return t===null?null:{parent:Et._currentValue,pool:t}}var fi=Error(i(460)),Id=Error(i(474)),oc=Error(i(542)),cc={then:function(){}};function Rp(t){return t=t.status,t==="fulfilled"||t==="rejected"}function _p(t,a,l){switch(l=t[l],l===void 0?t.push(a):l!==a&&(a.then(Ga,Ga),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Bp(t),t;default:if(typeof a.status=="string")a.then(Ga,Ga);else{if(t=ut,t!==null&&100<t.shellSuspendCounter)throw Error(i(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=u}},function(u){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Bp(t),t}throw wr=a,fi}}function jr(t){try{var a=t._init;return a(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(wr=l,fi):l}}var wr=null;function Lp(){if(wr===null)throw Error(i(459));var t=wr;return wr=null,t}function Bp(t){if(t===fi||t===oc)throw Error(i(483))}var hi=null,zl=0;function uc(t){var a=zl;return zl+=1,hi===null&&(hi=[]),_p(hi,t,a)}function Nl(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function dc(t,a){throw a.$$typeof===v?Error(i(525)):(t=Object.prototype.toString.call(a),Error(i(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function Up(t){function a($,I){if(t){var X=$.deletions;X===null?($.deletions=[I],$.flags|=16):X.push(I)}}function l($,I){if(!t)return null;for(;I!==null;)a($,I),I=I.sibling;return null}function u($){for(var I=new Map;$!==null;)$.key!==null?I.set($.key,$):I.set($.index,$),$=$.sibling;return I}function p($,I){return $=Qa($,I),$.index=0,$.sibling=null,$}function x($,I,X){return $.index=X,t?(X=$.alternate,X!==null?(X=X.index,X<I?($.flags|=67108866,I):X):($.flags|=67108866,I)):($.flags|=1048576,I)}function w($){return t&&$.alternate===null&&($.flags|=67108866),$}function T($,I,X,le){return I===null||I.tag!==6?(I=Td(X,$.mode,le),I.return=$,I):(I=p(I,X),I.return=$,I)}function H($,I,X,le){var Ne=X.type;return Ne===C?re($,I,X.props.children,le,X.key):I!==null&&(I.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ee&&jr(Ne)===I.type)?(I=p(I,X.props),Nl(I,X),I.return=$,I):(I=ac(X.type,X.key,X.props,null,$.mode,le),Nl(I,X),I.return=$,I)}function J($,I,X,le){return I===null||I.tag!==4||I.stateNode.containerInfo!==X.containerInfo||I.stateNode.implementation!==X.implementation?(I=Ad(X,$.mode,le),I.return=$,I):(I=p(I,X.children||[]),I.return=$,I)}function re($,I,X,le,Ne){return I===null||I.tag!==7?(I=xr(X,$.mode,le,Ne),I.return=$,I):(I=p(I,X),I.return=$,I)}function ce($,I,X){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return I=Td(""+I,$.mode,X),I.return=$,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case y:return X=ac(I.type,I.key,I.props,null,$.mode,X),Nl(X,I),X.return=$,X;case k:return I=Ad(I,$.mode,X),I.return=$,I;case ee:return I=jr(I),ce($,I,X)}if(q(I)||Y(I))return I=xr(I,$.mode,X,null),I.return=$,I;if(typeof I.then=="function")return ce($,uc(I),X);if(I.$$typeof===N)return ce($,ic($,I),X);dc($,I)}return null}function K($,I,X,le){var Ne=I!==null?I.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return Ne!==null?null:T($,I,""+X,le);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case y:return X.key===Ne?H($,I,X,le):null;case k:return X.key===Ne?J($,I,X,le):null;case ee:return X=jr(X),K($,I,X,le)}if(q(X)||Y(X))return Ne!==null?null:re($,I,X,le,null);if(typeof X.then=="function")return K($,I,uc(X),le);if(X.$$typeof===N)return K($,I,ic($,X),le);dc($,X)}return null}function ae($,I,X,le,Ne){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return $=$.get(X)||null,T(I,$,""+le,Ne);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case y:return $=$.get(le.key===null?X:le.key)||null,H(I,$,le,Ne);case k:return $=$.get(le.key===null?X:le.key)||null,J(I,$,le,Ne);case ee:return le=jr(le),ae($,I,X,le,Ne)}if(q(le)||Y(le))return $=$.get(X)||null,re(I,$,le,Ne,null);if(typeof le.then=="function")return ae($,I,X,uc(le),Ne);if(le.$$typeof===N)return ae($,I,X,ic(I,le),Ne);dc(I,le)}return null}function je($,I,X,le){for(var Ne=null,Ze=null,we=I,_e=I=0,Ve=null;we!==null&&_e<X.length;_e++){we.index>_e?(Ve=we,we=null):Ve=we.sibling;var We=K($,we,X[_e],le);if(We===null){we===null&&(we=Ve);break}t&&we&&We.alternate===null&&a($,we),I=x(We,I,_e),Ze===null?Ne=We:Ze.sibling=We,Ze=We,we=Ve}if(_e===X.length)return l($,we),Qe&&Xa($,_e),Ne;if(we===null){for(;_e<X.length;_e++)we=ce($,X[_e],le),we!==null&&(I=x(we,I,_e),Ze===null?Ne=we:Ze.sibling=we,Ze=we);return Qe&&Xa($,_e),Ne}for(we=u(we);_e<X.length;_e++)Ve=ae(we,$,_e,X[_e],le),Ve!==null&&(t&&Ve.alternate!==null&&we.delete(Ve.key===null?_e:Ve.key),I=x(Ve,I,_e),Ze===null?Ne=Ve:Ze.sibling=Ve,Ze=Ve);return t&&we.forEach(function(Gs){return a($,Gs)}),Qe&&Xa($,_e),Ne}function Ce($,I,X,le){if(X==null)throw Error(i(151));for(var Ne=null,Ze=null,we=I,_e=I=0,Ve=null,We=X.next();we!==null&&!We.done;_e++,We=X.next()){we.index>_e?(Ve=we,we=null):Ve=we.sibling;var Gs=K($,we,We.value,le);if(Gs===null){we===null&&(we=Ve);break}t&&we&&Gs.alternate===null&&a($,we),I=x(Gs,I,_e),Ze===null?Ne=Gs:Ze.sibling=Gs,Ze=Gs,we=Ve}if(We.done)return l($,we),Qe&&Xa($,_e),Ne;if(we===null){for(;!We.done;_e++,We=X.next())We=ce($,We.value,le),We!==null&&(I=x(We,I,_e),Ze===null?Ne=We:Ze.sibling=We,Ze=We);return Qe&&Xa($,_e),Ne}for(we=u(we);!We.done;_e++,We=X.next())We=ae(we,$,_e,We.value,le),We!==null&&(t&&We.alternate!==null&&we.delete(We.key===null?_e:We.key),I=x(We,I,_e),Ze===null?Ne=We:Ze.sibling=We,Ze=We);return t&&we.forEach(function(_z){return a($,_z)}),Qe&&Xa($,_e),Ne}function ot($,I,X,le){if(typeof X=="object"&&X!==null&&X.type===C&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case y:e:{for(var Ne=X.key;I!==null;){if(I.key===Ne){if(Ne=X.type,Ne===C){if(I.tag===7){l($,I.sibling),le=p(I,X.props.children),le.return=$,$=le;break e}}else if(I.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ee&&jr(Ne)===I.type){l($,I.sibling),le=p(I,X.props),Nl(le,X),le.return=$,$=le;break e}l($,I);break}else a($,I);I=I.sibling}X.type===C?(le=xr(X.props.children,$.mode,le,X.key),le.return=$,$=le):(le=ac(X.type,X.key,X.props,null,$.mode,le),Nl(le,X),le.return=$,$=le)}return w($);case k:e:{for(Ne=X.key;I!==null;){if(I.key===Ne)if(I.tag===4&&I.stateNode.containerInfo===X.containerInfo&&I.stateNode.implementation===X.implementation){l($,I.sibling),le=p(I,X.children||[]),le.return=$,$=le;break e}else{l($,I);break}else a($,I);I=I.sibling}le=Ad(X,$.mode,le),le.return=$,$=le}return w($);case ee:return X=jr(X),ot($,I,X,le)}if(q(X))return je($,I,X,le);if(Y(X)){if(Ne=Y(X),typeof Ne!="function")throw Error(i(150));return X=Ne.call(X),Ce($,I,X,le)}if(typeof X.then=="function")return ot($,I,uc(X),le);if(X.$$typeof===N)return ot($,I,ic($,X),le);dc($,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,I!==null&&I.tag===6?(l($,I.sibling),le=p(I,X),le.return=$,$=le):(l($,I),le=Td(X,$.mode,le),le.return=$,$=le),w($)):l($,I)}return function($,I,X,le){try{zl=0;var Ne=ot($,I,X,le);return hi=null,Ne}catch(we){if(we===fi||we===oc)throw we;var Ze=qn(29,we,null,$.mode);return Ze.lanes=le,Ze.return=$,Ze}finally{}}}var zr=Up(!0),Hp=Up(!1),Ts=!1;function Pd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fd(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function As(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ms(t,a,l){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(et&2)!==0){var p=u.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),u.pending=a,a=nc(t),wp(t,null,l),a}return tc(t,u,a,l),nc(t)}function kl(t,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var u=a.lanes;u&=t.pendingLanes,l|=u,a.lanes=l,jn(t,l)}}function $d(t,a){var l=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var p=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var w={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};x===null?p=x=w:x=x.next=w,l=l.next}while(l!==null);x===null?p=x=a:x=x.next=a}else p=x=a;l={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:u.shared,callbacks:u.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=a:t.next=a,l.lastBaseUpdate=a}var Vd=!1;function Sl(){if(Vd){var t=di;if(t!==null)throw t}}function Cl(t,a,l,u){Vd=!1;var p=t.updateQueue;Ts=!1;var x=p.firstBaseUpdate,w=p.lastBaseUpdate,T=p.shared.pending;if(T!==null){p.shared.pending=null;var H=T,J=H.next;H.next=null,w===null?x=J:w.next=J,w=H;var re=t.alternate;re!==null&&(re=re.updateQueue,T=re.lastBaseUpdate,T!==w&&(T===null?re.firstBaseUpdate=J:T.next=J,re.lastBaseUpdate=H))}if(x!==null){var ce=p.baseState;w=0,re=J=H=null,T=x;do{var K=T.lane&-536870913,ae=K!==T.lane;if(ae?($e&K)===K:(u&K)===K){K!==0&&K===ui&&(Vd=!0),re!==null&&(re=re.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var je=t,Ce=T;K=a;var ot=l;switch(Ce.tag){case 1:if(je=Ce.payload,typeof je=="function"){ce=je.call(ot,ce,K);break e}ce=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Ce.payload,K=typeof je=="function"?je.call(ot,ce,K):je,K==null)break e;ce=g({},ce,K);break e;case 2:Ts=!0}}K=T.callback,K!==null&&(t.flags|=64,ae&&(t.flags|=8192),ae=p.callbacks,ae===null?p.callbacks=[K]:ae.push(K))}else ae={lane:K,tag:T.tag,payload:T.payload,callback:T.callback,next:null},re===null?(J=re=ae,H=ce):re=re.next=ae,w|=K;if(T=T.next,T===null){if(T=p.shared.pending,T===null)break;ae=T,T=ae.next,ae.next=null,p.lastBaseUpdate=ae,p.shared.pending=null}}while(!0);re===null&&(H=ce),p.baseState=H,p.firstBaseUpdate=J,p.lastBaseUpdate=re,x===null&&(p.shared.lanes=0),Ls|=w,t.lanes=w,t.memoizedState=ce}}function qp(t,a){if(typeof t!="function")throw Error(i(191,t));t.call(a)}function Ip(t,a){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)qp(l[t],a)}var mi=U(null),fc=U(0);function Pp(t,a){t=is,D(fc,t),D(mi,a),is=t|a.baseLanes}function Gd(){D(fc,is),D(mi,mi.current)}function Yd(){is=fc.current,Q(mi),Q(fc)}var In=U(null),sa=null;function Ds(t){var a=t.alternate;D(Nt,Nt.current&1),D(In,t),sa===null&&(a===null||mi.current!==null||a.memoizedState!==null)&&(sa=t)}function Qd(t){D(Nt,Nt.current),D(In,t),sa===null&&(sa=t)}function Fp(t){t.tag===22?(D(Nt,Nt.current),D(In,t),sa===null&&(sa=t)):Os()}function Os(){D(Nt,Nt.current),D(In,In.current)}function Pn(t){Q(In),sa===t&&(sa=null),Q(Nt)}var Nt=U(0);function hc(t){for(var a=t;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||th(l)||nh(l)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Za=0,Oe=null,it=null,Tt=null,mc=!1,pi=!1,Nr=!1,pc=0,El=0,xi=null,kw=0;function vt(){throw Error(i(321))}function Xd(t,a){if(a===null)return!1;for(var l=0;l<a.length&&l<t.length;l++)if(!Hn(t[l],a[l]))return!1;return!0}function Jd(t,a,l,u,p,x){return Za=x,Oe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,B.H=t===null||t.memoizedState===null?Sx:ff,Nr=!1,x=l(u,p),Nr=!1,pi&&(x=Vp(a,l,u,p)),$p(t),x}function $p(t){B.H=Ml;var a=it!==null&&it.next!==null;if(Za=0,Tt=it=Oe=null,mc=!1,El=0,xi=null,a)throw Error(i(300));t===null||At||(t=t.dependencies,t!==null&&rc(t)&&(At=!0))}function Vp(t,a,l,u){Oe=t;var p=0;do{if(pi&&(xi=null),El=0,pi=!1,25<=p)throw Error(i(301));if(p+=1,Tt=it=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=Cx,x=a(l,u)}while(pi);return x}function Sw(){var t=B.H,a=t.useState()[0];return a=typeof a.then=="function"?Tl(a):a,t=t.useState()[0],(it!==null?it.memoizedState:null)!==t&&(Oe.flags|=1024),a}function Kd(){var t=pc!==0;return pc=0,t}function Zd(t,a,l){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~l}function Wd(t){if(mc){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}mc=!1}Za=0,Tt=it=Oe=null,pi=!1,El=pc=0,xi=null}function dn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Tt===null?Oe.memoizedState=Tt=t:Tt=Tt.next=t,Tt}function kt(){if(it===null){var t=Oe.alternate;t=t!==null?t.memoizedState:null}else t=it.next;var a=Tt===null?Oe.memoizedState:Tt.next;if(a!==null)Tt=a,it=t;else{if(t===null)throw Oe.alternate===null?Error(i(467)):Error(i(310));it=t,t={memoizedState:it.memoizedState,baseState:it.baseState,baseQueue:it.baseQueue,queue:it.queue,next:null},Tt===null?Oe.memoizedState=Tt=t:Tt=Tt.next=t}return Tt}function xc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tl(t){var a=El;return El+=1,xi===null&&(xi=[]),t=_p(xi,t,a),a=Oe,(Tt===null?a.memoizedState:Tt.next)===null&&(a=a.alternate,B.H=a===null||a.memoizedState===null?Sx:ff),t}function gc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Tl(t);if(t.$$typeof===N)return Qt(t)}throw Error(i(438,String(t)))}function ef(t){var a=null,l=Oe.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var u=Oe.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=xc(),Oe.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(t),u=0;u<t;u++)l[u]=L;return a.index++,l}function Wa(t,a){return typeof a=="function"?a(t):a}function bc(t){var a=kt();return tf(a,it,t)}function tf(t,a,l){var u=t.queue;if(u===null)throw Error(i(311));u.lastRenderedReducer=l;var p=t.baseQueue,x=u.pending;if(x!==null){if(p!==null){var w=p.next;p.next=x.next,x.next=w}a.baseQueue=p=x,u.pending=null}if(x=t.baseState,p===null)t.memoizedState=x;else{a=p.next;var T=w=null,H=null,J=a,re=!1;do{var ce=J.lane&-536870913;if(ce!==J.lane?($e&ce)===ce:(Za&ce)===ce){var K=J.revertLane;if(K===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ce===ui&&(re=!0);else if((Za&K)===K){J=J.next,K===ui&&(re=!0);continue}else ce={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},H===null?(T=H=ce,w=x):H=H.next=ce,Oe.lanes|=K,Ls|=K;ce=J.action,Nr&&l(x,ce),x=J.hasEagerState?J.eagerState:l(x,ce)}else K={lane:ce,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},H===null?(T=H=K,w=x):H=H.next=K,Oe.lanes|=ce,Ls|=ce;J=J.next}while(J!==null&&J!==a);if(H===null?w=x:H.next=T,!Hn(x,t.memoizedState)&&(At=!0,re&&(l=di,l!==null)))throw l;t.memoizedState=x,t.baseState=w,t.baseQueue=H,u.lastRenderedState=x}return p===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function nf(t){var a=kt(),l=a.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=t;var u=l.dispatch,p=l.pending,x=a.memoizedState;if(p!==null){l.pending=null;var w=p=p.next;do x=t(x,w.action),w=w.next;while(w!==p);Hn(x,a.memoizedState)||(At=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),l.lastRenderedState=x}return[x,u]}function Gp(t,a,l){var u=Oe,p=kt(),x=Qe;if(x){if(l===void 0)throw Error(i(407));l=l()}else l=a();var w=!Hn((it||p).memoizedState,l);if(w&&(p.memoizedState=l,At=!0),p=p.queue,rf(Xp.bind(null,u,p,t),[t]),p.getSnapshot!==a||w||Tt!==null&&Tt.memoizedState.tag&1){if(u.flags|=2048,gi(9,{destroy:void 0},Qp.bind(null,u,p,l,a),null),ut===null)throw Error(i(349));x||(Za&127)!==0||Yp(u,a,l)}return l}function Yp(t,a,l){t.flags|=16384,t={getSnapshot:a,value:l},a=Oe.updateQueue,a===null?(a=xc(),Oe.updateQueue=a,a.stores=[t]):(l=a.stores,l===null?a.stores=[t]:l.push(t))}function Qp(t,a,l,u){a.value=l,a.getSnapshot=u,Jp(a)&&Kp(t)}function Xp(t,a,l){return l(function(){Jp(a)&&Kp(t)})}function Jp(t){var a=t.getSnapshot;t=t.value;try{var l=a();return!Hn(t,l)}catch{return!0}}function Kp(t){var a=pr(t,2);a!==null&&En(a,t,2)}function af(t){var a=dn();if(typeof t=="function"){var l=t;if(t=l(),Nr){$t(!0);try{l()}finally{$t(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wa,lastRenderedState:t},a}function Zp(t,a,l,u){return t.baseState=l,tf(t,it,typeof u=="function"?u:Wa)}function Cw(t,a,l,u,p){if(jc(t))throw Error(i(485));if(t=a.action,t!==null){var x={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){x.listeners.push(w)}};B.T!==null?l(!0):x.isTransition=!1,u(x),l=a.pending,l===null?(x.next=a.pending=x,Wp(a,x)):(x.next=l.next,a.pending=l.next=x)}}function Wp(t,a){var l=a.action,u=a.payload,p=t.state;if(a.isTransition){var x=B.T,w={};B.T=w;try{var T=l(p,u),H=B.S;H!==null&&H(w,T),ex(t,a,T)}catch(J){sf(t,a,J)}finally{x!==null&&w.types!==null&&(x.types=w.types),B.T=x}}else try{x=l(p,u),ex(t,a,x)}catch(J){sf(t,a,J)}}function ex(t,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){tx(t,a,u)},function(u){return sf(t,a,u)}):tx(t,a,l)}function tx(t,a,l){a.status="fulfilled",a.value=l,nx(a),t.state=l,a=t.pending,a!==null&&(l=a.next,l===a?t.pending=null:(l=l.next,a.next=l,Wp(t,l)))}function sf(t,a,l){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=l,nx(a),a=a.next;while(a!==u)}t.action=null}function nx(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function ax(t,a){return a}function sx(t,a){if(Qe){var l=ut.formState;if(l!==null){e:{var u=Oe;if(Qe){if(mt){t:{for(var p=mt,x=aa;p.nodeType!==8;){if(!x){p=null;break t}if(p=ra(p.nextSibling),p===null){p=null;break t}}x=p.data,p=x==="F!"||x==="F"?p:null}if(p){mt=ra(p.nextSibling),u=p.data==="F!";break e}}Cs(u)}u=!1}u&&(a=l[0])}}return l=dn(),l.memoizedState=l.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ax,lastRenderedState:a},l.queue=u,l=zx.bind(null,Oe,u),u.dispatch=l,u=af(!1),x=df.bind(null,Oe,!1,u.queue),u=dn(),p={state:a,dispatch:null,action:t,pending:null},u.queue=p,l=Cw.bind(null,Oe,p,x,l),p.dispatch=l,u.memoizedState=t,[a,l,!1]}function rx(t){var a=kt();return ix(a,it,t)}function ix(t,a,l){if(a=tf(t,a,ax)[0],t=bc(Wa)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Tl(a)}catch(w){throw w===fi?oc:w}else u=a;a=kt();var p=a.queue,x=p.dispatch;return l!==a.memoizedState&&(Oe.flags|=2048,gi(9,{destroy:void 0},Ew.bind(null,p,l),null)),[u,x,t]}function Ew(t,a){t.action=a}function lx(t){var a=kt(),l=it;if(l!==null)return ix(a,l,t);kt(),a=a.memoizedState,l=kt();var u=l.queue.dispatch;return l.memoizedState=t,[a,u,!1]}function gi(t,a,l,u){return t={tag:t,create:l,deps:u,inst:a,next:null},a=Oe.updateQueue,a===null&&(a=xc(),Oe.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=t.next=t:(u=l.next,l.next=t,t.next=u,a.lastEffect=t),t}function ox(){return kt().memoizedState}function yc(t,a,l,u){var p=dn();Oe.flags|=t,p.memoizedState=gi(1|a,{destroy:void 0},l,u===void 0?null:u)}function vc(t,a,l,u){var p=kt();u=u===void 0?null:u;var x=p.memoizedState.inst;it!==null&&u!==null&&Xd(u,it.memoizedState.deps)?p.memoizedState=gi(a,x,l,u):(Oe.flags|=t,p.memoizedState=gi(1|a,x,l,u))}function cx(t,a){yc(8390656,8,t,a)}function rf(t,a){vc(2048,8,t,a)}function Tw(t){Oe.flags|=4;var a=Oe.updateQueue;if(a===null)a=xc(),Oe.updateQueue=a,a.events=[t];else{var l=a.events;l===null?a.events=[t]:l.push(t)}}function ux(t){var a=kt().memoizedState;return Tw({ref:a,nextImpl:t}),function(){if((et&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function dx(t,a){return vc(4,2,t,a)}function fx(t,a){return vc(4,4,t,a)}function hx(t,a){if(typeof a=="function"){t=t();var l=a(t);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function mx(t,a,l){l=l!=null?l.concat([t]):null,vc(4,4,hx.bind(null,a,t),l)}function lf(){}function px(t,a){var l=kt();a=a===void 0?null:a;var u=l.memoizedState;return a!==null&&Xd(a,u[1])?u[0]:(l.memoizedState=[t,a],t)}function xx(t,a){var l=kt();a=a===void 0?null:a;var u=l.memoizedState;if(a!==null&&Xd(a,u[1]))return u[0];if(u=t(),Nr){$t(!0);try{t()}finally{$t(!1)}}return l.memoizedState=[u,a],u}function of(t,a,l){return l===void 0||(Za&1073741824)!==0&&($e&261930)===0?t.memoizedState=a:(t.memoizedState=l,t=gg(),Oe.lanes|=t,Ls|=t,l)}function gx(t,a,l,u){return Hn(l,a)?l:mi.current!==null?(t=of(t,l,u),Hn(t,a)||(At=!0),t):(Za&42)===0||(Za&1073741824)!==0&&($e&261930)===0?(At=!0,t.memoizedState=l):(t=gg(),Oe.lanes|=t,Ls|=t,a)}function bx(t,a,l,u,p){var x=V.p;V.p=x!==0&&8>x?x:8;var w=B.T,T={};B.T=T,df(t,!1,a,l);try{var H=p(),J=B.S;if(J!==null&&J(T,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var re=Nw(H,u);Al(t,a,re,Vn(t))}else Al(t,a,u,Vn(t))}catch(ce){Al(t,a,{then:function(){},status:"rejected",reason:ce},Vn())}finally{V.p=x,w!==null&&T.types!==null&&(w.types=T.types),B.T=w}}function Aw(){}function cf(t,a,l,u){if(t.tag!==5)throw Error(i(476));var p=yx(t).queue;bx(t,p,a,oe,l===null?Aw:function(){return vx(t),l(u)})}function yx(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wa,lastRenderedState:oe},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wa,lastRenderedState:l},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function vx(t){var a=yx(t);a.next===null&&(a=t.alternate.memoizedState),Al(t,a.next.queue,{},Vn())}function uf(){return Qt(Yl)}function jx(){return kt().memoizedState}function wx(){return kt().memoizedState}function Mw(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var l=Vn();t=As(l);var u=Ms(a,t,l);u!==null&&(En(u,a,l),kl(u,a,l)),a={cache:Ud()},t.payload=a;return}a=a.return}}function Dw(t,a,l){var u=Vn();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},jc(t)?Nx(a,l):(l=Cd(t,a,l,u),l!==null&&(En(l,t,u),kx(l,a,u)))}function zx(t,a,l){var u=Vn();Al(t,a,l,u)}function Al(t,a,l,u){var p={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(jc(t))Nx(a,p);else{var x=t.alternate;if(t.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var w=a.lastRenderedState,T=x(w,l);if(p.hasEagerState=!0,p.eagerState=T,Hn(T,w))return tc(t,a,p,0),ut===null&&ec(),!1}catch{}finally{}if(l=Cd(t,a,p,u),l!==null)return En(l,t,u),kx(l,a,u),!0}return!1}function df(t,a,l,u){if(u={lane:2,revertLane:Ff(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},jc(t)){if(a)throw Error(i(479))}else a=Cd(t,l,u,2),a!==null&&En(a,t,2)}function jc(t){var a=t.alternate;return t===Oe||a!==null&&a===Oe}function Nx(t,a){pi=mc=!0;var l=t.pending;l===null?a.next=a:(a.next=l.next,l.next=a),t.pending=a}function kx(t,a,l){if((l&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,l|=u,a.lanes=l,jn(t,l)}}var Ml={readContext:Qt,use:gc,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};Ml.useEffectEvent=vt;var Sx={readContext:Qt,use:gc,useCallback:function(t,a){return dn().memoizedState=[t,a===void 0?null:a],t},useContext:Qt,useEffect:cx,useImperativeHandle:function(t,a,l){l=l!=null?l.concat([t]):null,yc(4194308,4,hx.bind(null,a,t),l)},useLayoutEffect:function(t,a){return yc(4194308,4,t,a)},useInsertionEffect:function(t,a){yc(4,2,t,a)},useMemo:function(t,a){var l=dn();a=a===void 0?null:a;var u=t();if(Nr){$t(!0);try{t()}finally{$t(!1)}}return l.memoizedState=[u,a],u},useReducer:function(t,a,l){var u=dn();if(l!==void 0){var p=l(a);if(Nr){$t(!0);try{l(a)}finally{$t(!1)}}}else p=a;return u.memoizedState=u.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},u.queue=t,t=t.dispatch=Dw.bind(null,Oe,t),[u.memoizedState,t]},useRef:function(t){var a=dn();return t={current:t},a.memoizedState=t},useState:function(t){t=af(t);var a=t.queue,l=zx.bind(null,Oe,a);return a.dispatch=l,[t.memoizedState,l]},useDebugValue:lf,useDeferredValue:function(t,a){var l=dn();return of(l,t,a)},useTransition:function(){var t=af(!1);return t=bx.bind(null,Oe,t.queue,!0,!1),dn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,l){var u=Oe,p=dn();if(Qe){if(l===void 0)throw Error(i(407));l=l()}else{if(l=a(),ut===null)throw Error(i(349));($e&127)!==0||Yp(u,a,l)}p.memoizedState=l;var x={value:l,getSnapshot:a};return p.queue=x,cx(Xp.bind(null,u,x,t),[t]),u.flags|=2048,gi(9,{destroy:void 0},Qp.bind(null,u,x,l,a),null),l},useId:function(){var t=dn(),a=ut.identifierPrefix;if(Qe){var l=Ta,u=Ea;l=(u&~(1<<32-Je(u)-1)).toString(32)+l,a="_"+a+"R_"+l,l=pc++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=kw++,a="_"+a+"r_"+l.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:uf,useFormState:sx,useActionState:sx,useOptimistic:function(t){var a=dn();a.memoizedState=a.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=df.bind(null,Oe,!0,l),l.dispatch=a,[t,a]},useMemoCache:ef,useCacheRefresh:function(){return dn().memoizedState=Mw.bind(null,Oe)},useEffectEvent:function(t){var a=dn(),l={impl:t};return a.memoizedState=l,function(){if((et&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},ff={readContext:Qt,use:gc,useCallback:px,useContext:Qt,useEffect:rf,useImperativeHandle:mx,useInsertionEffect:dx,useLayoutEffect:fx,useMemo:xx,useReducer:bc,useRef:ox,useState:function(){return bc(Wa)},useDebugValue:lf,useDeferredValue:function(t,a){var l=kt();return gx(l,it.memoizedState,t,a)},useTransition:function(){var t=bc(Wa)[0],a=kt().memoizedState;return[typeof t=="boolean"?t:Tl(t),a]},useSyncExternalStore:Gp,useId:jx,useHostTransitionStatus:uf,useFormState:rx,useActionState:rx,useOptimistic:function(t,a){var l=kt();return Zp(l,it,t,a)},useMemoCache:ef,useCacheRefresh:wx};ff.useEffectEvent=ux;var Cx={readContext:Qt,use:gc,useCallback:px,useContext:Qt,useEffect:rf,useImperativeHandle:mx,useInsertionEffect:dx,useLayoutEffect:fx,useMemo:xx,useReducer:nf,useRef:ox,useState:function(){return nf(Wa)},useDebugValue:lf,useDeferredValue:function(t,a){var l=kt();return it===null?of(l,t,a):gx(l,it.memoizedState,t,a)},useTransition:function(){var t=nf(Wa)[0],a=kt().memoizedState;return[typeof t=="boolean"?t:Tl(t),a]},useSyncExternalStore:Gp,useId:jx,useHostTransitionStatus:uf,useFormState:lx,useActionState:lx,useOptimistic:function(t,a){var l=kt();return it!==null?Zp(l,it,t,a):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:ef,useCacheRefresh:wx};Cx.useEffectEvent=ux;function hf(t,a,l,u){a=t.memoizedState,l=l(u,a),l=l==null?a:g({},a,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var mf={enqueueSetState:function(t,a,l){t=t._reactInternals;var u=Vn(),p=As(u);p.payload=a,l!=null&&(p.callback=l),a=Ms(t,p,u),a!==null&&(En(a,t,u),kl(a,t,u))},enqueueReplaceState:function(t,a,l){t=t._reactInternals;var u=Vn(),p=As(u);p.tag=1,p.payload=a,l!=null&&(p.callback=l),a=Ms(t,p,u),a!==null&&(En(a,t,u),kl(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var l=Vn(),u=As(l);u.tag=2,a!=null&&(u.callback=a),a=Ms(t,u,l),a!==null&&(En(a,t,l),kl(a,t,l))}};function Ex(t,a,l,u,p,x,w){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,x,w):a.prototype&&a.prototype.isPureReactComponent?!gl(l,u)||!gl(p,x):!0}function Tx(t,a,l,u){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,u),a.state!==t&&mf.enqueueReplaceState(a,a.state,null)}function kr(t,a){var l=a;if("ref"in a){l={};for(var u in a)u!=="ref"&&(l[u]=a[u])}if(t=t.defaultProps){l===a&&(l=g({},l));for(var p in t)l[p]===void 0&&(l[p]=t[p])}return l}function Ax(t){Wo(t)}function Mx(t){console.error(t)}function Dx(t){Wo(t)}function wc(t,a){try{var l=t.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function Ox(t,a,l){try{var u=t.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function pf(t,a,l){return l=As(l),l.tag=3,l.payload={element:null},l.callback=function(){wc(t,a)},l}function Rx(t){return t=As(t),t.tag=3,t}function _x(t,a,l,u){var p=l.type.getDerivedStateFromError;if(typeof p=="function"){var x=u.value;t.payload=function(){return p(x)},t.callback=function(){Ox(a,l,u)}}var w=l.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(t.callback=function(){Ox(a,l,u),typeof p!="function"&&(Bs===null?Bs=new Set([this]):Bs.add(this));var T=u.stack;this.componentDidCatch(u.value,{componentStack:T!==null?T:""})})}function Ow(t,a,l,u,p){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=l.alternate,a!==null&&ci(a,l,p,!0),l=In.current,l!==null){switch(l.tag){case 31:case 13:return sa===null?Rc():l.alternate===null&&jt===0&&(jt=3),l.flags&=-257,l.flags|=65536,l.lanes=p,u===cc?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([u]):a.add(u),qf(t,u,p)),!1;case 22:return l.flags|=65536,u===cc?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([u]):l.add(u)),qf(t,u,p)),!1}throw Error(i(435,l.tag))}return qf(t,u,p),Rc(),!1}if(Qe)return a=In.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,u!==Od&&(t=Error(i(422),{cause:u}),vl(ea(t,l)))):(u!==Od&&(a=Error(i(423),{cause:u}),vl(ea(a,l))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,u=ea(u,l),p=pf(t.stateNode,u,p),$d(t,p),jt!==4&&(jt=2)),!1;var x=Error(i(520),{cause:u});if(x=ea(x,l),Hl===null?Hl=[x]:Hl.push(x),jt!==4&&(jt=2),a===null)return!0;u=ea(u,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,t=p&-p,l.lanes|=t,t=pf(l.stateNode,u,t),$d(l,t),!1;case 1:if(a=l.type,x=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Bs===null||!Bs.has(x))))return l.flags|=65536,p&=-p,l.lanes|=p,p=Rx(p),_x(p,t,l,u),$d(l,p),!1}l=l.return}while(l!==null);return!1}var xf=Error(i(461)),At=!1;function Xt(t,a,l,u){a.child=t===null?Hp(a,null,l,u):zr(a,t.child,l,u)}function Lx(t,a,l,u,p){l=l.render;var x=a.ref;if("ref"in u){var w={};for(var T in u)T!=="ref"&&(w[T]=u[T])}else w=u;return yr(a),u=Jd(t,a,l,w,x,p),T=Kd(),t!==null&&!At?(Zd(t,a,p),es(t,a,p)):(Qe&&T&&Md(a),a.flags|=1,Xt(t,a,u,p),a.child)}function Bx(t,a,l,u,p){if(t===null){var x=l.type;return typeof x=="function"&&!Ed(x)&&x.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=x,Ux(t,a,x,u,p)):(t=ac(l.type,null,u,a,a.mode,p),t.ref=a.ref,t.return=a,a.child=t)}if(x=t.child,!Nf(t,p)){var w=x.memoizedProps;if(l=l.compare,l=l!==null?l:gl,l(w,u)&&t.ref===a.ref)return es(t,a,p)}return a.flags|=1,t=Qa(x,u),t.ref=a.ref,t.return=a,a.child=t}function Ux(t,a,l,u,p){if(t!==null){var x=t.memoizedProps;if(gl(x,u)&&t.ref===a.ref)if(At=!1,a.pendingProps=u=x,Nf(t,p))(t.flags&131072)!==0&&(At=!0);else return a.lanes=t.lanes,es(t,a,p)}return gf(t,a,l,u,p)}function Hx(t,a,l,u){var p=u.children,x=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|l:l,t!==null){for(u=a.child=t.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~x}else u=0,a.child=null;return qx(t,a,x,l,u)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&lc(a,x!==null?x.cachePool:null),x!==null?Pp(a,x):Gd(),Fp(a);else return u=a.lanes=536870912,qx(t,a,x!==null?x.baseLanes|l:l,l,u)}else x!==null?(lc(a,x.cachePool),Pp(a,x),Os(),a.memoizedState=null):(t!==null&&lc(a,null),Gd(),Os());return Xt(t,a,p,l),a.child}function Dl(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function qx(t,a,l,u,p){var x=qd();return x=x===null?null:{parent:Et._currentValue,pool:x},a.memoizedState={baseLanes:l,cachePool:x},t!==null&&lc(a,null),Gd(),Fp(a),t!==null&&ci(t,a,u,!0),a.childLanes=p,null}function zc(t,a){return a=kc({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function Ix(t,a,l){return zr(a,t.child,null,l),t=zc(a,a.pendingProps),t.flags|=2,Pn(a),a.memoizedState=null,t}function Rw(t,a,l){var u=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(Qe){if(u.mode==="hidden")return t=zc(a,u),a.lanes=536870912,Dl(null,t);if(Qd(a),(t=mt)?(t=Wg(t,aa),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:ks!==null?{id:Ea,overflow:Ta}:null,retryLane:536870912,hydrationErrors:null},l=Np(t),l.return=a,a.child=l,Yt=a,mt=null)):t=null,t===null)throw Cs(a);return a.lanes=536870912,null}return zc(a,u)}var x=t.memoizedState;if(x!==null){var w=x.dehydrated;if(Qd(a),p)if(a.flags&256)a.flags&=-257,a=Ix(t,a,l);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(i(558));else if(At||ci(t,a,l,!1),p=(l&t.childLanes)!==0,At||p){if(u=ut,u!==null&&(w=ua(u,l),w!==0&&w!==x.retryLane))throw x.retryLane=w,pr(t,w),En(u,t,w),xf;Rc(),a=Ix(t,a,l)}else t=x.treeContext,mt=ra(w.nextSibling),Yt=a,Qe=!0,Ss=null,aa=!1,t!==null&&Cp(a,t),a=zc(a,u),a.flags|=4096;return a}return t=Qa(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function Nc(t,a){var l=a.ref;if(l===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(t===null||t.ref!==l)&&(a.flags|=4194816)}}function gf(t,a,l,u,p){return yr(a),l=Jd(t,a,l,u,void 0,p),u=Kd(),t!==null&&!At?(Zd(t,a,p),es(t,a,p)):(Qe&&u&&Md(a),a.flags|=1,Xt(t,a,l,p),a.child)}function Px(t,a,l,u,p,x){return yr(a),a.updateQueue=null,l=Vp(a,u,l,p),$p(t),u=Kd(),t!==null&&!At?(Zd(t,a,x),es(t,a,x)):(Qe&&u&&Md(a),a.flags|=1,Xt(t,a,l,x),a.child)}function Fx(t,a,l,u,p){if(yr(a),a.stateNode===null){var x=ri,w=l.contextType;typeof w=="object"&&w!==null&&(x=Qt(w)),x=new l(u,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=mf,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=u,x.state=a.memoizedState,x.refs={},Pd(a),w=l.contextType,x.context=typeof w=="object"&&w!==null?Qt(w):ri,x.state=a.memoizedState,w=l.getDerivedStateFromProps,typeof w=="function"&&(hf(a,l,w,u),x.state=a.memoizedState),typeof l.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&&mf.enqueueReplaceState(x,x.state,null),Cl(a,u,x,p),Sl(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){x=a.stateNode;var T=a.memoizedProps,H=kr(l,T);x.props=H;var J=x.context,re=l.contextType;w=ri,typeof re=="object"&&re!==null&&(w=Qt(re));var ce=l.getDerivedStateFromProps;re=typeof ce=="function"||typeof x.getSnapshotBeforeUpdate=="function",T=a.pendingProps!==T,re||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(T||J!==w)&&Tx(a,x,u,w),Ts=!1;var K=a.memoizedState;x.state=K,Cl(a,u,x,p),Sl(),J=a.memoizedState,T||K!==J||Ts?(typeof ce=="function"&&(hf(a,l,ce,u),J=a.memoizedState),(H=Ts||Ex(a,l,H,u,K,J,w))?(re||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"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=J),x.props=u,x.state=J,x.context=w,u=H):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{x=a.stateNode,Fd(t,a),w=a.memoizedProps,re=kr(l,w),x.props=re,ce=a.pendingProps,K=x.context,J=l.contextType,H=ri,typeof J=="object"&&J!==null&&(H=Qt(J)),T=l.getDerivedStateFromProps,(J=typeof T=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(w!==ce||K!==H)&&Tx(a,x,u,H),Ts=!1,K=a.memoizedState,x.state=K,Cl(a,u,x,p),Sl();var ae=a.memoizedState;w!==ce||K!==ae||Ts||t!==null&&t.dependencies!==null&&rc(t.dependencies)?(typeof T=="function"&&(hf(a,l,T,u),ae=a.memoizedState),(re=Ts||Ex(a,l,re,u,K,ae,H)||t!==null&&t.dependencies!==null&&rc(t.dependencies))?(J||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(u,ae,H),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(u,ae,H)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||w===t.memoizedProps&&K===t.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&K===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ae),x.props=u,x.state=ae,x.context=H,u=re):(typeof x.componentDidUpdate!="function"||w===t.memoizedProps&&K===t.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||w===t.memoizedProps&&K===t.memoizedState||(a.flags|=1024),u=!1)}return x=u,Nc(t,a),u=(a.flags&128)!==0,x||u?(x=a.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,t!==null&&u?(a.child=zr(a,t.child,null,p),a.child=zr(a,null,l,p)):Xt(t,a,l,p),a.memoizedState=x.state,t=a.child):t=es(t,a,p),t}function $x(t,a,l,u){return gr(),a.flags|=256,Xt(t,a,l,u),a.child}var bf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yf(t){return{baseLanes:t,cachePool:Op()}}function vf(t,a,l){return t=t!==null?t.childLanes&~l:0,a&&(t|=$n),t}function Vx(t,a,l){var u=a.pendingProps,p=!1,x=(a.flags&128)!==0,w;if((w=x)||(w=t!==null&&t.memoizedState===null?!1:(Nt.current&2)!==0),w&&(p=!0,a.flags&=-129),w=(a.flags&32)!==0,a.flags&=-33,t===null){if(Qe){if(p?Ds(a):Os(),(t=mt)?(t=Wg(t,aa),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:ks!==null?{id:Ea,overflow:Ta}:null,retryLane:536870912,hydrationErrors:null},l=Np(t),l.return=a,a.child=l,Yt=a,mt=null)):t=null,t===null)throw Cs(a);return nh(t)?a.lanes=32:a.lanes=536870912,null}var T=u.children;return u=u.fallback,p?(Os(),p=a.mode,T=kc({mode:"hidden",children:T},p),u=xr(u,p,l,null),T.return=a,u.return=a,T.sibling=u,a.child=T,u=a.child,u.memoizedState=yf(l),u.childLanes=vf(t,w,l),a.memoizedState=bf,Dl(null,u)):(Ds(a),jf(a,T))}var H=t.memoizedState;if(H!==null&&(T=H.dehydrated,T!==null)){if(x)a.flags&256?(Ds(a),a.flags&=-257,a=wf(t,a,l)):a.memoizedState!==null?(Os(),a.child=t.child,a.flags|=128,a=null):(Os(),T=u.fallback,p=a.mode,u=kc({mode:"visible",children:u.children},p),T=xr(T,p,l,null),T.flags|=2,u.return=a,T.return=a,u.sibling=T,a.child=u,zr(a,t.child,null,l),u=a.child,u.memoizedState=yf(l),u.childLanes=vf(t,w,l),a.memoizedState=bf,a=Dl(null,u));else if(Ds(a),nh(T)){if(w=T.nextSibling&&T.nextSibling.dataset,w)var J=w.dgst;w=J,u=Error(i(419)),u.stack="",u.digest=w,vl({value:u,source:null,stack:null}),a=wf(t,a,l)}else if(At||ci(t,a,l,!1),w=(l&t.childLanes)!==0,At||w){if(w=ut,w!==null&&(u=ua(w,l),u!==0&&u!==H.retryLane))throw H.retryLane=u,pr(t,u),En(w,t,u),xf;th(T)||Rc(),a=wf(t,a,l)}else th(T)?(a.flags|=192,a.child=t.child,a=null):(t=H.treeContext,mt=ra(T.nextSibling),Yt=a,Qe=!0,Ss=null,aa=!1,t!==null&&Cp(a,t),a=jf(a,u.children),a.flags|=4096);return a}return p?(Os(),T=u.fallback,p=a.mode,H=t.child,J=H.sibling,u=Qa(H,{mode:"hidden",children:u.children}),u.subtreeFlags=H.subtreeFlags&65011712,J!==null?T=Qa(J,T):(T=xr(T,p,l,null),T.flags|=2),T.return=a,u.return=a,u.sibling=T,a.child=u,Dl(null,u),u=a.child,T=t.child.memoizedState,T===null?T=yf(l):(p=T.cachePool,p!==null?(H=Et._currentValue,p=p.parent!==H?{parent:H,pool:H}:p):p=Op(),T={baseLanes:T.baseLanes|l,cachePool:p}),u.memoizedState=T,u.childLanes=vf(t,w,l),a.memoizedState=bf,Dl(t.child,u)):(Ds(a),l=t.child,t=l.sibling,l=Qa(l,{mode:"visible",children:u.children}),l.return=a,l.sibling=null,t!==null&&(w=a.deletions,w===null?(a.deletions=[t],a.flags|=16):w.push(t)),a.child=l,a.memoizedState=null,l)}function jf(t,a){return a=kc({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function kc(t,a){return t=qn(22,t,null,a),t.lanes=0,t}function wf(t,a,l){return zr(a,t.child,null,l),t=jf(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function Gx(t,a,l){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),Ld(t.return,a,l)}function zf(t,a,l,u,p,x){var w=t.memoizedState;w===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:p,treeForkCount:x}:(w.isBackwards=a,w.rendering=null,w.renderingStartTime=0,w.last=u,w.tail=l,w.tailMode=p,w.treeForkCount=x)}function Yx(t,a,l){var u=a.pendingProps,p=u.revealOrder,x=u.tail;u=u.children;var w=Nt.current,T=(w&2)!==0;if(T?(w=w&1|2,a.flags|=128):w&=1,D(Nt,w),Xt(t,a,u,l),u=Qe?yl:0,!T&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Gx(t,l,a);else if(t.tag===19)Gx(t,l,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(p){case"forwards":for(l=a.child,p=null;l!==null;)t=l.alternate,t!==null&&hc(t)===null&&(p=l),l=l.sibling;l=p,l===null?(p=a.child,a.child=null):(p=l.sibling,l.sibling=null),zf(a,!1,p,l,x,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,p=a.child,a.child=null;p!==null;){if(t=p.alternate,t!==null&&hc(t)===null){a.child=p;break}t=p.sibling,p.sibling=l,l=p,p=t}zf(a,!0,l,null,x,u);break;case"together":zf(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function es(t,a,l){if(t!==null&&(a.dependencies=t.dependencies),Ls|=a.lanes,(l&a.childLanes)===0)if(t!==null){if(ci(t,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(i(153));if(a.child!==null){for(t=a.child,l=Qa(t,t.pendingProps),a.child=l,l.return=a;t.sibling!==null;)t=t.sibling,l=l.sibling=Qa(t,t.pendingProps),l.return=a;l.sibling=null}return a.child}function Nf(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&rc(t)))}function _w(t,a,l){switch(a.tag){case 3:de(a,a.stateNode.containerInfo),Es(a,Et,t.memoizedState.cache),gr();break;case 27:case 5:rt(a);break;case 4:de(a,a.stateNode.containerInfo);break;case 10:Es(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Qd(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Ds(a),a.flags|=128,null):(l&a.child.childLanes)!==0?Vx(t,a,l):(Ds(a),t=es(t,a,l),t!==null?t.sibling:null);Ds(a);break;case 19:var p=(t.flags&128)!==0;if(u=(l&a.childLanes)!==0,u||(ci(t,a,l,!1),u=(l&a.childLanes)!==0),p){if(u)return Yx(t,a,l);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),D(Nt,Nt.current),u)break;return null;case 22:return a.lanes=0,Hx(t,a,l,a.pendingProps);case 24:Es(a,Et,t.memoizedState.cache)}return es(t,a,l)}function Qx(t,a,l){if(t!==null)if(t.memoizedProps!==a.pendingProps)At=!0;else{if(!Nf(t,l)&&(a.flags&128)===0)return At=!1,_w(t,a,l);At=(t.flags&131072)!==0}else At=!1,Qe&&(a.flags&1048576)!==0&&Sp(a,yl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=jr(a.elementType),a.type=t,typeof t=="function")Ed(t)?(u=kr(t,u),a.tag=1,a=Fx(null,a,t,u,l)):(a.tag=0,a=gf(null,a,t,u,l));else{if(t!=null){var p=t.$$typeof;if(p===M){a.tag=11,a=Lx(null,a,t,u,l);break e}else if(p===F){a.tag=14,a=Bx(null,a,t,u,l);break e}}throw a=_(t)||t,Error(i(306,a,""))}}return a;case 0:return gf(t,a,a.type,a.pendingProps,l);case 1:return u=a.type,p=kr(u,a.pendingProps),Fx(t,a,u,p,l);case 3:e:{if(de(a,a.stateNode.containerInfo),t===null)throw Error(i(387));u=a.pendingProps;var x=a.memoizedState;p=x.element,Fd(t,a),Cl(a,u,null,l);var w=a.memoizedState;if(u=w.cache,Es(a,Et,u),u!==x.cache&&Bd(a,[Et],l,!0),Sl(),u=w.element,x.isDehydrated)if(x={element:u,isDehydrated:!1,cache:w.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=$x(t,a,u,l);break e}else if(u!==p){p=ea(Error(i(424)),a),vl(p),a=$x(t,a,u,l);break e}else{switch(t=a.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(mt=ra(t.firstChild),Yt=a,Qe=!0,Ss=null,aa=!0,l=Hp(a,null,u,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(gr(),u===p){a=es(t,a,l);break e}Xt(t,a,u,l)}a=a.child}return a;case 26:return Nc(t,a),t===null?(l=rb(a.type,null,a.pendingProps,null))?a.memoizedState=l:Qe||(l=a.type,t=a.pendingProps,u=Ic(ye.current).createElement(l),u[Gt]=a,u[wn]=t,Jt(u,l,t),Ht(u),a.stateNode=u):a.memoizedState=rb(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return rt(a),t===null&&Qe&&(u=a.stateNode=nb(a.type,a.pendingProps,ye.current),Yt=a,aa=!0,p=mt,Is(a.type)?(ah=p,mt=ra(u.firstChild)):mt=p),Xt(t,a,a.pendingProps.children,l),Nc(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&Qe&&((p=u=mt)&&(u=dz(u,a.type,a.pendingProps,aa),u!==null?(a.stateNode=u,Yt=a,mt=ra(u.firstChild),aa=!1,p=!0):p=!1),p||Cs(a)),rt(a),p=a.type,x=a.pendingProps,w=t!==null?t.memoizedProps:null,u=x.children,Zf(p,x)?u=null:w!==null&&Zf(p,w)&&(a.flags|=32),a.memoizedState!==null&&(p=Jd(t,a,Sw,null,null,l),Yl._currentValue=p),Nc(t,a),Xt(t,a,u,l),a.child;case 6:return t===null&&Qe&&((t=l=mt)&&(l=fz(l,a.pendingProps,aa),l!==null?(a.stateNode=l,Yt=a,mt=null,t=!0):t=!1),t||Cs(a)),null;case 13:return Vx(t,a,l);case 4:return de(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=zr(a,null,u,l):Xt(t,a,u,l),a.child;case 11:return Lx(t,a,a.type,a.pendingProps,l);case 7:return Xt(t,a,a.pendingProps,l),a.child;case 8:return Xt(t,a,a.pendingProps.children,l),a.child;case 12:return Xt(t,a,a.pendingProps.children,l),a.child;case 10:return u=a.pendingProps,Es(a,a.type,u.value),Xt(t,a,u.children,l),a.child;case 9:return p=a.type._context,u=a.pendingProps.children,yr(a),p=Qt(p),u=u(p),a.flags|=1,Xt(t,a,u,l),a.child;case 14:return Bx(t,a,a.type,a.pendingProps,l);case 15:return Ux(t,a,a.type,a.pendingProps,l);case 19:return Yx(t,a,l);case 31:return Rw(t,a,l);case 22:return Hx(t,a,l,a.pendingProps);case 24:return yr(a),u=Qt(Et),t===null?(p=qd(),p===null&&(p=ut,x=Ud(),p.pooledCache=x,x.refCount++,x!==null&&(p.pooledCacheLanes|=l),p=x),a.memoizedState={parent:u,cache:p},Pd(a),Es(a,Et,p)):((t.lanes&l)!==0&&(Fd(t,a),Cl(a,null,null,l),Sl()),p=t.memoizedState,x=a.memoizedState,p.parent!==u?(p={parent:u,cache:u},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),Es(a,Et,u)):(u=x.cache,Es(a,Et,u),u!==p.cache&&Bd(a,[Et],l,!0))),Xt(t,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function ts(t){t.flags|=4}function kf(t,a,l,u,p){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(p&335544128)===p)if(t.stateNode.complete)t.flags|=8192;else if(jg())t.flags|=8192;else throw wr=cc,Id}else t.flags&=-16777217}function Xx(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!ub(a))if(jg())t.flags|=8192;else throw wr=cc,Id}function Sc(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?ct():536870912,t.lanes|=a,ji|=a)}function Ol(t,a){if(!Qe)switch(t.tailMode){case"hidden":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function pt(t){var a=t.alternate!==null&&t.alternate.child===t.child,l=0,u=0;if(a)for(var p=t.child;p!==null;)l|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)l|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=u,t.childLanes=l,a}function Lw(t,a,l){var u=a.pendingProps;switch(Dd(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(a),null;case 1:return pt(a),null;case 3:return l=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Ka(Et),ke(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(oi(a)?ts(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Rd())),pt(a),null;case 26:var p=a.type,x=a.memoizedState;return t===null?(ts(a),x!==null?(pt(a),Xx(a,x)):(pt(a),kf(a,p,null,u,l))):x?x!==t.memoizedState?(ts(a),pt(a),Xx(a,x)):(pt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&ts(a),pt(a),kf(a,p,t,u,l)),null;case 27:if(yt(a),l=ye.current,p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&ts(a);else{if(!u){if(a.stateNode===null)throw Error(i(166));return pt(a),null}t=G.current,oi(a)?Ep(a):(t=nb(p,u,l),a.stateNode=t,ts(a))}return pt(a),null;case 5:if(yt(a),p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&ts(a);else{if(!u){if(a.stateNode===null)throw Error(i(166));return pt(a),null}if(x=G.current,oi(a))Ep(a);else{var w=Ic(ye.current);switch(x){case 1:x=w.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:x=w.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":x=w.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":x=w.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":x=w.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof u.is=="string"?w.createElement("select",{is:u.is}):w.createElement("select"),u.multiple?x.multiple=!0:u.size&&(x.size=u.size);break;default:x=typeof u.is=="string"?w.createElement(p,{is:u.is}):w.createElement(p)}}x[Gt]=a,x[wn]=u;e:for(w=a.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===a)break e;for(;w.sibling===null;){if(w.return===null||w.return===a)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}a.stateNode=x;e:switch(Jt(x,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&ts(a)}}return pt(a),kf(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,l),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&ts(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(i(166));if(t=ye.current,oi(a)){if(t=a.stateNode,l=a.memoizedProps,u=null,p=Yt,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}t[Gt]=a,t=!!(t.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||Vg(t.nodeValue,l)),t||Cs(a,!0)}else t=Ic(t).createTextNode(u),t[Gt]=a,a.stateNode=t}return pt(a),null;case 31:if(l=a.memoizedState,t===null||t.memoizedState!==null){if(u=oi(a),l!==null){if(t===null){if(!u)throw Error(i(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(i(557));t[Gt]=a}else gr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;pt(a),t=!1}else l=Rd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return a.flags&256?(Pn(a),a):(Pn(a),null);if((a.flags&128)!==0)throw Error(i(558))}return pt(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=oi(a),u!==null&&u.dehydrated!==null){if(t===null){if(!p)throw Error(i(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[Gt]=a}else gr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;pt(a),p=!1}else p=Rd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(Pn(a),a):(Pn(a),null)}return Pn(a),(a.flags&128)!==0?(a.lanes=l,a):(l=u!==null,t=t!==null&&t.memoizedState!==null,l&&(u=a.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),x=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(x=u.memoizedState.cachePool.pool),x!==p&&(u.flags|=2048)),l!==t&&l&&(a.child.flags|=8192),Sc(a,a.updateQueue),pt(a),null);case 4:return ke(),t===null&&Yf(a.stateNode.containerInfo),pt(a),null;case 10:return Ka(a.type),pt(a),null;case 19:if(Q(Nt),u=a.memoizedState,u===null)return pt(a),null;if(p=(a.flags&128)!==0,x=u.rendering,x===null)if(p)Ol(u,!1);else{if(jt!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(x=hc(t),x!==null){for(a.flags|=128,Ol(u,!1),t=x.updateQueue,a.updateQueue=t,Sc(a,t),a.subtreeFlags=0,t=l,l=a.child;l!==null;)zp(l,t),l=l.sibling;return D(Nt,Nt.current&1|2),Qe&&Xa(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&tt()>Mc&&(a.flags|=128,p=!0,Ol(u,!1),a.lanes=4194304)}else{if(!p)if(t=hc(x),t!==null){if(a.flags|=128,p=!0,t=t.updateQueue,a.updateQueue=t,Sc(a,t),Ol(u,!0),u.tail===null&&u.tailMode==="hidden"&&!x.alternate&&!Qe)return pt(a),null}else 2*tt()-u.renderingStartTime>Mc&&l!==536870912&&(a.flags|=128,p=!0,Ol(u,!1),a.lanes=4194304);u.isBackwards?(x.sibling=a.child,a.child=x):(t=u.last,t!==null?t.sibling=x:a.child=x,u.last=x)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=tt(),t.sibling=null,l=Nt.current,D(Nt,p?l&1|2:l&1),Qe&&Xa(a,u.treeForkCount),t):(pt(a),null);case 22:case 23:return Pn(a),Yd(),u=a.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(l&536870912)!==0&&(a.flags&128)===0&&(pt(a),a.subtreeFlags&6&&(a.flags|=8192)):pt(a),l=a.updateQueue,l!==null&&Sc(a,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==l&&(a.flags|=2048),t!==null&&Q(vr),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),Ka(Et),pt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function Bw(t,a){switch(Dd(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return Ka(Et),ke(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return yt(a),null;case 31:if(a.memoizedState!==null){if(Pn(a),a.alternate===null)throw Error(i(340));gr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(Pn(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(i(340));gr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return Q(Nt),null;case 4:return ke(),null;case 10:return Ka(a.type),null;case 22:case 23:return Pn(a),Yd(),t!==null&&Q(vr),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return Ka(Et),null;case 25:return null;default:return null}}function Jx(t,a){switch(Dd(a),a.tag){case 3:Ka(Et),ke();break;case 26:case 27:case 5:yt(a);break;case 4:ke();break;case 31:a.memoizedState!==null&&Pn(a);break;case 13:Pn(a);break;case 19:Q(Nt);break;case 10:Ka(a.type);break;case 22:case 23:Pn(a),Yd(),t!==null&&Q(vr);break;case 24:Ka(Et)}}function Rl(t,a){try{var l=a.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var p=u.next;l=p;do{if((l.tag&t)===t){u=void 0;var x=l.create,w=l.inst;u=x(),w.destroy=u}l=l.next}while(l!==p)}}catch(T){st(a,a.return,T)}}function Rs(t,a,l){try{var u=a.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var x=p.next;u=x;do{if((u.tag&t)===t){var w=u.inst,T=w.destroy;if(T!==void 0){w.destroy=void 0,p=a;var H=l,J=T;try{J()}catch(re){st(p,H,re)}}}u=u.next}while(u!==x)}}catch(re){st(a,a.return,re)}}function Kx(t){var a=t.updateQueue;if(a!==null){var l=t.stateNode;try{Ip(a,l)}catch(u){st(t,t.return,u)}}}function Zx(t,a,l){l.props=kr(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(u){st(t,a,u)}}function _l(t,a){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof l=="function"?t.refCleanup=l(u):l.current=u}}catch(p){st(t,a,p)}}function Aa(t,a){var l=t.ref,u=t.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(p){st(t,a,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(p){st(t,a,p)}else l.current=null}function Wx(t){var a=t.type,l=t.memoizedProps,u=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(p){st(t,t.return,p)}}function Sf(t,a,l){try{var u=t.stateNode;rz(u,t.type,l,a),u[wn]=a}catch(p){st(t,t.return,p)}}function eg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Is(t.type)||t.tag===4}function Cf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||eg(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&&Is(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 Ef(t,a,l){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(t),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=Ga));else if(u!==4&&(u===27&&Is(t.type)&&(l=t.stateNode,a=null),t=t.child,t!==null))for(Ef(t,a,l),t=t.sibling;t!==null;)Ef(t,a,l),t=t.sibling}function Cc(t,a,l){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?l.insertBefore(t,a):l.appendChild(t);else if(u!==4&&(u===27&&Is(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(Cc(t,a,l),t=t.sibling;t!==null;)Cc(t,a,l),t=t.sibling}function tg(t){var a=t.stateNode,l=t.memoizedProps;try{for(var u=t.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);Jt(a,u,l),a[Gt]=t,a[wn]=l}catch(x){st(t,t.return,x)}}var ns=!1,Mt=!1,Tf=!1,ng=typeof WeakSet=="function"?WeakSet:Set,qt=null;function Uw(t,a){if(t=t.containerInfo,Jf=Qc,t=mp(t),jd(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else e:{l=(l=t.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var p=u.anchorOffset,x=u.focusNode;u=u.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var w=0,T=-1,H=-1,J=0,re=0,ce=t,K=null;t:for(;;){for(var ae;ce!==l||p!==0&&ce.nodeType!==3||(T=w+p),ce!==x||u!==0&&ce.nodeType!==3||(H=w+u),ce.nodeType===3&&(w+=ce.nodeValue.length),(ae=ce.firstChild)!==null;)K=ce,ce=ae;for(;;){if(ce===t)break t;if(K===l&&++J===p&&(T=w),K===x&&++re===u&&(H=w),(ae=ce.nextSibling)!==null)break;ce=K,K=ce.parentNode}ce=ae}l=T===-1||H===-1?null:{start:T,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(Kf={focusedElem:t,selectionRange:l},Qc=!1,qt=a;qt!==null;)if(a=qt,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,qt=t;else for(;qt!==null;){switch(a=qt,x=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(l=0;l<t.length;l++)p=t[l],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&x!==null){t=void 0,l=a,p=x.memoizedProps,x=x.memoizedState,u=l.stateNode;try{var je=kr(l.type,p);t=u.getSnapshotBeforeUpdate(je,x),u.__reactInternalSnapshotBeforeUpdate=t}catch(Ce){st(l,l.return,Ce)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,l=t.nodeType,l===9)eh(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":eh(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(i(163))}if(t=a.sibling,t!==null){t.return=a.return,qt=t;break}qt=a.return}}function ag(t,a,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:ss(t,l),u&4&&Rl(5,l);break;case 1:if(ss(t,l),u&4)if(t=l.stateNode,a===null)try{t.componentDidMount()}catch(w){st(l,l.return,w)}else{var p=kr(l.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(p,a,t.__reactInternalSnapshotBeforeUpdate)}catch(w){st(l,l.return,w)}}u&64&&Kx(l),u&512&&_l(l,l.return);break;case 3:if(ss(t,l),u&64&&(t=l.updateQueue,t!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{Ip(t,a)}catch(w){st(l,l.return,w)}}break;case 27:a===null&&u&4&&tg(l);case 26:case 5:ss(t,l),a===null&&u&4&&Wx(l),u&512&&_l(l,l.return);break;case 12:ss(t,l);break;case 31:ss(t,l),u&4&&ig(t,l);break;case 13:ss(t,l),u&4&&lg(t,l),u&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=Yw.bind(null,l),hz(t,l))));break;case 22:if(u=l.memoizedState!==null||ns,!u){a=a!==null&&a.memoizedState!==null||Mt,p=ns;var x=Mt;ns=u,(Mt=a)&&!x?rs(t,l,(l.subtreeFlags&8772)!==0):ss(t,l),ns=p,Mt=x}break;case 30:break;default:ss(t,l)}}function sg(t){var a=t.alternate;a!==null&&(t.alternate=null,sg(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&sd(a)),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,Nn=!1;function as(t,a,l){for(l=l.child;l!==null;)rg(t,a,l),l=l.sibling}function rg(t,a,l){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(_t,l)}catch{}switch(l.tag){case 26:Mt||Aa(l,a),as(t,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Mt||Aa(l,a);var u=gt,p=Nn;Is(l.type)&&(gt=l.stateNode,Nn=!1),as(t,a,l),$l(l.stateNode),gt=u,Nn=p;break;case 5:Mt||Aa(l,a);case 6:if(u=gt,p=Nn,gt=null,as(t,a,l),gt=u,Nn=p,gt!==null)if(Nn)try{(gt.nodeType===9?gt.body:gt.nodeName==="HTML"?gt.ownerDocument.body:gt).removeChild(l.stateNode)}catch(x){st(l,a,x)}else try{gt.removeChild(l.stateNode)}catch(x){st(l,a,x)}break;case 18:gt!==null&&(Nn?(t=gt,Kg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),Ti(t)):Kg(gt,l.stateNode));break;case 4:u=gt,p=Nn,gt=l.stateNode.containerInfo,Nn=!0,as(t,a,l),gt=u,Nn=p;break;case 0:case 11:case 14:case 15:Rs(2,l,a),Mt||Rs(4,l,a),as(t,a,l);break;case 1:Mt||(Aa(l,a),u=l.stateNode,typeof u.componentWillUnmount=="function"&&Zx(l,a,u)),as(t,a,l);break;case 21:as(t,a,l);break;case 22:Mt=(u=Mt)||l.memoizedState!==null,as(t,a,l),Mt=u;break;default:as(t,a,l)}}function ig(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ti(t)}catch(l){st(a,a.return,l)}}}function lg(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ti(t)}catch(l){st(a,a.return,l)}}function Hw(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new ng),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new ng),a;default:throw Error(i(435,t.tag))}}function Ec(t,a){var l=Hw(t);a.forEach(function(u){if(!l.has(u)){l.add(u);var p=Qw.bind(null,t,u);u.then(p,p)}})}function kn(t,a){var l=a.deletions;if(l!==null)for(var u=0;u<l.length;u++){var p=l[u],x=t,w=a,T=w;e:for(;T!==null;){switch(T.tag){case 27:if(Is(T.type)){gt=T.stateNode,Nn=!1;break e}break;case 5:gt=T.stateNode,Nn=!1;break e;case 3:case 4:gt=T.stateNode.containerInfo,Nn=!0;break e}T=T.return}if(gt===null)throw Error(i(160));rg(x,w,p),gt=null,Nn=!1,x=p.alternate,x!==null&&(x.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)og(a,t),a=a.sibling}var fa=null;function og(t,a){var l=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:kn(a,t),Sn(t),u&4&&(Rs(3,t,t.return),Rl(3,t),Rs(5,t,t.return));break;case 1:kn(a,t),Sn(t),u&512&&(Mt||l===null||Aa(l,l.return)),u&64&&ns&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var p=fa;if(kn(a,t),Sn(t),u&512&&(Mt||l===null||Aa(l,l.return)),u&4){var x=l!==null?l.memoizedState:null;if(u=t.memoizedState,l===null)if(u===null)if(t.stateNode===null){e:{u=t.type,l=t.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":x=p.getElementsByTagName("title")[0],(!x||x[ol]||x[Gt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=p.createElement(u),p.head.insertBefore(x,p.querySelector("head > title"))),Jt(x,u,l),x[Gt]=t,Ht(x),u=x;break e;case"link":var w=ob("link","href",p).get(u+(l.href||""));if(w){for(var T=0;T<w.length;T++)if(x=w[T],x.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&x.getAttribute("rel")===(l.rel==null?null:l.rel)&&x.getAttribute("title")===(l.title==null?null:l.title)&&x.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){w.splice(T,1);break t}}x=p.createElement(u),Jt(x,u,l),p.head.appendChild(x);break;case"meta":if(w=ob("meta","content",p).get(u+(l.content||""))){for(T=0;T<w.length;T++)if(x=w[T],x.getAttribute("content")===(l.content==null?null:""+l.content)&&x.getAttribute("name")===(l.name==null?null:l.name)&&x.getAttribute("property")===(l.property==null?null:l.property)&&x.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&x.getAttribute("charset")===(l.charSet==null?null:l.charSet)){w.splice(T,1);break t}}x=p.createElement(u),Jt(x,u,l),p.head.appendChild(x);break;default:throw Error(i(468,u))}x[Gt]=t,Ht(x),u=x}t.stateNode=u}else cb(p,t.type,t.stateNode);else t.stateNode=lb(p,u,t.memoizedProps);else x!==u?(x===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):x.count--,u===null?cb(p,t.type,t.stateNode):lb(p,u,t.memoizedProps)):u===null&&t.stateNode!==null&&Sf(t,t.memoizedProps,l.memoizedProps)}break;case 27:kn(a,t),Sn(t),u&512&&(Mt||l===null||Aa(l,l.return)),l!==null&&u&4&&Sf(t,t.memoizedProps,l.memoizedProps);break;case 5:if(kn(a,t),Sn(t),u&512&&(Mt||l===null||Aa(l,l.return)),t.flags&32){p=t.stateNode;try{Zr(p,"")}catch(je){st(t,t.return,je)}}u&4&&t.stateNode!=null&&(p=t.memoizedProps,Sf(t,p,l!==null?l.memoizedProps:p)),u&1024&&(Tf=!0);break;case 6:if(kn(a,t),Sn(t),u&4){if(t.stateNode===null)throw Error(i(162));u=t.memoizedProps,l=t.stateNode;try{l.nodeValue=u}catch(je){st(t,t.return,je)}}break;case 3:if($c=null,p=fa,fa=Pc(a.containerInfo),kn(a,t),fa=p,Sn(t),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Ti(a.containerInfo)}catch(je){st(t,t.return,je)}Tf&&(Tf=!1,cg(t));break;case 4:u=fa,fa=Pc(t.stateNode.containerInfo),kn(a,t),Sn(t),fa=u;break;case 12:kn(a,t),Sn(t);break;case 31:kn(a,t),Sn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Ec(t,u)));break;case 13:kn(a,t),Sn(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Ac=tt()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Ec(t,u)));break;case 22:p=t.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,J=ns,re=Mt;if(ns=J||p,Mt=re||H,kn(a,t),Mt=re,ns=J,Sn(t),u&8192)e:for(a=t.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(l===null||H||ns||Mt||Sr(t)),l=null,a=t;;){if(a.tag===5||a.tag===26){if(l===null){H=l=a;try{if(x=H.stateNode,p)w=x.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{T=H.stateNode;var ce=H.memoizedProps.style,K=ce!=null&&ce.hasOwnProperty("display")?ce.display:null;T.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(je){st(H,H.return,je)}}}else if(a.tag===6){if(l===null){H=a;try{H.stateNode.nodeValue=p?"":H.memoizedProps}catch(je){st(H,H.return,je)}}}else if(a.tag===18){if(l===null){H=a;try{var ae=H.stateNode;p?Zg(ae,!0):Zg(H.stateNode,!1)}catch(je){st(H,H.return,je)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=t.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,Ec(t,l))));break;case 19:kn(a,t),Sn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Ec(t,u)));break;case 30:break;case 21:break;default:kn(a,t),Sn(t)}}function Sn(t){var a=t.flags;if(a&2){try{for(var l,u=t.return;u!==null;){if(eg(u)){l=u;break}u=u.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var p=l.stateNode,x=Cf(t);Cc(t,x,p);break;case 5:var w=l.stateNode;l.flags&32&&(Zr(w,""),l.flags&=-33);var T=Cf(t);Cc(t,T,w);break;case 3:case 4:var H=l.stateNode.containerInfo,J=Cf(t);Ef(t,J,H);break;default:throw Error(i(161))}}catch(re){st(t,t.return,re)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function cg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;cg(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function ss(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ag(t,a.alternate,a),a=a.sibling}function Sr(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:Rs(4,a,a.return),Sr(a);break;case 1:Aa(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&Zx(a,a.return,l),Sr(a);break;case 27:$l(a.stateNode);case 26:case 5:Aa(a,a.return),Sr(a);break;case 22:a.memoizedState===null&&Sr(a);break;case 30:Sr(a);break;default:Sr(a)}t=t.sibling}}function rs(t,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,p=t,x=a,w=x.flags;switch(x.tag){case 0:case 11:case 15:rs(p,x,l),Rl(4,x);break;case 1:if(rs(p,x,l),u=x,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(J){st(u,u.return,J)}if(u=x,p=u.updateQueue,p!==null){var T=u.stateNode;try{var H=p.shared.hiddenCallbacks;if(H!==null)for(p.shared.hiddenCallbacks=null,p=0;p<H.length;p++)qp(H[p],T)}catch(J){st(u,u.return,J)}}l&&w&64&&Kx(x),_l(x,x.return);break;case 27:tg(x);case 26:case 5:rs(p,x,l),l&&u===null&&w&4&&Wx(x),_l(x,x.return);break;case 12:rs(p,x,l);break;case 31:rs(p,x,l),l&&w&4&&ig(p,x);break;case 13:rs(p,x,l),l&&w&4&&lg(p,x);break;case 22:x.memoizedState===null&&rs(p,x,l),_l(x,x.return);break;case 30:break;default:rs(p,x,l)}a=a.sibling}}function Af(t,a){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&jl(l))}function Mf(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&jl(t))}function ha(t,a,l,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)ug(t,a,l,u),a=a.sibling}function ug(t,a,l,u){var p=a.flags;switch(a.tag){case 0:case 11:case 15:ha(t,a,l,u),p&2048&&Rl(9,a);break;case 1:ha(t,a,l,u);break;case 3:ha(t,a,l,u),p&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&jl(t)));break;case 12:if(p&2048){ha(t,a,l,u),t=a.stateNode;try{var x=a.memoizedProps,w=x.id,T=x.onPostCommit;typeof T=="function"&&T(w,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(H){st(a,a.return,H)}}else ha(t,a,l,u);break;case 31:ha(t,a,l,u);break;case 13:ha(t,a,l,u);break;case 23:break;case 22:x=a.stateNode,w=a.alternate,a.memoizedState!==null?x._visibility&2?ha(t,a,l,u):Ll(t,a):x._visibility&2?ha(t,a,l,u):(x._visibility|=2,bi(t,a,l,u,(a.subtreeFlags&10256)!==0||!1)),p&2048&&Af(w,a);break;case 24:ha(t,a,l,u),p&2048&&Mf(a.alternate,a);break;default:ha(t,a,l,u)}}function bi(t,a,l,u,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=t,w=a,T=l,H=u,J=w.flags;switch(w.tag){case 0:case 11:case 15:bi(x,w,T,H,p),Rl(8,w);break;case 23:break;case 22:var re=w.stateNode;w.memoizedState!==null?re._visibility&2?bi(x,w,T,H,p):Ll(x,w):(re._visibility|=2,bi(x,w,T,H,p)),p&&J&2048&&Af(w.alternate,w);break;case 24:bi(x,w,T,H,p),p&&J&2048&&Mf(w.alternate,w);break;default:bi(x,w,T,H,p)}a=a.sibling}}function Ll(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=t,u=a,p=u.flags;switch(u.tag){case 22:Ll(l,u),p&2048&&Af(u.alternate,u);break;case 24:Ll(l,u),p&2048&&Mf(u.alternate,u);break;default:Ll(l,u)}a=a.sibling}}var Bl=8192;function yi(t,a,l){if(t.subtreeFlags&Bl)for(t=t.child;t!==null;)dg(t,a,l),t=t.sibling}function dg(t,a,l){switch(t.tag){case 26:yi(t,a,l),t.flags&Bl&&t.memoizedState!==null&&kz(l,fa,t.memoizedState,t.memoizedProps);break;case 5:yi(t,a,l);break;case 3:case 4:var u=fa;fa=Pc(t.stateNode.containerInfo),yi(t,a,l),fa=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=Bl,Bl=16777216,yi(t,a,l),Bl=u):yi(t,a,l));break;default:yi(t,a,l)}}function fg(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function Ul(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var u=a[l];qt=u,mg(u,t)}fg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)hg(t),t=t.sibling}function hg(t){switch(t.tag){case 0:case 11:case 15:Ul(t),t.flags&2048&&Rs(9,t,t.return);break;case 3:Ul(t);break;case 12:Ul(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,Tc(t)):Ul(t);break;default:Ul(t)}}function Tc(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var u=a[l];qt=u,mg(u,t)}fg(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:Rs(8,a,a.return),Tc(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,Tc(a));break;default:Tc(a)}t=t.sibling}}function mg(t,a){for(;qt!==null;){var l=qt;switch(l.tag){case 0:case 11:case 15:Rs(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:jl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,qt=u;else e:for(l=t;qt!==null;){u=qt;var p=u.sibling,x=u.return;if(sg(u),u===l){qt=null;break e}if(p!==null){p.return=x,qt=p;break e}qt=x}}}var qw={getCacheForType:function(t){var a=Qt(Et),l=a.data.get(t);return l===void 0&&(l=t(),a.data.set(t,l)),l},cacheSignal:function(){return Qt(Et).controller.signal}},Iw=typeof WeakMap=="function"?WeakMap:Map,et=0,ut=null,Ie=null,$e=0,at=0,Fn=null,_s=!1,vi=!1,Df=!1,is=0,jt=0,Ls=0,Cr=0,Of=0,$n=0,ji=0,Hl=null,Cn=null,Rf=!1,Ac=0,pg=0,Mc=1/0,Dc=null,Bs=null,Lt=0,Us=null,wi=null,ls=0,_f=0,Lf=null,xg=null,ql=0,Bf=null;function Vn(){return(et&2)!==0&&$e!==0?$e&-$e:B.T!==null?Ff():D0()}function gg(){if($n===0)if(($e&536870912)===0||Qe){var t=$r;$r<<=1,($r&3932160)===0&&($r=262144),$n=t}else $n=536870912;return t=In.current,t!==null&&(t.flags|=32),$n}function En(t,a,l){(t===ut&&(at===2||at===9)||t.cancelPendingCommit!==null)&&(zi(t,0),Hs(t,$e,$n,!1)),Vt(t,l),((et&2)===0||t!==ut)&&(t===ut&&((et&2)===0&&(Cr|=l),jt===4&&Hs(t,$e,$n,!1)),Ma(t))}function bg(t,a,l){if((et&6)!==0)throw Error(i(327));var u=!l&&(a&127)===0&&(a&t.expiredLanes)===0||Te(t,a),p=u?$w(t,a):Hf(t,a,!0),x=u;do{if(p===0){vi&&!u&&Hs(t,a,0,!1);break}else{if(l=t.current.alternate,x&&!Pw(l)){p=Hf(t,a,!1),x=!1;continue}if(p===2){if(x=a,t.errorRecoveryDisabledLanes&x)var w=0;else w=t.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){a=w;e:{var T=t;p=Hl;var H=T.current.memoizedState.isDehydrated;if(H&&(zi(T,w).flags|=256),w=Hf(T,w,!1),w!==2){if(Df&&!H){T.errorRecoveryDisabledLanes|=x,Cr|=x,p=4;break e}x=Cn,Cn=p,x!==null&&(Cn===null?Cn=x:Cn.push.apply(Cn,x))}p=w}if(x=!1,p!==2)continue}}if(p===1){zi(t,0),Hs(t,a,0,!0);break}e:{switch(u=t,x=p,x){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:Hs(u,a,$n,!_s);break e;case 2:Cn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(p=Ac+300-tt(),10<p)){if(Hs(u,a,$n,!_s),Vr(u,0,!0)!==0)break e;ls=a,u.timeoutHandle=Xg(yg.bind(null,u,l,Cn,Dc,Rf,a,$n,Cr,ji,_s,x,"Throttled",-0,0),p);break e}yg(u,l,Cn,Dc,Rf,a,$n,Cr,ji,_s,x,null,-0,0)}}break}while(!0);Ma(t)}function yg(t,a,l,u,p,x,w,T,H,J,re,ce,K,ae){if(t.timeoutHandle=-1,ce=a.subtreeFlags,ce&8192||(ce&16785408)===16785408){ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ga},dg(a,x,ce);var je=(x&62914560)===x?Ac-tt():(x&4194048)===x?pg-tt():0;if(je=Sz(ce,je),je!==null){ls=x,t.cancelPendingCommit=je(Cg.bind(null,t,a,x,l,u,p,w,T,H,re,ce,null,K,ae)),Hs(t,x,w,!J);return}}Cg(t,a,x,l,u,p,w,T,H)}function Pw(t){for(var a=t;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var p=l[u],x=p.getSnapshot;p=p.value;try{if(!Hn(x(),p))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Hs(t,a,l,u){a&=~Of,a&=~Cr,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var p=a;0<p;){var x=31-Je(p),w=1<<x;u[x]=-1,p&=~w}l!==0&&Ca(t,l,a)}function Oc(){return(et&6)===0?(Il(0),!1):!0}function Uf(){if(Ie!==null){if(at===0)var t=Ie.return;else t=Ie,Ja=br=null,Wd(t),hi=null,zl=0,t=Ie;for(;t!==null;)Jx(t.alternate,t),t=t.return;Ie=null}}function zi(t,a){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,oz(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),ls=0,Uf(),ut=t,Ie=l=Qa(t.current,null),$e=a,at=0,Fn=null,_s=!1,vi=Te(t,a),Df=!1,ji=$n=Of=Cr=Ls=jt=0,Cn=Hl=null,Rf=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var p=31-Je(u),x=1<<p;a|=t[p],u&=~x}return is=a,ec(),l}function vg(t,a){Oe=null,B.H=Ml,a===fi||a===oc?(a=Lp(),at=3):a===Id?(a=Lp(),at=4):at=a===xf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Fn=a,Ie===null&&(jt=1,wc(t,ea(a,t.current)))}function jg(){var t=In.current;return t===null?!0:($e&4194048)===$e?sa===null:($e&62914560)===$e||($e&536870912)!==0?t===sa:!1}function wg(){var t=B.H;return B.H=Ml,t===null?Ml:t}function zg(){var t=B.A;return B.A=qw,t}function Rc(){jt=4,_s||($e&4194048)!==$e&&In.current!==null||(vi=!0),(Ls&134217727)===0&&(Cr&134217727)===0||ut===null||Hs(ut,$e,$n,!1)}function Hf(t,a,l){var u=et;et|=2;var p=wg(),x=zg();(ut!==t||$e!==a)&&(Dc=null,zi(t,a)),a=!1;var w=jt;e:do try{if(at!==0&&Ie!==null){var T=Ie,H=Fn;switch(at){case 8:Uf(),w=6;break e;case 3:case 2:case 9:case 6:In.current===null&&(a=!0);var J=at;if(at=0,Fn=null,Ni(t,T,H,J),l&&vi){w=0;break e}break;default:J=at,at=0,Fn=null,Ni(t,T,H,J)}}Fw(),w=jt;break}catch(re){vg(t,re)}while(!0);return a&&t.shellSuspendCounter++,Ja=br=null,et=u,B.H=p,B.A=x,Ie===null&&(ut=null,$e=0,ec()),w}function Fw(){for(;Ie!==null;)Ng(Ie)}function $w(t,a){var l=et;et|=2;var u=wg(),p=zg();ut!==t||$e!==a?(Dc=null,Mc=tt()+500,zi(t,a)):vi=Te(t,a);e:do try{if(at!==0&&Ie!==null){a=Ie;var x=Fn;t:switch(at){case 1:at=0,Fn=null,Ni(t,a,x,1);break;case 2:case 9:if(Rp(x)){at=0,Fn=null,kg(a);break}a=function(){at!==2&&at!==9||ut!==t||(at=7),Ma(t)},x.then(a,a);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:Rp(x)?(at=0,Fn=null,kg(a)):(at=0,Fn=null,Ni(t,a,x,7));break;case 5:var w=null;switch(Ie.tag){case 26:w=Ie.memoizedState;case 5:case 27:var T=Ie;if(w?ub(w):T.stateNode.complete){at=0,Fn=null;var H=T.sibling;if(H!==null)Ie=H;else{var J=T.return;J!==null?(Ie=J,_c(J)):Ie=null}break t}}at=0,Fn=null,Ni(t,a,x,5);break;case 6:at=0,Fn=null,Ni(t,a,x,6);break;case 8:Uf(),jt=6;break e;default:throw Error(i(462))}}Vw();break}catch(re){vg(t,re)}while(!0);return Ja=br=null,B.H=u,B.A=p,et=l,Ie!==null?0:(ut=null,$e=0,ec(),jt)}function Vw(){for(;Ie!==null&&!Ue();)Ng(Ie)}function Ng(t){var a=Qx(t.alternate,t,is);t.memoizedProps=t.pendingProps,a===null?_c(t):Ie=a}function kg(t){var a=t,l=a.alternate;switch(a.tag){case 15:case 0:a=Px(l,a,a.pendingProps,a.type,void 0,$e);break;case 11:a=Px(l,a,a.pendingProps,a.type.render,a.ref,$e);break;case 5:Wd(a);default:Jx(l,a),a=Ie=zp(a,is),a=Qx(l,a,is)}t.memoizedProps=t.pendingProps,a===null?_c(t):Ie=a}function Ni(t,a,l,u){Ja=br=null,Wd(a),hi=null,zl=0;var p=a.return;try{if(Ow(t,p,a,l,$e)){jt=1,wc(t,ea(l,t.current)),Ie=null;return}}catch(x){if(p!==null)throw Ie=p,x;jt=1,wc(t,ea(l,t.current)),Ie=null;return}a.flags&32768?(Qe||u===1?t=!0:vi||($e&536870912)!==0?t=!1:(_s=t=!0,(u===2||u===9||u===3||u===6)&&(u=In.current,u!==null&&u.tag===13&&(u.flags|=16384))),Sg(a,t)):_c(a)}function _c(t){var a=t;do{if((a.flags&32768)!==0){Sg(a,_s);return}t=a.return;var l=Lw(a.alternate,a,is);if(l!==null){Ie=l;return}if(a=a.sibling,a!==null){Ie=a;return}Ie=a=t}while(a!==null);jt===0&&(jt=5)}function Sg(t,a){do{var l=Bw(t.alternate,t);if(l!==null){l.flags&=32767,Ie=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(t=t.sibling,t!==null)){Ie=t;return}Ie=t=l}while(t!==null);jt=6,Ie=null}function Cg(t,a,l,u,p,x,w,T,H){t.cancelPendingCommit=null;do Lc();while(Lt!==0);if((et&6)!==0)throw Error(i(327));if(a!==null){if(a===t.current)throw Error(i(177));if(x=a.lanes|a.childLanes,x|=Sd,Sa(t,l,x,w,T,H),t===ut&&(Ie=ut=null,$e=0),wi=a,Us=t,ls=l,_f=x,Lf=p,xg=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Xw(Ee,function(){return Dg(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=B.T,B.T=null,p=V.p,V.p=2,w=et,et|=4;try{Uw(t,a,l)}finally{et=w,V.p=p,B.T=u}}Lt=1,Eg(),Tg(),Ag()}}function Eg(){if(Lt===1){Lt=0;var t=Us,a=wi,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=B.T,B.T=null;var u=V.p;V.p=2;var p=et;et|=4;try{og(a,t);var x=Kf,w=mp(t.containerInfo),T=x.focusedElem,H=x.selectionRange;if(w!==T&&T&&T.ownerDocument&&hp(T.ownerDocument.documentElement,T)){if(H!==null&&jd(T)){var J=H.start,re=H.end;if(re===void 0&&(re=J),"selectionStart"in T)T.selectionStart=J,T.selectionEnd=Math.min(re,T.value.length);else{var ce=T.ownerDocument||document,K=ce&&ce.defaultView||window;if(K.getSelection){var ae=K.getSelection(),je=T.textContent.length,Ce=Math.min(H.start,je),ot=H.end===void 0?Ce:Math.min(H.end,je);!ae.extend&&Ce>ot&&(w=ot,ot=Ce,Ce=w);var $=fp(T,Ce),I=fp(T,ot);if($&&I&&(ae.rangeCount!==1||ae.anchorNode!==$.node||ae.anchorOffset!==$.offset||ae.focusNode!==I.node||ae.focusOffset!==I.offset)){var X=ce.createRange();X.setStart($.node,$.offset),ae.removeAllRanges(),Ce>ot?(ae.addRange(X),ae.extend(I.node,I.offset)):(X.setEnd(I.node,I.offset),ae.addRange(X))}}}}for(ce=[],ae=T;ae=ae.parentNode;)ae.nodeType===1&&ce.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<ce.length;T++){var le=ce[T];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Qc=!!Jf,Kf=Jf=null}finally{et=p,V.p=u,B.T=l}}t.current=a,Lt=2}}function Tg(){if(Lt===2){Lt=0;var t=Us,a=wi,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=B.T,B.T=null;var u=V.p;V.p=2;var p=et;et|=4;try{ag(t,a.alternate,a)}finally{et=p,V.p=u,B.T=l}}Lt=3}}function Ag(){if(Lt===4||Lt===3){Lt=0,qe();var t=Us,a=wi,l=ls,u=xg;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Lt=5:(Lt=0,wi=Us=null,Mg(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&(Bs=null),nd(l),a=a.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(_t,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=B.T,p=V.p,V.p=2,B.T=null;try{for(var x=t.onRecoverableError,w=0;w<u.length;w++){var T=u[w];x(T.value,{componentStack:T.stack})}}finally{B.T=a,V.p=p}}(ls&3)!==0&&Lc(),Ma(t),p=t.pendingLanes,(l&261930)!==0&&(p&42)!==0?t===Bf?ql++:(ql=0,Bf=t):ql=0,Il(0)}}function Mg(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,jl(a)))}function Lc(){return Eg(),Tg(),Ag(),Dg()}function Dg(){if(Lt!==5)return!1;var t=Us,a=_f;_f=0;var l=nd(ls),u=B.T,p=V.p;try{V.p=32>l?32:l,B.T=null,l=Lf,Lf=null;var x=Us,w=ls;if(Lt=0,wi=Us=null,ls=0,(et&6)!==0)throw Error(i(331));var T=et;if(et|=4,hg(x.current),ug(x,x.current,w,l),et=T,Il(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(_t,x)}catch{}return!0}finally{V.p=p,B.T=u,Mg(t,a)}}function Og(t,a,l){a=ea(l,a),a=pf(t.stateNode,a,2),t=Ms(t,a,2),t!==null&&(Vt(t,2),Ma(t))}function st(t,a,l){if(t.tag===3)Og(t,t,l);else for(;a!==null;){if(a.tag===3){Og(a,t,l);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Bs===null||!Bs.has(u))){t=ea(l,t),l=Rx(2),u=Ms(a,l,2),u!==null&&(_x(l,u,a,t),Vt(u,2),Ma(u));break}}a=a.return}}function qf(t,a,l){var u=t.pingCache;if(u===null){u=t.pingCache=new Iw;var p=new Set;u.set(a,p)}else p=u.get(a),p===void 0&&(p=new Set,u.set(a,p));p.has(l)||(Df=!0,p.add(l),t=Gw.bind(null,t,a,l),a.then(t,t))}function Gw(t,a,l){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,ut===t&&($e&l)===l&&(jt===4||jt===3&&($e&62914560)===$e&&300>tt()-Ac?(et&2)===0&&zi(t,0):Of|=l,ji===$e&&(ji=0)),Ma(t)}function Rg(t,a){a===0&&(a=ct()),t=pr(t,a),t!==null&&(Vt(t,a),Ma(t))}function Yw(t){var a=t.memoizedState,l=0;a!==null&&(l=a.retryLane),Rg(t,l)}function Qw(t,a){var l=0;switch(t.tag){case 31:case 13:var u=t.stateNode,p=t.memoizedState;p!==null&&(l=p.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(i(314))}u!==null&&u.delete(a),Rg(t,l)}function Xw(t,a){return Me(t,a)}var Bc=null,ki=null,If=!1,Uc=!1,Pf=!1,qs=0;function Ma(t){t!==ki&&t.next===null&&(ki===null?Bc=ki=t:ki=ki.next=t),Uc=!0,If||(If=!0,Kw())}function Il(t,a){if(!Pf&&Uc){Pf=!0;do for(var l=!1,u=Bc;u!==null;){if(t!==0){var p=u.pendingLanes;if(p===0)var x=0;else{var w=u.suspendedLanes,T=u.pingedLanes;x=(1<<31-Je(42|t)+1)-1,x&=p&~(w&~T),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(l=!0,Ug(u,x))}else x=$e,x=Vr(u,u===ut?x:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(x&3)===0||Te(u,x)||(l=!0,Ug(u,x));u=u.next}while(l);Pf=!1}}function Jw(){_g()}function _g(){Uc=If=!1;var t=0;qs!==0&&lz()&&(t=qs);for(var a=tt(),l=null,u=Bc;u!==null;){var p=u.next,x=Lg(u,a);x===0?(u.next=null,l===null?Bc=p:l.next=p,p===null&&(ki=l)):(l=u,(t!==0||(x&3)!==0)&&(Uc=!0)),u=p}Lt!==0&&Lt!==5||Il(t),qs!==0&&(qs=0)}function Lg(t,a){for(var l=t.suspendedLanes,u=t.pingedLanes,p=t.expirationTimes,x=t.pendingLanes&-62914561;0<x;){var w=31-Je(x),T=1<<w,H=p[w];H===-1?((T&l)===0||(T&u)!==0)&&(p[w]=nt(T,a)):H<=a&&(t.expiredLanes|=T),x&=~T}if(a=ut,l=$e,l=Vr(t,t===a?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,l===0||t===a&&(at===2||at===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&ze(u),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||Te(t,l)){if(a=l&-l,a===t.callbackPriority)return a;switch(u!==null&&ze(u),nd(l)){case 2:case 8:l=fe;break;case 32:l=Ee;break;case 268435456:l=Ye;break;default:l=Ee}return u=Bg.bind(null,t),l=Me(l,u),t.callbackPriority=a,t.callbackNode=l,a}return u!==null&&u!==null&&ze(u),t.callbackPriority=2,t.callbackNode=null,2}function Bg(t,a){if(Lt!==0&&Lt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(Lc()&&t.callbackNode!==l)return null;var u=$e;return u=Vr(t,t===ut?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(bg(t,u,a),Lg(t,tt()),t.callbackNode!=null&&t.callbackNode===l?Bg.bind(null,t):null)}function Ug(t,a){if(Lc())return null;bg(t,a,!0)}function Kw(){cz(function(){(et&6)!==0?Me(te,Jw):_g()})}function Ff(){if(qs===0){var t=ui;t===0&&(t=ur,ur<<=1,(ur&261888)===0&&(ur=256)),qs=t}return qs}function Hg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Go(""+t)}function qg(t,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,t.id&&l.setAttribute("form",t.id),a.parentNode.insertBefore(l,a),t=new FormData(t),l.parentNode.removeChild(l),t}function Zw(t,a,l,u,p){if(a==="submit"&&l&&l.stateNode===p){var x=Hg((p[wn]||null).action),w=u.submitter;w&&(a=(a=w[wn]||null)?Hg(a.formAction):w.getAttribute("formAction"),a!==null&&(x=a,w=null));var T=new Jo("action","action",null,u,p);t.push({event:T,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(qs!==0){var H=w?qg(p,w):new FormData(p);cf(l,{pending:!0,data:H,method:p.method,action:x},null,H)}}else typeof x=="function"&&(T.preventDefault(),H=w?qg(p,w):new FormData(p),cf(l,{pending:!0,data:H,method:p.method,action:x},x,H))},currentTarget:p}]})}}for(var $f=0;$f<kd.length;$f++){var Vf=kd[$f],Ww=Vf.toLowerCase(),ez=Vf[0].toUpperCase()+Vf.slice(1);da(Ww,"on"+ez)}da(gp,"onAnimationEnd"),da(bp,"onAnimationIteration"),da(yp,"onAnimationStart"),da("dblclick","onDoubleClick"),da("focusin","onFocus"),da("focusout","onBlur"),da(xw,"onTransitionRun"),da(gw,"onTransitionStart"),da(bw,"onTransitionCancel"),da(vp,"onTransitionEnd"),Jr("onMouseEnter",["mouseout","mouseover"]),Jr("onMouseLeave",["mouseout","mouseover"]),Jr("onPointerEnter",["pointerout","pointerover"]),Jr("onPointerLeave",["pointerout","pointerover"]),dr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),dr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),dr("onBeforeInput",["compositionend","keypress","textInput","paste"]),dr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),dr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),dr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pl="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(" "),tz=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pl));function Ig(t,a){a=(a&4)!==0;for(var l=0;l<t.length;l++){var u=t[l],p=u.event;u=u.listeners;e:{var x=void 0;if(a)for(var w=u.length-1;0<=w;w--){var T=u[w],H=T.instance,J=T.currentTarget;if(T=T.listener,H!==x&&p.isPropagationStopped())break e;x=T,p.currentTarget=J;try{x(p)}catch(re){Wo(re)}p.currentTarget=null,x=H}else for(w=0;w<u.length;w++){if(T=u[w],H=T.instance,J=T.currentTarget,T=T.listener,H!==x&&p.isPropagationStopped())break e;x=T,p.currentTarget=J;try{x(p)}catch(re){Wo(re)}p.currentTarget=null,x=H}}}}function Pe(t,a){var l=a[ad];l===void 0&&(l=a[ad]=new Set);var u=t+"__bubble";l.has(u)||(Pg(a,t,2,!1),l.add(u))}function Gf(t,a,l){var u=0;a&&(u|=4),Pg(l,t,u,a)}var Hc="_reactListening"+Math.random().toString(36).slice(2);function Yf(t){if(!t[Hc]){t[Hc]=!0,_0.forEach(function(l){l!=="selectionchange"&&(tz.has(l)||Gf(l,!1,t),Gf(l,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Hc]||(a[Hc]=!0,Gf("selectionchange",!1,a))}}function Pg(t,a,l,u){switch(gb(a)){case 2:var p=Tz;break;case 8:p=Az;break;default:p=oh}l=p.bind(null,a,l,t),p=void 0,!fd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),u?p!==void 0?t.addEventListener(a,l,{capture:!0,passive:p}):t.addEventListener(a,l,!0):p!==void 0?t.addEventListener(a,l,{passive:p}):t.addEventListener(a,l,!1)}function Qf(t,a,l,u,p){var x=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var w=u.tag;if(w===3||w===4){var T=u.stateNode.containerInfo;if(T===p)break;if(w===4)for(w=u.return;w!==null;){var H=w.tag;if((H===3||H===4)&&w.stateNode.containerInfo===p)return;w=w.return}for(;T!==null;){if(w=Yr(T),w===null)return;if(H=w.tag,H===5||H===6||H===26||H===27){u=x=w;continue e}T=T.parentNode}}u=u.return}Y0(function(){var J=x,re=ud(l),ce=[];e:{var K=jp.get(t);if(K!==void 0){var ae=Jo,je=t;switch(t){case"keypress":if(Qo(l)===0)break e;case"keydown":case"keyup":ae=Qj;break;case"focusin":je="focus",ae=xd;break;case"focusout":je="blur",ae=xd;break;case"beforeblur":case"afterblur":ae=xd;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=J0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=Lj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=Kj;break;case gp:case bp:case yp:ae=Hj;break;case vp:ae=Wj;break;case"scroll":case"scrollend":ae=Rj;break;case"wheel":ae=tw;break;case"copy":case"cut":case"paste":ae=Ij;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=Z0;break;case"toggle":case"beforetoggle":ae=aw}var Ce=(a&4)!==0,ot=!Ce&&(t==="scroll"||t==="scrollend"),$=Ce?K!==null?K+"Capture":null:K;Ce=[];for(var I=J,X;I!==null;){var le=I;if(X=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||X===null||$===null||(le=ul(I,$),le!=null&&Ce.push(Fl(I,le,X))),ot)break;I=I.return}0<Ce.length&&(K=new ae(K,je,null,l,re),ce.push({event:K,listeners:Ce}))}}if((a&7)===0){e:{if(K=t==="mouseover"||t==="pointerover",ae=t==="mouseout"||t==="pointerout",K&&l!==cd&&(je=l.relatedTarget||l.fromElement)&&(Yr(je)||je[Gr]))break e;if((ae||K)&&(K=re.window===re?re:(K=re.ownerDocument)?K.defaultView||K.parentWindow:window,ae?(je=l.relatedTarget||l.toElement,ae=J,je=je?Yr(je):null,je!==null&&(ot=c(je),Ce=je.tag,je!==ot||Ce!==5&&Ce!==27&&Ce!==6)&&(je=null)):(ae=null,je=J),ae!==je)){if(Ce=J0,le="onMouseLeave",$="onMouseEnter",I="mouse",(t==="pointerout"||t==="pointerover")&&(Ce=Z0,le="onPointerLeave",$="onPointerEnter",I="pointer"),ot=ae==null?K:cl(ae),X=je==null?K:cl(je),K=new Ce(le,I+"leave",ae,l,re),K.target=ot,K.relatedTarget=X,le=null,Yr(re)===J&&(Ce=new Ce($,I+"enter",je,l,re),Ce.target=X,Ce.relatedTarget=ot,le=Ce),ot=le,ae&&je)t:{for(Ce=nz,$=ae,I=je,X=0,le=$;le;le=Ce(le))X++;le=0;for(var Ne=I;Ne;Ne=Ce(Ne))le++;for(;0<X-le;)$=Ce($),X--;for(;0<le-X;)I=Ce(I),le--;for(;X--;){if($===I||I!==null&&$===I.alternate){Ce=$;break t}$=Ce($),I=Ce(I)}Ce=null}else Ce=null;ae!==null&&Fg(ce,K,ae,Ce,!1),je!==null&&ot!==null&&Fg(ce,ot,je,Ce,!0)}}e:{if(K=J?cl(J):window,ae=K.nodeName&&K.nodeName.toLowerCase(),ae==="select"||ae==="input"&&K.type==="file")var Ze=ip;else if(sp(K))if(lp)Ze=hw;else{Ze=dw;var we=uw}else ae=K.nodeName,!ae||ae.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?J&&od(J.elementType)&&(Ze=ip):Ze=fw;if(Ze&&(Ze=Ze(t,J))){rp(ce,Ze,l,re);break e}we&&we(t,K,J),t==="focusout"&&J&&K.type==="number"&&J.memoizedProps.value!=null&&ld(K,"number",K.value)}switch(we=J?cl(J):window,t){case"focusin":(sp(we)||we.contentEditable==="true")&&(ni=we,wd=J,bl=null);break;case"focusout":bl=wd=ni=null;break;case"mousedown":zd=!0;break;case"contextmenu":case"mouseup":case"dragend":zd=!1,pp(ce,l,re);break;case"selectionchange":if(pw)break;case"keydown":case"keyup":pp(ce,l,re)}var _e;if(bd)e:{switch(t){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else ti?np(t,l)&&(Ve="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(Ve="onCompositionStart");Ve&&(W0&&l.locale!=="ko"&&(ti||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&ti&&(_e=Q0()):(Ns=re,hd="value"in Ns?Ns.value:Ns.textContent,ti=!0)),we=qc(J,Ve),0<we.length&&(Ve=new K0(Ve,t,null,l,re),ce.push({event:Ve,listeners:we}),_e?Ve.data=_e:(_e=ap(l),_e!==null&&(Ve.data=_e)))),(_e=rw?iw(t,l):lw(t,l))&&(Ve=qc(J,"onBeforeInput"),0<Ve.length&&(we=new K0("onBeforeInput","beforeinput",null,l,re),ce.push({event:we,listeners:Ve}),we.data=_e)),Zw(ce,t,J,l,re)}Ig(ce,a)})}function Fl(t,a,l){return{instance:t,listener:a,currentTarget:l}}function qc(t,a){for(var l=a+"Capture",u=[];t!==null;){var p=t,x=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||x===null||(p=ul(t,l),p!=null&&u.unshift(Fl(t,p,x)),p=ul(t,a),p!=null&&u.push(Fl(t,p,x))),t.tag===3)return u;t=t.return}return[]}function nz(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Fg(t,a,l,u,p){for(var x=a._reactName,w=[];l!==null&&l!==u;){var T=l,H=T.alternate,J=T.stateNode;if(T=T.tag,H!==null&&H===u)break;T!==5&&T!==26&&T!==27||J===null||(H=J,p?(J=ul(l,x),J!=null&&w.unshift(Fl(l,J,H))):p||(J=ul(l,x),J!=null&&w.push(Fl(l,J,H)))),l=l.return}w.length!==0&&t.push({event:a,listeners:w})}var az=/\r\n?/g,sz=/\u0000|\uFFFD/g;function $g(t){return(typeof t=="string"?t:""+t).replace(az,`
`).replace(sz,"")}function Vg(t,a){return a=$g(a),$g(t)===a}function lt(t,a,l,u,p,x){switch(l){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||Zr(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&Zr(t,""+u);break;case"className":$o(t,"class",u);break;case"tabIndex":$o(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":$o(t,l,u);break;case"style":V0(t,u,x);break;case"data":if(a!=="object"){$o(t,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||l!=="href")){t.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(l);break}u=Go(""+u),t.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(l==="formAction"?(a!=="input"&&lt(t,a,"name",p.name,p,null),lt(t,a,"formEncType",p.formEncType,p,null),lt(t,a,"formMethod",p.formMethod,p,null),lt(t,a,"formTarget",p.formTarget,p,null)):(lt(t,a,"encType",p.encType,p,null),lt(t,a,"method",p.method,p,null),lt(t,a,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(l);break}u=Go(""+u),t.setAttribute(l,u);break;case"onClick":u!=null&&(t.onclick=Ga);break;case"onScroll":u!=null&&Pe("scroll",t);break;case"onScrollEnd":u!=null&&Pe("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(i(61));if(l=u.__html,l!=null){if(p.children!=null)throw Error(i(60));t.innerHTML=l}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}l=Go(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,""+u):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":u===!0?t.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,u):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(l,u):t.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(l):t.setAttribute(l,u);break;case"popover":Pe("beforetoggle",t),Pe("toggle",t),Fo(t,"popover",u);break;case"xlinkActuate":Va(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Va(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Va(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Va(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Va(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Va(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Va(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Va(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Va(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Fo(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Dj.get(l)||l,Fo(t,l,u))}}function Xf(t,a,l,u,p,x){switch(l){case"style":V0(t,u,x);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(i(61));if(l=u.__html,l!=null){if(p.children!=null)throw Error(i(60));t.innerHTML=l}}break;case"children":typeof u=="string"?Zr(t,u):(typeof u=="number"||typeof u=="bigint")&&Zr(t,""+u);break;case"onScroll":u!=null&&Pe("scroll",t);break;case"onScrollEnd":u!=null&&Pe("scrollend",t);break;case"onClick":u!=null&&(t.onclick=Ga);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!L0.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(p=l.endsWith("Capture"),a=l.slice(2,p?l.length-7:void 0),x=t[wn]||null,x=x!=null?x[l]:null,typeof x=="function"&&t.removeEventListener(a,x,p),typeof u=="function")){typeof x!="function"&&x!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(a,u,p);break e}l in t?t[l]=u:u===!0?t.setAttribute(l,""):Fo(t,l,u)}}}function Jt(t,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pe("error",t),Pe("load",t);var u=!1,p=!1,x;for(x in l)if(l.hasOwnProperty(x)){var w=l[x];if(w!=null)switch(x){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:lt(t,a,x,w,l,null)}}p&&lt(t,a,"srcSet",l.srcSet,l,null),u&&lt(t,a,"src",l.src,l,null);return;case"input":Pe("invalid",t);var T=x=w=p=null,H=null,J=null;for(u in l)if(l.hasOwnProperty(u)){var re=l[u];if(re!=null)switch(u){case"name":p=re;break;case"type":w=re;break;case"checked":H=re;break;case"defaultChecked":J=re;break;case"value":x=re;break;case"defaultValue":T=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,a));break;default:lt(t,a,u,re,l,null)}}I0(t,x,T,H,J,w,p,!1);return;case"select":Pe("invalid",t),u=w=x=null;for(p in l)if(l.hasOwnProperty(p)&&(T=l[p],T!=null))switch(p){case"value":x=T;break;case"defaultValue":w=T;break;case"multiple":u=T;default:lt(t,a,p,T,l,null)}a=x,l=w,t.multiple=!!u,a!=null?Kr(t,!!u,a,!1):l!=null&&Kr(t,!!u,l,!0);return;case"textarea":Pe("invalid",t),x=p=u=null;for(w in l)if(l.hasOwnProperty(w)&&(T=l[w],T!=null))switch(w){case"value":u=T;break;case"defaultValue":p=T;break;case"children":x=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(i(91));break;default:lt(t,a,w,T,l,null)}F0(t,u,p,x);return;case"option":for(H in l)if(l.hasOwnProperty(H)&&(u=l[H],u!=null))switch(H){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:lt(t,a,H,u,l,null)}return;case"dialog":Pe("beforetoggle",t),Pe("toggle",t),Pe("cancel",t),Pe("close",t);break;case"iframe":case"object":Pe("load",t);break;case"video":case"audio":for(u=0;u<Pl.length;u++)Pe(Pl[u],t);break;case"image":Pe("error",t),Pe("load",t);break;case"details":Pe("toggle",t);break;case"embed":case"source":case"link":Pe("error",t),Pe("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(J in l)if(l.hasOwnProperty(J)&&(u=l[J],u!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:lt(t,a,J,u,l,null)}return;default:if(od(a)){for(re in l)l.hasOwnProperty(re)&&(u=l[re],u!==void 0&&Xf(t,a,re,u,l,void 0));return}}for(T in l)l.hasOwnProperty(T)&&(u=l[T],u!=null&&lt(t,a,T,u,l,null))}function rz(t,a,l,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,x=null,w=null,T=null,H=null,J=null,re=null;for(ae in l){var ce=l[ae];if(l.hasOwnProperty(ae)&&ce!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":H=ce;default:u.hasOwnProperty(ae)||lt(t,a,ae,null,u,ce)}}for(var K in u){var ae=u[K];if(ce=l[K],u.hasOwnProperty(K)&&(ae!=null||ce!=null))switch(K){case"type":x=ae;break;case"name":p=ae;break;case"checked":J=ae;break;case"defaultChecked":re=ae;break;case"value":w=ae;break;case"defaultValue":T=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(i(137,a));break;default:ae!==ce&&lt(t,a,K,ae,u,ce)}}id(t,w,T,H,J,re,x,p);return;case"select":ae=w=T=K=null;for(x in l)if(H=l[x],l.hasOwnProperty(x)&&H!=null)switch(x){case"value":break;case"multiple":ae=H;default:u.hasOwnProperty(x)||lt(t,a,x,null,u,H)}for(p in u)if(x=u[p],H=l[p],u.hasOwnProperty(p)&&(x!=null||H!=null))switch(p){case"value":K=x;break;case"defaultValue":T=x;break;case"multiple":w=x;default:x!==H&&lt(t,a,p,x,u,H)}a=T,l=w,u=ae,K!=null?Kr(t,!!l,K,!1):!!u!=!!l&&(a!=null?Kr(t,!!l,a,!0):Kr(t,!!l,l?[]:"",!1));return;case"textarea":ae=K=null;for(T in l)if(p=l[T],l.hasOwnProperty(T)&&p!=null&&!u.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:lt(t,a,T,null,u,p)}for(w in u)if(p=u[w],x=l[w],u.hasOwnProperty(w)&&(p!=null||x!=null))switch(w){case"value":K=p;break;case"defaultValue":ae=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(i(91));break;default:p!==x&&lt(t,a,w,p,u,x)}P0(t,K,ae);return;case"option":for(var je in l)if(K=l[je],l.hasOwnProperty(je)&&K!=null&&!u.hasOwnProperty(je))switch(je){case"selected":t.selected=!1;break;default:lt(t,a,je,null,u,K)}for(H in u)if(K=u[H],ae=l[H],u.hasOwnProperty(H)&&K!==ae&&(K!=null||ae!=null))switch(H){case"selected":t.selected=K&&typeof K!="function"&&typeof K!="symbol";break;default:lt(t,a,H,K,u,ae)}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 l)K=l[Ce],l.hasOwnProperty(Ce)&&K!=null&&!u.hasOwnProperty(Ce)&&lt(t,a,Ce,null,u,K);for(J in u)if(K=u[J],ae=l[J],u.hasOwnProperty(J)&&K!==ae&&(K!=null||ae!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(i(137,a));break;default:lt(t,a,J,K,u,ae)}return;default:if(od(a)){for(var ot in l)K=l[ot],l.hasOwnProperty(ot)&&K!==void 0&&!u.hasOwnProperty(ot)&&Xf(t,a,ot,void 0,u,K);for(re in u)K=u[re],ae=l[re],!u.hasOwnProperty(re)||K===ae||K===void 0&&ae===void 0||Xf(t,a,re,K,u,ae);return}}for(var $ in l)K=l[$],l.hasOwnProperty($)&&K!=null&&!u.hasOwnProperty($)&&lt(t,a,$,null,u,K);for(ce in u)K=u[ce],ae=l[ce],!u.hasOwnProperty(ce)||K===ae||K==null&&ae==null||lt(t,a,ce,K,u,ae)}function Gg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function iz(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var p=l[u],x=p.transferSize,w=p.initiatorType,T=p.duration;if(x&&T&&Gg(w)){for(w=0,T=p.responseEnd,u+=1;u<l.length;u++){var H=l[u],J=H.startTime;if(J>T)break;var re=H.transferSize,ce=H.initiatorType;re&&Gg(ce)&&(H=H.responseEnd,w+=re*(H<T?1:(T-J)/(H-J)))}if(--u,a+=8*(x+w)/(p.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Jf=null,Kf=null;function Ic(t){return t.nodeType===9?t:t.ownerDocument}function Yg(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 Qg(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function Zf(t,a){return t==="textarea"||t==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Wf=null;function lz(){var t=window.event;return t&&t.type==="popstate"?t===Wf?!1:(Wf=t,!0):(Wf=null,!1)}var Xg=typeof setTimeout=="function"?setTimeout:void 0,oz=typeof clearTimeout=="function"?clearTimeout:void 0,Jg=typeof Promise=="function"?Promise:void 0,cz=typeof queueMicrotask=="function"?queueMicrotask:typeof Jg<"u"?function(t){return Jg.resolve(null).then(t).catch(uz)}:Xg;function uz(t){setTimeout(function(){throw t})}function Is(t){return t==="head"}function Kg(t,a){var l=a,u=0;do{var p=l.nextSibling;if(t.removeChild(l),p&&p.nodeType===8)if(l=p.data,l==="/$"||l==="/&"){if(u===0){t.removeChild(p),Ti(a);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")$l(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,$l(l);for(var x=l.firstChild;x;){var w=x.nextSibling,T=x.nodeName;x[ol]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&x.rel.toLowerCase()==="stylesheet"||l.removeChild(x),x=w}}else l==="body"&&$l(t.ownerDocument.body);l=p}while(l);Ti(a)}function Zg(t,a){var l=t;t=0;do{var u=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=u}while(l)}function eh(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":eh(l),sd(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function dz(t,a,l,u){for(;t.nodeType===1;){var p=l;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[ol])switch(a){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!==p.rel||t.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||t.getAttribute("title")!==(p.title==null?null:p.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(x=t.getAttribute("src"),(x!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&x&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var x=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===x)return t}else return t;if(t=ra(t.nextSibling),t===null)break}return null}function fz(t,a,l){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=ra(t.nextSibling),t===null))return null;return t}function Wg(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=ra(t.nextSibling),t===null))return null;return t}function th(t){return t.data==="$?"||t.data==="$~"}function nh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function hz(t,a){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||l.readyState!=="loading")a();else{var u=function(){a(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function ra(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var ah=null;function eb(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(a===0)return ra(t.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}t=t.nextSibling}return null}function tb(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return t;a--}else l!=="/$"&&l!=="/&"||a++}t=t.previousSibling}return null}function nb(t,a,l){switch(a=Ic(l),t){case"html":if(t=a.documentElement,!t)throw Error(i(452));return t;case"head":if(t=a.head,!t)throw Error(i(453));return t;case"body":if(t=a.body,!t)throw Error(i(454));return t;default:throw Error(i(451))}}function $l(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);sd(t)}var ia=new Map,ab=new Set;function Pc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var os=V.d;V.d={f:mz,r:pz,D:xz,C:gz,L:bz,m:yz,X:jz,S:vz,M:wz};function mz(){var t=os.f(),a=Oc();return t||a}function pz(t){var a=Qr(t);a!==null&&a.tag===5&&a.type==="form"?vx(a):os.r(t)}var Si=typeof document>"u"?null:document;function sb(t,a,l){var u=Si;if(u&&typeof a=="string"&&a){var p=Zn(a);p='link[rel="'+t+'"][href="'+p+'"]',typeof l=="string"&&(p+='[crossorigin="'+l+'"]'),ab.has(p)||(ab.add(p),t={rel:t,crossOrigin:l,href:a},u.querySelector(p)===null&&(a=u.createElement("link"),Jt(a,"link",t),Ht(a),u.head.appendChild(a)))}}function xz(t){os.D(t),sb("dns-prefetch",t,null)}function gz(t,a){os.C(t,a),sb("preconnect",t,a)}function bz(t,a,l){os.L(t,a,l);var u=Si;if(u&&t&&a){var p='link[rel="preload"][as="'+Zn(a)+'"]';a==="image"&&l&&l.imageSrcSet?(p+='[imagesrcset="'+Zn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(p+='[imagesizes="'+Zn(l.imageSizes)+'"]')):p+='[href="'+Zn(t)+'"]';var x=p;switch(a){case"style":x=Ci(t);break;case"script":x=Ei(t)}ia.has(x)||(t=g({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:t,as:a},l),ia.set(x,t),u.querySelector(p)!==null||a==="style"&&u.querySelector(Vl(x))||a==="script"&&u.querySelector(Gl(x))||(a=u.createElement("link"),Jt(a,"link",t),Ht(a),u.head.appendChild(a)))}}function yz(t,a){os.m(t,a);var l=Si;if(l&&t){var u=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+Zn(u)+'"][href="'+Zn(t)+'"]',x=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Ei(t)}if(!ia.has(x)&&(t=g({rel:"modulepreload",href:t},a),ia.set(x,t),l.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Gl(x)))return}u=l.createElement("link"),Jt(u,"link",t),Ht(u),l.head.appendChild(u)}}}function vz(t,a,l){os.S(t,a,l);var u=Si;if(u&&t){var p=Xr(u).hoistableStyles,x=Ci(t);a=a||"default";var w=p.get(x);if(!w){var T={loading:0,preload:null};if(w=u.querySelector(Vl(x)))T.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":a},l),(l=ia.get(x))&&sh(t,l);var H=w=u.createElement("link");Ht(H),Jt(H,"link",t),H._p=new Promise(function(J,re){H.onload=J,H.onerror=re}),H.addEventListener("load",function(){T.loading|=1}),H.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Fc(w,a,u)}w={type:"stylesheet",instance:w,count:1,state:T},p.set(x,w)}}}function jz(t,a){os.X(t,a);var l=Si;if(l&&t){var u=Xr(l).hoistableScripts,p=Ei(t),x=u.get(p);x||(x=l.querySelector(Gl(p)),x||(t=g({src:t,async:!0},a),(a=ia.get(p))&&rh(t,a),x=l.createElement("script"),Ht(x),Jt(x,"link",t),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(p,x))}}function wz(t,a){os.M(t,a);var l=Si;if(l&&t){var u=Xr(l).hoistableScripts,p=Ei(t),x=u.get(p);x||(x=l.querySelector(Gl(p)),x||(t=g({src:t,async:!0,type:"module"},a),(a=ia.get(p))&&rh(t,a),x=l.createElement("script"),Ht(x),Jt(x,"link",t),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(p,x))}}function rb(t,a,l,u){var p=(p=ye.current)?Pc(p):null;if(!p)throw Error(i(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=Ci(l.href),l=Xr(p).hoistableStyles,u=l.get(a),u||(u={type:"style",instance:null,count:0,state:null},l.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Ci(l.href);var x=Xr(p).hoistableStyles,w=x.get(t);if(w||(p=p.ownerDocument||p,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(t,w),(x=p.querySelector(Vl(t)))&&!x._p&&(w.instance=x,w.state.loading=5),ia.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},ia.set(t,l),x||zz(p,t,l,w.state))),a&&u===null)throw Error(i(528,""));return w}if(a&&u!==null)throw Error(i(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Ei(l),l=Xr(p).hoistableScripts,u=l.get(a),u||(u={type:"script",instance:null,count:0,state:null},l.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,t))}}function Ci(t){return'href="'+Zn(t)+'"'}function Vl(t){return'link[rel="stylesheet"]['+t+"]"}function ib(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function zz(t,a,l,u){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=t.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),Jt(a,"link",l),Ht(a),t.head.appendChild(a))}function Ei(t){return'[src="'+Zn(t)+'"]'}function Gl(t){return"script[async]"+t}function lb(t,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+Zn(l.href)+'"]');if(u)return a.instance=u,Ht(u),u;var p=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Ht(u),Jt(u,"style",p),Fc(u,l.precedence,t),a.instance=u;case"stylesheet":p=Ci(l.href);var x=t.querySelector(Vl(p));if(x)return a.state.loading|=4,a.instance=x,Ht(x),x;u=ib(l),(p=ia.get(p))&&sh(u,p),x=(t.ownerDocument||t).createElement("link"),Ht(x);var w=x;return w._p=new Promise(function(T,H){w.onload=T,w.onerror=H}),Jt(x,"link",u),a.state.loading|=4,Fc(x,l.precedence,t),a.instance=x;case"script":return x=Ei(l.src),(p=t.querySelector(Gl(x)))?(a.instance=p,Ht(p),p):(u=l,(p=ia.get(x))&&(u=g({},l),rh(u,p)),t=t.ownerDocument||t,p=t.createElement("script"),Ht(p),Jt(p,"link",u),t.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,Fc(u,l.precedence,t));return a.instance}function Fc(t,a,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,x=p,w=0;w<u.length;w++){var T=u[w];if(T.dataset.precedence===a)x=T;else if(x!==p)break}x?x.parentNode.insertBefore(t,x.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(t,a.firstChild))}function sh(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function rh(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var $c=null;function ob(t,a,l){if($c===null){var u=new Map,p=$c=new Map;p.set(l,u)}else p=$c,u=p.get(l),u||(u=new Map,p.set(l,u));if(u.has(t))return u;for(u.set(t,null),l=l.getElementsByTagName(t),p=0;p<l.length;p++){var x=l[p];if(!(x[ol]||x[Gt]||t==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var w=x.getAttribute(a)||"";w=t+w;var T=u.get(w);T?T.push(x):u.set(w,[x])}}return u}function cb(t,a,l){t=t.ownerDocument||t,t.head.insertBefore(l,a==="title"?t.querySelector("head > title"):null)}function Nz(t,a,l){if(l===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return t=a.disabled,typeof a.precedence=="string"&&t==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function ub(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function kz(t,a,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var p=Ci(u.href),x=a.querySelector(Vl(p));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Vc.bind(t),a.then(t,t)),l.state.loading|=4,l.instance=x,Ht(x);return}x=a.ownerDocument||a,u=ib(u),(p=ia.get(p))&&sh(u,p),x=x.createElement("link"),Ht(x);var w=x;w._p=new Promise(function(T,H){w.onload=T,w.onerror=H}),Jt(x,"link",u),l.instance=x}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=Vc.bind(t),a.addEventListener("load",l),a.addEventListener("error",l))}}var ih=0;function Sz(t,a){return t.stylesheets&&t.count===0&&Yc(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var u=setTimeout(function(){if(t.stylesheets&&Yc(t,t.stylesheets),t.unsuspend){var x=t.unsuspend;t.unsuspend=null,x()}},6e4+a);0<t.imgBytes&&ih===0&&(ih=62500*iz());var p=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Yc(t,t.stylesheets),t.unsuspend)){var x=t.unsuspend;t.unsuspend=null,x()}},(t.imgBytes>ih?50:800)+a);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(p)}}:null}function Vc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Yc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Gc=null;function Yc(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Gc=new Map,a.forEach(Cz,t),Gc=null,Vc.call(t))}function Cz(t,a){if(!(a.state.loading&4)){var l=Gc.get(t);if(l)var u=l.get(null);else{l=new Map,Gc.set(t,l);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<p.length;x++){var w=p[x];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(l.set(w.dataset.precedence,w),u=w)}u&&l.set(null,u)}p=a.instance,w=p.getAttribute("data-precedence"),x=l.get(w)||u,x===u&&l.set(null,p),l.set(w,p),this.count++,u=Vc.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),x?x.parentNode.insertBefore(p,x.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),a.state.loading|=4}}var Yl={$$typeof:N,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function Ez(t,a,l,u,p,x,w,T,H){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=un(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=un(0),this.hiddenUpdates=un(null),this.identifierPrefix=u,this.onUncaughtError=p,this.onCaughtError=x,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function db(t,a,l,u,p,x,w,T,H,J,re,ce){return t=new Ez(t,a,l,w,H,J,re,ce,T),a=1,x===!0&&(a|=24),x=qn(3,null,null,a),t.current=x,x.stateNode=t,a=Ud(),a.refCount++,t.pooledCache=a,a.refCount++,x.memoizedState={element:u,isDehydrated:l,cache:a},Pd(x),t}function fb(t){return t?(t=ri,t):ri}function hb(t,a,l,u,p,x){p=fb(p),u.context===null?u.context=p:u.pendingContext=p,u=As(a),u.payload={element:l},x=x===void 0?null:x,x!==null&&(u.callback=x),l=Ms(t,u,a),l!==null&&(En(l,t,a),kl(l,t,a))}function mb(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<a?l:a}}function lh(t,a){mb(t,a),(t=t.alternate)&&mb(t,a)}function pb(t){if(t.tag===13||t.tag===31){var a=pr(t,67108864);a!==null&&En(a,t,67108864),lh(t,67108864)}}function xb(t){if(t.tag===13||t.tag===31){var a=Vn();a=td(a);var l=pr(t,a);l!==null&&En(l,t,a),lh(t,a)}}var Qc=!0;function Tz(t,a,l,u){var p=B.T;B.T=null;var x=V.p;try{V.p=2,oh(t,a,l,u)}finally{V.p=x,B.T=p}}function Az(t,a,l,u){var p=B.T;B.T=null;var x=V.p;try{V.p=8,oh(t,a,l,u)}finally{V.p=x,B.T=p}}function oh(t,a,l,u){if(Qc){var p=ch(u);if(p===null)Qf(t,a,u,Xc,l),bb(t,u);else if(Dz(p,t,a,l,u))u.stopPropagation();else if(bb(t,u),a&4&&-1<Mz.indexOf(t)){for(;p!==null;){var x=Qr(p);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var w=Wt(x.pendingLanes);if(w!==0){var T=x;for(T.pendingLanes|=2,T.entangledLanes|=2;w;){var H=1<<31-Je(w);T.entanglements[1]|=H,w&=~H}Ma(x),(et&6)===0&&(Mc=tt()+500,Il(0))}}break;case 31:case 13:T=pr(x,2),T!==null&&En(T,x,2),Oc(),lh(x,2)}if(x=ch(u),x===null&&Qf(t,a,u,Xc,l),x===p)break;p=x}p!==null&&u.stopPropagation()}else Qf(t,a,u,null,l)}}function ch(t){return t=ud(t),uh(t)}var Xc=null;function uh(t){if(Xc=null,t=Yr(t),t!==null){var a=c(t);if(a===null)t=null;else{var l=a.tag;if(l===13){if(t=d(a),t!==null)return t;t=null}else if(l===31){if(t=f(a),t!==null)return t;t=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return Xc=t,null}function gb(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(Ct()){case te:return 2;case fe:return 8;case Ee:case He:return 32;case Ye:return 268435456;default:return 32}default:return 32}}var dh=!1,Ps=null,Fs=null,$s=null,Ql=new Map,Xl=new Map,Vs=[],Mz="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 bb(t,a){switch(t){case"focusin":case"focusout":Ps=null;break;case"dragenter":case"dragleave":Fs=null;break;case"mouseover":case"mouseout":$s=null;break;case"pointerover":case"pointerout":Ql.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xl.delete(a.pointerId)}}function Jl(t,a,l,u,p,x){return t===null||t.nativeEvent!==x?(t={blockedOn:a,domEventName:l,eventSystemFlags:u,nativeEvent:x,targetContainers:[p]},a!==null&&(a=Qr(a),a!==null&&pb(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),t)}function Dz(t,a,l,u,p){switch(a){case"focusin":return Ps=Jl(Ps,t,a,l,u,p),!0;case"dragenter":return Fs=Jl(Fs,t,a,l,u,p),!0;case"mouseover":return $s=Jl($s,t,a,l,u,p),!0;case"pointerover":var x=p.pointerId;return Ql.set(x,Jl(Ql.get(x)||null,t,a,l,u,p)),!0;case"gotpointercapture":return x=p.pointerId,Xl.set(x,Jl(Xl.get(x)||null,t,a,l,u,p)),!0}return!1}function yb(t){var a=Yr(t.target);if(a!==null){var l=c(a);if(l!==null){if(a=l.tag,a===13){if(a=d(l),a!==null){t.blockedOn=a,O0(t.priority,function(){xb(l)});return}}else if(a===31){if(a=f(l),a!==null){t.blockedOn=a,O0(t.priority,function(){xb(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Jc(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var l=ch(t.nativeEvent);if(l===null){l=t.nativeEvent;var u=new l.constructor(l.type,l);cd=u,l.target.dispatchEvent(u),cd=null}else return a=Qr(l),a!==null&&pb(a),t.blockedOn=l,!1;a.shift()}return!0}function vb(t,a,l){Jc(t)&&l.delete(a)}function Oz(){dh=!1,Ps!==null&&Jc(Ps)&&(Ps=null),Fs!==null&&Jc(Fs)&&(Fs=null),$s!==null&&Jc($s)&&($s=null),Ql.forEach(vb),Xl.forEach(vb)}function Kc(t,a){t.blockedOn===a&&(t.blockedOn=null,dh||(dh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Oz)))}var Zc=null;function jb(t){Zc!==t&&(Zc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Zc===t&&(Zc=null);for(var a=0;a<t.length;a+=3){var l=t[a],u=t[a+1],p=t[a+2];if(typeof u!="function"){if(uh(u||l)===null)continue;break}var x=Qr(l);x!==null&&(t.splice(a,3),a-=3,cf(x,{pending:!0,data:p,method:l.method,action:u},u,p))}}))}function Ti(t){function a(H){return Kc(H,t)}Ps!==null&&Kc(Ps,t),Fs!==null&&Kc(Fs,t),$s!==null&&Kc($s,t),Ql.forEach(a),Xl.forEach(a);for(var l=0;l<Vs.length;l++){var u=Vs[l];u.blockedOn===t&&(u.blockedOn=null)}for(;0<Vs.length&&(l=Vs[0],l.blockedOn===null);)yb(l),l.blockedOn===null&&Vs.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var p=l[u],x=l[u+1],w=p[wn]||null;if(typeof x=="function")w||jb(l);else if(w){var T=null;if(x&&x.hasAttribute("formAction")){if(p=x,w=x[wn]||null)T=w.formAction;else if(uh(p)!==null)continue}else T=w.action;typeof T=="function"?l[u+1]=T:(l.splice(u,3),u-=3),jb(l)}}}function wb(){function t(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(w){return p=w})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),u||setTimeout(l,20)}function l(){if(!u&&!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 u=!1,p=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function fh(t){this._internalRoot=t}Wc.prototype.render=fh.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(i(409));var l=a.current,u=Vn();hb(l,u,t,a,null,null)},Wc.prototype.unmount=fh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;hb(t.current,2,null,t,null,null),Oc(),a[Gr]=null}};function Wc(t){this._internalRoot=t}Wc.prototype.unstable_scheduleHydration=function(t){if(t){var a=D0();t={blockedOn:null,target:t,priority:a};for(var l=0;l<Vs.length&&a!==0&&a<Vs[l].priority;l++);Vs.splice(l,0,t),l===0&&yb(t)}};var zb=n.version;if(zb!=="19.2.4")throw Error(i(527,zb,"19.2.4"));V.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(i(188)):(t=Object.keys(t).join(","),Error(i(268,t)));return t=h(a),t=t!==null?b(t):null,t=t===null?null:t.stateNode,t};var Rz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var eu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!eu.isDisabled&&eu.supportsFiber)try{_t=eu.inject(Rz),ft=eu}catch{}}return Zl.createRoot=function(t,a){if(!o(t))throw Error(i(299));var l=!1,u="",p=Ax,x=Mx,w=Dx;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError)),a=db(t,1,!1,null,null,l,u,null,p,x,w,wb),t[Gr]=a.current,Yf(t),new fh(a)},Zl.hydrateRoot=function(t,a,l){if(!o(t))throw Error(i(299));var u=!1,p="",x=Ax,w=Mx,T=Dx,H=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(p=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(w=l.onCaughtError),l.onRecoverableError!==void 0&&(T=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),a=db(t,1,!0,a,l??null,u,p,H,x,w,T,wb),a.context=fb(null),l=a.current,u=Vn(),u=td(u),p=As(u),p.callback=null,Ms(l,p,u),l=u,a.current.lanes=l,Vt(a,l),Ma(a),t[Gr]=a.current,Yf(t),new Wc(a)},Zl.version="19.2.4",Zl}var Rb;function Vz(){if(Rb)return xh.exports;Rb=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(n){console.error(n)}}return e(),xh.exports=$z(),xh.exports}var Gz=Vz();/**
 * 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 _b="popstate";function Yz(e={}){function n(i,o){let{pathname:c,search:d,hash:f}=i.location;return Kh("",{pathname:c,search:d,hash:f},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function r(i,o){return typeof o=="string"?o:go(o)}return Xz(n,r,null,e)}function bt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function ja(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Qz(){return Math.random().toString(36).substring(2,10)}function Lb(e,n){return{usr:e.state,key:e.key,idx:n}}function Kh(e,n,r=null,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Ki(n):n,state:r,key:n&&n.key||i||Qz()}}function go({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Ki(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let i=e.indexOf("?");i>=0&&(n.search=e.substring(i),e=e.substring(0,i)),e&&(n.pathname=e)}return n}function Xz(e,n,r,i={}){let{window:o=document.defaultView,v5Compat:c=!1}=i,d=o.history,f="POP",m=null,h=b();h==null&&(h=0,d.replaceState({...d.state,idx:h},""));function b(){return(d.state||{idx:null}).idx}function g(){f="POP";let z=b(),j=z==null?null:z-h;h=z,m&&m({action:f,location:C.location,delta:j})}function v(z,j){f="PUSH";let E=Kh(C.location,z,j);h=b()+1;let N=Lb(E,h),M=C.createHref(E);try{d.pushState(N,"",M)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;o.location.assign(M)}c&&m&&m({action:f,location:C.location,delta:1})}function y(z,j){f="REPLACE";let E=Kh(C.location,z,j);h=b();let N=Lb(E,h),M=C.createHref(E);d.replaceState(N,"",M),c&&m&&m({action:f,location:C.location,delta:0})}function k(z){return Jz(z)}let C={get action(){return f},get location(){return e(o,d)},listen(z){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(_b,g),m=z,()=>{o.removeEventListener(_b,g),m=null}},createHref(z){return n(o,z)},createURL:k,encodeLocation(z){let j=k(z);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:v,replace:y,go(z){return d.go(z)}};return C}function Jz(e,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),bt(r,"No window.location.(origin|href) available to create URL");let i=typeof e=="string"?e:go(e);return i=i.replace(/ $/,"%20"),!n&&i.startsWith("//")&&(i=r+i),new URL(i,r)}function w1(e,n,r="/"){return Kz(e,n,r,!1)}function Kz(e,n,r,i){let o=typeof n=="string"?Ki(n):n,c=ps(o.pathname||"/",r);if(c==null)return null;let d=z1(e);Zz(d);let f=null;for(let m=0;f==null&&m<d.length;++m){let h=cN(c);f=lN(d[m],h,i)}return f}function z1(e,n=[],r=[],i="",o=!1){let c=(d,f,m=o,h)=>{let b={relativePath:h===void 0?d.path||"":h,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(i)&&m)return;bt(b.relativePath.startsWith(i),`Absolute route path "${b.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(i.length)}let g=ms([i,b.relativePath]),v=r.concat(b);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 "${g}".`),z1(d.children,n,v,g,m)),!(d.path==null&&!d.index)&&n.push({path:g,score:rN(g,d.index),routesMeta:v})};return e.forEach((d,f)=>{var m;if(d.path===""||!((m=d.path)!=null&&m.includes("?")))c(d,f);else for(let h of N1(d.path))c(d,f,!0,h)}),n}function N1(e){let n=e.split("/");if(n.length===0)return[];let[r,...i]=n,o=r.endsWith("?"),c=r.replace(/\?$/,"");if(i.length===0)return o?[c,""]:[c];let d=N1(i.join("/")),f=[];return f.push(...d.map(m=>m===""?c:[c,m].join("/"))),o&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function Zz(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:iN(n.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}var Wz=/^:[\w-]+$/,eN=3,tN=2,nN=1,aN=10,sN=-2,Bb=e=>e==="*";function rN(e,n){let r=e.split("/"),i=r.length;return r.some(Bb)&&(i+=sN),n&&(i+=tN),r.filter(o=>!Bb(o)).reduce((o,c)=>o+(Wz.test(c)?eN:c===""?nN:aN),i)}function iN(e,n){return e.length===n.length&&e.slice(0,-1).every((i,o)=>i===n[o])?e[e.length-1]-n[n.length-1]:0}function lN(e,n,r=!1){let{routesMeta:i}=e,o={},c="/",d=[];for(let f=0;f<i.length;++f){let m=i[f],h=f===i.length-1,b=c==="/"?n:n.slice(c.length)||"/",g=wu({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},b),v=m.route;if(!g&&h&&r&&!i[i.length-1].route.index&&(g=wu({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},b)),!g)return null;Object.assign(o,g.params),d.push({params:o,pathname:ms([c,g.pathname]),pathnameBase:hN(ms([c,g.pathnameBase])),route:v}),g.pathnameBase!=="/"&&(c=ms([c,g.pathnameBase]))}return d}function wu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=oN(e.path,e.caseSensitive,e.end),o=n.match(r);if(!o)return null;let c=o[0],d=c.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:i.reduce((h,{paramName:b,isOptional:g},v)=>{if(b==="*"){let k=f[v]||"";d=c.slice(0,c.length-k.length).replace(/(.)\/+$/,"$1")}const y=f[v];return g&&!y?h[b]=void 0:h[b]=(y||"").replace(/%2F/g,"/"),h},{}),pathname:c,pathnameBase:d,pattern:e}}function oN(e,n=!1,r=!0){ja(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 i=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,m)=>(i.push({paramName:f,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),i]}function cN(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return ja(!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 (${n}).`),e}}function ps(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}var uN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function dN(e,n="/"){let{pathname:r,search:i="",hash:o=""}=typeof e=="string"?Ki(e):e,c;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?c=Ub(r.substring(1),"/"):c=Ub(r,n)):c=n,{pathname:c,search:mN(i),hash:pN(o)}}function Ub(e,n){let r=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function vh(e,n,r,i){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(i)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function fN(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Am(e){let n=fN(e);return n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase)}function Mm(e,n,r,i=!1){let o;typeof e=="string"?o=Ki(e):(o={...e},bt(!o.pathname||!o.pathname.includes("?"),vh("?","pathname","search",o)),bt(!o.pathname||!o.pathname.includes("#"),vh("#","pathname","hash",o)),bt(!o.search||!o.search.includes("#"),vh("#","search","hash",o)));let c=e===""||o.pathname==="",d=c?"/":o.pathname,f;if(d==null)f=r;else{let g=n.length-1;if(!i&&d.startsWith("..")){let v=d.split("/");for(;v[0]==="..";)v.shift(),g-=1;o.pathname=v.join("/")}f=g>=0?n[g]:"/"}let m=dN(o,f),h=d&&d!=="/"&&d.endsWith("/"),b=(c||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||b)&&(m.pathname+="/"),m}var ms=e=>e.join("/").replace(/\/\/+/g,"/"),hN=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),mN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,pN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,xN=class{constructor(e,n,r,i=!1){this.status=e,this.statusText=n||"",this.internal=i,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function gN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function bN(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var k1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function S1(e,n){let r=e;if(typeof r!="string"||!uN.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let i=r,o=!1;if(k1)try{let c=new URL(window.location.href),d=r.startsWith("//")?new URL(c.protocol+r):new URL(r),f=ps(d.pathname,n);d.origin===c.origin&&f!=null?r=f+d.search+d.hash:o=!0}catch{ja(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:o,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var C1=["POST","PUT","PATCH","DELETE"];new Set(C1);var yN=["GET",...C1];new Set(yN);var Zi=S.createContext(null);Zi.displayName="DataRouter";var Ru=S.createContext(null);Ru.displayName="DataRouterState";var vN=S.createContext(!1),E1=S.createContext({isTransitioning:!1});E1.displayName="ViewTransition";var jN=S.createContext(new Map);jN.displayName="Fetchers";var wN=S.createContext(null);wN.displayName="Await";var Qn=S.createContext(null);Qn.displayName="Navigation";var Co=S.createContext(null);Co.displayName="Location";var wa=S.createContext({outlet:null,matches:[],isDataRoute:!1});wa.displayName="Route";var Dm=S.createContext(null);Dm.displayName="RouteError";var T1="REACT_ROUTER_ERROR",zN="REDIRECT",NN="ROUTE_ERROR_RESPONSE";function kN(e){if(e.startsWith(`${T1}:${zN}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function SN(e){if(e.startsWith(`${T1}:${NN}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new xN(n.status,n.statusText,n.data)}catch{}}function CN(e,{relative:n}={}){bt(Wi(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:i}=S.useContext(Qn),{hash:o,pathname:c,search:d}=Eo(e,{relative:n}),f=c;return r!=="/"&&(f=c==="/"?r:ms([r,c])),i.createHref({pathname:f,search:d,hash:o})}function Wi(){return S.useContext(Co)!=null}function za(){return bt(Wi(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(Co).location}var A1="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function M1(e){S.useContext(Qn).static||S.useLayoutEffect(e)}function Rn(){let{isDataRoute:e}=S.useContext(wa);return e?qN():EN()}function EN(){bt(Wi(),"useNavigate() may be used only in the context of a <Router> component.");let e=S.useContext(Zi),{basename:n,navigator:r}=S.useContext(Qn),{matches:i}=S.useContext(wa),{pathname:o}=za(),c=JSON.stringify(Am(i)),d=S.useRef(!1);return M1(()=>{d.current=!0}),S.useCallback((m,h={})=>{if(ja(d.current,A1),!d.current)return;if(typeof m=="number"){r.go(m);return}let b=Mm(m,JSON.parse(c),o,h.relative==="path");e==null&&n!=="/"&&(b.pathname=b.pathname==="/"?n:ms([n,b.pathname])),(h.replace?r.replace:r.push)(b,h.state,h)},[n,r,c,o,e])}S.createContext(null);function D1(){let{matches:e}=S.useContext(wa),n=e[e.length-1];return n?n.params:{}}function Eo(e,{relative:n}={}){let{matches:r}=S.useContext(wa),{pathname:i}=za(),o=JSON.stringify(Am(r));return S.useMemo(()=>Mm(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function TN(e,n){return O1(e,n)}function O1(e,n,r,i,o){var E;bt(Wi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=S.useContext(Qn),{matches:d}=S.useContext(wa),f=d[d.length-1],m=f?f.params:{},h=f?f.pathname:"/",b=f?f.pathnameBase:"/",g=f&&f.route;{let N=g&&g.path||"";_1(h,!g||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${N}">) 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="${N}"> to <Route path="${N==="/"?"*":`${N}/*`}">.`)}let v=za(),y;if(n){let N=typeof n=="string"?Ki(n):n;bt(b==="/"||((E=N.pathname)==null?void 0:E.startsWith(b)),`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 "${b}" but pathname "${N.pathname}" was given in the \`location\` prop.`),y=N}else y=v;let k=y.pathname||"/",C=k;if(b!=="/"){let N=b.replace(/^\//,"").split("/");C="/"+k.replace(/^\//,"").split("/").slice(N.length).join("/")}let z=w1(e,{pathname:C});ja(g||z!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),ja(z==null||z[z.length-1].route.element!==void 0||z[z.length-1].route.Component!==void 0||z[z.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 j=RN(z&&z.map(N=>Object.assign({},N,{params:Object.assign({},m,N.params),pathname:ms([b,c.encodeLocation?c.encodeLocation(N.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?b:ms([b,c.encodeLocation?c.encodeLocation(N.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),d,r,i,o);return n&&j?S.createElement(Co.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},j):j}function AN(){let e=HN(),n=gN(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:i},c={padding:"2px 4px",backgroundColor:i},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=S.createElement(S.Fragment,null,S.createElement("p",null,"💿 Hey developer 👋"),S.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",S.createElement("code",{style:c},"ErrorBoundary")," or"," ",S.createElement("code",{style:c},"errorElement")," prop on your route.")),S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},n),r?S.createElement("pre",{style:o},r):null,d)}var MN=S.createElement(AN,null),R1=class extends S.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,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):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 r=SN(e.digest);r&&(e=r)}let n=e!==void 0?S.createElement(wa.Provider,{value:this.props.routeContext},S.createElement(Dm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?S.createElement(DN,{error:e},n):n}};R1.contextType=vN;var jh=new WeakMap;function DN({children:e,error:n}){let{basename:r}=S.useContext(Qn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let i=kN(n.digest);if(i){let o=jh.get(n);if(o)throw o;let c=S1(i.location,r);if(k1&&!jh.get(n))if(c.isExternal||i.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:i.replace}));throw jh.set(n,d),d}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function ON({routeContext:e,match:n,children:r}){let i=S.useContext(Zi);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),S.createElement(wa.Provider,{value:e},r)}function RN(e,n=[],r=null,i=null,o=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(n.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let c=e,d=r==null?void 0:r.errors;if(d!=null){let b=c.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);bt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,b+1))}let f=!1,m=-1;if(r)for(let b=0;b<c.length;b++){let g=c[b];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(m=b),g.route.id){let{loaderData:v,errors:y}=r,k=g.route.loader&&!v.hasOwnProperty(g.route.id)&&(!y||y[g.route.id]===void 0);if(g.route.lazy||k){f=!0,m>=0?c=c.slice(0,m+1):c=[c[0]];break}}}let h=r&&i?(b,g)=>{var v,y;i(b,{location:r.location,params:((y=(v=r.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:bN(r.matches),errorInfo:g})}:void 0;return c.reduceRight((b,g,v)=>{let y,k=!1,C=null,z=null;r&&(y=d&&g.route.id?d[g.route.id]:void 0,C=g.route.errorElement||MN,f&&(m<0&&v===0?(_1("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,z=null):m===v&&(k=!0,z=g.route.hydrateFallbackElement||null)));let j=n.concat(c.slice(0,v+1)),E=()=>{let N;return y?N=C:k?N=z:g.route.Component?N=S.createElement(g.route.Component,null):g.route.element?N=g.route.element:N=b,S.createElement(ON,{match:g,routeContext:{outlet:b,matches:j,isDataRoute:r!=null},children:N})};return r&&(g.route.ErrorBoundary||g.route.errorElement||v===0)?S.createElement(R1,{location:r.location,revalidation:r.revalidation,component:C,error:y,children:E(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:h}):E()},null)}function Om(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function _N(e){let n=S.useContext(Zi);return bt(n,Om(e)),n}function LN(e){let n=S.useContext(Ru);return bt(n,Om(e)),n}function BN(e){let n=S.useContext(wa);return bt(n,Om(e)),n}function Rm(e){let n=BN(e),r=n.matches[n.matches.length-1];return bt(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function UN(){return Rm("useRouteId")}function HN(){var i;let e=S.useContext(Dm),n=LN("useRouteError"),r=Rm("useRouteError");return e!==void 0?e:(i=n.errors)==null?void 0:i[r]}function qN(){let{router:e}=_N("useNavigate"),n=Rm("useNavigate"),r=S.useRef(!1);return M1(()=>{r.current=!0}),S.useCallback(async(o,c={})=>{ja(r.current,A1),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:n,...c}))},[e,n])}var Hb={};function _1(e,n,r){!n&&!Hb[e]&&(Hb[e]=!0,ja(!1,r))}S.memo(IN);function IN({routes:e,future:n,state:r,onError:i}){return O1(e,void 0,r,i,n)}function pu({to:e,replace:n,state:r,relative:i}){bt(Wi(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=S.useContext(Qn);ja(!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:c}=S.useContext(wa),{pathname:d}=za(),f=Rn(),m=Mm(e,Am(c),d,i==="path"),h=JSON.stringify(m);return S.useEffect(()=>{f(JSON.parse(h),{replace:n,state:r,relative:i})},[f,h,i,n,r]),null}function Bt(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 PN({basename:e="/",children:n=null,location:r,navigationType:i="POP",navigator:o,static:c=!1,unstable_useTransitions:d}){bt(!Wi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=S.useMemo(()=>({basename:f,navigator:o,static:c,unstable_useTransitions:d,future:{}}),[f,o,c,d]);typeof r=="string"&&(r=Ki(r));let{pathname:h="/",search:b="",hash:g="",state:v=null,key:y="default"}=r,k=S.useMemo(()=>{let C=ps(h,f);return C==null?null:{location:{pathname:C,search:b,hash:g,state:v,key:y},navigationType:i}},[f,h,b,g,v,y,i]);return ja(k!=null,`<Router basename="${f}"> is not able to match the URL "${h}${b}${g}" because it does not start with the basename, so the <Router> won't render anything.`),k==null?null:S.createElement(Qn.Provider,{value:m},S.createElement(Co.Provider,{children:n,value:k}))}function FN({children:e,location:n}){return TN(Zh(e),n)}function Zh(e,n=[]){let r=[];return S.Children.forEach(e,(i,o)=>{if(!S.isValidElement(i))return;let c=[...n,o];if(i.type===S.Fragment){r.push.apply(r,Zh(i.props.children,c));return}bt(i.type===Bt,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),bt(!i.props.index||!i.props.children,"An index route cannot have child routes.");let d={id:i.props.id||c.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(d.children=Zh(i.props.children,c)),r.push(d)}),r}var xu="get",gu="application/x-www-form-urlencoded";function _u(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function $N(e){return _u(e)&&e.tagName.toLowerCase()==="button"}function VN(e){return _u(e)&&e.tagName.toLowerCase()==="form"}function GN(e){return _u(e)&&e.tagName.toLowerCase()==="input"}function YN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function QN(e,n){return e.button===0&&(!n||n==="_self")&&!YN(e)}var nu=null;function XN(){if(nu===null)try{new FormData(document.createElement("form"),0),nu=!1}catch{nu=!0}return nu}var JN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function wh(e){return e!=null&&!JN.has(e)?(ja(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${gu}"`),null):e}function KN(e,n){let r,i,o,c,d;if(VN(e)){let f=e.getAttribute("action");i=f?ps(f,n):null,r=e.getAttribute("method")||xu,o=wh(e.getAttribute("enctype"))||gu,c=new FormData(e)}else if($N(e)||GN(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(i=m?ps(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||xu,o=wh(e.getAttribute("formenctype"))||wh(f.getAttribute("enctype"))||gu,c=new FormData(f,e),!XN()){let{name:h,type:b,value:g}=e;if(b==="image"){let v=h?`${h}.`:"";c.append(`${v}x`,"0"),c.append(`${v}y`,"0")}else h&&c.append(h,g)}}else{if(_u(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=xu,i=null,o=gu,d=e}return c&&o==="text/plain"&&(d=c,c=void 0),{action:i,method:r.toLowerCase(),encType:o,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function _m(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function ZN(e,n,r,i){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${i}`:o.pathname=`${o.pathname}.${i}`:o.pathname==="/"?o.pathname=`_root.${i}`:n&&ps(o.pathname,n)==="/"?o.pathname=`${n.replace(/\/$/,"")}/_root.${i}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${i}`,o}async function WN(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ek(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 tk(e,n,r){let i=await Promise.all(e.map(async o=>{let c=n.routes[o.route.id];if(c){let d=await WN(c,r);return d.links?d.links():[]}return[]}));return rk(i.flat(1).filter(ek).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function qb(e,n,r,i,o,c){let d=(m,h)=>r[h]?m.route.id!==r[h].route.id:!0,f=(m,h)=>{var b;return r[h].pathname!==m.pathname||((b=r[h].route.path)==null?void 0:b.endsWith("*"))&&r[h].params["*"]!==m.params["*"]};return c==="assets"?n.filter((m,h)=>d(m,h)||f(m,h)):c==="data"?n.filter((m,h)=>{var g;let b=i.routes[m.route.id];if(!b||!b.hasLoader)return!1;if(d(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let v=m.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((g=r[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function nk(e,n,{includeHydrateFallback:r}={}){return ak(e.map(i=>{let o=n.routes[i.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function ak(e){return[...new Set(e)]}function sk(e){let n={},r=Object.keys(e).sort();for(let i of r)n[i]=e[i];return n}function rk(e,n){let r=new Set;return new Set(n),e.reduce((i,o)=>{let c=JSON.stringify(sk(o));return r.has(c)||(r.add(c),i.push({key:c,link:o})),i},[])}function L1(){let e=S.useContext(Zi);return _m(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function ik(){let e=S.useContext(Ru);return _m(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Lm=S.createContext(void 0);Lm.displayName="FrameworkContext";function B1(){let e=S.useContext(Lm);return _m(e,"You must render this element inside a <HydratedRouter> element"),e}function lk(e,n){let r=S.useContext(Lm),[i,o]=S.useState(!1),[c,d]=S.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:b,onTouchStart:g}=n,v=S.useRef(null);S.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let C=j=>{j.forEach(E=>{d(E.isIntersecting)})},z=new IntersectionObserver(C,{threshold:.5});return v.current&&z.observe(v.current),()=>{z.disconnect()}}},[e]),S.useEffect(()=>{if(i){let C=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(C)}}},[i]);let y=()=>{o(!0)},k=()=>{o(!1),d(!1)};return r?e!=="intent"?[c,v,{}]:[c,v,{onFocus:Wl(f,y),onBlur:Wl(m,k),onMouseEnter:Wl(h,y),onMouseLeave:Wl(b,k),onTouchStart:Wl(g,y)}]:[!1,v,{}]}function Wl(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function ok({page:e,...n}){let{router:r}=L1(),i=S.useMemo(()=>w1(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?S.createElement(uk,{page:e,matches:i,...n}):null}function ck(e){let{manifest:n,routeModules:r}=B1(),[i,o]=S.useState([]);return S.useEffect(()=>{let c=!1;return tk(e,n,r).then(d=>{c||o(d)}),()=>{c=!0}},[e,n,r]),i}function uk({page:e,matches:n,...r}){let i=za(),{future:o,manifest:c,routeModules:d}=B1(),{basename:f}=L1(),{loaderData:m,matches:h}=ik(),b=S.useMemo(()=>qb(e,n,h,c,i,"data"),[e,n,h,c,i]),g=S.useMemo(()=>qb(e,n,h,c,i,"assets"),[e,n,h,c,i]),v=S.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let C=new Set,z=!1;if(n.forEach(E=>{var M;let N=c.routes[E.route.id];!N||!N.hasLoader||(!b.some(R=>R.route.id===E.route.id)&&E.route.id in m&&((M=d[E.route.id])!=null&&M.shouldRevalidate)||N.hasClientLoader?z=!0:C.add(E.route.id))}),C.size===0)return[];let j=ZN(e,f,o.unstable_trailingSlashAwareDataRequests,"data");return z&&C.size>0&&j.searchParams.set("_routes",n.filter(E=>C.has(E.route.id)).map(E=>E.route.id).join(",")),[j.pathname+j.search]},[f,o.unstable_trailingSlashAwareDataRequests,m,i,c,b,n,e,d]),y=S.useMemo(()=>nk(g,c),[g,c]),k=ck(g);return S.createElement(S.Fragment,null,v.map(C=>S.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),y.map(C=>S.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),k.map(({key:C,link:z})=>S.createElement("link",{key:C,nonce:r.nonce,...z,crossOrigin:z.crossOrigin??r.crossOrigin})))}function dk(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var fk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{fk&&(window.__reactRouterVersion="7.13.0")}catch{}function hk({basename:e,children:n,unstable_useTransitions:r,window:i}){let o=S.useRef();o.current==null&&(o.current=Yz({window:i,v5Compat:!0}));let c=o.current,[d,f]=S.useState({action:c.action,location:c.location}),m=S.useCallback(h=>{r===!1?f(h):S.startTransition(()=>f(h))},[r]);return S.useLayoutEffect(()=>c.listen(m),[c,m]),S.createElement(PN,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,unstable_useTransitions:r})}var U1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,H1=S.forwardRef(function({onClick:n,discover:r="render",prefetch:i="none",relative:o,reloadDocument:c,replace:d,state:f,target:m,to:h,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:v,...y},k){let{basename:C,unstable_useTransitions:z}=S.useContext(Qn),j=typeof h=="string"&&U1.test(h),E=S1(h,C);h=E.to;let N=CN(h,{relative:o}),[M,R,A]=lk(i,y),F=gk(h,{replace:d,state:f,target:m,preventScrollReset:b,relative:o,viewTransition:g,unstable_defaultShouldRevalidate:v,unstable_useTransitions:z});function ee(L){n&&n(L),L.defaultPrevented||F(L)}let Z=S.createElement("a",{...y,...A,href:E.absoluteURL||N,onClick:E.isExternal||c?n:ee,ref:dk(k,R),target:m,"data-discover":!j&&r==="render"?"true":void 0});return M&&!j?S.createElement(S.Fragment,null,Z,S.createElement(ok,{page:N})):Z});H1.displayName="Link";var mk=S.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:i="",end:o=!1,style:c,to:d,viewTransition:f,children:m,...h},b){let g=Eo(d,{relative:h.relative}),v=za(),y=S.useContext(Ru),{navigator:k,basename:C}=S.useContext(Qn),z=y!=null&&wk(g)&&f===!0,j=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,E=v.pathname,N=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;r||(E=E.toLowerCase(),N=N?N.toLowerCase():null,j=j.toLowerCase()),N&&C&&(N=ps(N,C)||N);const M=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let R=E===j||!o&&E.startsWith(j)&&E.charAt(M)==="/",A=N!=null&&(N===j||!o&&N.startsWith(j)&&N.charAt(j.length)==="/"),F={isActive:R,isPending:A,isTransitioning:z},ee=R?n:void 0,Z;typeof i=="function"?Z=i(F):Z=[i,R?"active":null,A?"pending":null,z?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(F):c;return S.createElement(H1,{...h,"aria-current":ee,className:Z,ref:b,style:L,to:d,viewTransition:f},typeof m=="function"?m(F):m)});mk.displayName="NavLink";var pk=S.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:i,replace:o,state:c,method:d=xu,action:f,onSubmit:m,relative:h,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:v,...y},k)=>{let{unstable_useTransitions:C}=S.useContext(Qn),z=vk(),j=jk(f,{relative:h}),E=d.toLowerCase()==="get"?"get":"post",N=typeof f=="string"&&U1.test(f),M=R=>{if(m&&m(R),R.defaultPrevented)return;R.preventDefault();let A=R.nativeEvent.submitter,F=(A==null?void 0:A.getAttribute("formmethod"))||d,ee=()=>z(A||R.currentTarget,{fetcherKey:n,method:F,navigate:r,replace:o,state:c,relative:h,preventScrollReset:b,viewTransition:g,unstable_defaultShouldRevalidate:v});C&&r!==!1?S.startTransition(()=>ee()):ee()};return S.createElement("form",{ref:k,method:E,action:j,onSubmit:i?m:M,...y,"data-discover":!N&&e==="render"?"true":void 0})});pk.displayName="Form";function xk(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function q1(e){let n=S.useContext(Zi);return bt(n,xk(e)),n}function gk(e,{target:n,replace:r,state:i,preventScrollReset:o,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:f,unstable_useTransitions:m}={}){let h=Rn(),b=za(),g=Eo(e,{relative:c});return S.useCallback(v=>{if(QN(v,n)){v.preventDefault();let y=r!==void 0?r:go(b)===go(g),k=()=>h(e,{replace:y,state:i,preventScrollReset:o,relative:c,viewTransition:d,unstable_defaultShouldRevalidate:f});m?S.startTransition(()=>k()):k()}},[b,h,g,r,i,n,e,o,c,d,f,m])}var bk=0,yk=()=>`__${String(++bk)}__`;function vk(){let{router:e}=q1("useSubmit"),{basename:n}=S.useContext(Qn),r=UN(),i=e.fetch,o=e.navigate;return S.useCallback(async(c,d={})=>{let{action:f,method:m,encType:h,formData:b,body:g}=KN(c,n);if(d.navigate===!1){let v=d.fetcherKey||yk();await i(v,r,d.action||f,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:b,body:g,formMethod:d.method||m,formEncType:d.encType||h,flushSync:d.flushSync})}else await o(d.action||f,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:b,body:g,formMethod:d.method||m,formEncType:d.encType||h,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[i,o,n,r])}function jk(e,{relative:n}={}){let{basename:r}=S.useContext(Qn),i=S.useContext(wa);bt(i,"useFormAction must be used inside a RouteContext");let[o]=i.matches.slice(-1),c={...Eo(e||".",{relative:n})},d=za();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),m=f.getAll("index");if(m.some(b=>b==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let b=f.toString();c.search=b?`?${b}`:""}}return(!e||e===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(c.pathname=c.pathname==="/"?r:ms([r,c.pathname])),go(c)}function wk(e,{relative:n}={}){let r=S.useContext(E1);bt(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=q1("useViewTransitionState"),o=Eo(e,{relative:n});if(!r.isTransitioning)return!1;let c=ps(r.currentLocation.pathname,i)||r.currentLocation.pathname,d=ps(r.nextLocation.pathname,i)||r.nextLocation.pathname;return wu(o.pathname,d)!=null||wu(o.pathname,c)!=null}var Bm=j1();const zk=Ou(Bm);var Lu=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(){}},Nk={setTimeout:(e,n)=>setTimeout(e,n),clearTimeout:e=>clearTimeout(e),setInterval:(e,n)=>setInterval(e,n),clearInterval:e=>clearInterval(e)},Ks,Em,f1,kk=(f1=class{constructor(){Xe(this,Ks,Nk);Xe(this,Em,!1)}setTimeoutProvider(e){Ae(this,Ks,e)}setTimeout(e,n){return ie(this,Ks).setTimeout(e,n)}clearTimeout(e){ie(this,Ks).clearTimeout(e)}setInterval(e,n){return ie(this,Ks).setInterval(e,n)}clearInterval(e){ie(this,Ks).clearInterval(e)}},Ks=new WeakMap,Em=new WeakMap,f1),Wh=new kk;function Sk(e){setTimeout(e,0)}var Bu=typeof window>"u"||"Deno"in globalThis;function xa(){}function Ck(e,n){return typeof e=="function"?e(n):e}function Ek(e){return typeof e=="number"&&e>=0&&e!==1/0}function Tk(e,n){return Math.max(e+(n||0)-Date.now(),0)}function em(e,n){return typeof e=="function"?e(n):e}function Ak(e,n){return typeof e=="function"?e(n):e}function Ib(e,n){const{type:r="all",exact:i,fetchStatus:o,predicate:c,queryKey:d,stale:f}=e;if(d){if(i){if(n.queryHash!==Um(d,n.options))return!1}else if(!yo(n.queryKey,d))return!1}if(r!=="all"){const m=n.isActive();if(r==="active"&&!m||r==="inactive"&&m)return!1}return!(typeof f=="boolean"&&n.isStale()!==f||o&&o!==n.state.fetchStatus||c&&!c(n))}function Pb(e,n){const{exact:r,status:i,predicate:o,mutationKey:c}=e;if(c){if(!n.options.mutationKey)return!1;if(r){if(bo(n.options.mutationKey)!==bo(c))return!1}else if(!yo(n.options.mutationKey,c))return!1}return!(i&&n.state.status!==i||o&&!o(n))}function Um(e,n){return((n==null?void 0:n.queryKeyHashFn)||bo)(e)}function bo(e){return JSON.stringify(e,(n,r)=>tm(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function yo(e,n){return e===n?!0:typeof e!=typeof n?!1:e&&n&&typeof e=="object"&&typeof n=="object"?Object.keys(n).every(r=>yo(e[r],n[r])):!1}var Mk=Object.prototype.hasOwnProperty;function I1(e,n,r=0){if(e===n)return e;if(r>500)return n;const i=Fb(e)&&Fb(n);if(!i&&!(tm(e)&&tm(n)))return n;const c=(i?e:Object.keys(e)).length,d=i?n:Object.keys(n),f=d.length,m=i?new Array(f):{};let h=0;for(let b=0;b<f;b++){const g=i?b:d[b],v=e[g],y=n[g];if(v===y){m[g]=v,(i?b<c:Mk.call(e,g))&&h++;continue}if(v===null||y===null||typeof v!="object"||typeof y!="object"){m[g]=y;continue}const k=I1(v,y,r+1);m[g]=k,k===v&&h++}return c===f&&h===c?e:m}function Fb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function tm(e){if(!$b(e))return!1;const n=e.constructor;if(n===void 0)return!0;const r=n.prototype;return!(!$b(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $b(e){return Object.prototype.toString.call(e)==="[object Object]"}function Dk(e){return new Promise(n=>{Wh.setTimeout(n,e)})}function Ok(e,n,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,n):r.structuralSharing!==!1?I1(e,n):n}function Rk(e,n,r=0){const i=[...e,n];return r&&i.length>r?i.slice(1):i}function _k(e,n,r=0){const i=[n,...e];return r&&i.length>r?i.slice(0,-1):i}var Hm=Symbol();function P1(e,n){return!e.queryFn&&(n!=null&&n.initialPromise)?()=>n.initialPromise:!e.queryFn||e.queryFn===Hm?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Lk(e,n,r){let i=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??(o=n()),i||(i=!0,o.aborted?r():o.addEventListener("abort",r,{once:!0})),o)}),e}var Mr,Zs,Hi,h1,Bk=(h1=class extends Lu{constructor(){super();Xe(this,Mr);Xe(this,Zs);Xe(this,Hi);Ae(this,Hi,n=>{if(!Bu&&window.addEventListener){const r=()=>n();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){ie(this,Zs)||this.setEventListener(ie(this,Hi))}onUnsubscribe(){var n;this.hasListeners()||((n=ie(this,Zs))==null||n.call(this),Ae(this,Zs,void 0))}setEventListener(n){var r;Ae(this,Hi,n),(r=ie(this,Zs))==null||r.call(this),Ae(this,Zs,n(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(n){ie(this,Mr)!==n&&(Ae(this,Mr,n),this.onFocus())}onFocus(){const n=this.isFocused();this.listeners.forEach(r=>{r(n)})}isFocused(){var n;return typeof ie(this,Mr)=="boolean"?ie(this,Mr):((n=globalThis.document)==null?void 0:n.visibilityState)!=="hidden"}},Mr=new WeakMap,Zs=new WeakMap,Hi=new WeakMap,h1),F1=new Bk;function Uk(){let e,n;const r=new Promise((o,c)=>{e=o,n=c});r.status="pending",r.catch(()=>{});function i(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{i({status:"fulfilled",value:o}),e(o)},r.reject=o=>{i({status:"rejected",reason:o}),n(o)},r}var Hk=Sk;function qk(){let e=[],n=0,r=f=>{f()},i=f=>{f()},o=Hk;const c=f=>{n?e.push(f):o(()=>{r(f)})},d=()=>{const f=e;e=[],f.length&&o(()=>{i(()=>{f.forEach(m=>{r(m)})})})};return{batch:f=>{let m;n++;try{m=f()}finally{n--,n||d()}return m},batchCalls:f=>(...m)=>{c(()=>{f(...m)})},schedule:c,setNotifyFunction:f=>{r=f},setBatchNotifyFunction:f=>{i=f},setScheduler:f=>{o=f}}}var hn=qk(),qi,Ws,Ii,m1,Ik=(m1=class extends Lu{constructor(){super();Xe(this,qi,!0);Xe(this,Ws);Xe(this,Ii);Ae(this,Ii,n=>{if(!Bu&&window.addEventListener){const r=()=>n(!0),i=()=>n(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",i)}}})}onSubscribe(){ie(this,Ws)||this.setEventListener(ie(this,Ii))}onUnsubscribe(){var n;this.hasListeners()||((n=ie(this,Ws))==null||n.call(this),Ae(this,Ws,void 0))}setEventListener(n){var r;Ae(this,Ii,n),(r=ie(this,Ws))==null||r.call(this),Ae(this,Ws,n(this.setOnline.bind(this)))}setOnline(n){ie(this,qi)!==n&&(Ae(this,qi,n),this.listeners.forEach(i=>{i(n)}))}isOnline(){return ie(this,qi)}},qi=new WeakMap,Ws=new WeakMap,Ii=new WeakMap,m1),zu=new Ik;function Pk(e){return Math.min(1e3*2**e,3e4)}function $1(e){return(e??"online")==="online"?zu.isOnline():!0}var nm=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function V1(e){let n=!1,r=0,i;const o=Uk(),c=()=>o.status!=="pending",d=C=>{var z;if(!c()){const j=new nm(C);v(j),(z=e.onCancel)==null||z.call(e,j)}},f=()=>{n=!0},m=()=>{n=!1},h=()=>F1.isFocused()&&(e.networkMode==="always"||zu.isOnline())&&e.canRun(),b=()=>$1(e.networkMode)&&e.canRun(),g=C=>{c()||(i==null||i(),o.resolve(C))},v=C=>{c()||(i==null||i(),o.reject(C))},y=()=>new Promise(C=>{var z;i=j=>{(c()||h())&&C(j)},(z=e.onPause)==null||z.call(e)}).then(()=>{var C;i=void 0,c()||(C=e.onContinue)==null||C.call(e)}),k=()=>{if(c())return;let C;const z=r===0?e.initialPromise:void 0;try{C=z??e.fn()}catch(j){C=Promise.reject(j)}Promise.resolve(C).then(g).catch(j=>{var A;if(c())return;const E=e.retry??(Bu?0:3),N=e.retryDelay??Pk,M=typeof N=="function"?N(r,j):N,R=E===!0||typeof E=="number"&&r<E||typeof E=="function"&&E(r,j);if(n||!R){v(j);return}r++,(A=e.onFail)==null||A.call(e,r,j),Dk(M).then(()=>h()?void 0:y()).then(()=>{n?v(j):k()})})};return{promise:o,status:()=>o.status,cancel:d,continue:()=>(i==null||i(),o),cancelRetry:f,continueRetry:m,canStart:b,start:()=>(b()?k():y().then(k),o)}}var Dr,p1,G1=(p1=class{constructor(){Xe(this,Dr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Ek(this.gcTime)&&Ae(this,Dr,Wh.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Bu?1/0:300*1e3))}clearGcTimeout(){ie(this,Dr)&&(Wh.clearTimeout(ie(this,Dr)),Ae(this,Dr,void 0))}},Dr=new WeakMap,p1),Or,Pi,la,Rr,It,No,_r,ga,ds,x1,Fk=(x1=class extends G1{constructor(n){super();Xe(this,ga);Xe(this,Or);Xe(this,Pi);Xe(this,la);Xe(this,Rr);Xe(this,It);Xe(this,No);Xe(this,_r);Ae(this,_r,!1),Ae(this,No,n.defaultOptions),this.setOptions(n.options),this.observers=[],Ae(this,Rr,n.client),Ae(this,la,ie(this,Rr).getQueryCache()),this.queryKey=n.queryKey,this.queryHash=n.queryHash,Ae(this,Or,Gb(this.options)),this.state=n.state??ie(this,Or),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var n;return(n=ie(this,It))==null?void 0:n.promise}setOptions(n){if(this.options={...ie(this,No),...n},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Gb(this.options);r.data!==void 0&&(this.setState(Vb(r.data,r.dataUpdatedAt)),Ae(this,Or,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ie(this,la).remove(this)}setData(n,r){const i=Ok(this.state.data,n,this.options);return en(this,ga,ds).call(this,{data:i,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),i}setState(n,r){en(this,ga,ds).call(this,{type:"setState",state:n,setStateOptions:r})}cancel(n){var i,o;const r=(i=ie(this,It))==null?void 0:i.promise;return(o=ie(this,It))==null||o.cancel(n),r?r.then(xa).catch(xa):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ie(this,Or))}isActive(){return this.observers.some(n=>Ak(n.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hm||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(n=>em(n.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(n=>n.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(n=0){return this.state.data===void 0?!0:n==="static"?!1:this.state.isInvalidated?!0:!Tk(this.state.dataUpdatedAt,n)}onFocus(){var r;const n=this.observers.find(i=>i.shouldFetchOnWindowFocus());n==null||n.refetch({cancelRefetch:!1}),(r=ie(this,It))==null||r.continue()}onOnline(){var r;const n=this.observers.find(i=>i.shouldFetchOnReconnect());n==null||n.refetch({cancelRefetch:!1}),(r=ie(this,It))==null||r.continue()}addObserver(n){this.observers.includes(n)||(this.observers.push(n),this.clearGcTimeout(),ie(this,la).notify({type:"observerAdded",query:this,observer:n}))}removeObserver(n){this.observers.includes(n)&&(this.observers=this.observers.filter(r=>r!==n),this.observers.length||(ie(this,It)&&(ie(this,_r)?ie(this,It).cancel({revert:!0}):ie(this,It).cancelRetry()),this.scheduleGc()),ie(this,la).notify({type:"observerRemoved",query:this,observer:n}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||en(this,ga,ds).call(this,{type:"invalidate"})}async fetch(n,r){var m,h,b,g,v,y,k,C,z,j,E,N;if(this.state.fetchStatus!=="idle"&&((m=ie(this,It))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(ie(this,It))return ie(this,It).continueRetry(),ie(this,It).promise}if(n&&this.setOptions(n),!this.options.queryFn){const M=this.observers.find(R=>R.options.queryFn);M&&this.setOptions(M.options)}const i=new AbortController,o=M=>{Object.defineProperty(M,"signal",{enumerable:!0,get:()=>(Ae(this,_r,!0),i.signal)})},c=()=>{const M=P1(this.options,r),A=(()=>{const F={client:ie(this,Rr),queryKey:this.queryKey,meta:this.meta};return o(F),F})();return Ae(this,_r,!1),this.options.persister?this.options.persister(M,A,this):M(A)},f=(()=>{const M={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:ie(this,Rr),state:this.state,fetchFn:c};return o(M),M})();(h=this.options.behavior)==null||h.onFetch(f,this),Ae(this,Pi,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((b=f.fetchOptions)==null?void 0:b.meta))&&en(this,ga,ds).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),Ae(this,It,V1({initialPromise:r==null?void 0:r.initialPromise,fn:f.fetchFn,onCancel:M=>{M instanceof nm&&M.revert&&this.setState({...ie(this,Pi),fetchStatus:"idle"}),i.abort()},onFail:(M,R)=>{en(this,ga,ds).call(this,{type:"failed",failureCount:M,error:R})},onPause:()=>{en(this,ga,ds).call(this,{type:"pause"})},onContinue:()=>{en(this,ga,ds).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const M=await ie(this,It).start();if(M===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(M),(y=(v=ie(this,la).config).onSuccess)==null||y.call(v,M,this),(C=(k=ie(this,la).config).onSettled)==null||C.call(k,M,this.state.error,this),M}catch(M){if(M instanceof nm){if(M.silent)return ie(this,It).promise;if(M.revert){if(this.state.data===void 0)throw M;return this.state.data}}throw en(this,ga,ds).call(this,{type:"error",error:M}),(j=(z=ie(this,la).config).onError)==null||j.call(z,M,this),(N=(E=ie(this,la).config).onSettled)==null||N.call(E,this.state.data,M,this),M}finally{this.scheduleGc()}}},Or=new WeakMap,Pi=new WeakMap,la=new WeakMap,Rr=new WeakMap,It=new WeakMap,No=new WeakMap,_r=new WeakMap,ga=new WeakSet,ds=function(n){const r=i=>{switch(n.type){case"failed":return{...i,fetchFailureCount:n.failureCount,fetchFailureReason:n.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...$k(i.data,this.options),fetchMeta:n.meta??null};case"success":const o={...i,...Vb(n.data,n.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!n.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ae(this,Pi,n.manual?o:void 0),o;case"error":const c=n.error;return{...i,error:c,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:c,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...n.state}}};this.state=r(this.state),hn.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),ie(this,la).notify({query:this,type:"updated",action:n})})},x1);function $k(e,n){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:$1(n.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Vb(e,n){return{data:e,dataUpdatedAt:n??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Gb(e){const n=typeof e.initialData=="function"?e.initialData():e.initialData,r=n!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:n,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}function Yb(e){return{onFetch:(n,r)=>{var b,g,v,y,k;const i=n.options,o=(v=(g=(b=n.fetchOptions)==null?void 0:b.meta)==null?void 0:g.fetchMore)==null?void 0:v.direction,c=((y=n.state.data)==null?void 0:y.pages)||[],d=((k=n.state.data)==null?void 0:k.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let C=!1;const z=N=>{Lk(N,()=>n.signal,()=>C=!0)},j=P1(n.options,n.fetchOptions),E=async(N,M,R)=>{if(C)return Promise.reject();if(M==null&&N.pages.length)return Promise.resolve(N);const F=(()=>{const P={client:n.client,queryKey:n.queryKey,pageParam:M,direction:R?"backward":"forward",meta:n.options.meta};return z(P),P})(),ee=await j(F),{maxPages:Z}=n.options,L=R?_k:Rk;return{pages:L(N.pages,ee,Z),pageParams:L(N.pageParams,M,Z)}};if(o&&c.length){const N=o==="backward",M=N?Vk:Qb,R={pages:c,pageParams:d},A=M(i,R);f=await E(R,A,N)}else{const N=e??c.length;do{const M=m===0?d[0]??i.initialPageParam:Qb(i,f);if(m>0&&M==null)break;f=await E(f,M),m++}while(m<N)}return f};n.options.persister?n.fetchFn=()=>{var C,z;return(z=(C=n.options).persister)==null?void 0:z.call(C,h,{client:n.client,queryKey:n.queryKey,meta:n.options.meta,signal:n.signal},r)}:n.fetchFn=h}}}function Qb(e,{pages:n,pageParams:r}){const i=n.length-1;return n.length>0?e.getNextPageParam(n[i],n,r[i],r):void 0}function Vk(e,{pages:n,pageParams:r}){var i;return n.length>0?(i=e.getPreviousPageParam)==null?void 0:i.call(e,n[0],n,r[0],r):void 0}var ko,Oa,an,Lr,Ra,Js,g1,Gk=(g1=class extends G1{constructor(n){super();Xe(this,Ra);Xe(this,ko);Xe(this,Oa);Xe(this,an);Xe(this,Lr);Ae(this,ko,n.client),this.mutationId=n.mutationId,Ae(this,an,n.mutationCache),Ae(this,Oa,[]),this.state=n.state||Yk(),this.setOptions(n.options),this.scheduleGc()}setOptions(n){this.options=n,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(n){ie(this,Oa).includes(n)||(ie(this,Oa).push(n),this.clearGcTimeout(),ie(this,an).notify({type:"observerAdded",mutation:this,observer:n}))}removeObserver(n){Ae(this,Oa,ie(this,Oa).filter(r=>r!==n)),this.scheduleGc(),ie(this,an).notify({type:"observerRemoved",mutation:this,observer:n})}optionalRemove(){ie(this,Oa).length||(this.state.status==="pending"?this.scheduleGc():ie(this,an).remove(this))}continue(){var n;return((n=ie(this,Lr))==null?void 0:n.continue())??this.execute(this.state.variables)}async execute(n){var d,f,m,h,b,g,v,y,k,C,z,j,E,N,M,R,A,F;const r=()=>{en(this,Ra,Js).call(this,{type:"continue"})},i={client:ie(this,ko),meta:this.options.meta,mutationKey:this.options.mutationKey};Ae(this,Lr,V1({fn:()=>this.options.mutationFn?this.options.mutationFn(n,i):Promise.reject(new Error("No mutationFn found")),onFail:(ee,Z)=>{en(this,Ra,Js).call(this,{type:"failed",failureCount:ee,error:Z})},onPause:()=>{en(this,Ra,Js).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ie(this,an).canRun(this)}));const o=this.state.status==="pending",c=!ie(this,Lr).canStart();try{if(o)r();else{en(this,Ra,Js).call(this,{type:"pending",variables:n,isPaused:c}),ie(this,an).config.onMutate&&await ie(this,an).config.onMutate(n,this,i);const Z=await((f=(d=this.options).onMutate)==null?void 0:f.call(d,n,i));Z!==this.state.context&&en(this,Ra,Js).call(this,{type:"pending",context:Z,variables:n,isPaused:c})}const ee=await ie(this,Lr).start();return await((h=(m=ie(this,an).config).onSuccess)==null?void 0:h.call(m,ee,n,this.state.context,this,i)),await((g=(b=this.options).onSuccess)==null?void 0:g.call(b,ee,n,this.state.context,i)),await((y=(v=ie(this,an).config).onSettled)==null?void 0:y.call(v,ee,null,this.state.variables,this.state.context,this,i)),await((C=(k=this.options).onSettled)==null?void 0:C.call(k,ee,null,n,this.state.context,i)),en(this,Ra,Js).call(this,{type:"success",data:ee}),ee}catch(ee){try{await((j=(z=ie(this,an).config).onError)==null?void 0:j.call(z,ee,n,this.state.context,this,i))}catch(Z){Promise.reject(Z)}try{await((N=(E=this.options).onError)==null?void 0:N.call(E,ee,n,this.state.context,i))}catch(Z){Promise.reject(Z)}try{await((R=(M=ie(this,an).config).onSettled)==null?void 0:R.call(M,void 0,ee,this.state.variables,this.state.context,this,i))}catch(Z){Promise.reject(Z)}try{await((F=(A=this.options).onSettled)==null?void 0:F.call(A,void 0,ee,n,this.state.context,i))}catch(Z){Promise.reject(Z)}throw en(this,Ra,Js).call(this,{type:"error",error:ee}),ee}finally{ie(this,an).runNext(this)}}},ko=new WeakMap,Oa=new WeakMap,an=new WeakMap,Lr=new WeakMap,Ra=new WeakSet,Js=function(n){const r=i=>{switch(n.type){case"failed":return{...i,failureCount:n.failureCount,failureReason:n.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:n.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:n.isPaused,status:"pending",variables:n.variables,submittedAt:Date.now()};case"success":return{...i,data:n.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:n.error,failureCount:i.failureCount+1,failureReason:n.error,isPaused:!1,status:"error"}}};this.state=r(this.state),hn.batch(()=>{ie(this,Oa).forEach(i=>{i.onMutationUpdate(n)}),ie(this,an).notify({mutation:this,type:"updated",action:n})})},g1);function Yk(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var fs,ba,So,b1,Qk=(b1=class extends Lu{constructor(n={}){super();Xe(this,fs);Xe(this,ba);Xe(this,So);this.config=n,Ae(this,fs,new Set),Ae(this,ba,new Map),Ae(this,So,0)}build(n,r,i){const o=new Gk({client:n,mutationCache:this,mutationId:++tu(this,So)._,options:n.defaultMutationOptions(r),state:i});return this.add(o),o}add(n){ie(this,fs).add(n);const r=au(n);if(typeof r=="string"){const i=ie(this,ba).get(r);i?i.push(n):ie(this,ba).set(r,[n])}this.notify({type:"added",mutation:n})}remove(n){if(ie(this,fs).delete(n)){const r=au(n);if(typeof r=="string"){const i=ie(this,ba).get(r);if(i)if(i.length>1){const o=i.indexOf(n);o!==-1&&i.splice(o,1)}else i[0]===n&&ie(this,ba).delete(r)}}this.notify({type:"removed",mutation:n})}canRun(n){const r=au(n);if(typeof r=="string"){const i=ie(this,ba).get(r),o=i==null?void 0:i.find(c=>c.state.status==="pending");return!o||o===n}else return!0}runNext(n){var i;const r=au(n);if(typeof r=="string"){const o=(i=ie(this,ba).get(r))==null?void 0:i.find(c=>c!==n&&c.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){hn.batch(()=>{ie(this,fs).forEach(n=>{this.notify({type:"removed",mutation:n})}),ie(this,fs).clear(),ie(this,ba).clear()})}getAll(){return Array.from(ie(this,fs))}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Pb(r,i))}findAll(n={}){return this.getAll().filter(r=>Pb(n,r))}notify(n){hn.batch(()=>{this.listeners.forEach(r=>{r(n)})})}resumePausedMutations(){const n=this.getAll().filter(r=>r.state.isPaused);return hn.batch(()=>Promise.all(n.map(r=>r.continue().catch(xa))))}},fs=new WeakMap,ba=new WeakMap,So=new WeakMap,b1);function au(e){var n;return(n=e.options.scope)==null?void 0:n.id}var _a,y1,Xk=(y1=class extends Lu{constructor(n={}){super();Xe(this,_a);this.config=n,Ae(this,_a,new Map)}build(n,r,i){const o=r.queryKey,c=r.queryHash??Um(o,r);let d=this.get(c);return d||(d=new Fk({client:n,queryKey:o,queryHash:c,options:n.defaultQueryOptions(r),state:i,defaultOptions:n.getQueryDefaults(o)}),this.add(d)),d}add(n){ie(this,_a).has(n.queryHash)||(ie(this,_a).set(n.queryHash,n),this.notify({type:"added",query:n}))}remove(n){const r=ie(this,_a).get(n.queryHash);r&&(n.destroy(),r===n&&ie(this,_a).delete(n.queryHash),this.notify({type:"removed",query:n}))}clear(){hn.batch(()=>{this.getAll().forEach(n=>{this.remove(n)})})}get(n){return ie(this,_a).get(n)}getAll(){return[...ie(this,_a).values()]}find(n){const r={exact:!0,...n};return this.getAll().find(i=>Ib(r,i))}findAll(n={}){const r=this.getAll();return Object.keys(n).length>0?r.filter(i=>Ib(n,i)):r}notify(n){hn.batch(()=>{this.listeners.forEach(r=>{r(n)})})}onFocus(){hn.batch(()=>{this.getAll().forEach(n=>{n.onFocus()})})}onOnline(){hn.batch(()=>{this.getAll().forEach(n=>{n.onOnline()})})}},_a=new WeakMap,y1),wt,er,tr,Fi,$i,nr,Vi,Gi,v1,Jk=(v1=class{constructor(e={}){Xe(this,wt);Xe(this,er);Xe(this,tr);Xe(this,Fi);Xe(this,$i);Xe(this,nr);Xe(this,Vi);Xe(this,Gi);Ae(this,wt,e.queryCache||new Xk),Ae(this,er,e.mutationCache||new Qk),Ae(this,tr,e.defaultOptions||{}),Ae(this,Fi,new Map),Ae(this,$i,new Map),Ae(this,nr,0)}mount(){tu(this,nr)._++,ie(this,nr)===1&&(Ae(this,Vi,F1.subscribe(async e=>{e&&(await this.resumePausedMutations(),ie(this,wt).onFocus())})),Ae(this,Gi,zu.subscribe(async e=>{e&&(await this.resumePausedMutations(),ie(this,wt).onOnline())})))}unmount(){var e,n;tu(this,nr)._--,ie(this,nr)===0&&((e=ie(this,Vi))==null||e.call(this),Ae(this,Vi,void 0),(n=ie(this,Gi))==null||n.call(this),Ae(this,Gi,void 0))}isFetching(e){return ie(this,wt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return ie(this,er).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const n=this.defaultQueryOptions({queryKey:e});return(r=ie(this,wt).get(n.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const n=this.defaultQueryOptions(e),r=ie(this,wt).build(this,n),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(em(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(i))}getQueriesData(e){return ie(this,wt).findAll(e).map(({queryKey:n,state:r})=>{const i=r.data;return[n,i]})}setQueryData(e,n,r){const i=this.defaultQueryOptions({queryKey:e}),o=ie(this,wt).get(i.queryHash),c=o==null?void 0:o.state.data,d=Ck(n,c);if(d!==void 0)return ie(this,wt).build(this,i).setData(d,{...r,manual:!0})}setQueriesData(e,n,r){return hn.batch(()=>ie(this,wt).findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,n,r)]))}getQueryState(e){var r;const n=this.defaultQueryOptions({queryKey:e});return(r=ie(this,wt).get(n.queryHash))==null?void 0:r.state}removeQueries(e){const n=ie(this,wt);hn.batch(()=>{n.findAll(e).forEach(r=>{n.remove(r)})})}resetQueries(e,n){const r=ie(this,wt);return hn.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},n)))}cancelQueries(e,n={}){const r={revert:!0,...n},i=hn.batch(()=>ie(this,wt).findAll(e).map(o=>o.cancel(r)));return Promise.all(i).then(xa).catch(xa)}invalidateQueries(e,n={}){return hn.batch(()=>(ie(this,wt).findAll(e).forEach(r=>{r.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"},n)))}refetchQueries(e,n={}){const r={...n,cancelRefetch:n.cancelRefetch??!0},i=hn.batch(()=>ie(this,wt).findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let c=o.fetch(void 0,r);return r.throwOnError||(c=c.catch(xa)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(i).then(xa)}fetchQuery(e){const n=this.defaultQueryOptions(e);n.retry===void 0&&(n.retry=!1);const r=ie(this,wt).build(this,n);return r.isStaleByTime(em(n.staleTime,r))?r.fetch(n):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(xa).catch(xa)}fetchInfiniteQuery(e){return e.behavior=Yb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(xa).catch(xa)}ensureInfiniteQueryData(e){return e.behavior=Yb(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return zu.isOnline()?ie(this,er).resumePausedMutations():Promise.resolve()}getQueryCache(){return ie(this,wt)}getMutationCache(){return ie(this,er)}getDefaultOptions(){return ie(this,tr)}setDefaultOptions(e){Ae(this,tr,e)}setQueryDefaults(e,n){ie(this,Fi).set(bo(e),{queryKey:e,defaultOptions:n})}getQueryDefaults(e){const n=[...ie(this,Fi).values()],r={};return n.forEach(i=>{yo(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,n){ie(this,$i).set(bo(e),{mutationKey:e,defaultOptions:n})}getMutationDefaults(e){const n=[...ie(this,$i).values()],r={};return n.forEach(i=>{yo(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const n={...ie(this,tr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return n.queryHash||(n.queryHash=Um(n.queryKey,n)),n.refetchOnReconnect===void 0&&(n.refetchOnReconnect=n.networkMode!=="always"),n.throwOnError===void 0&&(n.throwOnError=!!n.suspense),!n.networkMode&&n.persister&&(n.networkMode="offlineFirst"),n.queryFn===Hm&&(n.enabled=!1),n}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...ie(this,tr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){ie(this,wt).clear(),ie(this,er).clear()}},wt=new WeakMap,er=new WeakMap,tr=new WeakMap,Fi=new WeakMap,$i=new WeakMap,nr=new WeakMap,Vi=new WeakMap,Gi=new WeakMap,v1),Kk=S.createContext(void 0),Zk=({client:e,children:n})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),s.jsx(Kk.Provider,{value:e,children:n})),Wk=e=>{switch(e){case"success":return n5;case"info":return s5;case"warning":return a5;case"error":return r5;default:return null}},e5=Array(12).fill(0),t5=({visible:e,className:n})=>pe.createElement("div",{className:["sonner-loading-wrapper",n].filter(Boolean).join(" "),"data-visible":e},pe.createElement("div",{className:"sonner-spinner"},e5.map((r,i)=>pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),n5=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"})),a5=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"})),s5=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"})),r5=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"})),i5=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"})),l5=()=>{let[e,n]=pe.useState(document.hidden);return pe.useEffect(()=>{let r=()=>{n(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},am=1,o5=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;let{message:r,...i}=e,o=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:am++,c=this.toasts.find(f=>f.id===o),d=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),c?this.toasts=this.toasts.map(f=>f.id===o?(this.publish({...f,...e,id:o,title:r}),{...f,...e,id:o,dismissible:d,title:r}):f):this.addToast({title:r,...i,dismissible:d,id:o}),o},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:e,dismiss:!0})),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let i=e instanceof Promise?e:e(),o=r!==void 0,c,d=i.then(async m=>{if(c=["resolve",m],pe.isValidElement(m))o=!1,this.create({id:r,type:"default",message:m});else if(u5(m)&&!m.ok){o=!1;let h=typeof n.error=="function"?await n.error(`HTTP error! status: ${m.status}`):n.error,b=typeof n.description=="function"?await n.description(`HTTP error! status: ${m.status}`):n.description;this.create({id:r,type:"error",message:h,description:b})}else if(n.success!==void 0){o=!1;let h=typeof n.success=="function"?await n.success(m):n.success,b=typeof n.description=="function"?await n.description(m):n.description;this.create({id:r,type:"success",message:h,description:b})}}).catch(async m=>{if(c=["reject",m],n.error!==void 0){o=!1;let h=typeof n.error=="function"?await n.error(m):n.error,b=typeof n.description=="function"?await n.description(m):n.description;this.create({id:r,type:"error",message:h,description:b})}}).finally(()=>{var m;o&&(this.dismiss(r),r=void 0),(m=n.finally)==null||m.call(n)}),f=()=>new Promise((m,h)=>d.then(()=>c[0]==="reject"?h(c[1]):m(c[1])).catch(h));return typeof r!="string"&&typeof r!="number"?{unwrap:f}:Object.assign(r,{unwrap:f})},this.custom=(e,n)=>{let r=(n==null?void 0:n.id)||am++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Mn=new o5,c5=(e,n)=>{let r=(n==null?void 0:n.id)||am++;return Mn.addToast({title:e,...n,id:r}),r},u5=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",d5=c5,f5=()=>Mn.toasts,h5=()=>Mn.getActiveToasts(),Re=Object.assign(d5,{success:Mn.success,info:Mn.info,warning:Mn.warning,error:Mn.error,custom:Mn.custom,message:Mn.message,promise:Mn.promise,dismiss:Mn.dismiss,loading:Mn.loading},{getHistory:f5,getToasts:h5});function m5(e,{insertAt:n}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}m5(`: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 su(e){return e.label!==void 0}var p5=3,x5="32px",g5="16px",Xb=4e3,b5=356,y5=14,v5=20,j5=200;function pa(...e){return e.filter(Boolean).join(" ")}function w5(e){let[n,r]=e.split("-"),i=[];return n&&i.push(n),r&&i.push(r),i}var z5=e=>{var n,r,i,o,c,d,f,m,h,b,g;let{invert:v,toast:y,unstyled:k,interacting:C,setHeights:z,visibleToasts:j,heights:E,index:N,toasts:M,expanded:R,removeToast:A,defaultRichColors:F,closeButton:ee,style:Z,cancelButtonStyle:L,actionButtonStyle:P,className:Y="",descriptionClassName:me="",duration:_,position:q,gap:B,loadingIcon:V,expandByDefault:oe,classNames:ue,icons:O,closeButtonAriaLabel:U="Close toast",pauseWhenPageIsHidden:Q}=e,[D,G]=pe.useState(null),[be,ye]=pe.useState(null),[W,de]=pe.useState(!1),[ke,rt]=pe.useState(!1),[yt,vn]=pe.useState(!1),[Fa,Ln]=pe.useState(!1),[Xn,Bn]=pe.useState(!1),[$a,ge]=pe.useState(0),[ve,Me]=pe.useState(0),ze=pe.useRef(y.duration||_||Xb),Ue=pe.useRef(null),qe=pe.useRef(null),tt=N===0,Ct=N+1<=j,te=y.type,fe=y.dismissible!==!1,Ee=y.className||"",He=y.descriptionClassName||"",Ye=pe.useMemo(()=>E.findIndex(Te=>Te.toastId===y.id)||0,[E,y.id]),cn=pe.useMemo(()=>{var Te;return(Te=y.closeButton)!=null?Te:ee},[y.closeButton,ee]),Jn=pe.useMemo(()=>y.duration||_||Xb,[y.duration,_]),_t=pe.useRef(0),ft=pe.useRef(0),$t=pe.useRef(0),Je=pe.useRef(null),[ka,Un]=q.split("-"),Po=pe.useMemo(()=>E.reduce((Te,nt,ct)=>ct>=Ye?Te:Te+nt.height,0),[E,Ye]),ur=l5(),$r=y.invert||v,ws=te==="loading";ft.current=pe.useMemo(()=>Ye*B+Po,[Ye,Po]),pe.useEffect(()=>{ze.current=Jn},[Jn]),pe.useEffect(()=>{de(!0)},[]),pe.useEffect(()=>{let Te=qe.current;if(Te){let nt=Te.getBoundingClientRect().height;return Me(nt),z(ct=>[{toastId:y.id,height:nt,position:y.position},...ct]),()=>z(ct=>ct.filter(un=>un.toastId!==y.id))}},[z,y.id]),pe.useLayoutEffect(()=>{if(!W)return;let Te=qe.current,nt=Te.style.height;Te.style.height="auto";let ct=Te.getBoundingClientRect().height;Te.style.height=nt,Me(ct),z(un=>un.find(Vt=>Vt.toastId===y.id)?un.map(Vt=>Vt.toastId===y.id?{...Vt,height:ct}:Vt):[{toastId:y.id,height:ct,position:y.position},...un])},[W,y.title,y.description,z,y.id]);let Wt=pe.useCallback(()=>{rt(!0),ge(ft.current),z(Te=>Te.filter(nt=>nt.toastId!==y.id)),setTimeout(()=>{A(y)},j5)},[y,A,z,ft]);pe.useEffect(()=>{if(y.promise&&te==="loading"||y.duration===1/0||y.type==="loading")return;let Te;return R||C||Q&&ur?(()=>{if($t.current<_t.current){let nt=new Date().getTime()-_t.current;ze.current=ze.current-nt}$t.current=new Date().getTime()})():ze.current!==1/0&&(_t.current=new Date().getTime(),Te=setTimeout(()=>{var nt;(nt=y.onAutoClose)==null||nt.call(y,y),Wt()},ze.current)),()=>clearTimeout(Te)},[R,C,y,te,Q,ur,Wt]),pe.useEffect(()=>{y.delete&&Wt()},[Wt,y.delete]);function Vr(){var Te,nt,ct;return O!=null&&O.loading?pe.createElement("div",{className:pa(ue==null?void 0:ue.loader,(Te=y==null?void 0:y.classNames)==null?void 0:Te.loader,"sonner-loader"),"data-visible":te==="loading"},O.loading):V?pe.createElement("div",{className:pa(ue==null?void 0:ue.loader,(nt=y==null?void 0:y.classNames)==null?void 0:nt.loader,"sonner-loader"),"data-visible":te==="loading"},V):pe.createElement(t5,{className:pa(ue==null?void 0:ue.loader,(ct=y==null?void 0:y.classNames)==null?void 0:ct.loader),visible:te==="loading"})}return pe.createElement("li",{tabIndex:0,ref:qe,className:pa(Y,Ee,ue==null?void 0:ue.toast,(n=y==null?void 0:y.classNames)==null?void 0:n.toast,ue==null?void 0:ue.default,ue==null?void 0:ue[te],(r=y==null?void 0:y.classNames)==null?void 0:r[te]),"data-sonner-toast":"","data-rich-colors":(i=y.richColors)!=null?i:F,"data-styled":!(y.jsx||y.unstyled||k),"data-mounted":W,"data-promise":!!y.promise,"data-swiped":Xn,"data-removed":ke,"data-visible":Ct,"data-y-position":ka,"data-x-position":Un,"data-index":N,"data-front":tt,"data-swiping":yt,"data-dismissible":fe,"data-type":te,"data-invert":$r,"data-swipe-out":Fa,"data-swipe-direction":be,"data-expanded":!!(R||oe&&W),style:{"--index":N,"--toasts-before":N,"--z-index":M.length-N,"--offset":`${ke?$a:ft.current}px`,"--initial-height":oe?"auto":`${ve}px`,...Z,...y.style},onDragEnd:()=>{vn(!1),G(null),Je.current=null},onPointerDown:Te=>{ws||!fe||(Ue.current=new Date,ge(ft.current),Te.target.setPointerCapture(Te.pointerId),Te.target.tagName!=="BUTTON"&&(vn(!0),Je.current={x:Te.clientX,y:Te.clientY}))},onPointerUp:()=>{var Te,nt,ct,un;if(Fa||!fe)return;Je.current=null;let Vt=Number(((Te=qe.current)==null?void 0:Te.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Sa=Number(((nt=qe.current)==null?void 0:nt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ca=new Date().getTime()-((ct=Ue.current)==null?void 0:ct.getTime()),jn=D==="x"?Vt:Sa,ua=Math.abs(jn)/Ca;if(Math.abs(jn)>=v5||ua>.11){ge(ft.current),(un=y.onDismiss)==null||un.call(y,y),ye(D==="x"?Vt>0?"right":"left":Sa>0?"down":"up"),Wt(),Ln(!0),Bn(!1);return}vn(!1),G(null)},onPointerMove:Te=>{var nt,ct,un,Vt;if(!Je.current||!fe||((nt=window.getSelection())==null?void 0:nt.toString().length)>0)return;let Sa=Te.clientY-Je.current.y,Ca=Te.clientX-Je.current.x,jn=(ct=e.swipeDirections)!=null?ct:w5(q);!D&&(Math.abs(Ca)>1||Math.abs(Sa)>1)&&G(Math.abs(Ca)>Math.abs(Sa)?"x":"y");let ua={x:0,y:0};D==="y"?(jn.includes("top")||jn.includes("bottom"))&&(jn.includes("top")&&Sa<0||jn.includes("bottom")&&Sa>0)&&(ua.y=Sa):D==="x"&&(jn.includes("left")||jn.includes("right"))&&(jn.includes("left")&&Ca<0||jn.includes("right")&&Ca>0)&&(ua.x=Ca),(Math.abs(ua.x)>0||Math.abs(ua.y)>0)&&Bn(!0),(un=qe.current)==null||un.style.setProperty("--swipe-amount-x",`${ua.x}px`),(Vt=qe.current)==null||Vt.style.setProperty("--swipe-amount-y",`${ua.y}px`)}},cn&&!y.jsx?pe.createElement("button",{"aria-label":U,"data-disabled":ws,"data-close-button":!0,onClick:ws||!fe?()=>{}:()=>{var Te;Wt(),(Te=y.onDismiss)==null||Te.call(y,y)},className:pa(ue==null?void 0:ue.closeButton,(o=y==null?void 0:y.classNames)==null?void 0:o.closeButton)},(c=O==null?void 0:O.close)!=null?c:i5):null,y.jsx||S.isValidElement(y.title)?y.jsx?y.jsx:typeof y.title=="function"?y.title():y.title:pe.createElement(pe.Fragment,null,te||y.icon||y.promise?pe.createElement("div",{"data-icon":"",className:pa(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||Vr():null,y.type!=="loading"?y.icon||(O==null?void 0:O[te])||Wk(te):null):null,pe.createElement("div",{"data-content":"",className:pa(ue==null?void 0:ue.content,(f=y==null?void 0:y.classNames)==null?void 0:f.content)},pe.createElement("div",{"data-title":"",className:pa(ue==null?void 0:ue.title,(m=y==null?void 0:y.classNames)==null?void 0:m.title)},typeof y.title=="function"?y.title():y.title),y.description?pe.createElement("div",{"data-description":"",className:pa(me,He,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),S.isValidElement(y.cancel)?y.cancel:y.cancel&&su(y.cancel)?pe.createElement("button",{"data-button":!0,"data-cancel":!0,style:y.cancelButtonStyle||L,onClick:Te=>{var nt,ct;su(y.cancel)&&fe&&((ct=(nt=y.cancel).onClick)==null||ct.call(nt,Te),Wt())},className:pa(ue==null?void 0:ue.cancelButton,(b=y==null?void 0:y.classNames)==null?void 0:b.cancelButton)},y.cancel.label):null,S.isValidElement(y.action)?y.action:y.action&&su(y.action)?pe.createElement("button",{"data-button":!0,"data-action":!0,style:y.actionButtonStyle||P,onClick:Te=>{var nt,ct;su(y.action)&&((ct=(nt=y.action).onClick)==null||ct.call(nt,Te),!Te.defaultPrevented&&Wt())},className:pa(ue==null?void 0:ue.actionButton,(g=y==null?void 0:y.classNames)==null?void 0:g.actionButton)},y.action.label):null))};function Jb(){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 N5(e,n){let r={};return[e,n].forEach((i,o)=>{let c=o===1,d=c?"--mobile-offset":"--offset",f=c?g5:x5;function m(h){["top","right","bottom","left"].forEach(b=>{r[`${d}-${b}`]=typeof h=="number"?`${h}px`:h})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(h=>{i[h]===void 0?r[`${d}-${h}`]=f:r[`${d}-${h}`]=typeof i[h]=="number"?`${i[h]}px`:i[h]}):m(f)}),r}var k5=S.forwardRef(function(e,n){let{invert:r,position:i="bottom-right",hotkey:o=["altKey","KeyT"],expand:c,closeButton:d,className:f,offset:m,mobileOffset:h,theme:b="light",richColors:g,duration:v,style:y,visibleToasts:k=p5,toastOptions:C,dir:z=Jb(),gap:j=y5,loadingIcon:E,icons:N,containerAriaLabel:M="Notifications",pauseWhenPageIsHidden:R}=e,[A,F]=pe.useState([]),ee=pe.useMemo(()=>Array.from(new Set([i].concat(A.filter(Q=>Q.position).map(Q=>Q.position)))),[A,i]),[Z,L]=pe.useState([]),[P,Y]=pe.useState(!1),[me,_]=pe.useState(!1),[q,B]=pe.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=pe.useRef(null),oe=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),ue=pe.useRef(null),O=pe.useRef(!1),U=pe.useCallback(Q=>{F(D=>{var G;return(G=D.find(be=>be.id===Q.id))!=null&&G.delete||Mn.dismiss(Q.id),D.filter(({id:be})=>be!==Q.id)})},[]);return pe.useEffect(()=>Mn.subscribe(Q=>{if(Q.dismiss){F(D=>D.map(G=>G.id===Q.id?{...G,delete:!0}:G));return}setTimeout(()=>{zk.flushSync(()=>{F(D=>{let G=D.findIndex(be=>be.id===Q.id);return G!==-1?[...D.slice(0,G),{...D[G],...Q},...D.slice(G+1)]:[Q,...D]})})})}),[]),pe.useEffect(()=>{if(b!=="system"){B(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?B("dark"):B("light")),typeof window>"u")return;let Q=window.matchMedia("(prefers-color-scheme: dark)");try{Q.addEventListener("change",({matches:D})=>{B(D?"dark":"light")})}catch{Q.addListener(({matches:G})=>{try{B(G?"dark":"light")}catch(be){console.error(be)}})}},[b]),pe.useEffect(()=>{A.length<=1&&Y(!1)},[A]),pe.useEffect(()=>{let Q=D=>{var G,be;o.every(ye=>D[ye]||D.code===ye)&&(Y(!0),(G=V.current)==null||G.focus()),D.code==="Escape"&&(document.activeElement===V.current||(be=V.current)!=null&&be.contains(document.activeElement))&&Y(!1)};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[o]),pe.useEffect(()=>{if(V.current)return()=>{ue.current&&(ue.current.focus({preventScroll:!0}),ue.current=null,O.current=!1)}},[V.current]),pe.createElement("section",{ref:n,"aria-label":`${M} ${oe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ee.map((Q,D)=>{var G;let[be,ye]=Q.split("-");return A.length?pe.createElement("ol",{key:Q,dir:z==="auto"?Jb():z,tabIndex:-1,ref:V,className:f,"data-sonner-toaster":!0,"data-theme":q,"data-y-position":be,"data-lifted":P&&A.length>1&&!c,"data-x-position":ye,style:{"--front-toast-height":`${((G=Z[0])==null?void 0:G.height)||0}px`,"--width":`${b5}px`,"--gap":`${j}px`,...y,...N5(m,h)},onBlur:W=>{O.current&&!W.currentTarget.contains(W.relatedTarget)&&(O.current=!1,ue.current&&(ue.current.focus({preventScroll:!0}),ue.current=null))},onFocus:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||O.current||(O.current=!0,ue.current=W.relatedTarget)},onMouseEnter:()=>Y(!0),onMouseMove:()=>Y(!0),onMouseLeave:()=>{me||Y(!1)},onDragEnd:()=>Y(!1),onPointerDown:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||_(!0)},onPointerUp:()=>_(!1)},A.filter(W=>!W.position&&D===0||W.position===Q).map((W,de)=>{var ke,rt;return pe.createElement(z5,{key:W.id,icons:N,index:de,toast:W,defaultRichColors:g,duration:(ke=C==null?void 0:C.duration)!=null?ke:v,className:C==null?void 0:C.className,descriptionClassName:C==null?void 0:C.descriptionClassName,invert:r,visibleToasts:k,closeButton:(rt=C==null?void 0:C.closeButton)!=null?rt:d,interacting:me,position:Q,style:C==null?void 0:C.style,unstyled:C==null?void 0:C.unstyled,classNames:C==null?void 0:C.classNames,cancelButtonStyle:C==null?void 0:C.cancelButtonStyle,actionButtonStyle:C==null?void 0:C.actionButtonStyle,removeToast:U,toasts:A.filter(yt=>yt.position==W.position),heights:Z.filter(yt=>yt.position==W.position),setHeights:L,expandByDefault:c,gap:j,loadingIcon:E,expanded:P,pauseWhenPageIsHidden:R,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 S5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Y1=(...e)=>e.filter((n,r,i)=>!!n&&n.trim()!==""&&i.indexOf(n)===r).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 C5={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 E5=S.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:o="",children:c,iconNode:d,...f},m)=>S.createElement("svg",{ref:m,...C5,width:n,height:n,stroke:e,strokeWidth:i?Number(r)*24/Number(n):r,className:Y1("lucide",o),...f},[...d.map(([h,b])=>S.createElement(h,b)),...Array.isArray(c)?c:[c]]));/**
 * @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 se=(e,n)=>{const r=S.forwardRef(({className:i,...o},c)=>S.createElement(E5,{ref:c,iconNode:n,className:Y1(`lucide-${S5(e)}`,i),...o}));return r.displayName=`${e}`,r};/**
 * @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 Q1=se("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 T5=se("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 sm=se("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 A5=se("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 X1=se("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 M5=se("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 Nu=se("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 D5=se("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 J1=se("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 ya=se("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 Li=se("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 qm=se("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 Im=se("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 Pm=se("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 ku=se("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 ln=se("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 el=se("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 Uu=se("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 sr=se("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 rm=se("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/**
 * @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 tl=se("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 xs=se("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 O5=se("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 R5=se("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/**
 * @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 rr=se("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 _5=se("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 K1=se("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
 * @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=se("ClipboardPlus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}],["path",{d:"M12 17v-6",key:"1y8rbf"}]]);/**
 * @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 To=se("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 L5=se("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
 * @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 qa=se("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 B5=se("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=se("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 ev=se("DatabaseZap",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]);/**
 * @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 Ao=se("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 tv=se("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
 * @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 U5=se("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 Ha=se("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 nv=se("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 av=se("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 H5=se("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 Hu=se("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 Br=se("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 gs=se("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 sv=se("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/**
 * @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 q5=se("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 I5=se("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 rv=se("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 iv=se("FileScan",[["path",{d:"M20 10V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4",key:"1rdf37"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 14a2 2 0 0 0-2 2",key:"ceaadl"}],["path",{d:"M20 14a2 2 0 0 1 2 2",key:"1ny6zw"}],["path",{d:"M20 22a2 2 0 0 0 2-2",key:"1l9q4k"}],["path",{d:"M16 22a2 2 0 0 1-2-2",key:"1wqh5n"}]]);/**
 * @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 lv=se("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/**
 * @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 ov=se("FileTerminal",[["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:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]]);/**
 * @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 bs=se("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 P5=se("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 F5=se("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 fo=se("FolderArchive",[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]]);/**
 * @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 Fm=se("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 qu=se("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 $5=se("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
 * @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 V5=se("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 G5=se("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 cv=se("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
 * @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 uv=se("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/**
 * @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 dv=se("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/**
 * @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 Y5=se("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 $m=se("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 Vm=se("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 Gm=se("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 fv=se("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/**
 * @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 Q5=se("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 X5=se("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 J5=se("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 K5=se("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 Z5=se("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 W5=se("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
 * @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=se("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
 * @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 hv=se("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
 * @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=se("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 Ge=se("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 mv=se("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 t4=se("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
 * @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=se("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 a4=se("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 Ur=se("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 ir=se("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 pv=se("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 xv=se("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 gv=se("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
 * @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 Mo=se("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 Kb=se("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 bv=se("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 s4=se("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 Qm=se("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 Zb=se("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 Iu=se("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 Xm=se("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 Dn=se("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 r4=se("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 i4=se("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 yv=se("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 gn=se("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 vv=se("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 vo=se("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 Do=se("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 On=se("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 jo=se("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 l4=se("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
 * @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 Oo=se("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 Pu=se("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 Jm=se("ShieldBan",[["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:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/**
 * @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=se("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 Na=se("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 Fu=se("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 o4=se("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 xn=se("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 jv=se("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 c4=se("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 Yi=se("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 Zm=se("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/**
 * @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=se("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 wv=se("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 zv=se("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
 * @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 Nv=se("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
 * @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=se("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 $u=se("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 kv=se("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 Ro=se("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 _o=se("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 Pt=se("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 Hr=se("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 Vu=se("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 e0=se("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 Lo=se("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 t0=se("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 im=se("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 qr=se("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 bn=se("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 Pr=se("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"}]]),Wb=e=>{let n;const r=new Set,i=(h,b)=>{const g=typeof h=="function"?h(n):h;if(!Object.is(g,n)){const v=n;n=b??(typeof g!="object"||g===null)?g:Object.assign({},n,g),r.forEach(y=>y(n,v))}},o=()=>n,f={setState:i,getState:o,getInitialState:()=>m,subscribe:h=>(r.add(h),()=>r.delete(h))},m=n=e(i,o,f);return f},u4=(e=>e?Wb(e):Wb),d4=e=>e;function f4(e,n=d4){const r=pe.useSyncExternalStore(e.subscribe,pe.useCallback(()=>n(e.getState()),[e,n]),pe.useCallback(()=>n(e.getInitialState()),[e,n]));return pe.useDebugValue(r),r}const ey=e=>{const n=u4(e),r=i=>f4(n,i);return Object.assign(r,n),r},zt=(e=>e?ey(e):ey);function h4(e,n){let r;try{r=e()}catch{return}return{getItem:o=>{var c;const d=m=>m===null?null:JSON.parse(m,void 0),f=(c=r.getItem(o))!=null?c:null;return f instanceof Promise?f.then(d):d(f)},setItem:(o,c)=>r.setItem(o,JSON.stringify(c,void 0)),removeItem:o=>r.removeItem(o)}}const lm=e=>n=>{try{const r=e(n);return r instanceof Promise?r:{then(i){return lm(i)(r)},catch(i){return this}}}catch(r){return{then(i){return this},catch(i){return lm(i)(r)}}}},m4=(e,n)=>(r,i,o)=>{let c={storage:h4(()=>window.localStorage),partialize:z=>z,version:0,merge:(z,j)=>({...j,...z}),...n},d=!1,f=0;const m=new Set,h=new Set;let b=c.storage;if(!b)return e((...z)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),r(...z)},i,o);const g=()=>{const z=c.partialize({...i()});return b.setItem(c.name,{state:z,version:c.version})},v=o.setState;o.setState=(z,j)=>(v(z,j),g());const y=e((...z)=>(r(...z),g()),i,o);o.getInitialState=()=>y;let k;const C=()=>{var z,j;if(!b)return;const E=++f;d=!1,m.forEach(M=>{var R;return M((R=i())!=null?R:y)});const N=((j=c.onRehydrateStorage)==null?void 0:j.call(c,(z=i())!=null?z:y))||void 0;return lm(b.getItem.bind(b))(c.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==c.version){if(c.migrate){const R=c.migrate(M.state,M.version);return R instanceof Promise?R.then(A=>[!0,A]):[!0,R]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var R;if(E!==f)return;const[A,F]=M;if(k=c.merge(F,(R=i())!=null?R:y),r(k,!0),A)return g()}).then(()=>{E===f&&(N==null||N(k,void 0),k=i(),d=!0,h.forEach(M=>M(k)))}).catch(M=>{E===f&&(N==null||N(void 0,M))})};return o.persist={setOptions:z=>{c={...c,...z},z.storage&&(b=z.storage)},clearStorage:()=>{b==null||b.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>C(),hasHydrated:()=>d,onHydrate:z=>(m.add(z),()=>{m.delete(z)}),onFinishHydration:z=>(h.add(z),()=>{h.delete(z)})},c.skipHydration||C(),k||y},Ft=m4,yn=zt()(Ft(e=>({user:null,accessToken:null,refreshToken:null,isAuthenticated:!1,isLoading:!0,setupRequired:null,setUser:n=>e({user:n,isAuthenticated:n!==null}),setTokens:(n,r)=>e({accessToken:n,refreshToken:r,isAuthenticated:!0}),setAccessToken:n=>e({accessToken:n}),setSetupRequired:n=>e({setupRequired:n,isLoading:!1}),setLoading:n=>e({isLoading:n}),login:(n,r,i)=>e({user:n,accessToken:r,refreshToken:i,isAuthenticated:!0,isLoading:!1,setupRequired:!1}),logout:()=>e({user:null,accessToken:null,refreshToken:null,isAuthenticated:!1,isLoading:!1}),updateUser:n=>e(r=>({user:r.user?{...r.user,...n}: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(n,r,i){super(n),this.status=r,this.data=i,this.name="AuthApiError"}}async function ys(e,n={},r=!1){const i=`${p4}${e}`,o={"Content-Type":"application/json",...n.headers};if(r){const{accessToken:d}=yn.getState();d&&(o.Authorization=`Bearer ${d}`)}const c=await fetch(i,{...n,headers:o});if(!c.ok){const d=await c.json().catch(()=>({}));throw new x4(d.detail||`Request failed: ${c.statusText}`,c.status,d)}return c.json()}async function n0(){return ys("/auth/setup-required")}async function g4(e){return ys("/auth/setup",{method:"POST",body:JSON.stringify(e)})}async function b4(e){return ys("/auth/login",{method:"POST",body:JSON.stringify(e)})}async function y4(e){return ys("/auth/refresh",{method:"POST",body:JSON.stringify(e)})}async function v4(){return ys("/auth/me",{},!0)}async function Sv(e=100,n=0){return ys(`/auth/users?limit=${e}&offset=${n}`,{},!0)}async function Cv(e){return ys("/auth/users",{method:"POST",body:JSON.stringify(e)},!0)}async function Ev(e,n){return ys(`/auth/users/${e}`,{method:"PUT",body:JSON.stringify(n)},!0)}async function Tv(e){return ys(`/auth/users/${e}`,{method:"DELETE"},!0)}let eo=null;async function Ia(){const{refreshToken:e,setAccessToken:n,logout:r}=yn.getState();if(!e)return null;if(eo)try{return(await eo).access_token}catch{return null}try{eo=y4({refresh_token:e});const i=await eo;return n(i.access_token),i.access_token}catch{return r(),null}finally{eo=null}}const Av="/api";let a0=class extends Error{constructor(n,r,i){super(n),this.status=r,this.data=i,this.name="ApiError"}};function om(){const{accessToken:e}=yn.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function xe(e,n={},r=!0){const i=`${Av}${e}`,o=await fetch(i,{headers:{"Content-Type":"application/json",...om(),...n.headers},...n});if(o.status===401&&r&&await Ia())return xe(e,n,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new a0(c.detail||`Request failed: ${o.statusText}`,o.status,c)}return o.json()}async function s0(){return xe("/health")}async function Mv(){return xe("/config")}async function bu(e){return xe("/config",{method:"PUT",body:JSON.stringify(e)})}async function j4(e=50,n=0){return xe(`/chat/history?limit=${e}&offset=${n}`)}async function w4(){return xe("/chat/history",{method:"DELETE"})}async function Dv(e=[]){return(await xe("/creation/names",{method:"POST",body:JSON.stringify({count:4,exclude:e})})).names}async function z4(e={}){return(await xe("/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 N4(e){return(await xe("/creation/follow-up-questions",{method:"POST",body:JSON.stringify(e)})).questions}async function*Ov(e,n,r){var m;const i=`${Av}${e}`;let o=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...om()},body:JSON.stringify(n),signal:r});if(o.status===401&&await Ia()&&(o=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...om()},body:JSON.stringify(n),signal:r})),!o.ok){const h=await o.json().catch(()=>({}));throw new a0(h.detail||`SSE request failed: ${o.statusText}`,o.status,h)}const c=(m=o.body)==null?void 0:m.getReader();if(!c)throw new Error("No response body");const d=new TextDecoder;let f="";try{for(;;){const{done:h,value:b}=await c.read();if(h)break;f+=d.decode(b,{stream:!0});const g=f.split(`

`);f=g.pop()||"";for(const v of g){if(!v.trim())continue;let y="message",k="";for(const C of v.split(`
`))C.startsWith("event: ")?y=C.slice(7).trim():C.startsWith("data: ")&&(k=C.slice(6));if(k)try{yield{event:y,data:JSON.parse(k)}}catch{}}}}finally{c.releaseLock()}}async function Rv(e,n,r){try{for await(const{event:i,data:o}of Ov("/creation/names-with-meanings/stream",{count:e.count??4,exclude:e.exclude??[],purpose:e.purpose,personality:e.personality},r))i==="name"?n.onName(o):i==="done"?n.onDone():i==="error"&&n.onError(o.error)}catch(i){if(i.name==="AbortError")return;n.onError(i instanceof Error?i.message:"Stream failed")}}async function _v(e,n,r){try{for await(const{event:i,data:o}of Ov("/creation/follow-up-questions/stream",e,r))i==="question"?n.onQuestion(o):i==="done"?n.onDone():i==="error"&&n.onError(o.error)}catch(i){if(i.name==="AbortError")return;n.onError(i instanceof Error?i.message:"Stream failed")}}async function Lv(e){return xe("/creation/generate-prompt",{method:"POST",body:JSON.stringify(e)})}async function k4(e){return xe("/creation/suggest-prompt",{method:"POST",body:JSON.stringify(e)})}async function Bv(e){return xe("/creation/refine-prompt",{method:"POST",body:JSON.stringify(e)})}async function Uv(e){return xe("/creation/preview-bot",{method:"POST",body:JSON.stringify(e)})}async function Hv(e){return xe("/creation/analyze-context",{method:"POST",body:JSON.stringify(e)})}async function r0(e){return xe(`/bots/${e.id}`,{method:"PUT",body:JSON.stringify(e)})}async function qv(e){return xe(`/bots/${e}`,{method:"DELETE"})}async function S4(e){return xe(`/bots/${e}/export`)}async function C4(e){return xe("/bots/import",{method:"POST",body:JSON.stringify(e)})}async function Iv(e){return xe(`/bots/${e}/chats`)}async function Pv(e,n,r=50){return xe(`/bots/${e}/chats/${n}/messages?limit=${r}`)}async function Fv(e,n){return xe(`/bots/${e}/chats/${n}`,{method:"DELETE"})}async function $v(e,n){return xe(`/bots/${e}/chats/${n}/_clear-messages`,{method:"POST"})}async function E4(e){return xe(`/bots/${e}/chats/_clear`,{method:"POST"})}async function Vv(e,n){return xe(`/bots/${e}/chats/${n}/_archive`,{method:"POST"})}async function i0(e,n){return xe(`/bots/${e}/chats/${n}/_unarchive`,{method:"POST"})}async function Gv(e){return xe(`/bots/${e}/chats?include_archived=true`)}async function T4(e){return xe(`/bots/${e}/functions`)}async function A4(e,n){return xe(`/bots/${e}/functions/${n}`)}async function M4(e,n){return xe(`/bots/${e}/functions`,{method:"POST",body:JSON.stringify(n)})}async function D4(e,n,r){return xe(`/bots/${e}/functions/${n}`,{method:"PATCH",body:JSON.stringify(r)})}async function O4(e,n){return xe(`/bots/${e}/functions/${n}`,{method:"DELETE"})}async function R4(e,n,r){return xe(`/bots/${e}/functions/${n}/run`,{method:"POST",body:JSON.stringify(r||{})})}async function _4(e){return xe(`/bots/${e}/schedules`)}async function L4(e,n){return xe(`/bots/${e}/schedules/${n}`)}async function Yv(e,n){return xe(`/bots/${e}/schedules`,{method:"POST",body:JSON.stringify(n)})}async function B4(e,n,r){return xe(`/bots/${e}/schedules/${n}`,{method:"PATCH",body:JSON.stringify(r)})}async function U4(e,n){return xe(`/bots/${e}/schedules/${n}/toggle`,{method:"POST"})}async function H4(e,n){return xe(`/bots/${e}/schedules/${n}`,{method:"DELETE"})}async function q4(e,n,r=50){const i=new URLSearchParams;return n&&i.set("status",n),i.set("limit",r.toString()),xe(`/bots/${e}/work?${i}`)}async function I4(e){return xe(`/bots/${e}/work/active`)}async function P4(e,n){return xe(`/bots/${e}/work/${n}`)}async function F4(e,n){return xe(`/bots/${e}/work`,{method:"POST",body:JSON.stringify(n)})}async function $4(e,n,r){return xe(`/bots/${e}/work/${n}`,{method:"PATCH",body:JSON.stringify(r)})}async function V4(e,n){return xe(`/bots/${e}/work/${n}/start`,{method:"POST"})}async function G4(e,n,r){return xe(`/bots/${e}/work/${n}/complete`,{method:"POST",body:JSON.stringify({result:r})})}async function Y4(e,n,r){return xe(`/bots/${e}/work/${n}/fail`,{method:"POST",body:JSON.stringify({error:r})})}async function Q4(e,n){return xe(`/bots/${e}/work/${n}`,{method:"DELETE"})}async function X4(e,n){return xe(`/bots/${e}/work/${n}/tasks`)}async function J4(e,n){return xe(`/bots/${e}/work/${n}/tasks/ready`)}async function K4(e,n){return xe(`/bots/${e}/tasks/${n}`)}async function Z4(e,n,r){return xe(`/bots/${e}/work/${n}/tasks`,{method:"POST",body:JSON.stringify(r)})}async function W4(e,n,r){return xe(`/bots/${e}/tasks/${n}`,{method:"PATCH",body:JSON.stringify(r)})}async function eS(e,n){return xe(`/bots/${e}/tasks/${n}/start`,{method:"POST"})}async function tS(e,n,r){return xe(`/bots/${e}/tasks/${n}/complete`,{method:"POST",body:JSON.stringify({result:r})})}async function nS(e,n,r){return xe(`/bots/${e}/tasks/${n}/fail`,{method:"POST",body:JSON.stringify({error:r})})}async function aS(e,n){return xe(`/bots/${e}/tasks/${n}`,{method:"DELETE"})}async function sS(e,n){return xe(`/bots/${e}/tasks/${n}/jobs`)}async function rS(e,n){return xe(`/bots/${e}/work/${n}/jobs`)}async function iS(e){return xe(`/bots/${e}/jobs/running`)}async function lS(e,n){return xe(`/bots/${e}/jobs/${n}`)}async function oS(e,n,r,i,o){return xe(`/bots/${e}/jobs/${n}/log`,{method:"POST",body:JSON.stringify({level:r,message:i,data:o})})}async function cS(e,n,r){return xe(`/bots/${e}/jobs/${n}/progress?progress=${r}`,{method:"PATCH"})}async function uS(e,n,r=50){const i=new URLSearchParams;return n&&i.set("status",n),i.set("limit",r.toString()),xe(`/bots/${e}/todos?${i}`)}async function dS(e){return xe(`/bots/${e}/todos/open`)}async function fS(e,n){return xe(`/bots/${e}/todos/${n}`)}async function Qv(e,n){return xe(`/bots/${e}/todos`,{method:"POST",body:JSON.stringify(n)})}async function hS(e,n,r){return xe(`/bots/${e}/todos/${n}`,{method:"PATCH",body:JSON.stringify(r)})}async function mS(e,n){return xe(`/bots/${e}/todos/${n}/done`,{method:"POST"})}async function pS(e,n){return xe(`/bots/${e}/todos/${n}/dismiss`,{method:"POST"})}async function xS(e,n,r){return xe(`/bots/${e}/todos/${n}/convert`,{method:"POST",body:JSON.stringify(r||{})})}async function gS(e,n){return xe(`/bots/${e}/todos/${n}`,{method:"DELETE"})}async function bS(e,n){return null}async function yS(e){return null}async function vS(){return null}async function l0(e,n){const r=await bS();if(r)return r;const i=new URLSearchParams;return e&&i.set("category",e),n&&i.set("search",n),{...await xe(`/marketplace/templates?${i}`),source:"local"}}async function jS(e){const n=await yS();return n||xe(`/marketplace/templates/${e}`)}async function Xv(e){return xe(`/marketplace/templates/${e}/install`,{method:"POST"})}async function Jv(){const e=await vS();return e||xe("/marketplace/categories")}async function Kv(e=!1){return xe(`/update/check?force=${e}`)}async function Zv(e){return xe("/update/apply",{method:"POST",body:JSON.stringify(e||{})})}async function Wv(){return xe("/update/restart",{method:"POST"})}const cm=Object.freeze(Object.defineProperty({__proto__:null,ApiError:a0,analyzeCreationContext:Hv,appendJobLog:oS,applyUpdate:Zv,archivePlatformChat:Vv,checkForUpdate:Kv,checkHealth:s0,clearBotPlatformData:E4,clearChatHistory:w4,clearChatMessages:$v,completeTask:tS,completeWork:G4,convertTodoToWork:xS,createFunction:M4,createSchedule:Yv,createTask:Z4,createTodo:Qv,createWork:F4,deleteBackendBot:qv,deleteFunction:O4,deletePlatformChat:Fv,deleteSchedule:H4,deleteTask:aS,deleteTodo:gS,deleteWork:Q4,dismissTodo:pS,exportBot:S4,failTask:nS,failWork:Y4,generateBotNames:Dv,generateBotNamesWithMeanings:z4,generateFollowUpQuestions:N4,generateFullPrompt:Lv,getActiveWork:I4,getChatHistory:j4,getConfig:Mv,getFunction:A4,getFunctions:T4,getJob:lS,getJobsForTask:sS,getJobsForWork:rS,getMarketplaceCategories:Jv,getMarketplaceTemplate:jS,getMarketplaceTemplates:l0,getOpenTodos:dS,getPlatformChatMessages:Pv,getPlatformChats:Iv,getPlatformChatsIncludingArchived:Gv,getReadyTasks:J4,getRunningJobs:iS,getSchedule:L4,getSchedules:_4,getTask:K4,getTasks:X4,getTodo:fS,getTodos:uS,getWork:q4,getWorkById:P4,importBot:C4,installMarketplaceTemplate:Xv,markTodoDone:mS,previewBot:Uv,refinePrompt:Bv,restartServer:Wv,runFunction:R4,startTask:eS,startWork:V4,streamBotNamesWithMeanings:Rv,streamFollowUpQuestions:_v,suggestPrompt:k4,syncBot:r0,toggleSchedule:U4,unarchivePlatformChat:i0,updateConfig:bu,updateFunction:D4,updateJobProgress:cS,updateSchedule:B4,updateTask:W4,updateTodo:hS,updateWork:$4},Symbol.toStringTag,{value:"Module"})),Ar={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`},wS={id:"default",...Ar,tools:["file_read","file_write","file_list","file_edit","file_info","python_execute","task_complete"],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};function ty(e){e.systemPrompt&&r0({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(n=>{console.warn("Failed to sync bot to backend:",n)})}const Ot=zt()(Ft((e,n)=>({bots:[wS],activeBotId:"default",activeView:"chats",addBot:r=>{e(i=>({bots:[...i.bots,r]})),ty(r)},updateBot:(r,i)=>{e(c=>({bots:c.bots.map(d=>d.id===r?{...d,...i,updatedAt:new Date().toISOString()}:d)}));const o=n().bots.find(c=>c.id===r);o&&ty(o)},deleteBot:r=>{r!=="default"&&(e(i=>{var o;return{bots:i.bots.filter(c=>c.id!==r),activeBotId:i.activeBotId===r?((o=i.bots[0])==null?void 0:o.id)??null:i.activeBotId}}),qv(r).catch(i=>{console.warn("Failed to delete bot from backend:",i)}))},setActiveBot:r=>e({activeBotId:r}),setActiveView:r=>e({activeView:r}),getActiveBot:()=>{const r=n();return r.bots.find(i=>i.id===r.activeBotId)}}),{name:"cachibot-bots"})),mn=zt()(Ft((e,n)=>({chats:[],activeChatId:null,messages:{},thinking:null,toolCalls:[],isLoading:!1,error:null,addChat:r=>e(i=>({chats:[r,...i.chats]})),updateChat:(r,i)=>e(o=>({chats:o.chats.map(c=>c.id===r?{...c,...i,updatedAt:new Date().toISOString()}:c)})),deleteChat:r=>e(i=>{const{[r]:o,...c}=i.messages;return{chats:i.chats.filter(d=>d.id!==r),messages:c,activeChatId:i.activeChatId===r?null:i.activeChatId}}),setActiveChat:r=>e({activeChatId:r}),getChatsByBot:r=>n().chats.filter(o=>o.botId===r).sort((o,c)=>o.pinned&&!c.pinned?-1:!o.pinned&&c.pinned?1:new Date(c.updatedAt).getTime()-new Date(o.updatedAt).getTime()),syncPlatformChats:async r=>{try{const i=await Iv(r);e(o=>{const c=new Set(o.chats.map(m=>m.id)),d=i.filter(m=>!c.has(m.id)).map(m=>({id:m.id,botId:m.botId,title:m.title,createdAt:m.createdAt,updatedAt:m.updatedAt,messageCount:0,pinned:m.pinned,platform:m.platform,platformChatId:m.platformChatId})),f=o.chats.map(m=>{const h=i.find(b=>b.id===m.id);return h?{...m,title:h.title,updatedAt:h.updatedAt,pinned:h.pinned}:m});return{chats:[...d,...f]}})}catch(i){console.warn("Failed to sync platform chats:",i)}},loadPlatformChatMessages:async(r,i)=>{try{const o=await Pv(r,i);e(c=>({messages:{...c.messages,[i]: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(r,i)=>{try{await Vv(r,i),e(o=>({chats:o.chats.filter(c=>c.id!==i),activeChatId:o.activeChatId===i?null:o.activeChatId}))}catch(o){throw console.error("Failed to archive chat:",o),o}},unarchiveChat:async(r,i)=>{try{await i0(r,i),await n().syncPlatformChats(r)}catch(o){throw console.error("Failed to unarchive chat:",o),o}},addMessage:(r,i)=>e(o=>({messages:{...o.messages,[r]:[...o.messages[r]||[],i]}})),updateMessage:(r,i,o)=>e(c=>({messages:{...c.messages,[r]:(c.messages[r]||[]).map(d=>d.id===i?{...d,content:o}:d)}})),updateLastAssistantMessageMetadata:(r,i)=>e(o=>{const c=o.messages[r]||[];let d=-1;for(let f=c.length-1;f>=0;f--)if(c[f].role==="assistant"){d=f;break}return d===-1?o:{messages:{...o.messages,[r]:c.map((f,m)=>m===d?{...f,metadata:{...f.metadata,...i}}:f)}}}),getMessages:r=>n().messages[r]||[],clearMessages:r=>e(i=>({messages:{...i.messages,[r]:[]}})),setThinking:r=>e({thinking:r}),appendThinking:r=>e(i=>({thinking:i.thinking?i.thinking+r:r})),addToolCall:r=>e(i=>({toolCalls:[...i.toolCalls,{...r,startTime:Date.now()}]})),updateToolCall:(r,i,o)=>e(c=>({toolCalls:c.toolCalls.map(d=>d.id===r?{...d,result:i,success:o,endTime:Date.now()}:d)})),clearToolCalls:()=>e({toolCalls:[]}),attachToolCallsToLastMessage:(r,i)=>e(o=>{const c=o.messages[r]||[];let d=-1;for(let f=c.length-1;f>=0;f--)if(c[f].role==="assistant"){d=f;break}return d===-1?o:{messages:{...o.messages,[r]:c.map((f,m)=>m===d?{...f,toolCalls:[...i]}:f)}}}),setLoading:r=>e({isLoading:r}),setError:r=>e({error:r})}),{name:"cachibot-chats",partialize:e=>({chats:e.chats,messages:e.messages})})),um=zt()(Ft((e,n)=>({jobs:[],activeJobId:null,addJob:r=>e(i=>({jobs:[r,...i.jobs]})),updateJob:(r,i)=>e(o=>({jobs:o.jobs.map(c=>c.id===r?{...c,...i}:c)})),deleteJob:r=>e(i=>({jobs:i.jobs.filter(o=>o.id!==r),activeJobId:i.activeJobId===r?null:i.activeJobId})),setActiveJob:r=>e({activeJobId:r}),getJobsByBot:r=>n().jobs.filter(o=>o.botId===r).sort((o,c)=>new Date(c.createdAt).getTime()-new Date(o.createdAt).getTime()),getActiveJobs:r=>n().jobs.filter(o=>o.botId===r&&["pending","running"].includes(o.status))}),{name:"cachibot-jobs"})),Qi=zt()(Ft((e,n)=>({tasks:[],activeTaskId:null,filter:{status:"all",priority:"all"},addTask:r=>e(i=>({tasks:[...i.tasks,r]})),updateTask:(r,i)=>e(o=>({tasks:o.tasks.map(c=>c.id===r?{...c,...i}:c)})),deleteTask:r=>e(i=>({tasks:i.tasks.filter(o=>o.id!==r),activeTaskId:i.activeTaskId===r?null:i.activeTaskId})),setActiveTask:r=>e({activeTaskId:r}),getTasksByBot:r=>{const i=n();let o=i.tasks.filter(f=>f.botId===r);i.filter.status!=="all"&&(o=o.filter(f=>f.status===i.filter.status)),i.filter.priority!=="all"&&(o=o.filter(f=>f.priority===i.filter.priority));const c={todo:0,in_progress:1,blocked:2,done:3},d={high:0,medium:1,low:2};return o.sort((f,m)=>{const h=c[f.status]-c[m.status];return h!==0?h:d[f.priority]-d[m.priority]})},setFilter:r=>e(i=>({filter:{...i.filter,...r}}))}),{name:"cachibot-tasks"})),o0=zt()(Ft((e,n)=>({work:[],activeWorkId:null,filter:{status:"all",priority:"all"},addWork:r=>e(i=>({work:[r,...i.work]})),updateWork:(r,i)=>e(o=>({work:o.work.map(c=>c.id===r?{...c,...i}:c)})),deleteWork:r=>e(i=>({work:i.work.filter(o=>o.id!==r),activeWorkId:i.activeWorkId===r?null:i.activeWorkId})),setActiveWork:r=>e({activeWorkId:r}),getWorkByBot:r=>{const i=n();let o=i.work.filter(d=>d.botId===r);i.filter.status!=="all"&&(o=o.filter(d=>d.status===i.filter.status)),i.filter.priority!=="all"&&(o=o.filter(d=>d.priority===i.filter.priority));const c={urgent:0,high:1,normal:2,low:3};return o.sort((d,f)=>{const m=c[d.priority]-c[f.priority];return m!==0?m:new Date(f.createdAt).getTime()-new Date(d.createdAt).getTime()})},getActiveWork:r=>n().work.filter(o=>o.botId===r&&["pending","in_progress"].includes(o.status)),setFilter:r=>e(i=>({filter:{...i.filter,...r}}))}),{name:"cachibot-work"}));zt()(Ft((e,n)=>({tasks:[],activeTaskId:null,addTask:r=>e(i=>({tasks:[...i.tasks,r]})),addTasks:r=>e(i=>({tasks:[...i.tasks,...r]})),updateTask:(r,i)=>e(o=>({tasks:o.tasks.map(c=>c.id===r?{...c,...i}:c)})),deleteTask:r=>e(i=>({tasks:i.tasks.filter(o=>o.id!==r),activeTaskId:i.activeTaskId===r?null:i.activeTaskId})),setActiveTask:r=>e({activeTaskId:r}),getTasksByWork:r=>n().tasks.filter(o=>o.workId===r).sort((o,c)=>o.order-c.order),getReadyTasks:r=>{const o=n().tasks.filter(d=>d.workId===r),c=new Set(o.filter(d=>d.status==="completed").map(d=>d.id));return o.filter(d=>d.status!=="pending"?!1:d.dependsOn.every(f=>c.has(f)))},clearTasksForWork:r=>e(i=>({tasks:i.tasks.filter(o=>o.workId!==r)}))}),{name:"cachibot-work-tasks"}));zt()(Ft((e,n)=>({jobs:[],activeJobId:null,addJob:r=>e(i=>({jobs:[r,...i.jobs]})),updateJob:(r,i)=>e(o=>({jobs:o.jobs.map(c=>c.id===r?{...c,...i}:c)})),appendLog:(r,i,o,c)=>e(d=>({jobs:d.jobs.map(f=>f.id===r?{...f,logs:[...f.logs,{timestamp:new Date().toISOString(),level:i,message:o,data:c}]}:f)})),deleteJob:r=>e(i=>({jobs:i.jobs.filter(o=>o.id!==r),activeJobId:i.activeJobId===r?null:i.activeJobId})),setActiveJob:r=>e({activeJobId:r}),getJobsByTask:r=>n().jobs.filter(o=>o.taskId===r).sort((o,c)=>o.attempt-c.attempt),getJobsByWork:r=>n().jobs.filter(o=>o.workId===r).sort((o,c)=>new Date(c.createdAt).getTime()-new Date(o.createdAt).getTime()),getRunningJobs:r=>n().jobs.filter(o=>!(o.status!=="running"||r&&o.botId!==r)),clearJobsForWork:r=>e(i=>({jobs:i.jobs.filter(o=>o.workId!==r)}))}),{name:"cachibot-work-jobs"}));zt()(Ft((e,n)=>({todos:[],activeTodoId:null,filter:{status:"all",priority:"all"},addTodo:r=>e(i=>({todos:[r,...i.todos]})),updateTodo:(r,i)=>e(o=>({todos:o.todos.map(c=>c.id===r?{...c,...i}:c)})),deleteTodo:r=>e(i=>({todos:i.todos.filter(o=>o.id!==r),activeTodoId:i.activeTodoId===r?null:i.activeTodoId})),setActiveTodo:r=>e({activeTodoId:r}),getTodosByBot:r=>{const i=n();let o=i.todos.filter(d=>d.botId===r);i.filter.status!=="all"&&(o=o.filter(d=>d.status===i.filter.status)),i.filter.priority!=="all"&&(o=o.filter(d=>d.priority===i.filter.priority));const c={urgent:0,high:1,normal:2,low:3};return o.sort((d,f)=>{const m=c[d.priority]-c[f.priority];return m!==0?m:new Date(f.createdAt).getTime()-new Date(d.createdAt).getTime()})},getOpenTodos:r=>n().todos.filter(o=>o.botId===r&&o.status==="open"),markDone:r=>e(i=>({todos:i.todos.map(o=>o.id===r?{...o,status:"done",completedAt:new Date().toISOString()}:o)})),markConverted:(r,i,o)=>e(c=>({todos:c.todos.map(d=>d.id===r?{...d,status:"done",completedAt:new Date().toISOString(),convertedToWorkId:i,convertedToTaskId:o}:d)})),setFilter:r=>e(i=>({filter:{...i.filter,...r}}))}),{name:"cachibot-todos"}));zt()(Ft((e,n)=>({functions:[],activeFunctionId:null,addFunction:r=>e(i=>({functions:[...i.functions,r]})),updateFunction:(r,i)=>e(o=>({functions:o.functions.map(c=>c.id===r?{...c,...i,updatedAt:new Date().toISOString()}:c)})),deleteFunction:r=>e(i=>({functions:i.functions.filter(o=>o.id!==r),activeFunctionId:i.activeFunctionId===r?null:i.activeFunctionId})),setActiveFunction:r=>e({activeFunctionId:r}),getFunctionsByBot:r=>n().functions.filter(o=>o.botId===r).sort((o,c)=>o.name.localeCompare(c.name)),incrementRunCount:(r,i)=>e(o=>({functions:o.functions.map(c=>{if(c.id!==r)return c;const d=c.runCount+1,h=(c.runCount*c.successRate+(i?1:0))/d;return{...c,runCount:d,successRate:h,lastRunAt:new Date().toISOString(),updatedAt:new Date().toISOString()}})}))}),{name:"cachibot-functions"}));const e2=zt()(Ft((e,n)=>({schedules:[],activeScheduleId:null,addSchedule:r=>e(i=>({schedules:[...i.schedules,r]})),updateSchedule:(r,i)=>e(o=>({schedules:o.schedules.map(c=>c.id===r?{...c,...i,updatedAt:new Date().toISOString()}:c)})),deleteSchedule:r=>e(i=>({schedules:i.schedules.filter(o=>o.id!==r),activeScheduleId:i.activeScheduleId===r?null:i.activeScheduleId})),setActiveSchedule:r=>e({activeScheduleId:r}),getSchedulesByBot:r=>n().schedules.filter(o=>o.botId===r).sort((o,c)=>o.name.localeCompare(c.name)),getEnabledSchedules:r=>n().schedules.filter(o=>!(!o.enabled||r&&o.botId!==r)),toggleEnabled:r=>e(i=>({schedules:i.schedules.map(o=>o.id===r?{...o,enabled:!o.enabled,updatedAt:new Date().toISOString()}:o)})),recordRun:(r,i)=>e(o=>({schedules:o.schedules.map(c=>c.id===r?{...c,runCount:c.runCount+1,lastRunAt:new Date().toISOString(),nextRunAt:i||c.nextRunAt,updatedAt:new Date().toISOString()}:c)}))}),{name:"cachibot-schedules"})),Gu={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"}}},Rt=zt()(Ft(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:n=>e({theme:n}),setAccentColor:n=>e({accentColor:n}),toggleTheme:()=>e(n=>({theme:n.theme==="light"?"dark":"light"})),setSidebarCollapsed:n=>e({sidebarCollapsed:n}),toggleSidebar:()=>e(n=>({sidebarCollapsed:!n.sidebarCollapsed})),setMobileMenuOpen:n=>e({mobileMenuOpen:n}),toggleMobileMenu:()=>e(n=>({mobileMenuOpen:!n.mobileMenuOpen})),setSettingsOpen:n=>e({settingsOpen:n}),setBotSettingsOpen:n=>e({botSettingsOpen:n}),setCreateBotOpen:n=>e({createBotOpen:n}),setCommandPaletteOpen:n=>e({commandPaletteOpen:n}),setShowThinking:n=>e({showThinking:n}),setShowCost:n=>e({showCost:n}),setSettingsSection:n=>e({settingsSection:n}),setWorkSection:n=>e({workSection:n}),setScheduleSection:n=>e({scheduleSection:n})}),{name:"cachibot-ui",partialize:e=>({theme:e.theme,accentColor:e.accentColor,sidebarCollapsed:e.sidebarCollapsed,showThinking:e.showThinking,showCost:e.showCost})})),zS={shield:Na,bot:ya,brain:Li,zap:Pr,flame:F5,gem:V5,rocket:vv,target:Wm,laptop:X5,"bar-chart":ku,sparkles:xn,star:Yi,cpu:W1,ghost:G5,palette:Mo,"pen-tool":s4,code:qa,terminal:$u};function ca({icon:e,className:n,size:r=24,color:i}){const o=zS[e]||Na;return s.jsx(o,{className:n,size:r,style:i?{color:i}:void 0})}const t2=[{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 n2(e){var n,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(n=0;n<o;n++)e[n]&&(r=n2(e[n]))&&(i&&(i+=" "),i+=r)}else for(r in e)e[r]&&(i&&(i+=" "),i+=r);return i}function NS(){for(var e,n,r=0,i="",o=arguments.length;r<o;r++)(e=arguments[r])&&(n=n2(e))&&(i&&(i+=" "),i+=n);return i}const c0="-",kS=e=>{const n=CS(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:d=>{const f=d.split(c0);return f[0]===""&&f.length!==1&&f.shift(),a2(f,n)||SS(d)},getConflictingClassGroupIds:(d,f)=>{const m=r[d]||[];return f&&i[d]?[...m,...i[d]]:m}}},a2=(e,n)=>{var d;if(e.length===0)return n.classGroupId;const r=e[0],i=n.nextPart.get(r),o=i?a2(e.slice(1),i):void 0;if(o)return o;if(n.validators.length===0)return;const c=e.join(c0);return(d=n.validators.find(({validator:f})=>f(c)))==null?void 0:d.classGroupId},ny=/^\[(.+)\]$/,SS=e=>{if(ny.test(e)){const n=ny.exec(e)[1],r=n==null?void 0:n.substring(0,n.indexOf(":"));if(r)return"arbitrary.."+r}},CS=e=>{const{theme:n,prefix:r}=e,i={nextPart:new Map,validators:[]};return TS(Object.entries(e.classGroups),r).forEach(([c,d])=>{dm(d,i,c,n)}),i},dm=(e,n,r,i)=>{e.forEach(o=>{if(typeof o=="string"){const c=o===""?n:ay(n,o);c.classGroupId=r;return}if(typeof o=="function"){if(ES(o)){dm(o(i),n,r,i);return}n.validators.push({validator:o,classGroupId:r});return}Object.entries(o).forEach(([c,d])=>{dm(d,ay(n,c),r,i)})})},ay=(e,n)=>{let r=e;return n.split(c0).forEach(i=>{r.nextPart.has(i)||r.nextPart.set(i,{nextPart:new Map,validators:[]}),r=r.nextPart.get(i)}),r},ES=e=>e.isThemeGetter,TS=(e,n)=>n?e.map(([r,i])=>{const o=i.map(c=>typeof c=="string"?n+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,f])=>[n+d,f])):c);return[r,o]}):e,AS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,r=new Map,i=new Map;const o=(c,d)=>{r.set(c,d),n++,n>e&&(n=0,i=r,r=new Map)};return{get(c){let d=r.get(c);if(d!==void 0)return d;if((d=i.get(c))!==void 0)return o(c,d),d},set(c,d){r.has(c)?r.set(c,d):o(c,d)}}},s2="!",MS=e=>{const{separator:n,experimentalParseClassName:r}=e,i=n.length===1,o=n[0],c=n.length,d=f=>{const m=[];let h=0,b=0,g;for(let z=0;z<f.length;z++){let j=f[z];if(h===0){if(j===o&&(i||f.slice(z,z+c)===n)){m.push(f.slice(b,z)),b=z+c;continue}if(j==="/"){g=z;continue}}j==="["?h++:j==="]"&&h--}const v=m.length===0?f:f.substring(b),y=v.startsWith(s2),k=y?v.substring(1):v,C=g&&g>b?g-b:void 0;return{modifiers:m,hasImportantModifier:y,baseClassName:k,maybePostfixModifierPosition:C}};return r?f=>r({className:f,parseClassName:d}):d},DS=e=>{if(e.length<=1)return e;const n=[];let r=[];return e.forEach(i=>{i[0]==="["?(n.push(...r.sort(),i),r=[]):r.push(i)}),n.push(...r.sort()),n},OS=e=>({cache:AS(e.cacheSize),parseClassName:MS(e),...kS(e)}),RS=/\s+/,_S=(e,n)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:o}=n,c=[],d=e.trim().split(RS);let f="";for(let m=d.length-1;m>=0;m-=1){const h=d[m],{modifiers:b,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:y}=r(h);let k=!!y,C=i(k?v.substring(0,y):v);if(!C){if(!k){f=h+(f.length>0?" "+f:f);continue}if(C=i(v),!C){f=h+(f.length>0?" "+f:f);continue}k=!1}const z=DS(b).join(":"),j=g?z+s2:z,E=j+C;if(c.includes(E))continue;c.push(E);const N=o(C,k);for(let M=0;M<N.length;++M){const R=N[M];c.push(j+R)}f=h+(f.length>0?" "+f:f)}return f};function LS(){let e=0,n,r,i="";for(;e<arguments.length;)(n=arguments[e++])&&(r=r2(n))&&(i&&(i+=" "),i+=r);return i}const r2=e=>{if(typeof e=="string")return e;let n,r="";for(let i=0;i<e.length;i++)e[i]&&(n=r2(e[i]))&&(r&&(r+=" "),r+=n);return r};function BS(e,...n){let r,i,o,c=d;function d(m){const h=n.reduce((b,g)=>g(b),e());return r=OS(h),i=r.cache.get,o=r.cache.set,c=f,f(m)}function f(m){const h=i(m);if(h)return h;const b=_S(m,r);return o(m,b),b}return function(){return c(LS.apply(null,arguments))}}const xt=e=>{const n=r=>r[e]||[];return n.isThemeGetter=!0,n},i2=/^\[(?:([a-z-]+):)?(.+)\]$/i,US=/^\d+\/\d+$/,HS=new Set(["px","full","screen"]),qS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,IS=/\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$/,PS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,FS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$S=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cs=e=>Bi(e)||HS.has(e)||US.test(e),Ys=e=>nl(e,"length",ZS),Bi=e=>!!e&&!Number.isNaN(Number(e)),zh=e=>nl(e,"number",Bi),to=e=>!!e&&Number.isInteger(Number(e)),VS=e=>e.endsWith("%")&&Bi(e.slice(0,-1)),Le=e=>i2.test(e),Qs=e=>qS.test(e),GS=new Set(["length","size","percentage"]),YS=e=>nl(e,GS,l2),QS=e=>nl(e,"position",l2),XS=new Set(["image","url"]),JS=e=>nl(e,XS,e3),KS=e=>nl(e,"",WS),no=()=>!0,nl=(e,n,r)=>{const i=i2.exec(e);return i?i[1]?typeof n=="string"?i[1]===n:n.has(i[1]):r(i[2]):!1},ZS=e=>IS.test(e)&&!PS.test(e),l2=()=>!1,WS=e=>FS.test(e),e3=e=>$S.test(e),t3=()=>{const e=xt("colors"),n=xt("spacing"),r=xt("blur"),i=xt("brightness"),o=xt("borderColor"),c=xt("borderRadius"),d=xt("borderSpacing"),f=xt("borderWidth"),m=xt("contrast"),h=xt("grayscale"),b=xt("hueRotate"),g=xt("invert"),v=xt("gap"),y=xt("gradientColorStops"),k=xt("gradientColorStopPositions"),C=xt("inset"),z=xt("margin"),j=xt("opacity"),E=xt("padding"),N=xt("saturate"),M=xt("scale"),R=xt("sepia"),A=xt("skew"),F=xt("space"),ee=xt("translate"),Z=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",Le,n],Y=()=>[Le,n],me=()=>["",cs,Ys],_=()=>["auto",Bi,Le],q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],oe=()=>["start","end","center","between","around","evenly","stretch"],ue=()=>["","0",Le],O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[Bi,Le];return{cacheSize:500,separator:":",theme:{colors:[no],spacing:[cs,Ys],blur:["none","",Qs,Le],brightness:U(),borderColor:[e],borderRadius:["none","","full",Qs,Le],borderSpacing:Y(),borderWidth:me(),contrast:U(),grayscale:ue(),hueRotate:U(),invert:ue(),gap:Y(),gradientColorStops:[e],gradientColorStopPositions:[VS,Ys],inset:P(),margin:P(),opacity:U(),padding:Y(),saturate:U(),scale:U(),sepia:ue(),skew:U(),space:Y(),translate:Y()},classGroups:{aspect:[{aspect:["auto","square","video",Le]}],container:["container"],columns:[{columns:[Qs]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],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:[...q(),Le]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[C]}],"inset-x":[{"inset-x":[C]}],"inset-y":[{"inset-y":[C]}],start:[{start:[C]}],end:[{end:[C]}],top:[{top:[C]}],right:[{right:[C]}],bottom:[{bottom:[C]}],left:[{left:[C]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",to,Le]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Le]}],grow:[{grow:ue()}],shrink:[{shrink:ue()}],order:[{order:["first","last","none",to,Le]}],"grid-cols":[{"grid-cols":[no]}],"col-start-end":[{col:["auto",{span:["full",to,Le]},Le]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[no]}],"row-start-end":[{row:["auto",{span:[to,Le]},Le]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Le]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...oe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...oe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...oe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[z]}],mx:[{mx:[z]}],my:[{my:[z]}],ms:[{ms:[z]}],me:[{me:[z]}],mt:[{mt:[z]}],mr:[{mr:[z]}],mb:[{mb:[z]}],ml:[{ml:[z]}],"space-x":[{"space-x":[F]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[F]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Le,n]}],"min-w":[{"min-w":[Le,n,"min","max","fit"]}],"max-w":[{"max-w":[Le,n,"none","full","min","max","fit","prose",{screen:[Qs]},Qs]}],h:[{h:[Le,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Le,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Le,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Le,n,"auto","min","max","fit"]}],"font-size":[{text:["base",Qs,Ys]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",zh]}],"font-family":[{font:[no]}],"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",Le]}],"line-clamp":[{"line-clamp":["none",Bi,zh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",cs,Le]}],"list-image":[{"list-image":["none",Le]}],"list-style-type":[{list:["none","disc","decimal",Le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",cs,Ys]}],"underline-offset":[{"underline-offset":["auto",cs,Le]}],"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:Y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le]}],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",Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...q(),QS]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",YS]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},JS]}],"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:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"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":[j]}],"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":[j]}],"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":[cs,Le]}],"outline-w":[{outline:[cs,Ys]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[cs,Ys]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Qs,KS]}],"shadow-color":[{shadow:[no]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[i]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",Qs,Le]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[g]}],saturate:[{saturate:[N]}],sepia:[{sepia:[R]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[R]}],"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",Le]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",Le]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",Le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[M]}],"scale-x":[{"scale-x":[M]}],"scale-y":[{"scale-y":[M]}],rotate:[{rotate:[to,Le]}],"translate-x":[{"translate-x":[ee]}],"translate-y":[{"translate-y":[ee]}],"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",Le]}],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",Le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Y()}],"scroll-mx":[{"scroll-mx":Y()}],"scroll-my":[{"scroll-my":Y()}],"scroll-ms":[{"scroll-ms":Y()}],"scroll-me":[{"scroll-me":Y()}],"scroll-mt":[{"scroll-mt":Y()}],"scroll-mr":[{"scroll-mr":Y()}],"scroll-mb":[{"scroll-mb":Y()}],"scroll-ml":[{"scroll-ml":Y()}],"scroll-p":[{"scroll-p":Y()}],"scroll-px":[{"scroll-px":Y()}],"scroll-py":[{"scroll-py":Y()}],"scroll-ps":[{"scroll-ps":Y()}],"scroll-pe":[{"scroll-pe":Y()}],"scroll-pt":[{"scroll-pt":Y()}],"scroll-pr":[{"scroll-pr":Y()}],"scroll-pb":[{"scroll-pb":Y()}],"scroll-pl":[{"scroll-pl":Y()}],"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",Le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[cs,Ys,zh]}],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"]}}},n3=BS(t3);function ne(...e){return n3(NS(e))}const a3=["/dashboard","/settings"];function s3({onNavigate:e}){const n=Rn(),r=za(),{bots:i,activeBotId:o,setActiveBot:c}=Ot(),{setActiveChat:d}=mn(),{setCreateBotOpen:f}=Rt(),m=r.pathname,h=a3.some(v=>m===v||m.startsWith(v+"/")),b=v=>{c(v),d(null),n(`/${v}/chats`),e==null||e()},g=v=>{n(m===v?"/":v),e==null||e()};return s.jsxs("div",{className:"flex h-full w-[72px] flex-col items-center bg-zinc-200 py-3 dark:bg-zinc-950",children:[s.jsxs("div",{className:"flex flex-col items-center gap-2 pb-3",children:[s.jsxs("button",{onClick:()=>g("/dashboard"),className:ne("group relative flex h-12 w-12 items-center justify-center rounded-[24px] transition-all duration-200 hover:rounded-[16px]",m==="/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:[s.jsx(J5,{className:"h-5 w-5"}),s.jsx(ho,{children:"Dashboard"})]}),s.jsx(sy,{})]}),s.jsxs("div",{className:"flex flex-1 flex-col items-center gap-2 overflow-y-auto scrollbar-none",children:[i.map(v=>s.jsx(r3,{bot:v,active:v.id===o&&!h&&m.startsWith(`/${v.id}/`),onClick:()=>b(v.id)},v.id)),s.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:[s.jsx(Dn,{className:"h-5 w-5"}),s.jsx(ho,{children:"Create Bot"})]})]}),s.jsxs("div",{className:"mt-auto flex flex-col items-center gap-2 pt-3",children:[s.jsx(sy,{}),s.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:[s.jsx(Y5,{className:"h-5 w-5"}),s.jsx(ho,{children:"GitHub"})]}),s.jsxs("button",{onClick:()=>g("/settings"),className:ne("group relative flex h-12 w-12 items-center justify-center rounded-full transition-colors",m==="/settings"||m.startsWith("/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:[s.jsx(Oo,{className:"h-5 w-5"}),s.jsx(ho,{children:"Settings"})]})]})]})}function r3({bot:e,active:n,onClick:r}){return s.jsxs("button",{onClick:r,className:"group relative",children:[s.jsx("div",{className:ne("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",n?"h-10":"h-0 group-hover:h-5")}),s.jsx("div",{className:ne("flex h-12 w-12 items-center justify-center transition-all duration-200",n?"rounded-[16px]":"rounded-[24px] group-hover:rounded-[16px]"),style:{backgroundColor:e.color+"30"},children:s.jsx(ca,{icon:e.icon,className:"h-6 w-6",size:24})}),s.jsx(ho,{children:e.name})]})}function ho({children:e}){return s.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,s.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 sy(){return s.jsx("div",{className:"h-px w-8 bg-zinc-300 dark:bg-zinc-800"})}const fm={"file-text":bs,"file-pen":rv,"folder-open":qu,"file-search":lv,"file-scan":iv,"trash-2":Pt,code:qa,terminal:$u,globe:$m,search:On,database:Ao,wrench:qr,"check-circle":tl,send:jo,"message-circle":Ur,briefcase:qm,"list-todo":hv,"list-checks":Ym,"circle-check":xs,"clipboard-plus":Z1,"clipboard-list":K1,"git-branch":cv,"git-commit-horizontal":uv,"git-pull-request":dv,diff:tv,history:Vm,"file-terminal":ov,network:gv,"file-archive":sv,"folder-archive":fo,table:zv,"database-zap":ev,folder:$5},i3={file_read:bs,file_write:rv,file_list:qu,file_edit:lv,file_info:iv,file_delete:Pt,python_execute:qa,shell_execute:$u,shell_which:ov,git_status:dv,git_diff:tv,git_log:Vm,git_commit:uv,git_branch:cv,web_fetch:$m,web_search:On,http_request:gv,sqlite_query:Ao,sqlite_execute:ev,sqlite_tables:zv,zip_create:fo,zip_extract:fo,zip_list:sv,tar_create:fo,tar_extract:fo,task_complete:tl,telegram_send:jo,discord_send:Ur,work_create:qm,work_list:K1,work_update:Z1,todo_create:hv,todo_list:Ym,todo_done:xs};function u0({toolId:e,icon:n,className:r,size:i=20}){const o=n&&fm[n]||i3[e]||qr;return s.jsx(o,{className:r,size:i})}function l3(e){return e&&fm[e]?fm[e]:qr}const o3=[{id:"chats",label:"Chats",icon:ir},{id:"tasks",label:"Tasks",icon:jv},{id:"work",label:"Work",icon:Fm},{id:"schedules",label:"Schedules",icon:Im},{id:"tools",label:"Tools",icon:qr},{id:"settings",label:"Settings",icon:Oo}];function c3({onNavigate:e}){const n=Rn(),{getActiveBot:r,activeView:i,setActiveView:o,activeBotId:c}=Ot(),{sidebarCollapsed:d}=Rt(),f=r();if(!f)return null;const m=h=>{o(h),n(`/${c}/${h}`)};return s.jsxs("aside",{className:ne("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:[s.jsxs("div",{className:"flex h-14 items-center gap-3 border-b border-zinc-300 px-4 dark:border-zinc-800",children:[s.jsx("div",{className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:f.color+"20"},children:s.jsx(ca,{icon:f.icon,size:18})}),!d&&s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"truncate text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:f.name}),s.jsx("p",{className:"truncate text-xs text-zinc-500",children:f.model})]})]}),s.jsx("nav",{className:"flex items-center justify-center gap-1 border-b border-zinc-300 px-3 py-2 dark:border-zinc-800",children:o3.map(h=>s.jsx(u3,{icon:h.icon,label:h.label,active:i===h.id,onClick:()=>m(h.id)},h.id))}),s.jsxs("div",{className:"flex-1 overflow-hidden",children:[i==="chats"&&s.jsx(d3,{botId:f.id,collapsed:d,onNavigate:e}),i==="tasks"&&s.jsx(f3,{botId:f.id,collapsed:d,onNavigate:e}),i==="work"&&s.jsx(h3,{botId:f.id,collapsed:d}),i==="schedules"&&s.jsx(m3,{botId:f.id,collapsed:d}),i==="tools"&&s.jsx(p3,{botId:f.id,collapsed:d}),i==="settings"&&s.jsx(x3,{collapsed:d})]})]})}function u3({icon:e,label:n,active:r,onClick:i}){return s.jsxs("button",{onClick:i,title:n,className:ne("group relative flex h-8 w-8 items-center justify-center rounded-lg transition-all",r?"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:[s.jsx(e,{className:"h-4 w-4"}),s.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:n})]})}function d3({botId:e,collapsed:n,onNavigate:r}){const i=Rn(),{getChatsByBot:o,activeChatId:c,setActiveChat:d,addChat:f,updateChat:m,deleteChat:h,clearMessages:b,syncPlatformChats:g,loadPlatformChatMessages:v,archiveChat:y}=mn(),[k,C]=S.useState(""),[z,j]=S.useState(null);S.useEffect(()=>{g(e);const A=setInterval(()=>g(e),6e4);return()=>clearInterval(A)},[e,g]);const E=o(e).filter(A=>!k||A.title.toLowerCase().includes(k.toLowerCase())),N=A=>A.platform==="telegram"?s.jsx(Ur,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-blue-400"}):A.platform==="discord"?s.jsx(Ur,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-indigo-400"}):s.jsx(ir,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-zinc-500"}),M=()=>{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),i(`/${e}/chats/${A.id}`),r==null||r()},R=async A=>{d(A.id),A.platform&&await v(e,A.id);const F=A.platform?A.platform:A.id;i(`/${e}/chats/${F}`),r==null||r()};return n?s.jsx("div",{className:"flex flex-col items-center gap-2 p-2",children:s.jsx("button",{onClick:M,className:"flex h-10 w-10 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:s.jsx(Dn,{className:"h-4 w-4"})})}):s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsxs("div",{className:"flex gap-2 p-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(On,{className:"absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),s.jsx("input",{type:"text",placeholder:"Search chats...",value:k,onChange:A=>C(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"})]}),s.jsx("button",{onClick:M,className:"flex h-9 w-9 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:s.jsx(Dn,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto px-2 pb-2",children:E.length===0?s.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:k?"No chats found":"No chats yet"}):s.jsx("div",{className:"space-y-1",children:E.map(A=>s.jsxs("div",{className:"group relative",children:[s.jsxs("button",{onClick:()=>R(A),className:ne("flex w-full items-start gap-3 rounded-lg px-3 py-2.5 text-left transition-colors",c===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:[N(A),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:A.title}),A.pinned&&s.jsx(Zb,{className:"h-3 w-3 flex-shrink-0 text-cachi-500"}),A.platform&&s.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&&s.jsx("p",{className:"truncate text-xs text-zinc-500",children:A.lastMessage})]})]}),s.jsx("button",{onClick:F=>{F.stopPropagation(),j(z===A.id?null:A.id)},className:ne("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",z===A.id&&"opacity-100"),children:s.jsx(av,{className:"h-4 w-4"})}),z===A.id&&s.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:[s.jsxs("button",{onClick:()=>{m(A.id,{pinned:!A.pinned}),j(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:[s.jsx(Zb,{className:"h-4 w-4"}),A.pinned?"Unpin":"Pin"]}),A.platform?s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:async()=>{j(null);try{await $v(e,A.id),b(A.id),Re.success("Messages cleared")}catch{Re.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:[s.jsx(H5,{className:"h-4 w-4"}),"Clear Messages"]}),s.jsxs("button",{onClick:async()=>{j(null);try{await y(e,A.id),Re.success("Chat archived")}catch{Re.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:[s.jsx(sm,{className:"h-4 w-4"}),"Archive Chat"]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{onClick:()=>{m(A.id,{archived:!0}),j(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:[s.jsx(sm,{className:"h-4 w-4"}),"Archive"]}),s.jsx("div",{className:"my-1 h-px bg-zinc-300 dark:bg-zinc-700"}),s.jsxs("button",{onClick:()=>{h(A.id),j(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:[s.jsx(Pt,{className:"h-4 w-4"}),"Delete"]})]})]})]},A.id))})})]})}function f3({botId:e,collapsed:n,onNavigate:r}){const{getTasksByBot:i,activeTaskId:o,setActiveTask:c,addTask:d,updateTask:f}=Qi(),m=i(e),h=g=>{switch(g){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"}},b=()=>{const g={id:crypto.randomUUID(),botId:e,title:"New Task",status:"todo",priority:"medium",tags:[],createdAt:new Date().toISOString()};d(g),c(g.id),r==null||r()};if(n){const g=m.filter(v=>v.status==="todo").length;return s.jsxs("div",{className:"flex flex-col items-center gap-2 p-2",children:[s.jsx("button",{onClick:b,className:"flex h-10 w-10 items-center justify-center rounded-lg bg-cachi-600 text-white hover:bg-cachi-500",children:s.jsx(Dn,{className:"h-4 w-4"})}),g>0&&s.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:g})]})}return s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx("div",{className:"p-3",children:s.jsxs("button",{onClick:b,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:[s.jsx(Dn,{className:"h-4 w-4"}),"Add Task"]})}),s.jsx("div",{className:"flex-1 overflow-y-auto px-2 pb-2",children:m.length===0?s.jsx("div",{className:"py-8 text-center text-sm text-zinc-500",children:"No tasks yet"}):s.jsx("div",{className:"space-y-2",children:m.map(g=>s.jsxs("button",{onClick:()=>{c(g.id),r==null||r()},className:ne("flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors",o===g.id&&"ring-1 ring-cachi-500",h(g.status)),children:[s.jsx("button",{onClick:v=>{v.stopPropagation(),f(g.id,{status:g.status==="done"?"todo":"done",completedAt:g.status==="done"?void 0:new Date().toISOString()})},className:ne("mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border transition-colors",g.status==="done"?"border-green-500 bg-green-500 text-white":"border-zinc-500 hover:border-cachi-500"),children:g.status==="done"&&"✓"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:ne("text-sm",g.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:g.title}),g.tags.length>0&&s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:g.tags.map(v=>s.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:v},v))})]})]},g.id))})})]})}const ry=[{id:"overview",label:"Overview",icon:Fm},{id:"active",label:"Active",icon:Iu},{id:"completed",label:"Completed",icon:xs},{id:"history",label:"History",icon:Vm}];function h3({botId:e,collapsed:n}){const{workSection:r,setWorkSection:i}=Rt(),{getWorkByBot:o,getActiveWork:c}=o0(),d=o(e),f=c(e);return n?s.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:ry.map(m=>s.jsx("button",{onClick:()=>i(m.id),className:ne("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",r===m.id?"bg-blue-600/20 text-blue-400":"text-zinc-400 hover:bg-zinc-800"),title:m.label,children:s.jsx(m.icon,{className:"h-5 w-5"})},m.id))}):s.jsx("div",{className:"flex h-full flex-col p-3",children:s.jsx("div",{className:"space-y-1",children:ry.map(m=>{let h;return m.id==="active"&&(h=f.length),m.id==="completed"&&(h=d.filter(b=>b.status==="completed").length),m.id==="history"&&(h=d.length),s.jsxs("button",{onClick:()=>i(m.id),className:ne("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",r===m.id?"bg-blue-600/20 text-blue-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[s.jsx(m.icon,{className:"h-5 w-5"}),s.jsx("span",{className:"flex-1 text-sm",children:m.label}),h!==void 0&&h>0&&s.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:h})]},m.id)})})})}const iy=[{id:"all",label:"All Schedules",icon:Im},{id:"enabled",label:"Enabled",icon:Iu},{id:"disabled",label:"Disabled",icon:bv},{id:"create",label:"Create New",icon:Dn}];function m3({botId:e,collapsed:n}){const{scheduleSection:r,setScheduleSection:i}=Rt(),{getSchedulesByBot:o,getEnabledSchedules:c}=e2(),d=o(e),f=c(e);return n?s.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:iy.map(m=>s.jsx("button",{onClick:()=>i(m.id),className:ne("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",r===m.id?"bg-purple-600/20 text-purple-400":"text-zinc-400 hover:bg-zinc-800"),title:m.label,children:s.jsx(m.icon,{className:"h-5 w-5"})},m.id))}):s.jsx("div",{className:"flex h-full flex-col p-3",children:s.jsx("div",{className:"space-y-1",children:iy.map(m=>{let h;return m.id==="all"&&(h=d.length),m.id==="enabled"&&(h=f.length),m.id==="disabled"&&(h=d.length-f.length),s.jsxs("button",{onClick:()=>i(m.id),className:ne("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",r===m.id?"bg-purple-600/20 text-purple-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[s.jsx(m.icon,{className:"h-5 w-5"}),s.jsx("span",{className:"flex-1 text-sm",children:m.label}),h!==void 0&&h>0&&s.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:h})]},m.id)})})})}function p3({collapsed:e}){const{getActiveBot:n}=Ot(),r=n(),i=(r==null?void 0:r.tools)||[];return e?s.jsx("div",{className:"flex flex-col items-center p-2",children:s.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:i.length})}):s.jsx("div",{className:"flex h-full flex-col p-3",children:s.jsx("div",{className:"space-y-2",children:i.map(o=>s.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-700 bg-zinc-800/30 p-3",children:[s.jsx(u0,{toolId:o,className:"h-5 w-5 text-zinc-400"}),s.jsx("span",{className:"text-sm capitalize text-zinc-300",children:o.replace(/_/g," ")})]},o))})})}const ly=[{id:"general",label:"General",icon:ya},{id:"knowledge",label:"Knowledge",icon:J1},{id:"skills",label:"Skills",icon:xn},{id:"connections",label:"Connections",icon:Xm},{id:"advanced",label:"Advanced",icon:Fu},{id:"danger",label:"Danger Zone",icon:Hr,danger:!0}];function x3({collapsed:e}){const{settingsSection:n,setSettingsSection:r}=Rt();return e?s.jsx("div",{className:"flex flex-col items-center gap-1 p-2",children:ly.map(i=>s.jsx("button",{onClick:()=>r(i.id),className:ne("flex h-10 w-10 items-center justify-center rounded-lg transition-colors",n===i.id?"bg-cachi-600/20 text-cachi-400":i.danger?"text-red-400/70 hover:bg-red-500/10":"text-zinc-400 hover:bg-zinc-800"),title:i.label,children:s.jsx(i.icon,{className:"h-5 w-5"})},i.id))}):s.jsx("div",{className:"flex h-full flex-col p-3",children:s.jsx("div",{className:"space-y-1",children:ly.map(i=>s.jsxs("button",{onClick:()=>r(i.id),className:ne("flex w-full items-center gap-3 rounded-lg p-3 text-left transition-colors",n===i.id?"bg-cachi-600/20 text-cachi-400":i.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:[s.jsx(i.icon,{className:"h-5 w-5"}),s.jsx("span",{className:"text-sm",children:i.label})]},i.id))})})}const ru={name:null,nameSuggestions:[],purposeCategory:null,purposeDescription:null,communicationStyle:null,useEmojis:null,detectedLanguage:null},g3=zt()(Ft((e,n)=>({step:"idle",data:{...ru},flowChatId:null,isLoadingNames:!1,createdBotId:null,startFlow:r=>{e({step:"name",data:{...ru},flowChatId:r,isLoadingNames:!1})},setName:r=>{const i=Ot.getState().bots,o=r.toLowerCase().trim();if(i.some(d=>d.name.toLowerCase()===o))throw new Error(`A bot named "${r}" already exists. Please choose a different name.`);e(d=>({step:"purpose-category",data:{...d.data,name:r.trim()}}))},setNameSuggestions:r=>{e(i=>({data:{...i.data,nameSuggestions:r}}))},setPurposeCategory:r=>{e(i=>({step:"purpose-description",data:{...i.data,purposeCategory:r}}))},setPurposeDescription:r=>{e(i=>({step:"style",data:{...i.data,purposeDescription:r}}))},setStyle:r=>{e(i=>({step:"emoji",data:{...i.data,communicationStyle:r}}))},setEmoji:r=>{e(i=>({step:"summary",data:{...i.data,useEmojis:r}}))},setDetectedLanguage:r=>{e(i=>({data:{...i.data,detectedLanguage:r}}))},confirmAndCreate:()=>n().data,completeFlow:r=>{e({step:"idle",data:{...ru},flowChatId:null,isLoadingNames:!1,createdBotId:r||null})},cancelFlow:()=>{e({step:"idle",data:{...ru},flowChatId:null,isLoadingNames:!1,createdBotId:null})},setLoadingNames:r=>{e({isLoadingNames:r})},getFlowData:()=>({...n().data})}),{name:"cachibot-creation-flow",partialize:e=>({step:e.step,data:e.data,flowChatId:e.flowChatId})}));function b3(e,n){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const y3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,v3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,j3={};function oy(e,n){return(j3.jsx?v3:y3).test(e)}const w3=/[ \t\n\f\r]/g;function z3(e){return typeof e=="object"?e.type==="text"?cy(e.value):!1:cy(e)}function cy(e){return e.replace(w3,"")===""}class Bo{constructor(n,r,i){this.normal=r,this.property=n,i&&(this.space=i)}}Bo.prototype.normal={};Bo.prototype.property={};Bo.prototype.space=void 0;function o2(e,n){const r={},i={};for(const o of e)Object.assign(r,o.property),Object.assign(i,o.normal);return new Bo(r,i,n)}function hm(e){return e.toLowerCase()}class _n{constructor(n,r){this.attribute=r,this.property=n}}_n.prototype.attribute="";_n.prototype.booleanish=!1;_n.prototype.boolean=!1;_n.prototype.commaOrSpaceSeparated=!1;_n.prototype.commaSeparated=!1;_n.prototype.defined=!1;_n.prototype.mustUseProperty=!1;_n.prototype.number=!1;_n.prototype.overloadedBoolean=!1;_n.prototype.property="";_n.prototype.spaceSeparated=!1;_n.prototype.space=void 0;let N3=0;const Be=Fr(),Dt=Fr(),mm=Fr(),he=Fr(),ht=Fr(),Ui=Fr(),Gn=Fr();function Fr(){return 2**++N3}const pm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:Dt,commaOrSpaceSeparated:Gn,commaSeparated:Ui,number:he,overloadedBoolean:mm,spaceSeparated:ht},Symbol.toStringTag,{value:"Module"})),Nh=Object.keys(pm);class d0 extends _n{constructor(n,r,i,o){let c=-1;if(super(n,r),uy(this,"space",o),typeof i=="number")for(;++c<Nh.length;){const d=Nh[c];uy(this,Nh[c],(i&pm[d])===pm[d])}}}d0.prototype.defined=!0;function uy(e,n,r){r&&(e[n]=r)}function al(e){const n={},r={};for(const[i,o]of Object.entries(e.properties)){const c=new d0(i,e.transform(e.attributes||{},i),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),n[i]=c,r[hm(i)]=i,r[hm(c.attribute)]=i}return new Bo(n,r,e.space)}const c2=al({properties:{ariaActiveDescendant:null,ariaAtomic:Dt,ariaAutoComplete:null,ariaBusy:Dt,ariaChecked:Dt,ariaColCount:he,ariaColIndex:he,ariaColSpan:he,ariaControls:ht,ariaCurrent:null,ariaDescribedBy:ht,ariaDetails:null,ariaDisabled:Dt,ariaDropEffect:ht,ariaErrorMessage:null,ariaExpanded:Dt,ariaFlowTo:ht,ariaGrabbed:Dt,ariaHasPopup:null,ariaHidden:Dt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ht,ariaLevel:he,ariaLive:null,ariaModal:Dt,ariaMultiLine:Dt,ariaMultiSelectable:Dt,ariaOrientation:null,ariaOwns:ht,ariaPlaceholder:null,ariaPosInSet:he,ariaPressed:Dt,ariaReadOnly:Dt,ariaRelevant:null,ariaRequired:Dt,ariaRoleDescription:ht,ariaRowCount:he,ariaRowIndex:he,ariaRowSpan:he,ariaSelected:Dt,ariaSetSize:he,ariaSort:null,ariaValueMax:he,ariaValueMin:he,ariaValueNow:he,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function u2(e,n){return n in e?e[n]:n}function d2(e,n){return u2(e,n.toLowerCase())}const k3=al({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ui,acceptCharset:ht,accessKey:ht,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:ht,autoFocus:Be,autoPlay:Be,blocking:ht,capture:null,charSet:null,checked:Be,cite:null,className:ht,cols:he,colSpan:null,content:null,contentEditable:Dt,controls:Be,controlsList:ht,coords:he|Ui,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:mm,draggable:Dt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:ht,height:he,hidden:mm,high:he,href:null,hrefLang:null,htmlFor:ht,httpEquiv:ht,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:ht,itemRef:ht,itemScope:Be,itemType:ht,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:he,manifest:null,max:null,maxLength:he,media:null,method:null,min:null,minLength:he,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,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:Be,optimum:he,pattern:null,ping:ht,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:ht,required:Be,reversed:Be,rows:he,rowSpan:he,sandbox:ht,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shape:null,size:he,sizes:null,slot:null,span:he,spellCheck:Dt,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:Be,useMap:null,value:Dt,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:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:he,leftMargin:he,link:null,longDesc:null,lowSrc:null,marginHeight:he,marginWidth:he,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:he,rules:null,scheme:null,scrolling:Dt,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:Be,disableRemotePlayback:Be,prefix:null,property:null,results:he,security:null,unselectable:null},space:"html",transform:d2}),S3=al({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:Gn,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:Be,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:Ui,g2:Ui,glyphName:Ui,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:Gn,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:Gn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gn,rev:Gn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gn,requiredFeatures:Gn,requiredFonts:Gn,requiredFormats:Gn,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:Gn,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:Gn,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:Gn,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:u2}),f2=al({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),h2=al({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:d2}),m2=al({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),C3={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"},E3=/[A-Z]/g,dy=/-[a-z]/g,T3=/^data[-\w.:]+$/i;function A3(e,n){const r=hm(n);let i=n,o=_n;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&T3.test(n)){if(n.charAt(4)==="-"){const c=n.slice(5).replace(dy,D3);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=n.slice(4);if(!dy.test(c)){let d=c.replace(E3,M3);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=d0}return new o(i,n)}function M3(e){return"-"+e.toLowerCase()}function D3(e){return e.charAt(1).toUpperCase()}const O3=o2([c2,k3,f2,h2,m2],"html"),f0=o2([c2,S3,f2,h2,m2],"svg");function R3(e){return e.join(" ").trim()}var Ai={},kh,fy;function _3(){if(fy)return kh;fy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
`,h="/",b="*",g="",v="comment",y="declaration";function k(z,j){if(typeof z!="string")throw new TypeError("First argument must be a string");if(!z)return[];j=j||{};var E=1,N=1;function M(_){var q=_.match(n);q&&(E+=q.length);var B=_.lastIndexOf(m);N=~B?_.length-B:N+_.length}function R(){var _={line:E,column:N};return function(q){return q.position=new A(_),Z(),q}}function A(_){this.start=_,this.end={line:E,column:N},this.source=j.source}A.prototype.content=z;function F(_){var q=new Error(j.source+":"+E+":"+N+": "+_);if(q.reason=_,q.filename=j.source,q.line=E,q.column=N,q.source=z,!j.silent)throw q}function ee(_){var q=_.exec(z);if(q){var B=q[0];return M(B),z=z.slice(B.length),q}}function Z(){ee(r)}function L(_){var q;for(_=_||[];q=P();)q!==!1&&_.push(q);return _}function P(){var _=R();if(!(h!=z.charAt(0)||b!=z.charAt(1))){for(var q=2;g!=z.charAt(q)&&(b!=z.charAt(q)||h!=z.charAt(q+1));)++q;if(q+=2,g===z.charAt(q-1))return F("End of comment missing");var B=z.slice(2,q-2);return N+=2,M(B),z=z.slice(q),N+=2,_({type:v,comment:B})}}function Y(){var _=R(),q=ee(i);if(q){if(P(),!ee(o))return F("property missing ':'");var B=ee(c),V=_({type:y,property:C(q[0].replace(e,g)),value:B?C(B[0].replace(e,g)):g});return ee(d),V}}function me(){var _=[];L(_);for(var q;q=Y();)q!==!1&&(_.push(q),L(_));return _}return Z(),me()}function C(z){return z?z.replace(f,g):g}return kh=k,kh}var hy;function L3(){if(hy)return Ai;hy=1;var e=Ai&&Ai.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ai,"__esModule",{value:!0}),Ai.default=r;const n=e(_3());function r(i,o){let c=null;if(!i||typeof i!="string")return c;const d=(0,n.default)(i),f=typeof o=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:b}=m;f?o(h,b,m):b&&(c=c||{},c[h]=b)}),c}return Ai}var ao={},my;function B3(){if(my)return ao;my=1,Object.defineProperty(ao,"__esModule",{value:!0}),ao.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(h){return!h||r.test(h)||e.test(h)},d=function(h,b){return b.toUpperCase()},f=function(h,b){return"".concat(b,"-")},m=function(h,b){return b===void 0&&(b={}),c(h)?h:(h=h.toLowerCase(),b.reactCompat?h=h.replace(o,f):h=h.replace(i,f),h.replace(n,d))};return ao.camelCase=m,ao}var so,py;function U3(){if(py)return so;py=1;var e=so&&so.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(L3()),r=B3();function i(o,c){var d={};return!o||typeof o!="string"||(0,n.default)(o,function(f,m){f&&m&&(d[(0,r.camelCase)(f,c)]=m)}),d}return i.default=i,so=i,so}var H3=U3();const q3=Ou(H3),p2=x2("end"),h0=x2("start");function x2(e){return n;function n(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function I3(e){const n=h0(e),r=p2(e);if(n&&r)return{start:n,end:r}}function mo(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?xy(e.position):"start"in e||"end"in e?xy(e):"line"in e||"column"in e?xm(e):""}function xm(e){return gy(e&&e.line)+":"+gy(e&&e.column)}function xy(e){return xm(e&&e.start)+"-"+xm(e&&e.end)}function gy(e){return e&&typeof e=="number"?e:1}class on extends Error{constructor(n,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let o="",c={},d=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof n=="string"?o=n:!c.cause&&n&&(d=!0,o=n.message,c.cause=n),!c.ruleId&&!c.source&&typeof i=="string"){const m=i.indexOf(":");m===-1?c.ruleId=i:(c.source=i.slice(0,m),c.ruleId=i.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.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=mo(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=d&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}on.prototype.file="";on.prototype.name="";on.prototype.reason="";on.prototype.message="";on.prototype.stack="";on.prototype.column=void 0;on.prototype.line=void 0;on.prototype.ancestors=void 0;on.prototype.cause=void 0;on.prototype.fatal=void 0;on.prototype.place=void 0;on.prototype.ruleId=void 0;on.prototype.source=void 0;const m0={}.hasOwnProperty,P3=new Map,F3=/[A-Z]/g,$3=new Set(["table","tbody","thead","tfoot","tr"]),V3=new Set(["td","th"]),g2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function G3(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let i;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=eC(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=W3(r,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:i,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?f0:O3,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},c=b2(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function b2(e,n,r){if(n.type==="element")return Y3(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return Q3(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return J3(e,n,r);if(n.type==="mdxjsEsm")return X3(e,n);if(n.type==="root")return K3(e,n,r);if(n.type==="text")return Z3(e,n)}function Y3(e,n,r){const i=e.schema;let o=i;n.tagName.toLowerCase()==="svg"&&i.space==="html"&&(o=f0,e.schema=o),e.ancestors.push(n);const c=v2(e,n.tagName,!1),d=tC(e,n);let f=x0(e,n);return $3.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!z3(m):!0})),y2(e,d,c,n),p0(d,f),e.ancestors.pop(),e.schema=i,e.create(n,c,d,r)}function Q3(e,n){if(n.data&&n.data.estree&&e.evaluater){const i=n.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}wo(e,n.position)}function X3(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);wo(e,n.position)}function J3(e,n,r){const i=e.schema;let o=i;n.name==="svg"&&i.space==="html"&&(o=f0,e.schema=o),e.ancestors.push(n);const c=n.name===null?e.Fragment:v2(e,n.name,!0),d=nC(e,n),f=x0(e,n);return y2(e,d,c,n),p0(d,f),e.ancestors.pop(),e.schema=i,e.create(n,c,d,r)}function K3(e,n,r){const i={};return p0(i,x0(e,n)),e.create(n,e.Fragment,i,r)}function Z3(e,n){return n.value}function y2(e,n,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=i)}function p0(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function W3(e,n,r){return i;function i(o,c,d,f){const h=Array.isArray(d.children)?r:n;return f?h(c,d,f):h(c,d)}}function eC(e,n){return r;function r(i,o,c,d){const f=Array.isArray(c.children),m=h0(i);return n(o,c,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function tC(e,n){const r={};let i,o;for(o in n.properties)if(o!=="children"&&m0.call(n.properties,o)){const c=aC(e,o,n.properties[o]);if(c){const[d,f]=c;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&V3.has(n.tagName)?i=f:r[d]=f}}if(i){const c=r.style||(r.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function nC(e,n){const r={};for(const i of n.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const d=c.expression;d.type;const f=d.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else wo(e,n.position);else{const o=i.name;let c;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const f=i.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else wo(e,n.position);else c=i.value===null?!0:i.value;r[o]=c}return r}function x0(e,n){const r=[];let i=-1;const o=e.passKeys?new Map:P3;for(;++i<n.children.length;){const c=n.children[i];let d;if(e.passKeys){const m=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(m){const h=o.get(m)||0;d=m+"-"+h,o.set(m,h+1)}}const f=b2(e,c,d);f!==void 0&&r.push(f)}return r}function aC(e,n,r){const i=A3(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?b3(r):R3(r)),i.property==="style"){let o=typeof r=="object"?r:sC(e,String(r));return e.stylePropertyNameCase==="css"&&(o=rC(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&i.space?C3[i.property]||i.property:i.attribute,r]}}function sC(e,n){try{return q3(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,o=new on("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=g2+"#cannot-parse-style-attribute",o}}function v2(e,n,r){let i;if(!r)i={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let c=-1,d;for(;++c<o.length;){const f=oy(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}i=d}else i=oy(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(i.type==="Literal"){const o=i.value;return m0.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(i);wo(e)}function wo(e,n){const r=new on("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=g2+"#cannot-handle-mdx-estrees-without-createevaluater",r}function rC(e){const n={};let r;for(r in e)m0.call(e,r)&&(n[iC(r)]=e[r]);return n}function iC(e){let n=e.replace(F3,lC);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function lC(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"]},oC={};function g0(e,n){const r=oC,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return j2(e,i,o)}function j2(e,n,r){if(cC(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return by(e.children,n,r)}return Array.isArray(e)?by(e,n,r):""}function by(e,n,r){const i=[];let o=-1;for(;++o<e.length;)i[o]=j2(e[o],n,r);return i.join("")}function cC(e){return!!(e&&typeof e=="object")}const yy=document.createElement("i");function b0(e){const n="&"+e+";";yy.innerHTML=n;const r=yy.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Yn(e,n,r,i){const o=e.length;let c=0,d;if(n<0?n=-n>o?0:o+n:n=n>o?o:n,r=r>0?r:0,i.length<1e4)d=Array.from(i),d.unshift(n,r),e.splice(...d);else for(r&&e.splice(n,r);c<i.length;)d=i.slice(c,c+1e4),d.unshift(n,0),e.splice(...d),c+=1e4,n+=1e4}function oa(e,n){return e.length>0?(Yn(e,e.length,0,n),e):n}const vy={}.hasOwnProperty;function w2(e){const n={};let r=-1;for(;++r<e.length;)uC(n,e[r]);return n}function uC(e,n){let r;for(r in n){const o=(vy.call(e,r)?e[r]:void 0)||(e[r]={}),c=n[r];let d;if(c)for(d in c){vy.call(o,d)||(o[d]=[]);const f=c[d];dC(o[d],Array.isArray(f)?f:f?[f]:[])}}}function dC(e,n){let r=-1;const i=[];for(;++r<n.length;)(n[r].add==="after"?e:i).push(n[r]);Yn(e,0,0,i)}function z2(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function va(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pn=lr(/[A-Za-z]/),rn=lr(/[\dA-Za-z]/),fC=lr(/[#-'*+\--9=?A-Z^-~]/);function Cu(e){return e!==null&&(e<32||e===127)}const gm=lr(/\d/),hC=lr(/[\dA-Fa-f]/),mC=lr(/[!-/:-@[-`{-~]/);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 Yu=lr(new RegExp("\\p{P}|\\p{S}","u")),Ir=lr(/\s/);function lr(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function sl(e){const n=[];let r=-1,i=0,o=0;for(;++r<e.length;){const c=e.charCodeAt(r);let d="";if(c===37&&rn(e.charCodeAt(r+1))&&rn(e.charCodeAt(r+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(d=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(r+1);c<56320&&f>56319&&f<57344?(d=String.fromCharCode(c,f),o=1):d="�"}else d=String.fromCharCode(c);d&&(n.push(e.slice(i,r),encodeURIComponent(d)),i=r+o+1,d=""),o&&(r+=o,o=0)}return n.join("")+e.slice(i)}function Ke(e,n,r,i){const o=i?i-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(m){return Fe(m)?(e.enter(r),f(m)):n(m)}function f(m){return Fe(m)&&c++<o?(e.consume(m),f):(e.exit(r),n(m))}}const pC={tokenize:xC};function xC(e){const n=e.attempt(this.parser.constructs.contentInitial,i,o);let r;return n;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ke(e,n,"linePrefix")}function o(f){return e.enter("paragraph"),c(f)}function c(f){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,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"),c):(e.consume(f),d)}}const gC={tokenize:bC},jy={tokenize:yC};function bC(e){const n=this,r=[];let i=0,o,c,d;return f;function f(N){if(i<r.length){const M=r[i];return n.containerState=M[1],e.attempt(M[0].continuation,m,h)(N)}return h(N)}function m(N){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&E();const M=n.events.length;let R=M,A;for(;R--;)if(n.events[R][0]==="exit"&&n.events[R][1].type==="chunkFlow"){A=n.events[R][1].end;break}j(i);let F=M;for(;F<n.events.length;)n.events[F][1].end={...A},F++;return Yn(n.events,R+1,0,n.events.slice(M)),n.events.length=F,h(N)}return f(N)}function h(N){if(i===r.length){if(!o)return v(N);if(o.currentConstruct&&o.currentConstruct.concrete)return k(N);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(jy,b,g)(N)}function b(N){return o&&E(),j(i),v(N)}function g(N){return n.parser.lazy[n.now().line]=i!==r.length,d=n.now().offset,k(N)}function v(N){return n.containerState={},e.attempt(jy,y,k)(N)}function y(N){return i++,r.push([n.currentConstruct,n.containerState]),v(N)}function k(N){if(N===null){o&&E(),j(0),e.consume(N);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),C(N)}function C(N){if(N===null){z(e.exit("chunkFlow"),!0),j(0),e.consume(N);return}return Se(N)?(e.consume(N),z(e.exit("chunkFlow")),i=0,n.interrupt=void 0,f):(e.consume(N),C)}function z(N,M){const R=n.sliceStream(N);if(M&&R.push(null),N.previous=c,c&&(c.next=N),c=N,o.defineSkip(N.start),o.write(R),n.parser.lazy[N.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 F=n.events.length;let ee=F,Z,L;for(;ee--;)if(n.events[ee][0]==="exit"&&n.events[ee][1].type==="chunkFlow"){if(Z){L=n.events[ee][1].end;break}Z=!0}for(j(i),A=F;A<n.events.length;)n.events[A][1].end={...L},A++;Yn(n.events,ee+1,0,n.events.slice(F)),n.events.length=A}}function j(N){let M=r.length;for(;M-- >N;){const R=r[M];n.containerState=R[1],R[0].exit.call(n,e)}r.length=N}function E(){o.write([null]),c=void 0,o=void 0,n.containerState._closeFlow=void 0}}function yC(e,n,r){return Ke(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xi(e){if(e===null||dt(e)||Ir(e))return 1;if(Yu(e))return 2}function Qu(e,n,r){const i=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!i.includes(c)&&(n=c(n,r),i.push(c))}return n}const bm={name:"attention",resolveAll:vC,tokenize:jC};function vC(e,n){let r=-1,i,o,c,d,f,m,h,b;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[i][1].end},v={...e[r][1].start};wy(g,-m),wy(v,m),d={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:v},c={type:m>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[i][1].end={...d.start},e[r][1].start={...f.end},h=[],e[i][1].end.offset-e[i][1].start.offset&&(h=oa(h,[["enter",e[i][1],n],["exit",e[i][1],n]])),h=oa(h,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",c,n]]),h=oa(h,Qu(n.parser.constructs.insideSpan.null,e.slice(i+1,r),n)),h=oa(h,[["exit",c,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[r][1].end.offset-e[r][1].start.offset?(b=2,h=oa(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):b=0,Yn(e,i-1,r-i+3,h),r=i+h.length-b-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function jC(e,n){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,o=Xi(i);let c;return d;function d(m){return c=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===c)return e.consume(m),f;const h=e.exit("attentionSequence"),b=Xi(m),g=!b||b===2&&o||r.includes(m),v=!o||o===2&&b||r.includes(i);return h._open=!!(c===42?g:g&&(o||!v)),h._close=!!(c===42?v:v&&(b||!g)),n(m)}}function wy(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const wC={name:"autolink",tokenize:zC};function zC(e,n,r){let i=0;return o;function o(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(y){return pn(y)?(e.consume(y),d):y===64?r(y):h(y)}function d(y){return y===43||y===45||y===46||rn(y)?(i=1,f(y)):h(y)}function f(y){return y===58?(e.consume(y),i=0,m):(y===43||y===45||y===46||rn(y))&&i++<32?(e.consume(y),f):(i=0,h(y))}function m(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),n):y===null||y===32||y===60||Cu(y)?r(y):(e.consume(y),m)}function h(y){return y===64?(e.consume(y),b):fC(y)?(e.consume(y),h):r(y)}function b(y){return rn(y)?g(y):r(y)}function g(y){return y===46?(e.consume(y),i=0,b):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),n):v(y)}function v(y){if((y===45||rn(y))&&i++<63){const k=y===45?v:g;return e.consume(y),k}return r(y)}}const Uo={partial:!0,tokenize:NC};function NC(e,n,r){return i;function i(c){return Fe(c)?Ke(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||Se(c)?n(c):r(c)}}const N2={continuation:{tokenize:SC},exit:CC,name:"blockQuote",tokenize:kC};function kC(e,n,r){const i=this;return o;function o(d){if(d===62){const f=i.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),c}return r(d)}function c(d){return Fe(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(d))}}function SC(e,n,r){const i=this;return o;function o(d){return Fe(d)?Ke(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return e.attempt(N2,n,r)(d)}}function CC(e){e.exit("blockQuote")}const k2={name:"characterEscape",tokenize:EC};function EC(e,n,r){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return mC(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(c)}}const S2={name:"characterReference",tokenize:TC};function TC(e,n,r){const i=this;let o=0,c,d;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),c=31,d=rn,b(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,d=hC,b):(e.enter("characterReferenceValue"),c=7,d=gm,b(g))}function b(g){if(g===59&&o){const v=e.exit("characterReferenceValue");return d===rn&&!b0(i.sliceSerialize(v))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return d(g)&&o++<c?(e.consume(g),b):r(g)}}const zy={partial:!0,tokenize:MC},Ny={concrete:!0,name:"codeFenced",tokenize:AC};function AC(e,n,r){const i=this,o={partial:!0,tokenize:R};let c=0,d=0,f;return m;function m(A){return h(A)}function h(A){const F=i.events[i.events.length-1];return c=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,f=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),b(A)}function b(A){return A===f?(d++,e.consume(A),b):d<3?r(A):(e.exit("codeFencedFenceSequence"),Fe(A)?Ke(e,g,"whitespace")(A):g(A))}function g(A){return A===null||Se(A)?(e.exit("codeFencedFence"),i.interrupt?n(A):e.check(zy,C,M)(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"),g(A)):Fe(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ke(e,y,"whitespace")(A)):A===96&&A===f?r(A):(e.consume(A),v)}function y(A){return A===null||Se(A)?g(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"),g(A)):A===96&&A===f?r(A):(e.consume(A),k)}function C(A){return e.attempt(o,M,z)(A)}function z(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),j}function j(A){return c>0&&Fe(A)?Ke(e,E,"linePrefix",c+1)(A):E(A)}function E(A){return A===null||Se(A)?e.check(zy,C,M)(A):(e.enter("codeFlowValue"),N(A))}function N(A){return A===null||Se(A)?(e.exit("codeFlowValue"),E(A)):(e.consume(A),N)}function M(A){return e.exit("codeFenced"),n(A)}function R(A,F,ee){let Z=0;return L;function L(q){return A.enter("lineEnding"),A.consume(q),A.exit("lineEnding"),P}function P(q){return A.enter("codeFencedFence"),Fe(q)?Ke(A,Y,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):Y(q)}function Y(q){return q===f?(A.enter("codeFencedFenceSequence"),me(q)):ee(q)}function me(q){return q===f?(Z++,A.consume(q),me):Z>=d?(A.exit("codeFencedFenceSequence"),Fe(q)?Ke(A,_,"whitespace")(q):_(q)):ee(q)}function _(q){return q===null||Se(q)?(A.exit("codeFencedFence"),F(q)):ee(q)}}}function MC(e,n,r){const i=this;return o;function o(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c)}function c(d){return i.parser.lazy[i.now().line]?r(d):n(d)}}const Ch={name:"codeIndented",tokenize:OC},DC={partial:!0,tokenize:RC};function OC(e,n,r){const i=this;return o;function o(h){return e.enter("codeIndented"),Ke(e,c,"linePrefix",5)(h)}function c(h){const b=i.events[i.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?d(h):r(h)}function d(h){return h===null?m(h):Se(h)?e.attempt(DC,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Se(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),n(h)}}function RC(e,n,r){const i=this;return o;function o(d){return i.parser.lazy[i.now().line]?r(d):Se(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):Ke(e,c,"linePrefix",5)(d)}function c(d){const f=i.events[i.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):Se(d)?o(d):r(d)}}const _C={name:"codeText",previous:BC,resolve:LC,tokenize:UC};function LC(e){let n=e.length-4,r=3,i,o;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=r;++i<n;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(i=r-1,n++;++i<=n;)o===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(o=i):(i===n||e[i][1].type==="lineEnding")&&(e[o][1].type="codeTextData",i!==o+2&&(e[o][1].end=e[i-1][1].end,e.splice(o+2,i-o-2),n-=i-o-2,i=o+2),o=void 0);return e}function BC(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function UC(e,n,r){let i=0,o,c;return d;function d(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),i++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(c=e.enter("codeTextSequence"),o=0,b(g)):Se(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Se(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function b(g){return g===96?(e.consume(g),o++,b):o===i?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(c.type="codeTextData",h(g))}}class HC{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,r,i){const o=r||0;this.setCursor(Math.trunc(n));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return i&&ro(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),ro(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),ro(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);ro(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);ro(this.left,r.reverse())}}}function ro(e,n){let r=0;if(n.length<1e4)e.push(...n);else for(;r<n.length;)e.push(...n.slice(r,r+1e4)),r+=1e4}function C2(e){const n={};let r=-1,i,o,c,d,f,m,h;const b=new HC(e);for(;++r<b.length;){for(;r in n;)r=n[r];if(i=b.get(r),r&&i[1].type==="chunkFlow"&&b.get(r-1)[1].type==="listItemPrefix"&&(m=i[1]._tokenizer.events,c=0,c<m.length&&m[c][1].type==="lineEndingBlank"&&(c+=2),c<m.length&&m[c][1].type==="content"))for(;++c<m.length&&m[c][1].type!=="content";)m[c][1].type==="chunkText"&&(m[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,qC(b,r)),r=n[r],h=!0);else if(i[1]._container){for(c=r,o=void 0;c--;)if(d=b.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(b.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(i[1].end={...b.get(o)[1].start},f=b.slice(o,r),f.unshift(i),b.splice(o,r-o+1,f))}}return Yn(e,0,Number.POSITIVE_INFINITY,b.slice(0)),!h}function qC(e,n){const r=e.get(n)[1],i=e.get(n)[2];let o=n-1;const c=[];let d=r._tokenizer;d||(d=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,m=[],h={};let b,g,v=-1,y=r,k=0,C=0;const z=[C];for(;y;){for(;e.get(++o)[1]!==y;);c.push(o),y._tokenizer||(b=i.sliceStream(y),y.next||b.push(null),g&&d.defineSkip(y.start),y._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(b),y._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),g=y,y=y.next}for(y=r;++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&&(C=v+1,z.push(C),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(d.events=[],y?(y._tokenizer=void 0,y.previous=void 0):z.pop(),v=z.length;v--;){const j=f.slice(z[v],z[v+1]),E=c.pop();m.push([E,E+j.length-1]),e.splice(E,2,j)}for(m.reverse(),v=-1;++v<m.length;)h[k+m[v][0]]=k+m[v][1],k+=m[v][1]-m[v][0]-1;return h}const IC={resolve:FC,tokenize:$C},PC={partial:!0,tokenize:VC};function FC(e){return C2(e),e}function $C(e,n){let r;return i;function i(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?c(f):Se(f)?e.check(PC,d,c)(f):(e.consume(f),o)}function c(f){return e.exit("chunkContent"),e.exit("content"),n(f)}function d(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,o}}function VC(e,n,r){const i=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Ke(e,c,"linePrefix")}function c(d){if(d===null||Se(d))return r(d);const f=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):e.interrupt(i.parser.constructs.flow,r,n)(d)}}function E2(e,n,r,i,o,c,d,f,m){const h=m||Number.POSITIVE_INFINITY;let b=0;return g;function g(j){return j===60?(e.enter(i),e.enter(o),e.enter(c),e.consume(j),e.exit(c),v):j===null||j===32||j===41||Cu(j)?r(j):(e.enter(i),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),C(j))}function v(j){return j===62?(e.enter(c),e.consume(j),e.exit(c),e.exit(o),e.exit(i),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===62?(e.exit("chunkString"),e.exit(f),v(j)):j===null||j===60||Se(j)?r(j):(e.consume(j),j===92?k:y)}function k(j){return j===60||j===62||j===92?(e.consume(j),y):y(j)}function C(j){return!b&&(j===null||j===41||dt(j))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(i),n(j)):b<h&&j===40?(e.consume(j),b++,C):j===41?(e.consume(j),b--,C):j===null||j===32||j===40||Cu(j)?r(j):(e.consume(j),j===92?z:C)}function z(j){return j===40||j===41||j===92?(e.consume(j),C):C(j)}}function T2(e,n,r,i,o,c){const d=this;let f=0,m;return h;function h(y){return e.enter(i),e.enter(o),e.consume(y),e.exit(o),e.enter(c),b}function b(y){return f>999||y===null||y===91||y===93&&!m||y===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?r(y):y===93?(e.exit(c),e.enter(o),e.consume(y),e.exit(o),e.exit(i),n):Se(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),b):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||y===91||y===93||Se(y)||f++>999?(e.exit("chunkString"),b(y)):(e.consume(y),m||(m=!Fe(y)),y===92?v:g)}function v(y){return y===91||y===92||y===93?(e.consume(y),f++,g):g(y)}}function A2(e,n,r,i,o,c){let d;return f;function f(v){return v===34||v===39||v===40?(e.enter(i),e.enter(o),e.consume(v),e.exit(o),d=v===40?41:v,m):r(v)}function m(v){return v===d?(e.enter(o),e.consume(v),e.exit(o),e.exit(i),n):(e.enter(c),h(v))}function h(v){return v===d?(e.exit(c),m(d)):v===null?r(v):Se(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Ke(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),b(v))}function b(v){return v===d||v===null||Se(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?g:b)}function g(v){return v===d||v===92?(e.consume(v),b):b(v)}}function po(e,n){let r;return i;function i(o){return Se(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r=!0,i):Fe(o)?Ke(e,i,r?"linePrefix":"lineSuffix")(o):n(o)}}const GC={name:"definition",tokenize:QC},YC={partial:!0,tokenize:XC};function QC(e,n,r){const i=this;let o;return c;function c(y){return e.enter("definition"),d(y)}function d(y){return T2.call(i,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return o=va(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),m):r(y)}function m(y){return dt(y)?po(e,h)(y):h(y)}function h(y){return E2(e,b,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function b(y){return e.attempt(YC,g,g)(y)}function g(y){return Fe(y)?Ke(e,v,"whitespace")(y):v(y)}function v(y){return y===null||Se(y)?(e.exit("definition"),i.parser.defined.push(o),n(y)):r(y)}}function XC(e,n,r){return i;function i(f){return dt(f)?po(e,o)(f):r(f)}function o(f){return A2(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return Fe(f)?Ke(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Se(f)?n(f):r(f)}}const JC={name:"hardBreakEscape",tokenize:KC};function KC(e,n,r){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return Se(c)?(e.exit("hardBreakEscape"),n(c)):r(c)}}const ZC={name:"headingAtx",resolve:WC,tokenize:e6};function WC(e,n){let r=e.length-2,i=3,o,c;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(o={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},c={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},Yn(e,i,r-i+1,[["enter",o,n],["enter",c,n],["exit",c,n],["exit",o,n]])),e}function e6(e,n,r){let i=0;return o;function o(b){return e.enter("atxHeading"),c(b)}function c(b){return e.enter("atxHeadingSequence"),d(b)}function d(b){return b===35&&i++<6?(e.consume(b),d):b===null||dt(b)?(e.exit("atxHeadingSequence"),f(b)):r(b)}function f(b){return b===35?(e.enter("atxHeadingSequence"),m(b)):b===null||Se(b)?(e.exit("atxHeading"),n(b)):Fe(b)?Ke(e,f,"whitespace")(b):(e.enter("atxHeadingText"),h(b))}function m(b){return b===35?(e.consume(b),m):(e.exit("atxHeadingSequence"),f(b))}function h(b){return b===null||b===35||dt(b)?(e.exit("atxHeadingText"),f(b)):(e.consume(b),h)}}const t6=["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"],ky=["pre","script","style","textarea"],n6={concrete:!0,name:"htmlFlow",resolveTo:r6,tokenize:i6},a6={partial:!0,tokenize:o6},s6={partial:!0,tokenize:l6};function r6(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function i6(e,n,r){const i=this;let o,c,d,f,m;return h;function h(D){return b(D)}function b(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),g}function g(D){return D===33?(e.consume(D),v):D===47?(e.consume(D),c=!0,C):D===63?(e.consume(D),o=3,i.interrupt?n:O):pn(D)?(e.consume(D),d=String.fromCharCode(D),z):r(D)}function v(D){return D===45?(e.consume(D),o=2,y):D===91?(e.consume(D),o=5,f=0,k):pn(D)?(e.consume(D),o=4,i.interrupt?n:O):r(D)}function y(D){return D===45?(e.consume(D),i.interrupt?n:O):r(D)}function k(D){const G="CDATA[";return D===G.charCodeAt(f++)?(e.consume(D),f===G.length?i.interrupt?n:Y:k):r(D)}function C(D){return pn(D)?(e.consume(D),d=String.fromCharCode(D),z):r(D)}function z(D){if(D===null||D===47||D===62||dt(D)){const G=D===47,be=d.toLowerCase();return!G&&!c&&ky.includes(be)?(o=1,i.interrupt?n(D):Y(D)):t6.includes(d.toLowerCase())?(o=6,G?(e.consume(D),j):i.interrupt?n(D):Y(D)):(o=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(D):c?E(D):N(D))}return D===45||rn(D)?(e.consume(D),d+=String.fromCharCode(D),z):r(D)}function j(D){return D===62?(e.consume(D),i.interrupt?n:Y):r(D)}function E(D){return Fe(D)?(e.consume(D),E):L(D)}function N(D){return D===47?(e.consume(D),L):D===58||D===95||pn(D)?(e.consume(D),M):Fe(D)?(e.consume(D),N):L(D)}function M(D){return D===45||D===46||D===58||D===95||rn(D)?(e.consume(D),M):R(D)}function R(D){return D===61?(e.consume(D),A):Fe(D)?(e.consume(D),R):N(D)}function A(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(e.consume(D),m=D,F):Fe(D)?(e.consume(D),A):ee(D)}function F(D){return D===m?(e.consume(D),m=null,Z):D===null||Se(D)?r(D):(e.consume(D),F)}function ee(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||dt(D)?R(D):(e.consume(D),ee)}function Z(D){return D===47||D===62||Fe(D)?N(D):r(D)}function L(D){return D===62?(e.consume(D),P):r(D)}function P(D){return D===null||Se(D)?Y(D):Fe(D)?(e.consume(D),P):r(D)}function Y(D){return D===45&&o===2?(e.consume(D),B):D===60&&o===1?(e.consume(D),V):D===62&&o===4?(e.consume(D),U):D===63&&o===3?(e.consume(D),O):D===93&&o===5?(e.consume(D),ue):Se(D)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(a6,Q,me)(D)):D===null||Se(D)?(e.exit("htmlFlowData"),me(D)):(e.consume(D),Y)}function me(D){return e.check(s6,_,Q)(D)}function _(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),q}function q(D){return D===null||Se(D)?me(D):(e.enter("htmlFlowData"),Y(D))}function B(D){return D===45?(e.consume(D),O):Y(D)}function V(D){return D===47?(e.consume(D),d="",oe):Y(D)}function oe(D){if(D===62){const G=d.toLowerCase();return ky.includes(G)?(e.consume(D),U):Y(D)}return pn(D)&&d.length<8?(e.consume(D),d+=String.fromCharCode(D),oe):Y(D)}function ue(D){return D===93?(e.consume(D),O):Y(D)}function O(D){return D===62?(e.consume(D),U):D===45&&o===2?(e.consume(D),O):Y(D)}function U(D){return D===null||Se(D)?(e.exit("htmlFlowData"),Q(D)):(e.consume(D),U)}function Q(D){return e.exit("htmlFlow"),n(D)}}function l6(e,n,r){const i=this;return o;function o(d){return Se(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):r(d)}function c(d){return i.parser.lazy[i.now().line]?r(d):n(d)}}function o6(e,n,r){return i;function i(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Uo,n,r)}}const c6={name:"htmlText",tokenize:u6};function u6(e,n,r){const i=this;let o,c,d;return f;function f(O){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(O),m}function m(O){return O===33?(e.consume(O),h):O===47?(e.consume(O),R):O===63?(e.consume(O),N):pn(O)?(e.consume(O),ee):r(O)}function h(O){return O===45?(e.consume(O),b):O===91?(e.consume(O),c=0,k):pn(O)?(e.consume(O),E):r(O)}function b(O){return O===45?(e.consume(O),y):r(O)}function g(O){return O===null?r(O):O===45?(e.consume(O),v):Se(O)?(d=g,V(O)):(e.consume(O),g)}function v(O){return O===45?(e.consume(O),y):g(O)}function y(O){return O===62?B(O):O===45?v(O):g(O)}function k(O){const U="CDATA[";return O===U.charCodeAt(c++)?(e.consume(O),c===U.length?C:k):r(O)}function C(O){return O===null?r(O):O===93?(e.consume(O),z):Se(O)?(d=C,V(O)):(e.consume(O),C)}function z(O){return O===93?(e.consume(O),j):C(O)}function j(O){return O===62?B(O):O===93?(e.consume(O),j):C(O)}function E(O){return O===null||O===62?B(O):Se(O)?(d=E,V(O)):(e.consume(O),E)}function N(O){return O===null?r(O):O===63?(e.consume(O),M):Se(O)?(d=N,V(O)):(e.consume(O),N)}function M(O){return O===62?B(O):N(O)}function R(O){return pn(O)?(e.consume(O),A):r(O)}function A(O){return O===45||rn(O)?(e.consume(O),A):F(O)}function F(O){return Se(O)?(d=F,V(O)):Fe(O)?(e.consume(O),F):B(O)}function ee(O){return O===45||rn(O)?(e.consume(O),ee):O===47||O===62||dt(O)?Z(O):r(O)}function Z(O){return O===47?(e.consume(O),B):O===58||O===95||pn(O)?(e.consume(O),L):Se(O)?(d=Z,V(O)):Fe(O)?(e.consume(O),Z):B(O)}function L(O){return O===45||O===46||O===58||O===95||rn(O)?(e.consume(O),L):P(O)}function P(O){return O===61?(e.consume(O),Y):Se(O)?(d=P,V(O)):Fe(O)?(e.consume(O),P):Z(O)}function Y(O){return O===null||O===60||O===61||O===62||O===96?r(O):O===34||O===39?(e.consume(O),o=O,me):Se(O)?(d=Y,V(O)):Fe(O)?(e.consume(O),Y):(e.consume(O),_)}function me(O){return O===o?(e.consume(O),o=void 0,q):O===null?r(O):Se(O)?(d=me,V(O)):(e.consume(O),me)}function _(O){return O===null||O===34||O===39||O===60||O===61||O===96?r(O):O===47||O===62||dt(O)?Z(O):(e.consume(O),_)}function q(O){return O===47||O===62||dt(O)?Z(O):r(O)}function B(O){return O===62?(e.consume(O),e.exit("htmlTextData"),e.exit("htmlText"),n):r(O)}function V(O){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),oe}function oe(O){return Fe(O)?Ke(e,ue,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):ue(O)}function ue(O){return e.enter("htmlTextData"),d(O)}}const y0={name:"labelEnd",resolveAll:m6,resolveTo:p6,tokenize:x6},d6={tokenize:g6},f6={tokenize:b6},h6={tokenize:y6};function m6(e){let n=-1;const r=[];for(;++n<e.length;){const i=e[n][1];if(r.push(e[n]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const o=i.type==="labelImage"?4:2;i.type="data",n+=o}}return e.length!==r.length&&Yn(e,0,e.length,r),e}function p6(e,n){let r=e.length,i=0,o,c,d,f;for(;r--;)if(o=e[r][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[r][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[r][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=r,o.type!=="labelLink")){i=2;break}}else o.type==="labelEnd"&&(d=r);const m={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[c][1].start},end:{...e[d][1].end}},b={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,n],["enter",h,n]],f=oa(f,e.slice(c+1,c+i+3)),f=oa(f,[["enter",b,n]]),f=oa(f,Qu(n.parser.constructs.insideSpan.null,e.slice(c+i+4,d-3),n)),f=oa(f,[["exit",b,n],e[d-2],e[d-1],["exit",h,n]]),f=oa(f,e.slice(d+1)),f=oa(f,[["exit",m,n]]),Yn(e,c,e.length,f),e}function x6(e,n,r){const i=this;let o=i.events.length,c,d;for(;o--;)if((i.events[o][1].type==="labelImage"||i.events[o][1].type==="labelLink")&&!i.events[o][1]._balanced){c=i.events[o][1];break}return f;function f(v){return c?c._inactive?g(v):(d=i.parser.defined.includes(va(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),m):r(v)}function m(v){return v===40?e.attempt(d6,b,d?b:g)(v):v===91?e.attempt(f6,b,d?h:g)(v):d?b(v):g(v)}function h(v){return e.attempt(h6,b,g)(v)}function b(v){return n(v)}function g(v){return c._balanced=!0,r(v)}}function g6(e,n,r){return i;function i(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return dt(g)?po(e,c)(g):c(g)}function c(g){return g===41?b(g):E2(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function d(g){return dt(g)?po(e,m)(g):b(g)}function f(g){return r(g)}function m(g){return g===34||g===39||g===40?A2(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):b(g)}function h(g){return dt(g)?po(e,b)(g):b(g)}function b(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),n):r(g)}}function b6(e,n,r){const i=this;return o;function o(f){return T2.call(i,e,c,d,"reference","referenceMarker","referenceString")(f)}function c(f){return i.parser.defined.includes(va(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function d(f){return r(f)}}function y6(e,n,r){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),o}function o(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),n):r(c)}}const v6={name:"labelStartImage",resolveAll:y0.resolveAll,tokenize:j6};function j6(e,n,r){const i=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),d):r(f)}function d(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(f):n(f)}}const w6={name:"labelStartLink",resolveAll:y0.resolveAll,tokenize:z6};function z6(e,n,r){const i=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),c}function c(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(d):n(d)}}const Eh={name:"lineEnding",tokenize:N6};function N6(e,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Ke(e,n,"linePrefix")}}const yu={name:"thematicBreak",tokenize:k6};function k6(e,n,r){let i=0,o;return c;function c(h){return e.enter("thematicBreak"),d(h)}function d(h){return o=h,f(h)}function f(h){return h===o?(e.enter("thematicBreakSequence"),m(h)):i>=3&&(h===null||Se(h))?(e.exit("thematicBreak"),n(h)):r(h)}function m(h){return h===o?(e.consume(h),i++,m):(e.exit("thematicBreakSequence"),Fe(h)?Ke(e,f,"whitespace")(h):f(h))}}const An={continuation:{tokenize:T6},exit:M6,name:"list",tokenize:E6},S6={partial:!0,tokenize:D6},C6={partial:!0,tokenize:A6};function E6(e,n,r){const i=this,o=i.events[i.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return f;function f(y){const k=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:gm(y)){if(i.containerState.type||(i.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(yu,r,h)(y):h(y);if(!i.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(y)}return r(y)}function m(y){return gm(y)&&++d<10?(e.consume(y),m):(!i.interrupt||d<2)&&(i.containerState.marker?y===i.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),h(y)):r(y)}function h(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||y,e.check(Uo,i.interrupt?r:b,e.attempt(S6,v,g))}function b(y){return i.containerState.initialBlankLine=!0,c++,v(y)}function g(y){return Fe(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),v):r(y)}function v(y){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(y)}}function T6(e,n,r){const i=this;return i.containerState._closeFlow=void 0,e.check(Uo,o,c);function o(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Ke(e,n,"listItemIndent",i.containerState.size+1)(f)}function c(f){return i.containerState.furtherBlankLines||!Fe(f)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,d(f)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(C6,n,d)(f))}function d(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,Ke(e,e.attempt(An,n,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function A6(e,n,r){const i=this;return Ke(e,o,"listItemIndent",i.containerState.size+1);function o(c){const d=i.events[i.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===i.containerState.size?n(c):r(c)}}function M6(e){e.exit(this.containerState.type)}function D6(e,n,r){const i=this;return Ke(e,o,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=i.events[i.events.length-1];return!Fe(c)&&d&&d[1].type==="listItemPrefixWhitespace"?n(c):r(c)}}const Sy={name:"setextUnderline",resolveTo:O6,tokenize:R6};function O6(e,n){let r=e.length,i,o,c;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&e.splice(r,1),!c&&e[r][1].type==="definition"&&(c=r);const d={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",d,n]),e.splice(c+1,0,["exit",e[i][1],n]),e[i][1].end={...e[c][1].end}):e[i][1]=d,e.push(["exit",d,n]),e}function R6(e,n,r){const i=this;let o;return c;function c(h){let b=i.events.length,g;for(;b--;)if(i.events[b][1].type!=="lineEnding"&&i.events[b][1].type!=="linePrefix"&&i.events[b][1].type!=="content"){g=i.events[b][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),o=h,d(h)):r(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)?Ke(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Se(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const _6={tokenize:L6};function L6(e){const n=this,r=e.attempt(Uo,i,e.attempt(this.parser.constructs.flowInitial,o,Ke(e,e.attempt(this.parser.constructs.flow,o,e.attempt(IC,o)),"linePrefix")));return r;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const B6={resolveAll:D2()},U6=M2("string"),H6=M2("text");function M2(e){return{resolveAll:D2(e==="text"?q6:void 0),tokenize:n};function n(r){const i=this,o=this.parser.constructs[e],c=r.attempt(o,d,f);return d;function d(b){return h(b)?c(b):f(b)}function f(b){if(b===null){r.consume(b);return}return r.enter("data"),r.consume(b),m}function m(b){return h(b)?(r.exit("data"),c(b)):(r.consume(b),m)}function h(b){if(b===null)return!0;const g=o[b];let v=-1;if(g)for(;++v<g.length;){const y=g[v];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function D2(e){return n;function n(r,i){let o=-1,c;for(;++o<=r.length;)c===void 0?r[o]&&r[o][1].type==="data"&&(c=o,o++):(!r[o]||r[o][1].type!=="data")&&(o!==c+2&&(r[c][1].end=r[o-1][1].end,r.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(r,i):r}}function q6(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],o=n.sliceStream(i);let c=o.length,d=-1,f=0,m;for(;c--;){const h=o[c];if(typeof h=="string"){for(d=h.length;h.charCodeAt(d-1)===32;)f++,d--;if(d)break;d=-1}else if(h===-2)m=!0,f++;else if(h!==-1){c++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const h={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?d:i.start._bufferIndex+d,_index:i.start._index+c,line:i.end.line,column:i.end.column-f,offset:i.end.offset-f},end:{...i.end}};i.end={...h.start},i.start.offset===i.end.offset?Object.assign(i,h):(e.splice(r,0,["enter",h,n],["exit",h,n]),r+=2)}r++}return e}const I6={42:An,43:An,45:An,48:An,49:An,50:An,51:An,52:An,53:An,54:An,55:An,56:An,57:An,62:N2},P6={91:GC},F6={[-2]:Ch,[-1]:Ch,32:Ch},$6={35:ZC,42:yu,45:[Sy,yu],60:n6,61:Sy,95:yu,96:Ny,126:Ny},V6={38:S2,92:k2},G6={[-5]:Eh,[-4]:Eh,[-3]:Eh,33:v6,38:S2,42:bm,60:[wC,c6],91:w6,92:[JC,k2],93:y0,95:bm,96:_C},Y6={null:[bm,B6]},Q6={null:[42,95]},X6={null:[]},J6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Q6,contentInitial:P6,disable:X6,document:I6,flow:$6,flowInitial:F6,insideSpan:Y6,string:V6,text:G6},Symbol.toStringTag,{value:"Module"}));function K6(e,n,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const o={},c=[];let d=[],f=[];const m={attempt:F(R),check:F(A),consume:E,enter:N,exit:M,interrupt:F(A,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:v,sliceStream:y,write:g};let b=n.tokenize.call(h,m);return n.resolveAll&&c.push(n),h;function g(P){return d=oa(d,P),z(),d[d.length-1]!==null?[]:(ee(n,0),h.events=Qu(c,h.events,h),h.events)}function v(P,Y){return W6(y(P),Y)}function y(P){return Z6(d,P)}function k(){const{_bufferIndex:P,_index:Y,line:me,column:_,offset:q}=i;return{_bufferIndex:P,_index:Y,line:me,column:_,offset:q}}function C(P){o[P.line]=P.column,L()}function z(){let P;for(;i._index<d.length;){const Y=d[i._index];if(typeof Y=="string")for(P=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===P&&i._bufferIndex<Y.length;)j(Y.charCodeAt(i._bufferIndex));else j(Y)}}function j(P){b=b(P)}function E(P){Se(P)?(i.line++,i.column=1,i.offset+=P===-3?2:1,L()):P!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===d[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=P}function N(P,Y){const me=Y||{};return me.type=P,me.start=k(),h.events.push(["enter",me,h]),f.push(me),me}function M(P){const Y=f.pop();return Y.end=k(),h.events.push(["exit",Y,h]),Y}function R(P,Y){ee(P,Y.from)}function A(P,Y){Y.restore()}function F(P,Y){return me;function me(_,q,B){let V,oe,ue,O;return Array.isArray(_)?Q(_):"tokenize"in _?Q([_]):U(_);function U(ye){return W;function W(de){const ke=de!==null&&ye[de],rt=de!==null&&ye.null,yt=[...Array.isArray(ke)?ke:ke?[ke]:[],...Array.isArray(rt)?rt:rt?[rt]:[]];return Q(yt)(de)}}function Q(ye){return V=ye,oe=0,ye.length===0?B:D(ye[oe])}function D(ye){return W;function W(de){return O=Z(),ue=ye,ye.partial||(h.currentConstruct=ye),ye.name&&h.parser.constructs.disable.null.includes(ye.name)?be():ye.tokenize.call(Y?Object.assign(Object.create(h),Y):h,m,G,be)(de)}}function G(ye){return P(ue,O),q}function be(ye){return O.restore(),++oe<V.length?D(V[oe]):B}}}function ee(P,Y){P.resolveAll&&!c.includes(P)&&c.push(P),P.resolve&&Yn(h.events,Y,h.events.length-Y,P.resolve(h.events.slice(Y),h)),P.resolveTo&&(h.events=P.resolveTo(h.events,h))}function Z(){const P=k(),Y=h.previous,me=h.currentConstruct,_=h.events.length,q=Array.from(f);return{from:_,restore:B};function B(){i=P,h.previous=Y,h.currentConstruct=me,h.events.length=_,f=q,L()}}function L(){i.line in o&&i.column<2&&(i.column=o[i.line],i.offset+=o[i.line]-1)}}function Z6(e,n){const r=n.start._index,i=n.start._bufferIndex,o=n.end._index,c=n.end._bufferIndex;let d;if(r===o)d=[e[r].slice(i,c)];else{if(d=e.slice(r,o),i>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(i):d.shift()}c>0&&d.push(e[o].slice(0,c))}return d}function W6(e,n){let r=-1;const i=[];let o;for(;++r<e.length;){const c=e[r];let d;if(typeof c=="string")d=c;else switch(c){case-5:{d="\r";break}case-4:{d=`
`;break}case-3:{d=`\r
`;break}case-2:{d=n?" ":"	";break}case-1:{if(!n&&o)continue;d=" ";break}default:d=String.fromCharCode(c)}o=c===-2,i.push(d)}return i.join("")}function eE(e){const i={constructs:w2([J6,...(e||{}).extensions||[]]),content:o(pC),defined:[],document:o(gC),flow:o(_6),lazy:{},string:o(U6),text:o(H6)};return i;function o(c){return d;function d(f){return K6(i,c,f)}}}function tE(e){for(;!C2(e););return e}const Cy=/[\0\t\n\r]/g;function nE(){let e=1,n="",r=!0,i;return o;function o(c,d,f){const m=[];let h,b,g,v,y;for(c=n+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c)),g=0,n="",r&&(c.charCodeAt(0)===65279&&g++,r=void 0);g<c.length;){if(Cy.lastIndex=g,h=Cy.exec(c),v=h&&h.index!==void 0?h.index:c.length,y=c.charCodeAt(v),!h){n=c.slice(g);break}if(y===10&&g===v&&i)m.push(-3),i=void 0;else switch(i&&(m.push(-5),i=void 0),g<v&&(m.push(c.slice(g,v)),e+=v-g),y){case 0:{m.push(65533),e++;break}case 9:{for(b=Math.ceil(e/4)*4,m.push(-2);e++<b;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:i=!0,e=1}g=v+1}return f&&(i&&m.push(-5),n&&m.push(n),m.push(null)),m}}const aE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sE(e){return e.replace(aE,rE)}function rE(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const o=r.charCodeAt(1),c=o===120||o===88;return z2(r.slice(c?2:1),c?16:10)}return b0(r)||e}const O2={}.hasOwnProperty;function iE(e,n,r){return typeof n!="string"&&(r=n,n=void 0),lE(r)(tE(eE(r).document().write(nE()(e,n,!0))))}function lE(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(ve),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:c(Xn),blockQuote:c(rt),characterEscape:Z,characterReference:Z,codeFenced:c(yt),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(yt,d),codeText:c(vn,d),codeTextData:Z,data:Z,codeFlowValue:Z,definition:c(Fa),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c(Ln),hardBreakEscape:c(Bn),hardBreakTrailing:c(Bn),htmlFlow:c($a,d),htmlFlowData:Z,htmlText:c($a,d),htmlTextData:Z,image:c(ge),label:d,link:c(ve),listItem:c(ze),listItemValue:v,listOrdered:c(Me,g),listUnordered:c(Me),paragraph:c(Ue),reference:D,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(Xn),strong:c(qe),thematicBreak:c(Ct)},exit:{atxHeading:m(),atxHeadingSequence:R,autolink:m(),autolinkEmail:ke,autolinkProtocol:de,blockQuote:m(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:ye,characterReference:W,codeFenced:m(z),codeFencedFence:C,codeFencedFenceInfo:y,codeFencedFenceMeta:k,codeFlowValue:L,codeIndented:m(j),codeText:m(q),codeTextData:L,data:L,definition:m(),definitionDestinationString:M,definitionLabelString:E,definitionTitleString:N,emphasis:m(),hardBreakEscape:m(Y),hardBreakTrailing:m(Y),htmlFlow:m(me),htmlFlowData:L,htmlText:m(_),htmlTextData:L,image:m(V),label:ue,labelText:oe,lineEnding:P,link:m(B),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:G,resourceDestinationString:O,resourceTitleString:U,resource:Q,setextHeading:m(ee),setextHeadingLineSequence:F,setextHeadingText:A,strong:m(),thematicBreak:m()}};R2(n,(e||{}).mdastExtensions||[]);const r={};return i;function i(te){let fe={type:"root",children:[]};const Ee={stack:[fe],tokenStack:[],config:n,enter:f,exit:h,buffer:d,resume:b,data:r},He=[];let Ye=-1;for(;++Ye<te.length;)if(te[Ye][1].type==="listOrdered"||te[Ye][1].type==="listUnordered")if(te[Ye][0]==="enter")He.push(Ye);else{const cn=He.pop();Ye=o(te,cn,Ye)}for(Ye=-1;++Ye<te.length;){const cn=n[te[Ye][0]];O2.call(cn,te[Ye][1].type)&&cn[te[Ye][1].type].call(Object.assign({sliceSerialize:te[Ye][2].sliceSerialize},Ee),te[Ye][1])}if(Ee.tokenStack.length>0){const cn=Ee.tokenStack[Ee.tokenStack.length-1];(cn[1]||Ey).call(Ee,void 0,cn[0])}for(fe.position={start:Xs(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:Xs(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},Ye=-1;++Ye<n.transforms.length;)fe=n.transforms[Ye](fe)||fe;return fe}function o(te,fe,Ee){let He=fe-1,Ye=-1,cn=!1,Jn,_t,ft,$t;for(;++He<=Ee;){const Je=te[He];switch(Je[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Je[0]==="enter"?Ye++:Ye--,$t=void 0;break}case"lineEndingBlank":{Je[0]==="enter"&&(Jn&&!$t&&!Ye&&!ft&&(ft=He),$t=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$t=void 0}if(!Ye&&Je[0]==="enter"&&Je[1].type==="listItemPrefix"||Ye===-1&&Je[0]==="exit"&&(Je[1].type==="listUnordered"||Je[1].type==="listOrdered")){if(Jn){let ka=He;for(_t=void 0;ka--;){const Un=te[ka];if(Un[1].type==="lineEnding"||Un[1].type==="lineEndingBlank"){if(Un[0]==="exit")continue;_t&&(te[_t][1].type="lineEndingBlank",cn=!0),Un[1].type="lineEnding",_t=ka}else if(!(Un[1].type==="linePrefix"||Un[1].type==="blockQuotePrefix"||Un[1].type==="blockQuotePrefixWhitespace"||Un[1].type==="blockQuoteMarker"||Un[1].type==="listItemIndent"))break}ft&&(!_t||ft<_t)&&(Jn._spread=!0),Jn.end=Object.assign({},_t?te[_t][1].start:Je[1].end),te.splice(_t||He,0,["exit",Jn,Je[2]]),He++,Ee++}if(Je[1].type==="listItemPrefix"){const ka={type:"listItem",_spread:!1,start:Object.assign({},Je[1].start),end:void 0};Jn=ka,te.splice(He,0,["enter",ka,Je[2]]),He++,Ee++,ft=void 0,$t=!0}}}return te[fe][1]._spread=cn,Ee}function c(te,fe){return Ee;function Ee(He){f.call(this,te(He),He),fe&&fe.call(this,He)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(te,fe,Ee){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([fe,Ee||void 0]),te.position={start:Xs(fe.start),end:void 0}}function m(te){return fe;function fe(Ee){te&&te.call(this,Ee),h.call(this,Ee)}}function h(te,fe){const Ee=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==te.type&&(fe?fe.call(this,te,He[0]):(He[1]||Ey).call(this,te,He[0]));else throw new Error("Cannot close `"+te.type+"` ("+mo({start:te.start,end:te.end})+"): it’s not open");Ee.position.end=Xs(te.end)}function b(){return g0(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function v(te){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0}}function y(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=te}function k(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=te}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function z(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.value=te.replace(/(\r?\n|\r)$/g,"")}function E(te){const fe=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=fe,Ee.identifier=va(this.sliceSerialize(te)).toLowerCase()}function N(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.title=te}function M(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.url=te}function R(te){const fe=this.stack[this.stack.length-1];if(!fe.depth){const Ee=this.sliceSerialize(te).length;fe.depth=Ee}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function F(te){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function ee(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(te){const Ee=this.stack[this.stack.length-1].children;let He=Ee[Ee.length-1];(!He||He.type!=="text")&&(He=tt(),He.position={start:Xs(te.start),end:void 0},Ee.push(He)),this.stack.push(He)}function L(te){const fe=this.stack.pop();fe.value+=this.sliceSerialize(te),fe.position.end=Xs(te.end)}function P(te){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ee=fe.children[fe.children.length-1];Ee.position.end=Xs(te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(fe.type)&&(Z.call(this,te),L.call(this,te))}function Y(){this.data.atHardBreak=!0}function me(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.value=te}function _(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.value=te}function q(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.value=te}function B(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=fe,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function V(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=fe,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function oe(te){const fe=this.sliceSerialize(te),Ee=this.stack[this.stack.length-2];Ee.label=sE(fe),Ee.identifier=va(fe).toLowerCase()}function ue(){const te=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 He=te.children;Ee.children=He}else Ee.alt=fe}function O(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.url=te}function U(){const te=this.resume(),fe=this.stack[this.stack.length-1];fe.title=te}function Q(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function G(te){const fe=this.resume(),Ee=this.stack[this.stack.length-1];Ee.label=fe,Ee.identifier=va(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function be(te){this.data.characterReferenceType=te.type}function ye(te){const fe=this.sliceSerialize(te),Ee=this.data.characterReferenceType;let He;Ee?(He=z2(fe,Ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=b0(fe);const Ye=this.stack[this.stack.length-1];Ye.value+=He}function W(te){const fe=this.stack.pop();fe.position.end=Xs(te.end)}function de(te){L.call(this,te);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(te)}function ke(te){L.call(this,te);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(te)}function rt(){return{type:"blockquote",children:[]}}function yt(){return{type:"code",lang:null,meta:null,value:""}}function vn(){return{type:"inlineCode",value:""}}function Fa(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ln(){return{type:"emphasis",children:[]}}function Xn(){return{type:"heading",depth:0,children:[]}}function Bn(){return{type:"break"}}function $a(){return{type:"html",value:""}}function ge(){return{type:"image",title:null,url:"",alt:null}}function ve(){return{type:"link",title:null,url:"",children:[]}}function Me(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function ze(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function Ue(){return{type:"paragraph",children:[]}}function qe(){return{type:"strong",children:[]}}function tt(){return{type:"text",value:""}}function Ct(){return{type:"thematicBreak"}}}function Xs(e){return{line:e.line,column:e.column,offset:e.offset}}function R2(e,n){let r=-1;for(;++r<n.length;){const i=n[r];Array.isArray(i)?R2(e,i):oE(e,i)}}function oE(e,n){let r;for(r in n)if(O2.call(n,r))switch(r){case"canContainEols":{const i=n[r];i&&e[r].push(...i);break}case"transforms":{const i=n[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=n[r];i&&Object.assign(e[r],i);break}}}function Ey(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+mo({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+mo({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+mo({start:n.start,end:n.end})+") is still open")}function cE(e){const n=this;n.parser=r;function r(i){return iE(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function uE(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function dE(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
`}]}function fE(e,n){const r=n.value?n.value+`
`:"",i={},o=n.lang?n.lang.split(/\s+/):[];o.length>0&&(i.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return n.meta&&(c.data={meta:n.meta}),e.patch(n,c),c=e.applyData(n,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(n,c),c}function hE(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function mE(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function pE(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),o=sl(i.toLowerCase()),c=e.footnoteOrder.indexOf(i);let d,f=e.footnoteCounts.get(i);f===void 0?(f=0,e.footnoteOrder.push(i),d=e.footnoteOrder.length):d=c+1,f+=1,e.footnoteCounts.set(i,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(n,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,h),e.applyData(n,h)}function xE(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function gE(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function _2(e,n){const r=n.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];const o=e.all(n),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=i:o.push({type:"text",value:i}),o}function bE(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return _2(e,n);const o={src:sl(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(o.title=i.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,c),e.applyData(n,c)}function yE(e,n){const r={src:sl(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,i),e.applyData(n,i)}function vE(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,i),e.applyData(n,i)}function jE(e,n){const r=String(n.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return _2(e,n);const o={href:sl(i.url||"")};i.title!==null&&i.title!==void 0&&(o.title=i.title);const c={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,c),e.applyData(n,c)}function wE(e,n){const r={href:sl(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const i={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function zE(e,n,r){const i=e.all(n),o=r?NE(r):L2(n),c={},d=[];if(typeof n.checked=="boolean"){const b=i[0];let g;b&&b.type==="element"&&b.tagName==="p"?g=b:(g={type:"element",tagName:"p",properties:{},children:[]},i.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<i.length;){const b=i[f];(o||f!==0||b.type!=="element"||b.tagName!=="p")&&d.push({type:"text",value:`
`}),b.type==="element"&&b.tagName==="p"&&!o?d.push(...b.children):d.push(b)}const m=i[i.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
`});const h={type:"element",tagName:"li",properties:c,children:d};return e.patch(n,h),e.applyData(n,h)}function NE(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let i=-1;for(;!n&&++i<r.length;)n=L2(r[i])}return n}function L2(e){const n=e.spread;return n??e.children.length>1}function kE(e,n){const r={},i=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++o<i.length;){const d=i[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const c={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(n,c),e.applyData(n,c)}function SE(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function CE(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function EE(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function TE(e,n){const r=e.all(n),i=r.shift(),o=[];if(i){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],d),o.push(d)}if(r.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=h0(n.children[1]),m=p2(n.children[n.children.length-1]);f&&m&&(d.position={start:f,end:m}),o.push(d)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,c),e.applyData(n,c)}function AE(e,n,r){const i=r?r.children:void 0,c=(i?i.indexOf(n):1)===0?"th":"td",d=r&&r.type==="table"?r.align:void 0,f=d?d.length:n.children.length;let m=-1;const h=[];for(;++m<f;){const g=n.children[m],v={},y=d?d[m]:void 0;y&&(v.align=y);let k={type:"element",tagName:c,properties:v,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),h.push(k)}const b={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(n,b),e.applyData(n,b)}function ME(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const Ty=9,Ay=32;function DE(e){const n=String(e),r=/\r?\n|\r/g;let i=r.exec(n),o=0;const c=[];for(;i;)c.push(My(n.slice(o,i.index),o>0,!0),i[0]),o=i.index+i[0].length,i=r.exec(n);return c.push(My(n.slice(o),o>0,!1)),c.join("")}function My(e,n,r){let i=0,o=e.length;if(n){let c=e.codePointAt(i);for(;c===Ty||c===Ay;)i++,c=e.codePointAt(i)}if(r){let c=e.codePointAt(o-1);for(;c===Ty||c===Ay;)o--,c=e.codePointAt(o-1)}return o>i?e.slice(i,o):""}function OE(e,n){const r={type:"text",value:DE(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function RE(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const _E={blockquote:uE,break:dE,code:fE,delete:hE,emphasis:mE,footnoteReference:pE,heading:xE,html:gE,imageReference:bE,image:yE,inlineCode:vE,linkReference:jE,link:wE,listItem:zE,list:kE,paragraph:SE,root:CE,strong:EE,table:TE,tableCell:ME,tableRow:AE,text:OE,thematicBreak:RE,toml:iu,yaml:iu,definition:iu,footnoteDefinition:iu};function iu(){}const B2=-1,Xu=0,xo=1,Eu=2,v0=3,j0=4,w0=5,z0=6,U2=7,H2=8,Dy=typeof self=="object"?self:globalThis,LE=(e,n)=>{const r=(o,c)=>(e.set(c,o),o),i=o=>{if(e.has(o))return e.get(o);const[c,d]=n[o];switch(c){case Xu:case B2:return r(d,o);case xo:{const f=r([],o);for(const m of d)f.push(i(m));return f}case Eu:{const f=r({},o);for(const[m,h]of d)f[i(m)]=i(h);return f}case v0:return r(new Date(d),o);case j0:{const{source:f,flags:m}=d;return r(new RegExp(f,m),o)}case w0:{const f=r(new Map,o);for(const[m,h]of d)f.set(i(m),i(h));return f}case z0:{const f=r(new Set,o);for(const m of d)f.add(i(m));return f}case U2:{const{name:f,message:m}=d;return r(new Dy[f](m),o)}case H2:return r(BigInt(d),o);case"BigInt":return r(Object(BigInt(d)),o);case"ArrayBuffer":return r(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:f}=new Uint8Array(d);return r(new DataView(f),d)}}return r(new Dy[c](d),o)};return i},Oy=e=>LE(new Map,e)(0),Mi="",{toString:BE}={},{keys:UE}=Object,io=e=>{const n=typeof e;if(n!=="object"||!e)return[Xu,n];const r=BE.call(e).slice(8,-1);switch(r){case"Array":return[xo,Mi];case"Object":return[Eu,Mi];case"Date":return[v0,Mi];case"RegExp":return[j0,Mi];case"Map":return[w0,Mi];case"Set":return[z0,Mi];case"DataView":return[xo,r]}return r.includes("Array")?[xo,r]:r.includes("Error")?[U2,r]:[Eu,r]},lu=([e,n])=>e===Xu&&(n==="function"||n==="symbol"),HE=(e,n,r,i)=>{const o=(d,f)=>{const m=i.push(d)-1;return r.set(f,m),m},c=d=>{if(r.has(d))return r.get(d);let[f,m]=io(d);switch(f){case Xu:{let b=d;switch(m){case"bigint":f=H2,b=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);b=null;break;case"undefined":return o([B2],d)}return o([f,b],d)}case xo:{if(m){let v=d;return m==="DataView"?v=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(v=new Uint8Array(d)),o([m,[...v]],d)}const b=[],g=o([f,b],d);for(const v of d)b.push(c(v));return g}case Eu:{if(m)switch(m){case"BigInt":return o([m,d.toString()],d);case"Boolean":case"Number":case"String":return o([m,d.valueOf()],d)}if(n&&"toJSON"in d)return c(d.toJSON());const b=[],g=o([f,b],d);for(const v of UE(d))(e||!lu(io(d[v])))&&b.push([c(v),c(d[v])]);return g}case v0:return o([f,d.toISOString()],d);case j0:{const{source:b,flags:g}=d;return o([f,{source:b,flags:g}],d)}case w0:{const b=[],g=o([f,b],d);for(const[v,y]of d)(e||!(lu(io(v))||lu(io(y))))&&b.push([c(v),c(y)]);return g}case z0:{const b=[],g=o([f,b],d);for(const v of d)(e||!lu(io(v)))&&b.push(c(v));return g}}const{message:h}=d;return o([f,{name:m,message:h}],d)};return c},Ry=(e,{json:n,lossy:r}={})=>{const i=[];return HE(!(n||r),!!n,new Map,i)(e),i},Tu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?Oy(Ry(e,n)):structuredClone(e):(e,n)=>Oy(Ry(e,n));function qE(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function IE(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function PE(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||qE,i=e.options.footnoteBackLabel||IE,o=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const b=e.all(h),g=String(h.identifier).toUpperCase(),v=sl(g.toLowerCase());let y=0;const k=[],C=e.footnoteCounts.get(g);for(;C!==void 0&&++y<=C;){k.length>0&&k.push({type:"text",value:" "});let E=typeof r=="string"?r:r(m,y);typeof E=="string"&&(E={type:"text",value:E}),k.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+v+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(m,y),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const z=b[b.length-1];if(z&&z.type==="element"&&z.tagName==="p"){const E=z.children[z.children.length-1];E&&E.type==="text"?E.value+=" ":z.children.push({type:"text",value:" "}),z.children.push(...k)}else b.push(...k);const j={type:"element",tagName:"li",properties:{id:n+"fn-"+v},children:e.wrap(b,!0)};e.patch(h,j),f.push(j)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Tu(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 Ju=(function(e){if(e==null)return GE;if(typeof e=="function")return Ku(e);if(typeof e=="object")return Array.isArray(e)?FE(e):$E(e);if(typeof e=="string")return VE(e);throw new Error("Expected function, string, or object as test")});function FE(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Ju(e[r]);return Ku(i);function i(...o){let c=-1;for(;++c<n.length;)if(n[c].apply(this,o))return!0;return!1}}function $E(e){const n=e;return Ku(r);function r(i){const o=i;let c;for(c in e)if(o[c]!==n[c])return!1;return!0}}function VE(e){return Ku(n);function n(r){return r&&r.type===e}}function Ku(e){return n;function n(r,i,o){return!!(YE(r)&&e.call(this,r,typeof i=="number"?i:void 0,o||void 0))}}function GE(){return!0}function YE(e){return e!==null&&typeof e=="object"&&"type"in e}const q2=[],QE=!0,ym=!1,XE="skip";function I2(e,n,r,i){let o;typeof n=="function"&&typeof r!="function"?(i=r,r=n):o=n;const c=Ju(o),d=i?-1:1;f(e,void 0,[])();function f(m,h,b){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const y=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(m.type+(y?"<"+y+">":""))+")"})}return v;function v(){let y=q2,k,C,z;if((!n||c(m,h,b[b.length-1]||void 0))&&(y=JE(r(m,b)),y[0]===ym))return y;if("children"in m&&m.children){const j=m;if(j.children&&y[0]!==XE)for(C=(i?j.children.length:-1)+d,z=b.concat(j);C>-1&&C<j.children.length;){const E=j.children[C];if(k=f(E,C,z)(),k[0]===ym)return k;C=typeof k[1]=="number"?k[1]:C+d}}return y}}}function JE(e){return Array.isArray(e)?e:typeof e=="number"?[QE,e]:e==null?q2:[e]}function N0(e,n,r,i){let o,c,d;typeof n=="function"&&typeof r!="function"?(c=void 0,d=n,o=r):(c=n,d=r,o=i),I2(e,c,f,o);function f(m,h){const b=h[h.length-1],g=b?b.children.indexOf(m):void 0;return d(m,g,b)}}const vm={}.hasOwnProperty,KE={};function ZE(e,n){const r=n||KE,i=new Map,o=new Map,c=new Map,d={..._E,...r.handlers},f={all:h,applyData:eT,definitionById:i,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:m,options:r,patch:WE,wrap:nT};return N0(e,function(b){if(b.type==="definition"||b.type==="footnoteDefinition"){const g=b.type==="definition"?i:o,v=String(b.identifier).toUpperCase();g.has(v)||g.set(v,b)}}),f;function m(b,g){const v=b.type,y=f.handlers[v];if(vm.call(f.handlers,v)&&y)return y(f,b,g);if(f.options.passThrough&&f.options.passThrough.includes(v)){if("children"in b){const{children:C,...z}=b,j=Tu(z);return j.children=f.all(b),j}return Tu(b)}return(f.options.unknownHandler||tT)(f,b,g)}function h(b){const g=[];if("children"in b){const v=b.children;let y=-1;for(;++y<v.length;){const k=f.one(v[y],b);if(k){if(y&&v[y-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=_y(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=_y(C.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function WE(e,n){e.position&&(n.position=I3(e))}function eT(e,n){let r=n;if(e&&e.data){const i=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const d="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:d}}r.type==="element"&&c&&Object.assign(r.properties,Tu(c)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function tT(e,n){const r=n.data||{},i="value"in n&&!(vm.call(r,"hProperties")||vm.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function nT(e,n){const r=[];let i=-1;for(n&&r.push({type:"text",value:`
`});++i<e.length;)i&&r.push({type:"text",value:`
`}),r.push(e[i]);return n&&e.length>0&&r.push({type:"text",value:`
`}),r}function _y(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function Ly(e,n){const r=ZE(e,n),i=r.one(e,void 0),o=PE(r),c=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
`},o),c}function aT(e,n){return e&&"run"in e?async function(r,i){const o=Ly(r,{file:i,...n});await e.run(o,i)}:function(r,i){return Ly(r,{file:i,...e||n})}}function By(e){if(e)throw e}var Th,Uy;function sT(){if(Uy)return Th;Uy=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},c=function(h){if(!h||n.call(h)!=="[object Object]")return!1;var b=e.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!b&&!g)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},d=function(h,b){r&&b.name==="__proto__"?r(h,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):h[b.name]=b.newValue},f=function(h,b){if(b==="__proto__")if(e.call(h,b)){if(i)return i(h,b).value}else return;return h[b]};return Th=function m(){var h,b,g,v,y,k,C=arguments[0],z=1,j=arguments.length,E=!1;for(typeof C=="boolean"&&(E=C,C=arguments[1]||{},z=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});z<j;++z)if(h=arguments[z],h!=null)for(b in h)g=f(C,b),v=f(h,b),C!==v&&(E&&v&&(c(v)||(y=o(v)))?(y?(y=!1,k=g&&o(g)?g:[]):k=g&&c(g)?g:{},d(C,{name:b,newValue:m(E,k,v)})):typeof v<"u"&&d(C,{name:b,newValue:v}));return C},Th}var rT=sT();const Ah=Ou(rT);function jm(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function iT(){const e=[],n={run:r,use:i};return n;function r(...o){let c=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);f(null,...o);function f(m,...h){const b=e[++c];let g=-1;if(m){d(m);return}for(;++g<o.length;)(h[g]===null||h[g]===void 0)&&(h[g]=o[g]);o=h,b?lT(b,f)(...h):d(null,...h)}}function i(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),n}}function lT(e,n){let r;return i;function i(...d){const f=e.length>d.length;let m;f&&d.push(o);try{m=e.apply(this,d)}catch(h){const b=h;if(f&&r)throw b;return o(b)}f||(m&&m.then&&typeof m.then=="function"?m.then(c,o):m instanceof Error?o(m):c(m))}function o(d,...f){r||(r=!0,n(d,...f))}function c(d){o(null,d)}}const Da={basename:oT,dirname:cT,extname:uT,join:dT,sep:"/"};function oT(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Ho(e);let r=0,i=-1,o=e.length,c;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else i<0&&(c=!0,i=o+1);return i<0?"":e.slice(r,i)}if(n===e)return"";let d=-1,f=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else d<0&&(c=!0,d=o+1),f>-1&&(e.codePointAt(o)===n.codePointAt(f--)?f<0&&(i=o):(f=-1,i=d));return r===i?i=d:i<0&&(i=e.length),e.slice(r,i)}function cT(e){if(Ho(e),e.length===0)return".";let n=-1,r=e.length,i;for(;--r;)if(e.codePointAt(r)===47){if(i){n=r;break}}else i||(i=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function uT(e){Ho(e);let n=e.length,r=-1,i=0,o=-1,c=0,d;for(;n--;){const f=e.codePointAt(n);if(f===47){if(d){i=n+1;break}continue}r<0&&(d=!0,r=n+1),f===46?o<0?o=n:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||r<0||c===0||c===1&&o===r-1&&o===i+1?"":e.slice(o,r)}function dT(...e){let n=-1,r;for(;++n<e.length;)Ho(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":fT(r)}function fT(e){Ho(e);const n=e.codePointAt(0)===47;let r=hT(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function hT(e,n){let r="",i=0,o=-1,c=0,d=-1,f,m;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||c===1))if(o!==d-1&&c===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",i=0):(r=r.slice(0,m),i=r.length-1-r.lastIndexOf("/")),o=d,c=0;continue}}else if(r.length>0){r="",i=0,o=d,c=0;continue}}n&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),i=d-o-1;o=d,c=0}else f===46&&c>-1?c++:c=-1}return r}function Ho(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const mT={cwd:pT};function pT(){return"/"}function wm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function xT(e){if(typeof e=="string")e=new URL(e);else if(!wm(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return gT(e)}function gT(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const i=n.codePointAt(r+2);if(i===70||i===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(n)}const Mh=["history","path","basename","stem","extname","dirname"];class P2{constructor(n){let r;n?wm(n)?r={path:n}:typeof n=="string"||bT(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":mT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Mh.length;){const c=Mh[i];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let o;for(o in r)Mh.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?Da.basename(this.path):void 0}set basename(n){Oh(n,"basename"),Dh(n,"basename"),this.path=Da.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Da.dirname(this.path):void 0}set dirname(n){Hy(this.basename,"dirname"),this.path=Da.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Da.extname(this.path):void 0}set extname(n){if(Dh(n,"extname"),Hy(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Da.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){wm(n)&&(n=xT(n)),Oh(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Da.basename(this.path,this.extname):void 0}set stem(n){Oh(n,"stem"),Dh(n,"stem"),this.path=Da.join(this.dirname||"",n+(this.extname||""))}fail(n,r,i){const o=this.message(n,r,i);throw o.fatal=!0,o}info(n,r,i){const o=this.message(n,r,i);return o.fatal=void 0,o}message(n,r,i){const o=new on(n,r,i);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function Dh(e,n){if(e&&e.includes(Da.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Da.sep+"`")}function Oh(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function Hy(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function bT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yT=(function(e){const i=this.constructor.prototype,o=i[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),vT={}.hasOwnProperty;class k0 extends yT{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=iT()}copy(){const n=new k0;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];n.use(...i)}return n.data(Ah(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Lh("data",this.frozen),this.namespace[n]=r,this):vT.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Lh("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const o=r.call(n,...i);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=ou(n),i=this.parser||this.Parser;return Rh("parse",i),i(String(r),r)}process(n,r){const i=this;return this.freeze(),Rh("process",this.parser||this.Parser),_h("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(c,d){const f=ou(n),m=i.parse(f);i.run(m,f,function(b,g,v){if(b||!g||!v)return h(b);const y=g,k=i.stringify(y,v);zT(k)?v.value=k:v.result=k,h(b,v)});function h(b,g){b||!g?d(b):c?c(g):r(void 0,g)}}}processSync(n){let r=!1,i;return this.freeze(),Rh("processSync",this.parser||this.Parser),_h("processSync",this.compiler||this.Compiler),this.process(n,o),Iy("processSync","process",r),i;function o(c,d){r=!0,By(c),i=d}}run(n,r,i){qy(n),this.freeze();const o=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?c(void 0,i):new Promise(c);function c(d,f){const m=ou(r);o.run(n,m,h);function h(b,g,v){const y=g||n;b?f(b):d?d(y):i(void 0,y,v)}}}runSync(n,r){let i=!1,o;return this.run(n,r,c),Iy("runSync","run",i),o;function c(d,f){By(d),o=f,i=!0}}stringify(n,r){this.freeze();const i=ou(r),o=this.compiler||this.Compiler;return _h("stringify",o),qy(n),o(n,i)}use(n,...r){const i=this.attachers,o=this.namespace;if(Lh("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):d(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function c(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[b,...g]=h;m(b,g)}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=Ah(!0,o.settings,h.settings))}function f(h){let b=-1;if(h!=null)if(Array.isArray(h))for(;++b<h.length;){const g=h[b];c(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,b){let g=-1,v=-1;for(;++g<i.length;)if(i[g][0]===h){v=g;break}if(v===-1)i.push([h,...b]);else if(b.length>0){let[y,...k]=b;const C=i[v][1];jm(C)&&jm(y)&&(y=Ah(!0,C,y)),i[v]=[h,y,...k]}}}}const jT=new k0().freeze();function Rh(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function _h(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Lh(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function qy(e){if(!jm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Iy(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function ou(e){return wT(e)?e:new P2(e)}function wT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function zT(e){return typeof e=="string"||NT(e)}function NT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const kT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Py=[],Fy={allowDangerousHtml:!0},ST=/^(https?|ircs?|mailto|xmpp)$/i,CT=[{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 ET(e){const n=TT(e),r=AT(e);return MT(n.runSync(n.parse(r),r),e)}function TT(e){const n=e.rehypePlugins||Py,r=e.remarkPlugins||Py,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Fy}:Fy;return jT().use(cE).use(r).use(aT,i).use(n)}function AT(e){const n=e.children||"",r=new P2;return typeof n=="string"&&(r.value=n),r}function MT(e,n){const r=n.allowedElements,i=n.allowElement,o=n.components,c=n.disallowedElements,d=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||DT;for(const b of CT)Object.hasOwn(n,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+kT+b.id,void 0);return N0(e,h),G3(e,{Fragment:s.Fragment,components:o,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function h(b,g,v){if(b.type==="raw"&&v&&typeof g=="number")return d?v.children.splice(g,1):v.children[g]={type:"text",value:b.value},g;if(b.type==="element"){let y;for(y in Sh)if(Object.hasOwn(Sh,y)&&Object.hasOwn(b.properties,y)){const k=b.properties[y],C=Sh[y];(C===null||C.includes(b.tagName))&&(b.properties[y]=m(String(k||""),y,b))}}if(b.type==="element"){let y=r?!r.includes(b.tagName):c?c.includes(b.tagName):!1;if(!y&&i&&typeof g=="number"&&(y=!i(b,g,v)),y&&v&&typeof g=="number")return f&&b.children?v.children.splice(g,1,...b.children):v.children.splice(g,1),g}}}function DT(e){const n=e.indexOf(":"),r=e.indexOf("?"),i=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||r!==-1&&n>r||i!==-1&&n>i||ST.test(e.slice(0,n))?e:""}function $y(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,o=r.indexOf(n);for(;o!==-1;)i++,o=r.indexOf(n,o+n.length);return i}function OT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function RT(e,n,r){const o=Ju((r||{}).ignore||[]),c=_T(n);let d=-1;for(;++d<c.length;)I2(e,"text",f);function f(h,b){let g=-1,v;for(;++g<b.length;){const y=b[g],k=v?v.children:void 0;if(o(y,k?k.indexOf(y):void 0,v))return;v=y}if(v)return m(h,b)}function m(h,b){const g=b[b.length-1],v=c[d][0],y=c[d][1];let k=0;const z=g.children.indexOf(h);let j=!1,E=[];v.lastIndex=0;let N=v.exec(h.value);for(;N;){const M=N.index,R={index:N.index,input:N.input,stack:[...b,h]};let A=y(...N,R);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?v.lastIndex=M+1:(k!==M&&E.push({type:"text",value:h.value.slice(k,M)}),Array.isArray(A)?E.push(...A):A&&E.push(A),k=M+N[0].length,j=!0),!v.global)break;N=v.exec(h.value)}return j?(k<h.value.length&&E.push({type:"text",value:h.value.slice(k)}),g.children.splice(z,1,...E)):E=[h],z+E.length}}function _T(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<r.length;){const o=r[i];n.push([LT(o[0]),BT(o[1])])}return n}function LT(e){return typeof e=="string"?new RegExp(OT(e),"g"):e}function BT(e){return typeof e=="function"?e:function(){return e}}const Bh="phrasing",Uh=["autolink","link","image","label"];function UT(){return{transforms:[VT],enter:{literalAutolink:qT,literalAutolinkEmail:Hh,literalAutolinkHttp:Hh,literalAutolinkWww:Hh},exit:{literalAutolink:$T,literalAutolinkEmail:FT,literalAutolinkHttp:IT,literalAutolinkWww:PT}}}function HT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Bh,notInConstruct:Uh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Bh,notInConstruct:Uh},{character:":",before:"[ps]",after:"\\/",inConstruct:Bh,notInConstruct:Uh}]}}function qT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Hh(e){this.config.enter.autolinkProtocol.call(this,e)}function IT(e){this.config.exit.autolinkProtocol.call(this,e)}function PT(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function FT(e){this.config.exit.autolinkEmail.call(this,e)}function $T(e){this.exit(e)}function VT(e){RT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,GT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),YT]],{ignore:["link","linkReference"]})}function GT(e,n,r,i,o){let c="";if(!F2(o)||(/^w/i.test(n)&&(r=n+r,n="",c="http://"),!QT(r)))return!1;const d=XT(r+i);if(!d[0])return!1;const f={type:"link",title:null,url:c+n+d[0],children:[{type:"text",value:n+d[0]}]};return d[1]?[f,{type:"text",value:d[1]}]:f}function YT(e,n,r,i){return!F2(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function QT(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function XT(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],i=r.indexOf(")");const o=$y(e,"(");let c=$y(e,")");for(;i!==-1&&o>c;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),c++;return[e,r]}function F2(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||Ir(r)||Yu(r))&&(!n||r!==47)}$2.peek=s8;function JT(){this.buffer()}function KT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ZT(){this.buffer()}function WT(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function e8(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=va(this.sliceSerialize(e)).toLowerCase(),r.label=n}function t8(e){this.exit(e)}function n8(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=va(this.sliceSerialize(e)).toLowerCase(),r.label=n}function a8(e){this.exit(e)}function s8(){return"["}function $2(e,n,r,i){const o=r.createTracker(i);let c=o.move("[^");const d=r.enter("footnoteReference"),f=r.enter("reference");return c+=o.move(r.safe(r.associationId(e),{after:"]",before:c})),f(),d(),c+=o.move("]"),c}function r8(){return{enter:{gfmFootnoteCallString:JT,gfmFootnoteCall:KT,gfmFootnoteDefinitionLabelString:ZT,gfmFootnoteDefinition:WT},exit:{gfmFootnoteCallString:e8,gfmFootnoteCall:t8,gfmFootnoteDefinitionLabelString:n8,gfmFootnoteDefinition:a8}}}function i8(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:$2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,o,c,d){const f=c.createTracker(d);let m=f.move("[^");const h=c.enter("footnoteDefinition"),b=c.enter("label");return m+=f.move(c.safe(c.associationId(i),{before:m,after:"]"})),b(),m+=f.move("]:"),i.children&&i.children.length>0&&(f.shift(4),m+=f.move((n?`
`:" ")+c.indentLines(c.containerFlow(i,f.current()),n?V2:l8))),h(),m}}function l8(e,n,r){return n===0?e:V2(e,n,r)}function V2(e,n,r){return(r?"":"    ")+e}const o8=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];G2.peek=h8;function c8(){return{canContainEols:["delete"],enter:{strikethrough:d8},exit:{strikethrough:f8}}}function u8(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:o8}],handlers:{delete:G2}}}function d8(e){this.enter({type:"delete",children:[]},e)}function f8(e){this.exit(e)}function G2(e,n,r,i){const o=r.createTracker(i),c=r.enter("strikethrough");let d=o.move("~~");return d+=r.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),c(),d}function h8(){return"~"}function m8(e){return e.length}function p8(e,n){const r=n||{},i=(r.align||[]).concat(),o=r.stringLength||m8,c=[],d=[],f=[],m=[];let h=0,b=-1;for(;++b<e.length;){const C=[],z=[];let j=-1;for(e[b].length>h&&(h=e[b].length);++j<e[b].length;){const E=x8(e[b][j]);if(r.alignDelimiters!==!1){const N=o(E);z[j]=N,(m[j]===void 0||N>m[j])&&(m[j]=N)}C.push(E)}d[b]=C,f[b]=z}let g=-1;if(typeof i=="object"&&"length"in i)for(;++g<h;)c[g]=Vy(i[g]);else{const C=Vy(i);for(;++g<h;)c[g]=C}g=-1;const v=[],y=[];for(;++g<h;){const C=c[g];let z="",j="";C===99?(z=":",j=":"):C===108?z=":":C===114&&(j=":");let E=r.alignDelimiters===!1?1:Math.max(1,m[g]-z.length-j.length);const N=z+"-".repeat(E)+j;r.alignDelimiters!==!1&&(E=z.length+E+j.length,E>m[g]&&(m[g]=E),y[g]=E),v[g]=N}d.splice(1,0,v),f.splice(1,0,y),b=-1;const k=[];for(;++b<d.length;){const C=d[b],z=f[b];g=-1;const j=[];for(;++g<h;){const E=C[g]||"";let N="",M="";if(r.alignDelimiters!==!1){const R=m[g]-(z[g]||0),A=c[g];A===114?N=" ".repeat(R):A===99?R%2?(N=" ".repeat(R/2+.5),M=" ".repeat(R/2-.5)):(N=" ".repeat(R/2),M=N):M=" ".repeat(R)}r.delimiterStart!==!1&&!g&&j.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&E==="")&&(r.delimiterStart!==!1||g)&&j.push(" "),r.alignDelimiters!==!1&&j.push(N),j.push(E),r.alignDelimiters!==!1&&j.push(M),r.padding!==!1&&j.push(" "),(r.delimiterEnd!==!1||g!==h-1)&&j.push("|")}k.push(r.delimiterEnd===!1?j.join("").replace(/ +$/,""):j.join(""))}return k.join(`
`)}function x8(e){return e==null?"":String(e)}function Vy(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function g8(e,n,r,i){const o=r.enter("blockquote"),c=r.createTracker(i);c.move("> "),c.shift(2);const d=r.indentLines(r.containerFlow(e,c.current()),b8);return o(),d}function b8(e,n,r){return">"+(r?"":" ")+e}function y8(e,n){return Gy(e,n.inConstruct,!0)&&!Gy(e,n.notInConstruct,!1)}function Gy(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let i=-1;for(;++i<n.length;)if(e.includes(n[i]))return!0;return!1}function Yy(e,n,r,i){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
`&&y8(r.stack,r.unsafe[o]))return/[ \t]/.test(i.before)?"":" ";return`\\
`}function v8(e,n){const r=String(e);let i=r.indexOf(n),o=i,c=0,d=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===o?++c>d&&(d=c):c=1,o=i+n.length,i=r.indexOf(n,o);return d}function j8(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function w8(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function z8(e,n,r,i){const o=w8(r),c=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(j8(e,r)){const g=r.enter("codeIndented"),v=r.indentLines(c,N8);return g(),v}const f=r.createTracker(i),m=o.repeat(Math.max(v8(c,o)+1,3)),h=r.enter("codeFenced");let b=f.move(m);if(e.lang){const g=r.enter(`codeFencedLang${d}`);b+=f.move(r.safe(e.lang,{before:b,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${d}`);b+=f.move(" "),b+=f.move(r.safe(e.meta,{before:b,after:`
`,encode:["`"],...f.current()})),g()}return b+=f.move(`
`),c&&(b+=f.move(c+`
`)),b+=f.move(m),h(),b}function N8(e,n,r){return(r?"":"    ")+e}function S0(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function k8(e,n,r,i){const o=S0(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("definition");let f=r.enter("label");const m=r.createTracker(i);let h=m.move("[");return h+=m.move(r.safe(r.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":`
`,...m.current()}))),f(),e.title&&(f=r.enter(`title${c}`),h+=m.move(" "+o),h+=m.move(r.safe(e.title,{before:h,after:o,...m.current()})),h+=m.move(o),f()),d(),h}function S8(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function zo(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Au(e,n,r){const i=Xi(e),o=Xi(n);return i===void 0?o===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===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}}Y2.peek=C8;function Y2(e,n,r,i){const o=S8(r),c=r.enter("emphasis"),d=r.createTracker(i),f=d.move(o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),b=Au(i.before.charCodeAt(i.before.length-1),h,o);b.inside&&(m=zo(h)+m.slice(1));const g=m.charCodeAt(m.length-1),v=Au(i.after.charCodeAt(0),g,o);v.inside&&(m=m.slice(0,-1)+zo(g));const y=d.move(o);return c(),r.attentionEncodeSurroundingInfo={after:v.outside,before:b.outside},f+m+y}function C8(e,n,r){return r.options.emphasis||"*"}function E8(e,n){let r=!1;return N0(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,ym}),!!((!e.depth||e.depth<3)&&g0(e)&&(n.options.setext||r))}function T8(e,n,r,i){const o=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(i);if(E8(e,r)){const b=r.enter("headingSetext"),g=r.enter("phrasing"),v=r.containerPhrasing(e,{...c.current(),before:`
`,after:`
`});return g(),b(),v+`
`+(o===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
`))+1))}const d="#".repeat(o),f=r.enter("headingAtx"),m=r.enter("phrasing");c.move(d+" ");let h=r.containerPhrasing(e,{before:"# ",after:`
`,...c.current()});return/^[\t ]/.test(h)&&(h=zo(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,r.options.closeAtx&&(h+=" "+d),m(),f(),h}Q2.peek=A8;function Q2(e){return e.value||""}function A8(){return"<"}X2.peek=M8;function X2(e,n,r,i){const o=S0(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("image");let f=r.enter("label");const m=r.createTracker(i);let h=m.move("![");return h+=m.move(r.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${c}`),h+=m.move(" "+o),h+=m.move(r.safe(e.title,{before:h,after:o,...m.current()})),h+=m.move(o),f()),h+=m.move(")"),d(),h}function M8(){return"!"}J2.peek=D8;function J2(e,n,r,i){const o=e.referenceType,c=r.enter("imageReference");let d=r.enter("label");const f=r.createTracker(i);let m=f.move("![");const h=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const b=r.stack;r.stack=[],d=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=b,c(),o==="full"||!h||h!==g?m+=f.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function D8(){return"!"}K2.peek=O8;function K2(e,n,r){let i=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(i);)o+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++c<r.unsafe.length;){const d=r.unsafe[c],f=r.compilePattern(d);let m;if(d.atBreak)for(;m=f.exec(i);){let h=m.index;i.charCodeAt(h)===10&&i.charCodeAt(h-1)===13&&h--,i=i.slice(0,h)+" "+i.slice(m.index+1)}}return o+i+o}function O8(){return"`"}function Z2(e,n){const r=g0(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}W2.peek=R8;function W2(e,n,r,i){const o=S0(r),c=o==='"'?"Quote":"Apostrophe",d=r.createTracker(i);let f,m;if(Z2(e,r)){const b=r.stack;r.stack=[],f=r.enter("autolink");let g=d.move("<");return g+=d.move(r.containerPhrasing(e,{before:g,after:">",...d.current()})),g+=d.move(">"),f(),r.stack=b,g}f=r.enter("link"),m=r.enter("label");let h=d.move("[");return h+=d.move(r.containerPhrasing(e,{before:h,after:"](",...d.current()})),h+=d.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(m=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),m(),e.title&&(m=r.enter(`title${c}`),h+=d.move(" "+o),h+=d.move(r.safe(e.title,{before:h,after:o,...d.current()})),h+=d.move(o),m()),h+=d.move(")"),f(),h}function R8(e,n,r){return Z2(e,r)?"<":"["}ej.peek=_8;function ej(e,n,r,i){const o=e.referenceType,c=r.enter("linkReference");let d=r.enter("label");const f=r.createTracker(i);let m=f.move("[");const h=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const b=r.stack;r.stack=[],d=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=b,c(),o==="full"||!h||h!==g?m+=f.move(g+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function _8(){return"["}function C0(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function L8(e){const n=C0(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function B8(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function tj(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function U8(e,n,r,i){const o=r.enter("list"),c=r.bulletCurrent;let d=e.ordered?B8(r):C0(r);const f=e.ordered?d==="."?")":".":L8(r);let m=n&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!e.ordered){const b=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&b&&(!b.children||!b.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),tj(r)===d&&b){let g=-1;for(;++g<e.children.length;){const v=e.children[g];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(d=f),r.bulletCurrent=d;const h=r.containerFlow(e,i);return r.bulletLastUsed=d,r.bulletCurrent=c,o(),h}function H8(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function q8(e,n,r,i){const o=H8(r);let c=r.bulletCurrent||C0(r);n&&n.type==="list"&&n.ordered&&(c=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+c);let d=c.length+1;(o==="tab"||o==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(d=Math.ceil(d/4)*4);const f=r.createTracker(i);f.move(c+" ".repeat(d-c.length)),f.shift(d);const m=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,f.current()),b);return m(),h;function b(g,v,y){return v?(y?"":" ".repeat(d))+g:(y?c:c+" ".repeat(d-c.length))+g}}function I8(e,n,r,i){const o=r.enter("paragraph"),c=r.enter("phrasing"),d=r.containerPhrasing(e,i);return c(),o(),d}const P8=Ju(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function F8(e,n,r,i){return(e.children.some(function(d){return P8(d)})?r.containerPhrasing:r.containerFlow).call(r,e,i)}function $8(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}nj.peek=V8;function nj(e,n,r,i){const o=$8(r),c=r.enter("strong"),d=r.createTracker(i),f=d.move(o+o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),b=Au(i.before.charCodeAt(i.before.length-1),h,o);b.inside&&(m=zo(h)+m.slice(1));const g=m.charCodeAt(m.length-1),v=Au(i.after.charCodeAt(0),g,o);v.inside&&(m=m.slice(0,-1)+zo(g));const y=d.move(o+o);return c(),r.attentionEncodeSurroundingInfo={after:v.outside,before:b.outside},f+m+y}function V8(e,n,r){return r.options.strong||"*"}function G8(e,n,r,i){return r.safe(e.value,i)}function Y8(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function Q8(e,n,r){const i=(tj(r)+(r.options.ruleSpaces?" ":"")).repeat(Y8(r));return r.options.ruleSpaces?i.slice(0,-1):i}const aj={blockquote:g8,break:Yy,code:z8,definition:k8,emphasis:Y2,hardBreak:Yy,heading:T8,html:Q2,image:X2,imageReference:J2,inlineCode:K2,link:W2,linkReference:ej,list:U8,listItem:q8,paragraph:I8,root:F8,strong:nj,text:G8,thematicBreak:Q8};function X8(){return{enter:{table:J8,tableData:Qy,tableHeader:Qy,tableRow:Z8},exit:{codeText:W8,table:K8,tableData:qh,tableHeader:qh,tableRow:qh}}}function J8(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function K8(e){this.exit(e),this.data.inTable=void 0}function Z8(e){this.enter({type:"tableRow",children:[]},e)}function qh(e){this.exit(e)}function Qy(e){this.enter({type:"tableCell",children:[]},e)}function W8(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,eA));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function eA(e,n){return n==="|"?n:e}function tA(e){const n=e||{},r=n.tableCellPadding,i=n.tablePipeAlign,o=n.stringLength,c=r?" ":"|";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:m,tableRow:f}};function d(y,k,C,z){return h(b(y,C,z),y.align)}function f(y,k,C,z){const j=g(y,C,z),E=h([j]);return E.slice(0,E.indexOf(`
`))}function m(y,k,C,z){const j=C.enter("tableCell"),E=C.enter("phrasing"),N=C.containerPhrasing(y,{...z,before:c,after:c});return E(),j(),N}function h(y,k){return p8(y,{align:k,alignDelimiters:i,padding:r,stringLength:o})}function b(y,k,C){const z=y.children;let j=-1;const E=[],N=k.enter("table");for(;++j<z.length;)E[j]=g(z[j],k,C);return N(),E}function g(y,k,C){const z=y.children;let j=-1;const E=[],N=k.enter("tableRow");for(;++j<z.length;)E[j]=m(z[j],y,k,C);return N(),E}function v(y,k,C){let z=aj.inlineCode(y,k,C);return C.stack.includes("tableCell")&&(z=z.replace(/\|/g,"\\$&")),z}}function nA(){return{exit:{taskListCheckValueChecked:Xy,taskListCheckValueUnchecked:Xy,paragraph:sA}}}function aA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:rA}}}function Xy(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function sA(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const o=n.children;let c=-1,d;for(;++c<o.length;){const f=o[c];if(f.type==="paragraph"){d=f;break}}d===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function rA(e,n,r,i){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",f=r.createTracker(i);c&&f.move(d);let m=aj.listItem(e,n,r,{...i,...f.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(b){return b+d}}function iA(){return[UT(),r8(),c8(),X8(),nA()]}function lA(e){return{extensions:[HT(),i8(e),u8(),tA(e),aA()]}}const oA={tokenize:mA,partial:!0},sj={tokenize:pA,partial:!0},rj={tokenize:xA,partial:!0},ij={tokenize:gA,partial:!0},cA={tokenize:bA,partial:!0},lj={name:"wwwAutolink",tokenize:fA,previous:cj},oj={name:"protocolAutolink",tokenize:hA,previous:uj},vs={name:"emailAutolink",tokenize:dA,previous:dj},Pa={};function uA(){return{text:Pa}}let Er=48;for(;Er<123;)Pa[Er]=vs,Er++,Er===58?Er=65:Er===91&&(Er=97);Pa[43]=vs;Pa[45]=vs;Pa[46]=vs;Pa[95]=vs;Pa[72]=[vs,oj];Pa[104]=[vs,oj];Pa[87]=[vs,lj];Pa[119]=[vs,lj];function dA(e,n,r){const i=this;let o,c;return d;function d(g){return!zm(g)||!dj.call(i,i.previous)||E0(i.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return zm(g)?(e.consume(g),f):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(cA,b,h)(g):g===45||g===95||rn(g)?(c=!0,e.consume(g),m):b(g)}function h(g){return e.consume(g),o=!0,m}function b(g){return c&&o&&pn(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):r(g)}}function fA(e,n,r){const i=this;return o;function o(d){return d!==87&&d!==119||!cj.call(i,i.previous)||E0(i.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(oA,e.attempt(sj,e.attempt(rj,c),r),r)(d))}function c(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(d)}}function hA(e,n,r){const i=this;let o="",c=!1;return d;function d(g){return(g===72||g===104)&&uj.call(i,i.previous)&&!E0(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),f):r(g)}function f(g){if(pn(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const v=o.toLowerCase();if(v==="http"||v==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),c?h:(c=!0,m)):r(g)}function h(g){return g===null||Cu(g)||dt(g)||Ir(g)||Yu(g)?r(g):e.attempt(sj,e.attempt(rj,b),r)(g)}function b(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function mA(e,n,r){let i=0;return o;function o(d){return(d===87||d===119)&&i<3?(i++,e.consume(d),o):d===46&&i===3?(e.consume(d),c):r(d)}function c(d){return d===null?r(d):n(d)}}function pA(e,n,r){let i,o,c;return d;function d(h){return h===46||h===95?e.check(ij,m,f)(h):h===null||dt(h)||Ir(h)||h!==45&&Yu(h)?m(h):(c=!0,e.consume(h),d)}function f(h){return h===95?i=!0:(o=i,i=void 0),e.consume(h),d}function m(h){return o||i||!c?r(h):n(h)}}function xA(e,n){let r=0,i=0;return o;function o(d){return d===40?(r++,e.consume(d),o):d===41&&i<r?c(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(ij,n,c)(d):d===null||dt(d)||Ir(d)?n(d):(e.consume(d),o)}function c(d){return d===41&&i++,e.consume(d),o}}function gA(e,n,r){return i;function i(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),i):f===38?(e.consume(f),c):f===93?(e.consume(f),o):f===60||f===null||dt(f)||Ir(f)?n(f):r(f)}function o(f){return f===null||f===40||f===91||dt(f)||Ir(f)?n(f):i(f)}function c(f){return pn(f)?d(f):r(f)}function d(f){return f===59?(e.consume(f),i):pn(f)?(e.consume(f),d):r(f)}}function bA(e,n,r){return i;function i(c){return e.consume(c),o}function o(c){return rn(c)?r(c):n(c)}}function cj(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||dt(e)}function uj(e){return!pn(e)}function dj(e){return!(e===47||zm(e))}function zm(e){return e===43||e===45||e===46||e===95||rn(e)}function E0(e){let n=e.length,r=!1;for(;n--;){const i=e[n][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const yA={tokenize:CA,partial:!0};function vA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:NA,continuation:{tokenize:kA},exit:SA}},text:{91:{name:"gfmFootnoteCall",tokenize:zA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jA,resolveTo:wA}}}}function jA(e,n,r){const i=this;let o=i.events.length;const c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let d;for(;o--;){const m=i.events[o][1];if(m.type==="labelImage"){d=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!d||!d._balanced)return r(m);const h=va(i.sliceSerialize({start:d.end,end:i.now()}));return h.codePointAt(0)!==94||!c.includes(h.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function wA(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[r+1],e[r+2],["enter",i,n],e[r+3],e[r+4],["enter",o,n],["exit",o,n],["enter",c,n],["enter",d,n],["exit",d,n],["exit",c,n],e[e.length-2],e[e.length-1],["exit",i,n]];return e.splice(r,e.length-r+1,...f),e}function zA(e,n,r){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=0,d;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(c>999||g===93&&!d||g===null||g===91||dt(g))return r(g);if(g===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return o.includes(va(i.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(g)}return dt(g)||(d=!0),c++,e.consume(g),g===92?b:h}function b(g){return g===91||g===92||g===93?(e.consume(g),c++,h):h(g)}}function NA(e,n,r){const i=this,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,d=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",b):r(k)}function b(k){if(d>999||k===93&&!f||k===null||k===91||dt(k))return r(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=va(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return dt(k)||(f=!0),d++,e.consume(k),k===92?g:b}function g(k){return k===91||k===92||k===93?(e.consume(k),d++,b):b(k)}function v(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),o.includes(c)||o.push(c),Ke(e,y,"gfmFootnoteDefinitionWhitespace")):r(k)}function y(k){return n(k)}}function kA(e,n,r){return e.check(Uo,n,e.attempt(yA,n,r))}function SA(e){e.exit("gfmFootnoteDefinition")}function CA(e,n,r){const i=this;return Ke(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const d=i.events[i.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?n(c):r(c)}}function EA(e){let r=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:c,resolveAll:o};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function o(d,f){let m=-1;for(;++m<d.length;)if(d[m][0]==="enter"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._close){let h=m;for(;h--;)if(d[h][0]==="exit"&&d[h][1].type==="strikethroughSequenceTemporary"&&d[h][1]._open&&d[m][1].end.offset-d[m][1].start.offset===d[h][1].end.offset-d[h][1].start.offset){d[m][1].type="strikethroughSequence",d[h][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},d[h][1].start),end:Object.assign({},d[m][1].end)},g={type:"strikethroughText",start:Object.assign({},d[h][1].end),end:Object.assign({},d[m][1].start)},v=[["enter",b,f],["enter",d[h][1],f],["exit",d[h][1],f],["enter",g,f]],y=f.parser.constructs.insideSpan.null;y&&Yn(v,v.length,0,Qu(y,d.slice(h+1,m),f)),Yn(v,v.length,0,[["exit",g,f],["enter",d[m][1],f],["exit",d[m][1],f],["exit",b,f]]),Yn(d,h-1,m-h+3,v),m=h+v.length-2;break}}for(m=-1;++m<d.length;)d[m][1].type==="strikethroughSequenceTemporary"&&(d[m][1].type="data");return d}function c(d,f,m){const h=this.previous,b=this.events;let g=0;return v;function v(k){return h===126&&b[b.length-1][1].type!=="characterEscape"?m(k):(d.enter("strikethroughSequenceTemporary"),y(k))}function y(k){const C=Xi(h);if(k===126)return g>1?m(k):(d.consume(k),g++,y);if(g<2&&!r)return m(k);const z=d.exit("strikethroughSequenceTemporary"),j=Xi(k);return z._open=!j||j===2&&!!C,z._close=!C||C===2&&!!j,f(k)}}}class TA{constructor(){this.map=[]}add(n,r,i){AA(this,n,r,i)}consume(n){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];i.push(n.slice()),n.length=0;let o=i.pop();for(;o;){for(const c of o)n.push(c);o=i.pop()}this.map.length=0}}function AA(e,n,r,i){let o=0;if(!(r===0&&i.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=r,e.map[o][2].push(...i);return}o+=1}e.map.push([n,r,i])}}function MA(e,n){let r=!1;const i=[];for(;n<e.length;){const o=e[n];if(r){if(o[0]==="enter")o[1].type==="tableContent"&&i.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const c=i.length-1;i[c]=i[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return i}function DA(){return{flow:{null:{name:"table",tokenize:OA,resolveAll:RA}}}}function OA(e,n,r){const i=this;let o=0,c=0,d;return f;function f(L){let P=i.events.length-1;for(;P>-1;){const _=i.events[P][1].type;if(_==="lineEnding"||_==="linePrefix")P--;else break}const Y=P>-1?i.events[P][1].type:null,me=Y==="tableHead"||Y==="tableRow"?A:m;return me===A&&i.parser.lazy[i.now().line]?r(L):me(L)}function m(L){return e.enter("tableHead"),e.enter("tableRow"),h(L)}function h(L){return L===124||(d=!0,c+=1),b(L)}function b(L){return L===null?r(L):Se(L)?c>1?(c=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),y):r(L):Fe(L)?Ke(e,b,"whitespace")(L):(c+=1,d&&(d=!1,o+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),d=!0,b):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||dt(L)?(e.exit("data"),b(L)):(e.consume(L),L===92?v:g)}function v(L){return L===92||L===124?(e.consume(L),g):g(L)}function y(L){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(L):(e.enter("tableDelimiterRow"),d=!1,Fe(L)?Ke(e,k,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):k(L))}function k(L){return L===45||L===58?z(L):L===124?(d=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),C):R(L)}function C(L){return Fe(L)?Ke(e,z,"whitespace")(L):z(L)}function z(L){return L===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),j):L===45?(c+=1,j(L)):L===null||Se(L)?M(L):R(L)}function j(L){return L===45?(e.enter("tableDelimiterFiller"),E(L)):R(L)}function E(L){return L===45?(e.consume(L),E):L===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(L))}function N(L){return Fe(L)?Ke(e,M,"whitespace")(L):M(L)}function M(L){return L===124?k(L):L===null||Se(L)?!d||o!==c?R(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(L)):R(L)}function R(L){return r(L)}function A(L){return e.enter("tableRow"),F(L)}function F(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),F):L===null||Se(L)?(e.exit("tableRow"),n(L)):Fe(L)?Ke(e,F,"whitespace")(L):(e.enter("data"),ee(L))}function ee(L){return L===null||L===124||dt(L)?(e.exit("data"),F(L)):(e.consume(L),L===92?Z:ee)}function Z(L){return L===92||L===124?(e.consume(L),ee):ee(L)}}function RA(e,n){let r=-1,i=!0,o=0,c=[0,0,0,0],d=[0,0,0,0],f=!1,m=0,h,b,g;const v=new TA;for(;++r<e.length;){const y=e[r],k=y[1];y[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Jy(v,n,m,h,b),b=void 0,m=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(r,0,[["enter",h,n]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(i=!0,g=void 0,c=[0,0,0,0],d=[0,r+1,0,0],f&&(f=!1,b={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(r,0,[["enter",b,n]])),o=k.type==="tableDelimiterRow"?2:b?3:1):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(i=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],g=cu(v,n,c,o,void 0,g),c=[0,0,0,0]),d[2]=r)):k.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(d[0]=d[1],g=cu(v,n,c,o,void 0,g)),c=d,d=[c[1],r,0,0])):k.type==="tableHead"?(f=!0,m=r):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=r,c[1]!==0?(d[0]=d[1],g=cu(v,n,c,o,r,g)):d[1]!==0&&(g=cu(v,n,d,o,r,g)),o=0):o&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&Jy(v,n,m,h,b),v.consume(n.events),r=-1;++r<n.events.length;){const y=n.events[r];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=MA(n.events,r))}return e}function cu(e,n,r,i,o,c){const d=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(c.end=Object.assign({},Ri(n.events,r[0])),e.add(r[0],0,[["exit",c,n]]));const m=Ri(n.events,r[1]);if(c={type:d,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",c,n]]),r[2]!==0){const h=Ri(n.events,r[2]),b=Ri(n.events,r[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},b)};if(e.add(r[2],0,[["enter",g,n]]),i!==2){const v=n.events[r[2]],y=n.events[r[3]];if(v[1].end=Object.assign({},y[1].end),v[1].type="chunkText",v[1].contentType="text",r[3]>r[2]+1){const k=r[2]+1,C=r[3]-r[2]-1;e.add(k,C,[])}}e.add(r[3]+1,0,[["exit",g,n]])}return o!==void 0&&(c.end=Object.assign({},Ri(n.events,o)),e.add(o,0,[["exit",c,n]]),c=void 0),c}function Jy(e,n,r,i,o){const c=[],d=Ri(n.events,r);o&&(o.end=Object.assign({},d),c.push(["exit",o,n])),i.end=Object.assign({},d),c.push(["exit",i,n]),e.add(r+1,0,c)}function Ri(e,n){const r=e[n],i=r[0]==="enter"?"start":"end";return r[1][i]}const _A={name:"tasklistCheck",tokenize:BA};function LA(){return{text:{91:_A}}}function BA(e,n,r){const i=this;return o;function o(m){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),c)}function c(m){return dt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),d):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),d):r(m)}function d(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Se(m)?n(m):Fe(m)?e.check({tokenize:UA},n,r)(m):r(m)}}function UA(e,n,r){return Ke(e,i,"whitespace");function i(o){return o===null?r(o):n(o)}}function HA(e){return w2([uA(),vA(),EA(e),DA(),LA()])}const qA={};function IA(e){const n=this,r=e||qA,i=n.data(),o=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),d=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);o.push(HA(r)),c.push(iA()),d.push(lA(r))}const PA={h1:({children:e})=>s.jsx("h1",{className:"mb-4 mt-6 text-xl font-bold text-zinc-100 first:mt-0",children:e}),h2:({children:e})=>s.jsx("h2",{className:"mb-3 mt-5 text-lg font-bold text-zinc-100 first:mt-0",children:e}),h3:({children:e})=>s.jsx("h3",{className:"mb-2 mt-4 text-base font-bold text-zinc-100 first:mt-0",children:e}),p:({children:e})=>s.jsx("p",{className:"mb-3 leading-relaxed text-zinc-100 last:mb-0",children:e}),a:({href:e,children:n})=>s.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:n}),ul:({children:e})=>s.jsx("ul",{className:"mb-3 ml-4 list-disc space-y-1 text-zinc-100 last:mb-0",children:e}),ol:({children:e})=>s.jsx("ol",{className:"mb-3 ml-4 list-decimal space-y-1 text-zinc-100 last:mb-0",children:e}),li:({children:e})=>s.jsx("li",{className:"text-zinc-100",children:e}),code:({className:e,children:n,...r})=>{if(!e)return s.jsx("code",{className:"rounded bg-zinc-700/50 px-1.5 py-0.5 font-mono text-sm text-cachi-300",children:n});const o=/language-(\w+)/.exec(e||""),c=o?o[1]:"";return s.jsxs("div",{className:"relative my-3",children:[c&&s.jsx("div",{className:"absolute right-2 top-2 rounded bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:c}),s.jsx("pre",{className:"overflow-x-auto rounded-lg bg-zinc-900 p-4",children:s.jsx("code",{className:ne("font-mono text-sm text-zinc-300",e),...r,children:n})})]})},pre:({children:e})=>s.jsx(s.Fragment,{children:e}),blockquote:({children:e})=>s.jsx("blockquote",{className:"my-3 border-l-4 border-cachi-500/50 pl-4 italic text-zinc-400",children:e}),hr:()=>s.jsx("hr",{className:"my-4 border-zinc-700"}),strong:({children:e})=>s.jsx("strong",{className:"font-bold text-zinc-100",children:e}),em:({children:e})=>s.jsx("em",{className:"italic text-zinc-200",children:e}),del:({children:e})=>s.jsx("del",{className:"text-zinc-500 line-through",children:e}),table:({children:e})=>s.jsx("div",{className:"my-3 overflow-x-auto",children:s.jsx("table",{className:"min-w-full border-collapse text-sm",children:e})}),thead:({children:e})=>s.jsx("thead",{className:"border-b border-zinc-700 bg-zinc-800/50",children:e}),tbody:({children:e})=>s.jsx("tbody",{children:e}),tr:({children:e})=>s.jsx("tr",{className:"border-b border-zinc-800",children:e}),th:({children:e})=>s.jsx("th",{className:"px-3 py-2 text-left font-medium text-zinc-300",children:e}),td:({children:e})=>s.jsx("td",{className:"px-3 py-2 text-zinc-100",children:e})};function fj({content:e,className:n}){return s.jsx("div",{className:ne("prose prose-invert prose-sm max-w-none",n),children:s.jsx(ET,{remarkPlugins:[IA],components:PA,children:e})})}const FA={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 Ih(e){const n=e.join(" ").toLowerCase();if(n.length<10)return null;const r={};for(const[c,{words:d,chars:f}]of Object.entries(FA)){let m=0;f&&f.test(n)&&(m+=3);for(const h of d){const b=n.match(h);b&&(m+=b.length)}r[c]=m}let i=null,o=0;for(const[c,d]of Object.entries(r))d>o&&(o=d,i=c);return o>=2?i:null}const $A={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."},VA={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."},GA={en:"English",es:"Spanish",pt:"Portuguese",fr:"French",de:"German",it:"Italian"};function YA(e){const n=[];if(n.push(`You are ${e.name}, an AI assistant.`),e.purposeDescription&&n.push(`Your purpose: ${e.purposeDescription}`),e.purposeCategory&&e.purposeCategory!=="Other"&&n.push(`You specialize in ${e.purposeCategory.toLowerCase()}-related tasks.`),e.communicationStyle){const r=$A[e.communicationStyle];r?n.push(r):n.push(`Communication style: ${e.communicationStyle}`)}if(e.useEmojis&&n.push(VA[e.useEmojis]),e.detectedLanguage&&e.detectedLanguage!=="en"){const r=GA[e.detectedLanguage]||e.detectedLanguage;n.push(`Always respond in ${r} unless the user explicitly requests another language.`)}return n.push("Be helpful, honest, and stay true to your personality."),n.join(`

`)}class QA{constructor(n){ma(this,"ws",null);ma(this,"url");ma(this,"reconnectAttempts",0);ma(this,"maxReconnectAttempts",5);ma(this,"reconnectDelay",1e3);ma(this,"isIntentionalClose",!1);ma(this,"messageHandlers",[]);ma(this,"connectHandlers",[]);ma(this,"disconnectHandlers",[]);ma(this,"errorHandlers",[]);const r=window.location.protocol==="https:"?"wss:":"ws:",i=window.location.host;this.url=n||`${r}//${i}/ws`}connect(){var i,o;if(((i=this.ws)==null?void 0:i.readyState)===WebSocket.OPEN||((o=this.ws)==null?void 0:o.readyState)===WebSocket.CONNECTING)return;const{accessToken:n}=yn.getState();if(!n){console.error("Cannot connect WebSocket: not authenticated");return}this.isIntentionalClose=!1;const r=`${this.url}?token=${encodeURIComponent(n)}`;this.ws=new WebSocket(r),this.ws.onopen=()=>{this.reconnectAttempts=0,this.connectHandlers.forEach(c=>c())},this.ws.onmessage=c=>{try{const d=JSON.parse(c.data);this.messageHandlers.forEach(f=>f(d))}catch(d){console.error("Failed to parse WebSocket message:",d)}},this.ws.onclose=()=>{this.disconnectHandlers.forEach(c=>c()),this.attemptReconnect()},this.ws.onerror=c=>{this.errorHandlers.forEach(d=>d(c))}}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 n=this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);setTimeout(()=>{this.isIntentionalClose||(console.log(`Reconnecting... (attempt ${this.reconnectAttempts})`),this.connect())},n)}send(n,r={}){var i;if(((i=this.ws)==null?void 0:i.readyState)!==WebSocket.OPEN){console.error("WebSocket is not connected");return}this.ws.send(JSON.stringify({type:n,payload:r}))}sendChat(n,r){this.send("chat",{message:n,systemPrompt:r==null?void 0:r.systemPrompt,botId:r==null?void 0:r.botId,chatId:r==null?void 0:r.chatId,capabilities:r==null?void 0:r.capabilities,toolConfigs:r==null?void 0:r.toolConfigs,enabledSkills:r==null?void 0:r.enabledSkills})}sendCancel(){this.send("cancel")}sendApproval(n,r){this.send("approval",{id:n,approved:r})}onMessage(n){return this.messageHandlers.push(n),()=>{this.messageHandlers=this.messageHandlers.filter(r=>r!==n)}}onConnect(n){return this.connectHandlers.push(n),()=>{this.connectHandlers=this.connectHandlers.filter(r=>r!==n)}}onDisconnect(n){return this.disconnectHandlers.push(n),()=>{this.disconnectHandlers=this.disconnectHandlers.filter(r=>r!==n)}}onError(n){return this.errorHandlers.push(n),()=>{this.errorHandlers=this.errorHandlers.filter(r=>r!==n)}}get isConnected(){var n;return((n=this.ws)==null?void 0:n.readyState)===WebSocket.OPEN}}const us=new QA,XA=zt()(Ft((e,n)=>({connections:[],activeConnectionId:null,addConnection:r=>e(i=>({connections:[...i.connections,r]})),updateConnection:(r,i)=>e(o=>({connections:o.connections.map(c=>c.id===r?{...c,...i}:c)})),deleteConnection:r=>e(i=>({connections:i.connections.filter(o=>o.id!==r),activeConnectionId:i.activeConnectionId===r?null:i.activeConnectionId})),setActiveConnection:r=>e({activeConnectionId:r}),getConnectionsByBot:r=>n().connections.filter(o=>o.botId===r),getConnectionsByPlatform:r=>n().connections.filter(o=>o.platform===r)}),{name:"cachibot-connections"})),Ky={totalMessages:0,totalTokens:0,totalCost:0,byModel:{},byBot:{},daily:[]},Mu=zt()(Ft(e=>({stats:Ky,recordUsage:({botId:n,model:r,tokens:i,cost:o})=>e(c=>{var m,h,b,g,v,y;const d=new Date().toISOString().split("T")[0],f=c.stats.daily.find(k=>k.date===d);return{stats:{totalMessages:c.stats.totalMessages+1,totalTokens:c.stats.totalTokens+i,totalCost:c.stats.totalCost+o,byModel:{...c.stats.byModel,[r]:{tokens:(((m=c.stats.byModel[r])==null?void 0:m.tokens)||0)+i,cost:(((h=c.stats.byModel[r])==null?void 0:h.cost)||0)+o,messages:(((b=c.stats.byModel[r])==null?void 0:b.messages)||0)+1}},byBot:{...c.stats.byBot,[n]:{tokens:(((g=c.stats.byBot[n])==null?void 0:g.tokens)||0)+i,cost:(((v=c.stats.byBot[n])==null?void 0:v.cost)||0)+o,messages:(((y=c.stats.byBot[n])==null?void 0:y.messages)||0)+1}},daily:f?c.stats.daily.map(k=>k.date===d?{...k,tokens:k.tokens+i,cost:k.cost+o,messages:k.messages+1}:k):[...c.stats.daily.slice(-29),{date:d,tokens:i,cost:o,messages:1}]}}}),resetStats:()=>e({stats:Ky}),clearBotStats:n=>e(r=>{const i=r.stats.byBot[n];if(!i)return r;const{[n]:o,...c}=r.stats.byBot;return{stats:{...r.stats,totalMessages:Math.max(0,r.stats.totalMessages-i.messages),totalTokens:Math.max(0,r.stats.totalTokens-i.tokens),totalCost:Math.max(0,r.stats.totalCost-i.cost),byBot:c}}})}),{name:"cachibot-usage"}));let hj=null,vu=[];function JA(){return hj}function Zy(e){hj=e,vu.forEach(n=>n(e))}function KA(e){return vu.push(e),()=>{vu=vu.filter(n=>n!==e)}}let _i=null;function ZA(e){_i=e}function WA(){const[e,n]=S.useState(!1),{addMessage:r,updateMessage:i,setThinking:o,appendThinking:c,addToolCall:d,updateToolCall:f,clearToolCalls:m,attachToolCallsToLastMessage:h,setLoading:b,setError:g,updateLastAssistantMessageMetadata:v}=mn(),y=S.useRef(null);S.useEffect(()=>{const E=mn.subscribe(N=>{y.current=N.activeChatId});return y.current=mn.getState().activeChatId,E},[]);const k=S.useCallback(E=>{switch(E.type){case"thinking":{const N=E.payload;c(N.content);break}case"tool_start":{const N=E.payload;o(null),d({id:N.id,tool:N.tool,args:N.args});break}case"tool_end":{const N=E.payload;f(N.id,N.result,N.success);break}case"message":{const N=E.payload,M=y.current||_i;if(console.log("[WS] Message received:",{role:N.role,chatId:M,refValue:y.current,pendingChatId:_i}),M){const R=N.messageId||`msg-${Date.now()}-${Math.random().toString(36).slice(2)}`;if(N.messageId&&N.role==="assistant"){const F=mn.getState().getMessages(M).find(ee=>ee.id===N.messageId);F?i(M,N.messageId,F.content+N.content):r(M,{id:R,role:N.role,content:N.content,timestamp:new Date().toISOString()})}else r(M,{id:R,role:N.role,content:N.content,timestamp:new Date().toISOString()})}else console.warn("[WS] No chatId available for message, dropping:",N);break}case"approval_needed":{const N=E.payload;Zy(N);break}case"platform_message":{const N=E.payload;if(r(N.chatId,{id:N.messageId,role:N.role,content:N.content,timestamp:new Date().toISOString(),metadata:{platform:N.platform,...N.metadata}}),N.role==="assistant"&&N.metadata){const M=N.metadata.tokens,R=N.metadata.cost,A=N.metadata.model;M!==void 0&&R!==void 0&&Mu.getState().recordUsage({botId:N.botId,model:A||"unknown",tokens:M,cost:R})}break}case"usage":{const N=E.payload,M=Ot.getState().activeBotId,R=Ot.getState().getActiveBot(),A=y.current||_i;Mu.getState().recordUsage({botId:M||"unknown",model:(R==null?void 0:R.model)||"unknown",tokens:N.totalTokens,cost:N.totalCost}),A&&v(A,{tokens:N.totalTokens,promptTokens:N.promptTokens,completionTokens:N.completionTokens,cost:N.totalCost,model:R==null?void 0:R.model,iterations:N.iterations,elapsedMs:N.elapsedMs,tokensPerSecond:N.tokensPerSecond,callCount:N.callCount,errors:N.errors,perModel:N.perModel,latencyStats:N.latencyStats});break}case"error":{const N=E.payload;g(N.message),b(!1),o(null);break}case"done":{b(!1),o(null);const N=y.current||_i,M=mn.getState().toolCalls;N&&M.length>0&&h(N,M),m(),_i=null;break}}},[r,i,o,c,d,f,m,h,b,g,v]);S.useEffect(()=>{const E=us.onMessage(k),N=us.onConnect(()=>n(!0)),M=us.onDisconnect(()=>n(!1)),R=us.onError(()=>{g("WebSocket connection error")}),A=setTimeout(()=>{us.connect()},100);return()=>{clearTimeout(A),E(),N(),M(),R(),us.disconnect()}},[k,g]);const C=S.useCallback((E,N)=>{const{setLoading:M,setError:R,clearToolCalls:A}=mn.getState();M(!0),R(null),A(),us.sendChat(E,N)},[]),z=S.useCallback(()=>{us.sendCancel(),b(!1),o(null)},[b,o]),j=S.useCallback((E,N)=>{us.sendApproval(E,N),Zy(null)},[]);return{isConnected:e,sendMessage:C,cancel:z,approve:j}}function eM(){const{setCreateBotOpen:e,setSettingsOpen:n,setSidebarCollapsed:r}=Rt(),{bots:i}=Ot(),{addMessage:o,activeChatId:c}=mn(),d=S.useCallback(h=>h.trim().startsWith("/"),[]),f=S.useCallback(h=>{c&&o(c,{id:crypto.randomUUID(),role:"assistant",content:h,timestamp:new Date().toISOString()})},[c,o]),m=S.useCallback(h=>{const b=h.trim();if(!b.startsWith("/"))return{handled:!1};const v=b.slice(1).split(/\s+/)[0].toLowerCase();switch(v){case"new":case"create":return e(!0),{handled:!0};case"settings":return n(!0),{handled:!0};case"list":case"bots":r(!1);const y=i.length>0?i.map((k,C)=>`${C+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,n,r,i,f]);return{isCommand:d,handleCommand:m}}const Wy=["bot","brain","zap","sparkles","rocket","star","gem","flame"],e1=["#3b82f6","#8b5cf6","#ec4899","#f97316","#22c55e","#06b6d4"];function tM(){return Wy[Math.floor(Math.random()*Wy.length)]}function nM(){return e1[Math.floor(Math.random()*e1.length)]}function t1({onSendMessage:e,onCancel:n,isConnected:r}){const i=Rn(),{activeChatId:o,getMessages:c,thinking:d,toolCalls:f,isLoading:m,addMessage:h,addChat:b,setActiveChat:g}=mn(),{getActiveBot:v,activeBotId:y,bots:k,addBot:C,setActiveBot:z,setActiveView:j}=Ot(),{showThinking:E}=Rt(),N=g3(),{sendMessage:M,cancel:R,isConnected:A}=WA(),{isCommand:F,handleCommand:ee}=eM(),Z=r??A,L=n??R,[P,Y]=S.useState(""),[me,_]=S.useState([]),[q,B]=S.useState(!1),[V,oe]=S.useState(0),ue=S.useRef(null),O=S.useRef(null),U=[{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:"👋"}],Q=P.startsWith("/")?U.filter(ge=>ge.name.toLowerCase().startsWith(P.slice(1).toLowerCase())):[];S.useEffect(()=>{P==="/"||P.startsWith("/")&&P.length>1&&Q.length>0?(B(!0),oe(0)):B(!1)},[P,Q.length]);const D=o?c(o):[],G=v(),be=N.step!=="idle",ye=k.map(ge=>ge.name),W=S.useCallback(ge=>ge.map((ve,Me)=>`${Me+1}. ${ve}`).join(`
`),[]),de=S.useCallback(async ge=>{N.setLoadingNames(!0);try{const ve=await Dv(ye);N.setNameSuggestions(ve),h(ge,{id:crypto.randomUUID(),role:"assistant",content:`Here are some name ideas:

${W(ve)}

Type a number to pick one, your own name, or "more" for new suggestions.`,timestamp:new Date().toISOString()})}catch{h(ge,{id:crypto.randomUUID(),role:"assistant",content:"I had trouble generating names. Please type a name for your new bot:",timestamp:new Date().toISOString()})}finally{N.setLoadingNames(!1)}},[N,ye,W,h]),ke=S.useCallback((ge,ve)=>{const Me=ge.trim();if(Me.toLowerCase()==="more")return h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()}),de(ve),!0;const Ue=parseInt(Me),qe=N.data.nameSuggestions;if(!isNaN(Ue)&&Ue>=1&&Ue<=qe.length){const te=qe[Ue-1];h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});try{N.setName(te),h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Great, ${te} 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 tt=Me.toLowerCase(),Ct=ye.some(te=>te.toLowerCase()===tt);if(h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()}),Ct)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{N.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},[N,ye,de,h]),rt=S.useCallback((ge,ve)=>{const Me=ge.trim(),ze=N.data.name||"your bot";h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});const Ue=[...me,Me];_(Ue);const qe=Ih(Ue);qe&&N.setDetectedLanguage(qe);const Ct={1:"Work",2:"Personal",3:"Creative",4:"Learning",5:"Other"}[Me]||Me;return N.setPurposeCategory(Ct),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},[N,me,h]),yt=S.useCallback((ge,ve)=>{const Me=ge.trim(),ze=N.data.name||"your bot";h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});const Ue=[...me,Me];_(Ue);const qe=Ih(Ue);return qe&&N.setDetectedLanguage(qe),N.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},[N,me,h]),vn=S.useCallback((ge,ve)=>{const Me=ge.trim(),ze=N.data.name||"your bot";h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});const Ue=[...me,Me];_(Ue);const qe=Ih(Ue);qe&&N.setDetectedLanguage(qe);const Ct={1:"Professional",2:"Casual",3:"Playful",4:"Technical"}[Me]||Me;return N.setStyle(Ct),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},[N,me,h]),Fa=S.useCallback((ge,ve)=>{const Me=ge.trim(),ze=Me.toLowerCase(),Ue=N.data.name||"your bot";h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()});let qe="sometimes";ze==="1"||ze==="yes"||ze==="y"?qe="yes":ze==="2"||ze==="no"||ze==="n"?qe="no":(ze==="3"||ze==="sometimes"||ze==="sparingly")&&(qe="sometimes"),N.setEmoji(qe);const tt=N.data,Ct=qe==="yes"?"Yes":qe==="no"?"No":"Sometimes";return h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Perfect! Here's a summary of ${Ue}:

**Name:** ${tt.name}
**Category:** ${tt.purposeCategory}
**Purpose:** ${tt.purposeDescription}
**Style:** ${tt.communicationStyle}
**Emojis:** ${Ct}

Type "confirm" to create ${Ue}, or "back" to make changes.`,timestamp:new Date().toISOString()}),!0},[N,h]),Ln=S.useCallback((ge,ve)=>{const Me=ge.trim(),ze=Me.toLowerCase(),Ue=N.data,qe=Ue.name||"your bot";if(h(ve,{id:crypto.randomUUID(),role:"user",content:Me,timestamp:new Date().toISOString()}),ze==="cancel"||ze==="no"||ze==="n")return N.cancelFlow(),_([]),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 tt=YA(Ue),Ct={id:crypto.randomUUID(),name:Ue.name,description:Ue.purposeDescription||`A ${Ue.purposeCategory} assistant`,icon:tM(),color:nM(),model:"moonshot/kimi-k2.5",systemPrompt:tt,tools:["file_read","file_write","python_execute"],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),personality:{purposeCategory:Ue.purposeCategory,purposeDescription:Ue.purposeDescription,communicationStyle:Ue.communicationStyle,useEmojis:Ue.useEmojis}};C(Ct),z(Ct.id),N.confirmAndCreate(),N.completeFlow(),_([]);const te=crypto.randomUUID(),fe={id:te,botId:Ct.id,title:`Chat with ${Ct.name}`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};return b(fe),g(te),h(te,{id:crypto.randomUUID(),role:"assistant",content:`**${Ct.name}** has been created! You're now chatting with your new bot.

Say hello to see ${Ct.name}'s personality in action!`,timestamp:new Date().toISOString()}),!0}return h(ve,{id:crypto.randomUUID(),role:"assistant",content:`Type "confirm" to create ${qe}, or "cancel" to start over.`,timestamp:new Date().toISOString()}),!0},[N,me,h,C,z,b,g]);S.useEffect(()=>{var ge;(ge=ue.current)==null||ge.scrollIntoView({behavior:"smooth"})},[D,d,f]),S.useEffect(()=>{O.current&&(O.current.style.height="auto",O.current.style.height=Math.min(O.current.scrollHeight,200)+"px")},[P]);const Xn=ge=>{if(ge.preventDefault(),!P.trim()||m)return;const ve=P.trim(),Me=ve.toLowerCase();if(F(ve)&&Me!=="/create"&&!be&&(o&&h(o,{id:crypto.randomUUID(),role:"user",content:ve,timestamp:new Date().toISOString()}),ee(ve).handled)){Y("");return}if(Me==="/create"){let ze=o;if(!ze&&y){const Ue={id:crypto.randomUUID(),botId:y,title:"New Bot Creation",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};b(Ue),g(Ue.id),ze=Ue.id}ze&&(N.startFlow(ze),_([]),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)),Y("");return}if(be&&Me==="cancel"){N.cancelFlow(),_([]),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()})),Y("");return}if(be&&o){let ze=!1;switch(N.step){case"name":ze=ke(ve,o);break;case"purpose-category":ze=rt(ve,o);break;case"purpose-description":ze=yt(ve,o);break;case"style":ze=vn(ve,o);break;case"emoji":ze=Fa(ve,o);break;case"summary":ze=Ln(ve,o);break}if(ze){Y("");return}}if(e)e(ve);else{let ze=o;if(!ze&&y){const qe=crypto.randomUUID(),tt={id:qe,botId:y,title:ve.slice(0,50)+(ve.length>50?"...":""),createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),messageCount:0};b(tt),g(qe),ze=qe,ZA(qe),i(`/${y}/chats/${qe}`)}const Ue={codeExecution:!0,fileOperations:!0,gitOperations:!1,shellAccess:!1,webAccess:!1,dataOperations:!1,contacts:!1,connections:!1,workManagement:!0};M(ve,{systemPrompt:G==null?void 0:G.systemPrompt,botId:G==null?void 0:G.id,chatId:ze??void 0,capabilities:(G==null?void 0:G.capabilities)||Ue,toolConfigs:G==null?void 0:G.toolConfigs})}Y("")},Bn=ge=>{var ve;Y(`/${ge}`),B(!1),(ve=O.current)==null||ve.focus()},$a=ge=>{if(q&&Q.length>0){if(ge.key==="ArrowDown"){ge.preventDefault(),oe(ve=>ve<Q.length-1?ve+1:0);return}if(ge.key==="ArrowUp"){ge.preventDefault(),oe(ve=>ve>0?ve-1:Q.length-1);return}if(ge.key==="Tab"||ge.key==="Enter"&&!ge.shiftKey){ge.preventDefault(),Bn(Q[V].name);return}if(ge.key==="Escape"){ge.preventDefault(),B(!1);return}}ge.key==="Enter"&&!ge.shiftKey&&(ge.preventDefault(),Xn(ge))};return o?s.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[s.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:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full",style:{backgroundColor:((G==null?void 0:G.color)||"#22c55e")+"30"},children:s.jsx(ca,{icon:(G==null?void 0:G.icon)||"shield",size:18,className:"text-zinc-100"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:(G==null?void 0:G.name)||"CachiBot"}),s.jsx("p",{className:"text-xs text-zinc-500",children:(G==null?void 0:G.model)||"moonshot/kimi-k2.5"})]})]}),s.jsx("button",{onClick:()=>j("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:s.jsx(Oo,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs("div",{className:"mx-auto max-w-3xl px-3 py-4 sm:px-4 sm:py-6",children:[D.length===0?s.jsxs("div",{className:"py-12 text-center",children:[s.jsx(xn,{className:"mx-auto mb-4 h-8 w-8 text-cachi-500"}),s.jsx("p",{className:"text-zinc-400",children:"Start the conversation..."})]}):s.jsx("div",{className:"space-y-6",children:D.map(ge=>s.jsx(aM,{message:ge,botIcon:G==null?void 0:G.icon,botColor:G==null?void 0:G.color},ge.id))}),f.length>0&&s.jsx("div",{className:"mt-6 space-y-2",children:f.map(ge=>s.jsx(rM,{call:ge},ge.id))}),m&&!d&&f.length===0&&s.jsx("div",{className:"mt-6",children:s.jsx(lM,{botColor:G==null?void 0:G.color})}),d&&E&&s.jsx("div",{className:"mt-6",children:s.jsx(iM,{content:d})}),s.jsx("div",{ref:ue})]})}),s.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:s.jsxs("form",{onSubmit:Xn,className:"mx-auto max-w-3xl",children:[s.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:[q&&Q.length>0&&s.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:[s.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"}),s.jsx("div",{className:"max-h-48 overflow-y-auto",children:Q.map((ge,ve)=>s.jsxs("button",{type:"button",onClick:()=>Bn(ge.name),className:ne("flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors",ve===V?"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:[s.jsx("span",{className:"text-lg",children:ge.icon}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"font-medium",children:["/",ge.name]}),s.jsx("div",{className:"text-xs text-zinc-500 truncate",children:ge.description})]}),ve===V&&s.jsx("span",{className:"text-xs text-zinc-500",children:"↵"})]},ge.name))})]}),s.jsx("textarea",{ref:O,value:P,onChange:ge=>Y(ge.target.value),onKeyDown:$a,placeholder:N.step==="name"?'Type a number (1-4), your own name, or "more"...':`Message ${(G==null?void 0:G.name)||"CachiBot"} or type / for commands...`,disabled:!Z||m||N.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"}),s.jsxs("div",{className:"absolute bottom-2 right-2 flex items-center gap-1",children:[s.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:s.jsx(Kb,{className:"h-4 w-4"})}),m?s.jsx("button",{type:"button",onClick:L,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:s.jsx(c4,{className:"h-4 w-4"})}):s.jsx("button",{type:"submit",disabled:!P.trim()||!Z,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:s.jsx(jo,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-zinc-500",children:[s.jsxs("div",{className:"flex items-center gap-2 sm:gap-4",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:ne("h-2 w-2 rounded-full",Z?"bg-green-500":"bg-red-500")}),s.jsx("span",{className:"hidden xs:inline",children:Z?"Connected":"Disconnected"})]}),s.jsx("span",{className:"truncate max-w-[120px] sm:max-w-none",children:G==null?void 0:G.model})]}),s.jsx("span",{className:"hidden sm:inline",children:"Press Enter to send, Shift+Enter for new line"})]}),be&&s.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:N.isLoadingNames?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"h-3 w-3 animate-spin"}),s.jsx("span",{children:"Generating name suggestions..."})]}):s.jsxs(s.Fragment,{children:[s.jsx(xn,{className:"h-3 w-3"}),s.jsxs("span",{children:["Creating a new bot (Step: ",N.step,")... Type 'cancel' to stop"]})]})})]})})]}):s.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[s.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:s.jsxs("div",{className:"max-w-md text-center",children:[s.jsx("div",{className:"mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-2xl",style:{backgroundColor:((G==null?void 0:G.color)||"#22c55e")+"30"},children:s.jsx(ca,{icon:(G==null?void 0:G.icon)||"shield",size:48,className:"text-zinc-100"})}),s.jsxs("h2",{className:"mb-2 text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:["Welcome to ",(G==null?void 0:G.name)||"CachiBot"]}),s.jsx("p",{className:"mb-8 text-zinc-500 dark:text-zinc-400",children:(G==null?void 0:G.description)||"Start a new chat to begin working with your AI assistant."}),s.jsx("div",{className:"grid gap-3",children:["Write a Python script","Analyze this codebase","Help me debug an error"].map(ge=>s.jsxs("button",{onClick:()=>{var ve;Y(ge),(ve=O.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:[s.jsx(xn,{className:"h-4 w-4 text-cachi-500"}),ge]},ge))})]})}),s.jsx("div",{className:"border-t border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-4",children:s.jsxs("form",{onSubmit:Xn,className:"mx-auto max-w-3xl",children:[s.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:[q&&Q.length>0&&s.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:[s.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"}),s.jsx("div",{className:"max-h-48 overflow-y-auto",children:Q.map((ge,ve)=>s.jsxs("button",{type:"button",onClick:()=>Bn(ge.name),className:ne("flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors",ve===V?"bg-cachi-600/20 text-zinc-100":"text-zinc-300 hover:bg-zinc-700/50"),children:[s.jsx("span",{className:"text-lg",children:ge.icon}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"font-medium",children:["/",ge.name]}),s.jsx("div",{className:"text-xs text-zinc-500 truncate",children:ge.description})]}),ve===V&&s.jsx("span",{className:"text-xs text-zinc-500",children:"↵"})]},ge.name))})]}),s.jsx("textarea",{ref:O,value:P,onChange:ge=>Y(ge.target.value),onKeyDown:$a,placeholder:`Message ${(G==null?void 0:G.name)||"CachiBot"} or type / for commands...`,disabled:!Z||m,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"}),s.jsxs("div",{className:"absolute bottom-2 right-2 flex items-center gap-1",children:[s.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:s.jsx(Kb,{className:"h-4 w-4"})}),s.jsx("button",{type:"submit",disabled:!P.trim()||!Z,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:s.jsx(jo,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-zinc-500",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:ne("h-2 w-2 rounded-full",Z?"bg-green-500":"bg-red-500")}),Z?"Connected":"Disconnected"]}),s.jsx("span",{children:"Press Enter to send, Shift+Enter for new line"})]})]})})]})}function aM({message:e,botIcon:n,botColor:r}){var k,C,z,j,E,N;const i=e.role==="user",[o,c]=S.useState(!1),[d,f]=S.useState(!1),[m,h]=S.useState(!1),{accentColor:b}=Rt(),g=Gu[b].palette[600],v=()=>{navigator.clipboard.writeText(e.content),c(!0),setTimeout(()=>c(!1),2e3)},y=!i&&e.metadata&&(e.metadata.tokens!==void 0||e.metadata.cost!==void 0||e.metadata.model!==void 0);return s.jsxs("div",{className:ne("group flex gap-4",i&&"flex-row-reverse"),children:[s.jsx("div",{className:ne("flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full",i?"text-white":"bg-zinc-800"),style:i?{backgroundColor:g}:r?{backgroundColor:r+"30"}:void 0,children:i?s.jsx(Lo,{className:"h-5 w-5"}):s.jsx(ca,{icon:n||"shield",size:20})}),s.jsxs("div",{className:ne("flex max-w-[80%] flex-col gap-1",i&&"items-end"),children:[s.jsxs("div",{className:ne("rounded-2xl px-4 py-3",i?"text-white":"bg-zinc-800/80 text-zinc-100"),style:i?{backgroundColor:g}:void 0,children:[i?s.jsx("div",{className:"whitespace-pre-wrap",children:e.content}):s.jsx(fj,{content:e.content}),!i&&e.toolCalls&&e.toolCalls.length>0&&s.jsxs("div",{className:"mt-3",children:[s.jsxs("button",{onClick:()=>h(!m),className:"flex items-center gap-2 text-xs text-zinc-400 hover:text-zinc-200 transition-colors",children:[s.jsx(Pr,{className:"h-3 w-3"}),s.jsxs("span",{children:[e.toolCalls.length," tool action",e.toolCalls.length>1?"s":""]}),s.jsx(el,{className:ne("h-3 w-3 transition-transform",m&&"rotate-180")})]}),m&&s.jsx("div",{className:"mt-2 space-y-1.5",children:e.toolCalls.map(M=>s.jsx(sM,{call:M},M.id))})]}),d&&y&&s.jsx("div",{className:"mt-3 rounded-lg border border-zinc-700 bg-zinc-900 p-3 text-xs",children:s.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-zinc-400",children:[((k=e.metadata)==null?void 0:k.model)&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Model:"}),s.jsx("span",{className:"text-zinc-200",children:String(e.metadata.model)})]}),((C=e.metadata)==null?void 0:C.tokens)!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Tokens:"}),s.jsxs("span",{className:"text-zinc-200",children:[Number(e.metadata.tokens).toLocaleString(),(e.metadata.promptTokens!==void 0||e.metadata.completionTokens!==void 0)&&s.jsxs("span",{className:"text-zinc-500 ml-1",children:["(",Number(e.metadata.promptTokens||0).toLocaleString()," in / ",Number(e.metadata.completionTokens||0).toLocaleString()," out)"]})]})]}),((z=e.metadata)==null?void 0:z.cost)!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Cost:"}),s.jsxs("span",{className:"text-zinc-200",children:["$",Number(e.metadata.cost).toFixed(6)]})]}),((j=e.metadata)==null?void 0:j.iterations)!==void 0&&Number(e.metadata.iterations)>1&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Iterations:"}),s.jsx("span",{className:"text-zinc-200",children:Number(e.metadata.iterations)})]}),((E=e.metadata)==null?void 0:E.elapsedMs)!==void 0&&Number(e.metadata.elapsedMs)>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Time:"}),s.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&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"Speed:"}),s.jsxs("span",{className:"text-zinc-200",children:[Number(e.metadata.tokensPerSecond).toFixed(1)," tok/s"]})]})]})})]}),s.jsxs("div",{className:"flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[s.jsxs("button",{onClick:v,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?s.jsx(tl,{className:"h-3 w-3"}):s.jsx(B5,{className:"h-3 w-3"}),o?"Copied":"Copy"]}),!i&&e.toolCalls&&e.toolCalls.length>0&&s.jsxs("button",{onClick:()=>h(!m),className:ne("flex h-6 items-center gap-1 rounded px-2 text-xs text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300",m&&"bg-zinc-800 text-zinc-300"),children:[s.jsx(qa,{className:"h-3 w-3"}),"Tools (",e.toolCalls.length,")"]}),y&&s.jsxs("button",{onClick:()=>f(!d),className:ne("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:[s.jsx(Gm,{className:"h-3 w-3"}),"Info"]}),!i&&s.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:[s.jsx(vo,{className:"h-3 w-3"}),"Retry"]})]})]})]})}function sM({call:e}){const[n,r]=S.useState(!1),i=e.success!==!1;return s.jsxs("div",{className:"rounded-lg border border-zinc-700/50 bg-zinc-900/50",children:[s.jsxs("button",{onClick:()=>r(!n),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs",children:[i?s.jsx(tl,{className:"h-3 w-3 flex-shrink-0 text-green-400"}):s.jsx(rr,{className:"h-3 w-3 flex-shrink-0 text-red-400"}),s.jsx(qa,{className:"h-3 w-3 flex-shrink-0 text-zinc-500"}),s.jsx("span",{className:"flex-1 font-mono text-zinc-300 truncate",children:e.tool}),s.jsx(el,{className:ne("h-3 w-3 flex-shrink-0 text-zinc-500 transition-transform",n&&"rotate-180")})]}),n&&s.jsx("div",{className:"border-t border-zinc-700/50 px-3 py-2",children:s.jsxs("div",{className:"space-y-2 font-mono text-xs",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-zinc-500",children:"Arguments:"}),s.jsx("pre",{className:"mt-1 overflow-x-auto rounded bg-zinc-950 p-1.5 text-zinc-300",children:JSON.stringify(e.args,null,2)})]}),e.result!==void 0&&s.jsxs("div",{children:[s.jsx("span",{className:"text-zinc-500",children:"Result:"}),s.jsx("pre",{className:"mt-1 max-h-32 overflow-auto rounded bg-zinc-950 p-1.5 text-zinc-300",children:typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2)})]})]})})]})}function rM({call:e}){const[n,r]=S.useState(!1),i=e.endTime!==void 0,o=e.success===!0;return s.jsxs("div",{className:"overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",children:[s.jsxs("button",{onClick:()=>r(!n),className:"flex w-full items-center gap-3 px-4 py-3 text-left",children:[i?o?s.jsx(tl,{className:"h-4 w-4 text-green-400"}):s.jsx(rr,{className:"h-4 w-4 text-red-400"}):s.jsx(Ge,{className:"h-4 w-4 animate-spin text-blue-400"}),s.jsx(qa,{className:"h-4 w-4 text-zinc-500"}),s.jsx("span",{className:"flex-1 font-mono text-sm text-zinc-300",children:e.tool}),s.jsx(el,{className:ne("h-4 w-4 text-zinc-500 transition-transform",n&&"rotate-180")})]}),n&&s.jsx("div",{className:"border-t border-zinc-800 bg-zinc-950/50 p-4",children:s.jsxs("div",{className:"space-y-3 font-mono text-xs",children:[s.jsxs("div",{children:[s.jsx("span",{className:"text-zinc-500",children:"Arguments:"}),s.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&&s.jsxs("div",{children:[s.jsx("span",{className:"text-zinc-500",children:"Result:"}),s.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 iM({content:e}){return s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-purple-600/20",children:s.jsx(Pr,{className:"h-5 w-5 animate-pulse text-purple-400"})}),s.jsxs("div",{className:"flex-1 rounded-2xl bg-purple-900/20 px-4 py-3",children:[s.jsx("div",{className:"mb-1 text-xs font-medium text-purple-400",children:"Thinking..."}),s.jsx("div",{className:"text-sm text-zinc-400",children:e})]})]})}function lM({botColor:e}){return s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full animate-pulse",style:{backgroundColor:(e||"#22c55e")+"30"},children:s.jsx(Ge,{className:"h-5 w-5 animate-spin",style:{color:e||"#22c55e"}})}),s.jsx("div",{className:"flex-1 rounded-2xl bg-zinc-800/50 px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[s.jsx("span",{children:"Generating response"}),s.jsxs("span",{className:"flex gap-1",children:[s.jsx("span",{className:"animate-pulse",style:{animationDelay:"0ms"},children:"."}),s.jsx("span",{className:"animate-pulse",style:{animationDelay:"200ms"},children:"."}),s.jsx("span",{className:"animate-pulse",style:{animationDelay:"400ms"},children:"."})]})]})})]})}function oM(){const{getActiveBot:e}=Ot(),{getTasksByBot:n,addTask:r,updateTask:i,deleteTask:o,filter:c,setFilter:d}=Qi(),[f,m]=S.useState("kanban"),[h,b]=S.useState(""),[g,v]=S.useState(!1),y=e();if(!y)return null;const C=n(y.id).filter(N=>!h||N.title.toLowerCase().includes(h.toLowerCase())),z=(N,M="todo")=>{const R={id:crypto.randomUUID(),botId:y.id,title:N,status:M,priority:"medium",tags:[],createdAt:new Date().toISOString()};r(R),v(!1)},j=(N,M)=>{i(N,{status:M,completedAt:M==="done"?new Date().toISOString():void 0})},E={todo:C.filter(N=>N.status==="todo").length,in_progress:C.filter(N=>N.status==="in_progress").length,done:C.filter(N=>N.status==="done").length,blocked:C.filter(N=>N.status==="blocked").length};return s.jsxs("div",{className:"flex h-full flex-col bg-zinc-950",children:[s.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Tasks"}),s.jsxs("p",{className:"text-sm text-zinc-500",children:[E.done,"/",C.length," completed"]})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex items-center rounded-lg border border-zinc-700 bg-zinc-800/50 p-1",children:[s.jsx("button",{onClick:()=>m("kanban"),className:ne("rounded-md p-1.5 transition-colors",f==="kanban"?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:s.jsx(K5,{className:"h-4 w-4"})}),s.jsx("button",{onClick:()=>m("list"),className:ne("rounded-md p-1.5 transition-colors",f==="list"?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:s.jsx(e4,{className:"h-4 w-4"})})]}),s.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:[s.jsx(Dn,{className:"h-4 w-4"}),"Add Task"]})]})]}),s.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex-1 max-w-md",children:[s.jsx(On,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),s.jsx("input",{type:"text",placeholder:"Search tasks...",value:h,onChange:N=>b(N.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"})]}),s.jsxs("select",{value:c.priority,onChange:N=>d({priority:N.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:[s.jsx("option",{value:"all",children:"All priorities"}),s.jsx("option",{value:"high",children:"High"}),s.jsx("option",{value:"medium",children:"Medium"}),s.jsx("option",{value:"low",children:"Low"})]})]})]}),s.jsx("div",{className:"flex-1 overflow-hidden p-6",children:f==="kanban"?s.jsx(cM,{tasks:C,onMoveTask:j,onDeleteTask:o,onAddTask:z}):s.jsx(dM,{tasks:C,onMoveTask:j,onDeleteTask:o})}),g&&s.jsx(fM,{onClose:()=>v(!1),onSave:z})]})}const T0=[{id:"todo",label:"To Do",icon:_5,color:"text-zinc-400"},{id:"in_progress",label:"In Progress",icon:To,color:"text-blue-400"},{id:"blocked",label:"Blocked",icon:sr,color:"text-red-400"},{id:"done",label:"Done",icon:xs,color:"text-green-400"}];function cM({tasks:e,onMoveTask:n,onDeleteTask:r,onAddTask:i}){const o=S.useMemo(()=>{const c={todo:[],in_progress:[],blocked:[],done:[]};return e.forEach(d=>{c[d.status].push(d)}),c},[e]);return s.jsx("div",{className:"flex h-full gap-4 overflow-x-auto pb-4",children:T0.map(c=>s.jsxs("div",{className:"flex w-80 flex-shrink-0 flex-col rounded-xl border border-zinc-800 bg-zinc-900/30",children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-zinc-800 px-4 py-3",children:[s.jsx(c.icon,{className:ne("h-5 w-5",c.color)}),s.jsx("span",{className:"font-medium text-zinc-200",children:c.label}),s.jsx("span",{className:"ml-auto rounded-full bg-zinc-800 px-2 py-0.5 text-xs text-zinc-400",children:o[c.id].length})]}),s.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto p-3",children:[o[c.id].map(d=>s.jsx(uM,{task:d,onMove:n,onDelete:r},d.id)),c.id==="todo"&&s.jsxs("button",{onClick:()=>{const d=prompt("Task title:");d&&i(d,c.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:[s.jsx(Dn,{className:"h-4 w-4"}),"Add task"]})]})]},c.id))})}function uM({task:e,onMove:n,onDelete:r}){const[i,o]=S.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 s.jsxs("div",{className:ne("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:[s.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)"}}),s.jsxs("div",{className:"ml-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("span",{className:ne("text-sm font-medium",e.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:e.title}),s.jsx("button",{onClick:()=>o(!i),className:"flex-shrink-0 rounded p-1 text-zinc-500 opacity-0 transition-opacity hover:bg-zinc-700 group-hover:opacity-100",children:s.jsx(av,{className:"h-4 w-4"})})]}),e.description&&s.jsx("p",{className:"mt-1 text-xs text-zinc-500 line-clamp-2",children:e.description}),e.tags.length>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:e.tags.map(f=>s.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:f},f))}),s.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[s.jsxs("div",{className:ne("flex items-center gap-1 rounded px-1.5 py-0.5 text-xs",d.bg,d.color),children:[s.jsx(P5,{className:"h-3 w-3"}),e.priority]}),e.dueDate&&s.jsxs("div",{className:"flex items-center gap-1 text-xs text-zinc-500",children:[s.jsx(Pm,{className:"h-3 w-3"}),new Date(e.dueDate).toLocaleDateString()]})]})]}),i&&s.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:[T0.filter(f=>f.id!==e.status).map(f=>s.jsxs("button",{onClick:()=>{n(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:[s.jsx(X1,{className:"h-4 w-4"}),"Move to ",f.label]},f.id)),s.jsx("div",{className:"my-1 h-px bg-zinc-700"}),s.jsxs("button",{onClick:()=>{r(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:[s.jsx(Pt,{className:"h-4 w-4"}),"Delete"]})]})]})}function dM({tasks:e,onMoveTask:n,onDeleteTask:r}){return s.jsxs("div",{className:"space-y-1",children:[e.map(i=>s.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-zinc-800 bg-zinc-900/30 px-4 py-3",children:[s.jsx("button",{onClick:()=>n(i.id,i.status==="done"?"todo":"done"),className:ne("flex h-5 w-5 items-center justify-center rounded border transition-colors",i.status==="done"?"border-green-500 bg-green-500 text-white":"border-zinc-600 hover:border-cachi-500"),children:i.status==="done"&&s.jsx(xs,{className:"h-4 w-4"})}),s.jsx("span",{className:ne("flex-1",i.status==="done"?"text-zinc-500 line-through":"text-zinc-200"),children:i.title}),s.jsx("div",{className:"flex items-center gap-2",children:i.tags.map(o=>s.jsx("span",{className:"rounded bg-zinc-700 px-2 py-0.5 text-xs text-zinc-400",children:o},o))}),s.jsx("div",{className:ne("rounded px-2 py-0.5 text-xs font-medium",i.priority==="high"&&"bg-red-500/20 text-red-400",i.priority==="medium"&&"bg-yellow-500/20 text-yellow-400",i.priority==="low"&&"bg-zinc-700 text-zinc-400"),children:i.priority}),s.jsx("select",{value:i.status,onChange:o=>n(i.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:T0.map(o=>s.jsx("option",{value:o.id,children:o.label},o.id))}),s.jsx("button",{onClick:()=>r(i.id),className:"rounded p-1 text-zinc-500 hover:bg-zinc-800 hover:text-red-400",children:s.jsx(Pt,{className:"h-4 w-4"})})]},i.id)),e.length===0&&s.jsx("div",{className:"py-12 text-center text-zinc-500",children:"No tasks yet"})]})}function fM({onClose:e,onSave:n}){const[r,i]=S.useState(""),o=c=>{c.preventDefault(),r.trim()&&n(r.trim(),"todo")};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-zinc-800 bg-zinc-900 p-6 shadow-2xl",children:[s.jsx("h2",{className:"mb-4 text-lg font-bold text-zinc-100",children:"New Task"}),s.jsxs("form",{onSubmit:o,children:[s.jsx("input",{type:"text",placeholder:"Task title...",value:r,onChange:c=>i(c.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"}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:e,className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!r.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"})]})]})]})})}function Ph(e,n){return n.type==="number"&&typeof e=="number"?n.unit==="chars"&&e>=1e3?`${(e/1e3).toFixed(0)}k ${n.unit}`:n.unit?`${e} ${n.unit}`:String(e):String(e)}function hM({tool:e,botId:n,currentConfigs:r,isOpen:i,onClose:o}){const{updateBot:c}=Ot(),d=e.configParams||[],f=d.length>0,[m,h]=S.useState({});S.useEffect(()=>{if(!i)return;const j=e.configParams||[],E={},N=r==null?void 0:r[e.id];for(const M of j){const R=N==null?void 0:N[M.name];E[M.name]=R!==void 0?R:M.default}h(E)},[i,e.id,e.configParams,r]);const b=()=>{const j={...r};j[e.id]={...m},c(n,{toolConfigs:j}),o()},g=()=>{const j={};for(const E of d)j[E.name]=E.default;h(j)},v=(j,E)=>{h(N=>({...N,[j]:E}))},[y,k]=S.useState(new Set),C=j=>{k(E=>{const N=new Set(E);return N.has(j)?N.delete(j):N.add(j),N})};if(!i)return null;const z=j=>{const E=m[j.name];switch(j.type){case"number":{const N=typeof E=="number"?E:j.default??0;return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsx("span",{className:"text-sm text-zinc-400",children:Ph(N,j)})]}),s.jsx("input",{type:"range",min:j.min??0,max:j.max??100,step:j.step??1,value:N,onChange:M=>v(j.name,Number(M.target.value)),className:"w-full accent-cachi-500"}),s.jsxs("div",{className:"flex justify-between text-xs text-zinc-500",children:[s.jsx("span",{children:Ph(j.min??0,j)}),s.jsx("span",{children:Ph(j.max??100,j)})]}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"boolean":{const N=typeof E=="boolean"?E:!!j.default;return s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 p-4",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"text-sm font-medium text-zinc-200",children:j.displayName||j.name}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]}),s.jsx("button",{onClick:()=>v(j.name,!N),className:ne("relative h-6 w-11 rounded-full transition-colors",N?"bg-cachi-600":"bg-zinc-700"),children:s.jsx("span",{className:ne("absolute top-0.5 h-5 w-5 rounded-full bg-white transition-transform",N?"left-[22px]":"left-0.5")})})]},j.name)}case"select":{const N=String(E??j.default??"");return s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsx("select",{value:N,onChange:M=>v(j.name,M.target.value),className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 outline-none focus:border-cachi-500",children:(j.options||[]).map(M=>s.jsx("option",{value:M,children:M},M))}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"string":{const N=String(E??j.default??"");return s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsx("input",{type:"text",value:N,onChange:M=>v(j.name,M.target.value),placeholder:j.placeholder,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"secret":{const N=String(E??j.default??""),M=y.has(j.name);return s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:M?"text":"password",value:N,onChange:R=>v(j.name,R.target.value),placeholder:j.placeholder??"Enter secret...",className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 pr-10 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"}),s.jsx("button",{type:"button",onClick:()=>C(j.name),className:"absolute right-2 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:M?s.jsx(Br,{className:"h-4 w-4"}):s.jsx(gs,{className:"h-4 w-4"})})]}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"text":{const N=String(E??j.default??"");return s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsx("textarea",{value:N,onChange:M=>v(j.name,M.target.value),rows:j.rows??4,placeholder:j.placeholder,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500 resize-y"}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"path":{const N=String(E??j.default??""),R=j.pathType==="directory"?qu:j.pathType==="file"?bs:t4;return s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500",children:s.jsx(R,{className:"h-4 w-4"})}),s.jsx("input",{type:"text",value:N,onChange:A=>v(j.name,A.target.value),placeholder:j.placeholder??(j.pathType==="directory"?"/path/to/directory":"/path/to/file"),className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 pl-9 pr-3 py-2 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500 font-mono"})]}),j.pathType&&s.jsx("span",{className:"inline-block rounded bg-zinc-800 px-2 py-0.5 text-xs text-zinc-400 border border-zinc-700",children:j.pathType}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"string[]":case"number[]":{const N=j.type==="number[]",M=Array.isArray(E)?E:Array.isArray(j.default)?j.default:[],R=j.maxItems===void 0||M.length<j.maxItems,A=j.minItems===void 0||M.length>j.minItems,F=ee=>{v(j.name,ee)};return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsxs("span",{className:"text-xs text-zinc-500",children:[M.length,j.maxItems!==void 0?` / ${j.maxItems}`:""," items"]})]}),s.jsx("div",{className:"space-y-2",children:M.map((ee,Z)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:N?"number":"text",value:ee,onChange:L=>{const P=[...M];P[Z]=N?Number(L.target.value):L.target.value,F(P)},placeholder:j.itemPlaceholder,className:"flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-1.5 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"}),s.jsx("button",{onClick:()=>{A&&F(M.filter((L,P)=>P!==Z))},disabled:!A,className:"rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-800 hover:text-red-400 disabled:opacity-30 disabled:cursor-not-allowed",children:s.jsx(Pt,{className:"h-3.5 w-3.5"})})]},Z))}),s.jsxs("button",{onClick:()=>{R&&F([...M,N?0:""])},disabled:!R,className:"flex items-center gap-1.5 rounded-lg border border-dashed border-zinc-700 px-3 py-1.5 text-xs text-zinc-400 hover:border-cachi-500 hover:text-cachi-400 disabled:opacity-30 disabled:cursor-not-allowed",children:[s.jsx(Dn,{className:"h-3.5 w-3.5"}),"Add item"]}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"map":{const N=Array.isArray(E)?E:Array.isArray(j.default)?j.default:[],M=j.maxItems===void 0||N.length<j.maxItems,R=A=>{v(j.name,A)};return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsxs("span",{className:"text-xs text-zinc-500",children:[N.length,j.maxItems!==void 0?` / ${j.maxItems}`:""," entries"]})]}),s.jsx("div",{className:"space-y-2",children:N.map(([A,F],ee)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:A,onChange:Z=>{const L=[...N];L[ee]=[Z.target.value,F],R(L)},placeholder:j.keyPlaceholder??"Key",className:"w-2/5 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-1.5 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"}),s.jsx("input",{type:"text",value:F,onChange:Z=>{const L=[...N];L[ee]=[A,Z.target.value],R(L)},placeholder:j.valuePlaceholder??"Value",className:"flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-1.5 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"}),s.jsx("button",{onClick:()=>R(N.filter((Z,L)=>L!==ee)),className:"rounded-lg p-1.5 text-zinc-500 hover:bg-zinc-800 hover:text-red-400",children:s.jsx(Pt,{className:"h-3.5 w-3.5"})})]},ee))}),s.jsxs("button",{onClick:()=>{M&&R([...N,["",""]])},disabled:!M,className:"flex items-center gap-1.5 rounded-lg border border-dashed border-zinc-700 px-3 py-1.5 text-xs text-zinc-400 hover:border-cachi-500 hover:text-cachi-400 disabled:opacity-30 disabled:cursor-not-allowed",children:[s.jsx(Dn,{className:"h-3.5 w-3.5"}),"Add entry"]}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"multiselect":{const N=Array.isArray(E)?E:Array.isArray(j.default)?j.default:[],M=j.options||[],R=A=>{const F=N.includes(A)?N.filter(ee=>ee!==A):[...N,A];v(j.name,F)};return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsxs("span",{className:"text-xs text-zinc-500",children:[N.length," / ",M.length," selected"]})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:M.map(A=>{const F=N.includes(A);return s.jsxs("button",{onClick:()=>R(A),className:ne("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs transition-colors",F?"border-cachi-500 bg-cachi-500/15 text-cachi-300":"border-zinc-700 bg-zinc-800 text-zinc-400 hover:border-zinc-600 hover:text-zinc-300"),children:[F&&s.jsx(ln,{className:"h-3 w-3"}),A]},A)})}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"url":{const N=String(E??j.default??"");return s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-zinc-500",children:s.jsx(W5,{className:"h-4 w-4"})}),s.jsx("input",{type:"url",value:N,onChange:M=>v(j.name,M.target.value),placeholder:j.placeholder??"https://...",className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 pl-9 pr-3 py-2 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500"})]}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}case"code":{const N=String(E??j.default??"");return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:j.displayName||j.name}),j.language&&s.jsxs("span",{className:"flex items-center gap-1 rounded bg-zinc-800 px-2 py-0.5 text-xs text-zinc-400 border border-zinc-700",children:[s.jsx(qa,{className:"h-3 w-3"}),j.language]})]}),s.jsx("textarea",{value:N,onChange:M=>v(j.name,M.target.value),rows:j.rows??6,placeholder:j.placeholder,spellCheck:!1,className:"w-full rounded-lg border border-zinc-700 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 placeholder-zinc-600 outline-none focus:border-cachi-500 resize-y font-mono leading-relaxed"}),j.description&&s.jsx("p",{className:"text-xs text-zinc-500",children:j.description})]},j.name)}default:return null}};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"w-full max-w-md rounded-xl bg-zinc-900 shadow-xl",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 p-4",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-lg font-semibold text-zinc-100",children:["Configure ",e.name]}),s.jsx("p",{className:"text-sm text-zinc-500",children:e.description})]}),s.jsx("button",{onClick:o,className:"rounded-lg p-2 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:s.jsx(bn,{className:"h-5 w-5"})})]}),s.jsx("div",{className:"max-h-[60vh] overflow-y-auto p-4",children:f?s.jsx("div",{className:"space-y-6",children:d.map(z)}):s.jsx("div",{className:"py-8 text-center text-zinc-500",children:"No configuration options available for this tool."})}),s.jsxs("div",{className:"flex justify-between border-t border-zinc-800 p-4",children:[s.jsxs("button",{onClick:g,disabled:!f,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:[s.jsx(vo,{className:"h-4 w-4"}),"Reset to Defaults"]}),s.jsxs("div",{className:"flex gap-3",children:[s.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"}),s.jsxs("button",{onClick:b,disabled:!f,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:[s.jsx(Do,{className:"h-4 w-4"}),"Save"]})]})]})]})})}const mM="/api";let pM=class extends Error{constructor(n,r,i){super(n),this.status=r,this.data=i,this.name="ApiError"}};function xM(){const{accessToken:e}=yn.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function mj(e,n={},r=!0){const i=`${mM}${e}`,o=await fetch(i,{headers:{"Content-Type":"application/json",...xM(),...n.headers},...n});if(o.status===401&&r&&await Ia())return mj(e,n,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new pM(c.detail||`Request failed: ${o.statusText}`,o.status,c)}return o.json()}async function gM(){return(await mj("/plugins")).plugins}const bM={file:"filesystem",code:"code",task:"system",platform:"web",work:"data",git:"system",shell:"system",web:"web",http:"web",sql:"data",compression:"filesystem",general:"custom"},pj={filesystem:{label:"Filesystem",icon:bs},code:{label:"Code",icon:qa},web:{label:"Connections",icon:$m},system:{label:"System",icon:$u},data:{label:"Work",icon:Ao},custom:{label:"Custom",icon:yv}};function Nm(e){return e.split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function yM(e){return typeof e=="string"?{id:e,name:Nm(e),description:"",category:"custom",icon:e,enabled:!0,riskLevel:"safe"}:{id:e.name,name:e.displayName||Nm(e.name),description:e.description,category:bM[e.category]||"custom",icon:e.icon||e.name,enabled:!0,riskLevel:e.riskLevel||"safe",configParams:e.configParams}}function vM(){const{getActiveBot:e,updateBot:n}=Ot(),[r,i]=S.useState(""),[o,c]=S.useState("all"),[d,f]=S.useState(null),[m,h]=S.useState(null),[b,g]=S.useState([]),[v,y]=S.useState(!0),[k,C]=S.useState(null),z=e();if(S.useEffect(()=>{let _=!1;return y(!0),C(null),gM().then(q=>{_||g(q)}).catch(q=>{_||C(q.message||"Failed to load plugins")}).finally(()=>{_||y(!1)}),()=>{_=!0}},[]),!z)return null;const j=b.map(_=>{const q=_.skills.map(yM);return{plugin:_,tools:q}}),E=j.map(({plugin:_,tools:q})=>({plugin:_,tools:q.filter(B=>!(r&&!B.name.toLowerCase().includes(r.toLowerCase())||o!=="all"&&B.category!==o))})).filter(({tools:_})=>_.length>0),N=j.flatMap(({tools:_})=>_.map(q=>q.id)),M=z.tools.filter(_=>N.includes(_)).length,R=_=>{const q=z.tools,B=q.includes(_)?q.filter(V=>V!==_):[...q,_];n(z.id,{tools:B})},A=_=>z.tools.includes(_),F=["safe","moderate","dangerous","critical"],ee={safe:{icon:Na,color:"text-green-500",bg:"bg-green-500/10",border:"border-green-500/30"},moderate:{icon:Pu,color:"text-yellow-500",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},dangerous:{icon:Km,color:"text-red-500",bg:"bg-red-500/10",border:"border-red-500/30"},critical:{icon:Jm,color:"text-red-600",bg:"bg-red-600/10",border:"border-red-600/30"}},Z=_=>j.flatMap(({tools:q})=>q.filter(B=>B.riskLevel===_)),L=_=>{const q=Z(_);if(q.length===0)return;const B=q.every(oe=>z.tools.includes(oe.id));let V;if(B){const oe=new Set(q.map(ue=>ue.id));V=z.tools.filter(ue=>!oe.has(ue))}else{const oe=q.map(ue=>ue.id).filter(ue=>!z.tools.includes(ue));V=[...z.tools,...oe]}n(z.id,{tools:V})},P=()=>{const _=j.flatMap(({tools:q})=>q.map(B=>B.id));n(z.id,{tools:[...new Set([...z.tools,..._])]})},Y=()=>{const _=new Set(j.flatMap(({tools:q})=>q.map(B=>B.id)));n(z.id,{tools:z.tools.filter(q=>!_.has(q))})},me=new Set;for(const{tools:_}of j)for(const q of _)me.add(q.category);return s.jsxs("div",{className:"flex h-full bg-zinc-950",children:[s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Tools"}),s.jsxs("p",{className:"text-sm text-zinc-500",children:[M," tools enabled for ",z.name]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[F.map(_=>{const q=ee[_],B=q.icon,V=Z(_),oe=V.filter(U=>z.tools.includes(U.id)).length,ue=V.length;if(ue===0)return null;const O=oe===ue;return s.jsxs("button",{onClick:()=>L(_),title:O?`Disable all ${_} tools`:`Enable all ${_} tools`,className:ne("flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs transition-colors",O?`${q.bg} ${q.border} ${q.color}`:"border-zinc-700 bg-zinc-800/50 text-zinc-500 hover:border-zinc-600 hover:text-zinc-400"),children:[s.jsx(B,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"capitalize",children:_}),s.jsxs("span",{className:ne("rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none",O?"bg-white/10":"bg-zinc-700"),children:[oe,"/",ue]})]},_)}),s.jsx("div",{className:"mx-1 h-5 w-px bg-zinc-700"}),s.jsx("button",{onClick:P,className:"rounded-lg px-2 py-1.5 text-xs text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:"All on"}),s.jsx("button",{onClick:Y,className:"rounded-lg px-2 py-1.5 text-xs text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:"All off"})]})]}),s.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(On,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),s.jsx("input",{type:"text",placeholder:"Search tools...",value:r,onChange:_=>i(_.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"})]}),s.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-zinc-700 bg-zinc-800/50 p-1",children:[s.jsx("button",{onClick:()=>c("all"),className:ne("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(pj).filter(([_])=>me.has(_)).map(([_,q])=>s.jsx("button",{onClick:()=>c(_),className:ne("rounded-md px-3 py-1 text-xs font-medium transition-colors",o===_?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:text-zinc-200"),children:q.label},_))]})]})]}),s.jsxs("div",{className:"p-6",children:[v&&s.jsxs("div",{className:"flex items-center justify-center py-12 text-zinc-500",children:[s.jsx(Ge,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading plugins..."]}),k&&s.jsxs("div",{className:"flex items-center justify-center gap-2 py-12 text-red-400",children:[s.jsx(sr,{className:"h-5 w-5"}),k]}),!v&&!k&&E.length===0&&s.jsx("div",{className:"py-12 text-center text-zinc-500",children:"No tools match your search"}),!v&&!k&&E.map(({plugin:_,tools:q})=>{const B=_.displayName||Nm(_.name),V=l3(_.icon);return s.jsxs("div",{className:"mb-8",children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsx(V,{className:"h-5 w-5 text-zinc-500"}),s.jsx("h2",{className:"text-sm font-semibold text-zinc-300",children:B}),s.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-xs text-zinc-500",children:q.length}),_.capability&&s.jsx("span",{className:"rounded-full bg-zinc-800/50 px-2 py-0.5 text-xs text-zinc-600",children:_.capability}),_.alwaysEnabled&&s.jsx("span",{className:"rounded-full bg-green-500/10 px-2 py-0.5 text-xs text-green-500",children:"always on"})]}),s.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:q.map(oe=>s.jsx(jM,{tool:oe,enabled:A(oe.id),onToggle:()=>R(oe.id),onSelect:()=>f(oe),onConfigure:()=>h(oe)},oe.id))})]},_.name)})]})]}),d&&s.jsx(wM,{tool:d,enabled:A(d.id),onToggle:()=>R(d.id),onClose:()=>f(null)}),m&&s.jsx(hM,{tool:m,botId:z.id,currentConfigs:z.toolConfigs,isOpen:!!m,onClose:()=>h(null)})]})}function jM({tool:e,enabled:n,onToggle:r,onSelect:i,onConfigure:o}){const c={safe:{icon:Na,color:"text-green-500",bg:"bg-green-500/10"},moderate:{icon:Pu,color:"text-yellow-500",bg:"bg-yellow-500/10"},dangerous:{icon:Km,color:"text-red-500",bg:"bg-red-500/10"},critical:{icon:Jm,color:"text-red-600",bg:"bg-red-600/10"}},d=c[e.riskLevel]||c.safe,f=d.icon;return s.jsxs("div",{className:ne("group relative rounded-xl border p-4 transition-all",n?"border-cachi-500/50 bg-cachi-500/5":"border-zinc-800 bg-zinc-900/30 hover:border-zinc-700"),children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-zinc-800",children:s.jsx(u0,{toolId:e.id,icon:e.icon,className:"h-5 w-5 text-zinc-300"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-medium text-zinc-200",children:e.name}),s.jsxs("div",{className:ne("flex items-center gap-1 text-xs",d.color),children:[s.jsx(f,{className:"h-3 w-3"}),e.riskLevel]})]})]}),s.jsx("button",{onClick:m=>{m.stopPropagation(),r()},className:ne("transition-colors",n?"text-cachi-500":"text-zinc-600"),children:n?s.jsx(_o,{className:"h-6 w-6"}):s.jsx(Ro,{className:"h-6 w-6"})})]}),s.jsx("p",{className:"mt-3 text-sm text-zinc-500 line-clamp-2",children:e.description}),s.jsxs("div",{className:"mt-3 flex items-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[s.jsxs("button",{onClick:i,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:[s.jsx(Gm,{className:"h-3 w-3"}),"Details"]}),e.configParams&&e.configParams.length>0&&s.jsxs("button",{onClick:m=>{m.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:[s.jsx(Oo,{className:"h-3 w-3"}),"Configure"]})]})]})}function wM({tool:e,enabled:n,onToggle:r,onClose:i}){var f;const o={safe:{icon:Na,color:"text-green-500",bg:"bg-green-500/10",border:"border-green-500/30"},moderate:{icon:Pu,color:"text-yellow-500",bg:"bg-yellow-500/10",border:"border-yellow-500/30"},dangerous:{icon:Km,color:"text-red-500",bg:"bg-red-500/10",border:"border-red-500/30"},critical:{icon:Jm,color:"text-red-600",bg:"bg-red-600/10",border:"border-red-600/30"}},c=o[e.riskLevel]||o.safe,d=c.icon;return s.jsxs("div",{className:"w-96 flex-shrink-0 border-l border-zinc-800 bg-zinc-900/50",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-4 py-3",children:[s.jsx("h2",{className:"font-semibold text-zinc-100",children:"Tool Details"}),s.jsx("button",{onClick:i,className:"rounded p-1 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:"x"})]}),s.jsxs("div",{className:"p-4",children:[s.jsxs("div",{className:"mb-6 flex items-center gap-4",children:[s.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl bg-zinc-800",children:s.jsx(u0,{toolId:e.id,icon:e.icon,className:"h-7 w-7 text-zinc-300"})}),s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-bold text-zinc-100",children:e.name}),s.jsx("p",{className:"text-sm text-zinc-500",children:((f=pj[e.category])==null?void 0:f.label)||e.category})]})]}),s.jsxs("div",{className:ne("mb-6 rounded-lg border p-4",c.bg,c.border),children:[s.jsxs("div",{className:ne("flex items-center gap-2",c.color),children:[s.jsx(d,{className:"h-5 w-5"}),s.jsxs("span",{className:"font-medium capitalize",children:[e.riskLevel," Risk"]})]}),s.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.",e.riskLevel==="critical"&&"This tool performs critical operations with significant risk. Requires explicit approval."]})]}),s.jsxs("div",{className:"mb-6",children:[s.jsx("h4",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Description"}),s.jsx("p",{className:"text-sm text-zinc-500",children:e.description})]}),e.parameters&&e.parameters.length>0&&s.jsxs("div",{className:"mb-6",children:[s.jsx("h4",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Parameters"}),s.jsx("div",{className:"space-y-2",children:e.parameters.map(m=>s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"font-mono text-sm text-cachi-400",children:m.name}),s.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 text-xs text-zinc-500",children:m.type}),m.required&&s.jsx("span",{className:"rounded bg-red-500/20 px-1.5 py-0.5 text-xs text-red-400",children:"required"})]}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:m.description})]},m.name))})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:r,className:ne("flex flex-1 items-center justify-center gap-2 rounded-lg py-2 text-sm font-medium transition-colors",n?"bg-red-600/20 text-red-400 hover:bg-red-600/30":"bg-cachi-600 text-white hover:bg-cachi-500"),children:n?s.jsxs(s.Fragment,{children:[s.jsx(Ro,{className:"h-4 w-4"}),"Disable"]}):s.jsxs(s.Fragment,{children:[s.jsx(_o,{className:"h-4 w-4"}),"Enable"]})}),s.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:[s.jsx(Iu,{className:"h-4 w-4"}),"Test"]})]})]})]})}const zM="modulepreload",NM=function(e){return"/"+e},n1={},km=function(n,r,i){let o=Promise.resolve();if(r&&r.length>0){let d=function(h){return Promise.all(h.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));o=d(r.map(h=>{if(h=NM(h),h in n1)return;n1[h]=!0;const b=h.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const v=document.createElement("link");if(v.rel=b?"stylesheet":zM,b||(v.as="script"),v.crossOrigin="",v.href=h,m&&v.setAttribute("nonce",m),document.head.appendChild(v),b)return new Promise((y,k)=>{v.addEventListener("load",y),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function c(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"&&c(f.reason);return n().catch(c)})},kM="/api";function SM(){const{accessToken:e}=yn.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function Zu(e,n={},r=!0){const i=`${kM}${e}`,o=await fetch(i,{headers:{"Content-Type":"application/json",...SM(),...n.headers},...n});if(o.status===401&&r&&await Ia())return Zu(e,n,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.detail||`Request failed: ${o.statusText}`)}return o.json()}async function CM(){return(await Zu("/models")).groups||{}}async function EM(){return(await Zu("/models/default")).model}async function TM(e){await Zu("/models/default",{method:"PUT",body:JSON.stringify({model:e})})}const js=zt((e,n)=>({groups:{},defaultModel:"",loading:!0,error:null,get models(){return Object.values(n().groups).flat()},refresh:async()=>{e({loading:!0,error:null});try{const[r,i]=await Promise.all([CM(),EM()]);e({groups:r,defaultModel:i,loading:!1})}catch(r){e({error:r instanceof Error?r.message:"Failed to load models",loading:!1})}},updateDefaultModel:async r=>{try{await TM(r),e({defaultModel:r})}catch(i){e({error:i instanceof Error?i.message:"Failed to update default model"})}}})),AM={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 MM(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 DM(e){return AM[e]||e.charAt(0).toUpperCase()+e.slice(1)}function qo({value:e,onChange:n,placeholder:r="System Default",className:i=""}){const{groups:o,refresh:c,loading:d}=js(),[f,m]=S.useState(!1),[h,b]=S.useState(""),[g,v]=S.useState(!1),[y,k]=S.useState(""),C=S.useRef(null),z=S.useRef(null),j=S.useRef(null),E=S.useRef(null),[N,M]=S.useState({top:0,left:0,width:0});S.useEffect(()=>{c()},[c]);const R=S.useCallback(()=>{if(C.current){const Z=C.current.getBoundingClientRect();M({top:Z.bottom+4,left:Z.left,width:Z.width})}},[]);S.useEffect(()=>{if(!f)return;const Z=L=>{C.current&&!C.current.contains(L.target)&&z.current&&!z.current.contains(L.target)&&(m(!1),v(!1))};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[f]),S.useEffect(()=>{if(f)return R(),window.addEventListener("scroll",R,!0),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R)}},[f,R]),S.useEffect(()=>{f&&!g&&j.current&&j.current.focus()},[f,g]),S.useEffect(()=>{g&&E.current&&E.current.focus()},[g]);const A=S.useMemo(()=>{const Z=h.toLowerCase().trim();if(!Z)return o;const L={};for(const[P,Y]of Object.entries(o)){const me=Y.filter(_=>_.id.toLowerCase().includes(Z)||P.toLowerCase().includes(Z));me.length>0&&(L[P]=me)}return L},[o,h]),F=Object.values(A).reduce((Z,L)=>Z+L.length,0),ee=()=>{const Z=y.trim();Z&&n(Z),m(!1),v(!1),k("")};return s.jsxs("div",{className:ne("relative",i),children:[s.jsxs("button",{ref:C,type:"button",onClick:()=>{m(!f),b(""),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:[s.jsx("span",{className:ne("truncate",e?"text-zinc-900 font-mono text-xs dark:text-zinc-100":"text-zinc-500"),children:e||r}),s.jsx(el,{className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 h-4 w-4 pointer-events-none"})]}),f&&Bm.createPortal(s.jsx("div",{ref:z,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:N.top,left:N.left,width:Math.max(N.width,300)},children:g?s.jsxs("div",{className:"p-2",children:[s.jsx("p",{className:"text-[10px] text-zinc-500 mb-1.5 px-1",children:"Enter model in provider/model format"}),s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx("input",{ref:E,type:"text",value:y,onChange:Z=>k(Z.target.value),onKeyDown:Z=>{Z.key==="Enter"&&ee(),Z.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"}),s.jsx("button",{type:"button",onClick:ee,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"})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"p-2 border-b border-zinc-200 dark:border-zinc-800",children:s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-zinc-500 h-3.5 w-3.5"}),s.jsx("input",{ref:j,type:"text",value:h,onChange:Z=>b(Z.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"})]})}),s.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[d&&s.jsx("div",{className:"px-3 py-6 text-center text-xs text-zinc-500",children:"Discovering models..."}),!h&&!d&&s.jsxs("button",{type:"button",onClick:()=>{n(""),m(!1)},className:ne("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:[s.jsx("span",{children:r}),!e&&s.jsx(ln,{className:"h-3.5 w-3.5 text-cachi-500"})]}),!d&&Object.entries(A).sort(([Z],[L])=>Z.localeCompare(L)).map(([Z,L])=>s.jsxs("div",{children:[s.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:[DM(Z),s.jsx("span",{className:"ml-1.5 text-zinc-400 dark:text-zinc-600",children:L.length})]}),L.map(P=>{const Y=e===P.id,me=MM(P.context_window);return s.jsxs("button",{type:"button",onClick:()=>{n(P.id),m(!1)},className:ne("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",Y?"text-cachi-600 bg-cachi-500/5 dark:text-cachi-400":"text-zinc-700 dark:text-zinc-300"),children:[s.jsx("span",{className:"truncate font-mono text-xs",children:P.id}),s.jsxs("span",{className:"flex items-center gap-2 shrink-0",children:[me&&s.jsx("span",{className:"text-[10px] text-zinc-500 dark:text-zinc-600",children:me}),P.supports_vision&&s.jsx("span",{className:"text-[9px] bg-zinc-200 text-zinc-600 px-1 rounded dark:bg-zinc-800 dark:text-zinc-400",children:"vision"}),P.is_reasoning&&s.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"}),Y&&s.jsx(ln,{className:"h-3.5 w-3.5 text-cachi-500"})]})]},P.id)})]},Z)),!d&&F===0&&s.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."})]}),s.jsx("div",{className:"border-t border-zinc-200 dark:border-zinc-800",children:s.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:[s.jsx(Qm,{className:"h-3 w-3"}),"Enter manually"]})})]})}),document.body)]})}const xj="/api/bots";function Sm(){const{accessToken:e}=yn.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function Zt(e,n={},r=!0){const i=`${xj}${e}`,o=await fetch(i,{headers:{"Content-Type":"application/json",...Sm(),...n.headers},...n});if(o.status===401&&r&&await Ia())return Zt(e,n,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.detail||`Request failed: ${o.statusText}`)}return o.json()}async function OM(e,n){const r=new FormData;r.append("file",n);const i=`${xj}/${e}/documents/`,o=await fetch(i,{method:"POST",headers:{...Sm()},body:r});if(o.status===401&&await Ia()){const d=await fetch(i,{method:"POST",headers:{...Sm()},body:r});if(!d.ok){const f=await d.json().catch(()=>({detail:"Upload failed"}));throw new Error(f.detail||`Upload failed: ${d.status}`)}return d.json()}if(!o.ok){const c=await o.json().catch(()=>({detail:"Upload failed"}));throw new Error(c.detail||`Upload failed: ${o.status}`)}return o.json()}async function RM(e){return Zt(`/${e}/documents/`)}async function _M(e,n){return Zt(`/${e}/documents/${n}`)}async function LM(e,n){return Zt(`/${e}/documents/${n}`,{method:"DELETE"})}async function BM(e){return Zt(`/${e}/instructions/`)}async function gj(e,n){return Zt(`/${e}/instructions/`,{method:"PUT",body:JSON.stringify({content:n})})}async function UM(e){return Zt(`/${e}/instructions/`,{method:"DELETE"})}async function HM(e,n){const r=new URLSearchParams;n!=null&&n.tags&&r.set("tags",n.tags),n!=null&&n.search&&r.set("search",n.search),n!=null&&n.limit&&r.set("limit",String(n.limit)),n!=null&&n.offset&&r.set("offset",String(n.offset));const i=r.toString();return Zt(`/${e}/knowledge/notes${i?`?${i}`:""}`)}async function qM(e,n){return Zt(`/${e}/knowledge/notes`,{method:"POST",body:JSON.stringify(n)})}async function IM(e,n){return Zt(`/${e}/knowledge/notes/${n}`)}async function PM(e,n,r){return Zt(`/${e}/knowledge/notes/${n}`,{method:"PUT",body:JSON.stringify(r)})}async function FM(e,n){return Zt(`/${e}/knowledge/notes/${n}`,{method:"DELETE"})}async function $M(e){return Zt(`/${e}/knowledge/notes/tags`)}async function VM(e){return Zt(`/${e}/knowledge/stats`)}async function GM(e,n,r=!0,i=!0,o=10){return Zt(`/${e}/knowledge/search`,{method:"POST",body:JSON.stringify({query:n,include_notes:r,include_documents:i,limit:o})})}async function YM(e,n){return Zt(`/${e}/knowledge/documents/${n}/retry`,{method:"POST"})}async function QM(e,n){return Zt(`/${e}/knowledge/documents/${n}/chunks`)}const nn={documents:{upload:OM,list:RM,get:_M,delete:LM,retry:YM,getChunks:QM},instructions:{get:BM,update:gj,delete:UM},notes:{list:HM,create:qM,get:IM,update:PM,delete:FM,getTags:$M},stats:VM,search:GM},or=zt()(Ft((e,n)=>({documents:{},instructions:{},notes:{},allTags:{},stats:{},searchResults:[],documentChunks:{},loadingDocuments:{},loadingInstructions:{},loadingNotes:{},loadingStats:{},loadingSearch:!1,loadingChunks:{},uploadingBots:new Set,error:null,loadDocuments:async r=>{e(i=>({loadingDocuments:{...i.loadingDocuments,[r]:!0},error:null}));try{const i=await nn.documents.list(r);e(o=>({documents:{...o.documents,[r]:i},loadingDocuments:{...o.loadingDocuments,[r]:!1}}))}catch(i){e(o=>({loadingDocuments:{...o.loadingDocuments,[r]:!1},error:i instanceof Error?i.message:"Failed to load documents"}))}},uploadDocument:async(r,i)=>{e(o=>({uploadingBots:new Set([...o.uploadingBots,r]),error:null}));try{const o=await nn.documents.upload(r,i);return await n().loadDocuments(r),e(c=>{const d=new Set(c.uploadingBots);return d.delete(r),{uploadingBots:d}}),o.document_id}catch(o){throw e(c=>{const d=new Set(c.uploadingBots);return d.delete(r),{uploadingBots:d,error:o instanceof Error?o.message:"Upload failed"}}),o}},deleteDocument:async(r,i)=>{try{await nn.documents.delete(r,i),e(o=>({documents:{...o.documents,[r]:(o.documents[r]||[]).filter(c=>c.id!==i)}}))}catch(o){throw e({error:o instanceof Error?o.message:"Delete failed"}),o}},refreshDocument:async(r,i)=>{try{const o=await nn.documents.get(r,i);e(c=>({documents:{...c.documents,[r]:(c.documents[r]||[]).map(d=>d.id===i?o:d)}}))}catch{}},getDocuments:r=>n().documents[r]||[],retryDocument:async(r,i)=>{try{await nn.documents.retry(r,i),await n().loadDocuments(r)}catch(o){throw e({error:o instanceof Error?o.message:"Retry failed"}),o}},loadDocumentChunks:async(r,i)=>{e(o=>({loadingChunks:{...o.loadingChunks,[i]:!0}}));try{const o=await nn.documents.getChunks(r,i);e(c=>({documentChunks:{...c.documentChunks,[i]:o},loadingChunks:{...c.loadingChunks,[i]:!1}}))}catch(o){e(c=>({loadingChunks:{...c.loadingChunks,[i]:!1},error:o instanceof Error?o.message:"Failed to load chunks"}))}},loadInstructions:async r=>{e(i=>({loadingInstructions:{...i.loadingInstructions,[r]:!0},error:null}));try{const i=await nn.instructions.get(r);e(o=>({instructions:{...o.instructions,[r]:i.content},loadingInstructions:{...o.loadingInstructions,[r]:!1}}))}catch(i){e(o=>({loadingInstructions:{...o.loadingInstructions,[r]:!1},error:i instanceof Error?i.message:"Failed to load instructions"}))}},updateInstructions:async(r,i)=>{try{await nn.instructions.update(r,i),e(o=>({instructions:{...o.instructions,[r]:i}}))}catch(o){throw e({error:o instanceof Error?o.message:"Update failed"}),o}},deleteInstructions:async r=>{try{await nn.instructions.delete(r),e(i=>({instructions:{...i.instructions,[r]:""}}))}catch(i){throw e({error:i instanceof Error?i.message:"Delete failed"}),i}},getInstructions:r=>n().instructions[r]||"",loadNotes:async(r,i,o)=>{e(c=>({loadingNotes:{...c.loadingNotes,[r]:!0},error:null}));try{const c=await nn.notes.list(r,{tags:i,search:o});e(d=>({notes:{...d.notes,[r]:c},loadingNotes:{...d.loadingNotes,[r]:!1}}))}catch(c){e(d=>({loadingNotes:{...d.loadingNotes,[r]:!1},error:c instanceof Error?c.message:"Failed to load notes"}))}},createNote:async(r,i)=>{try{const o=await nn.notes.create(r,i);return e(c=>({notes:{...c.notes,[r]:[o,...c.notes[r]||[]]}})),o}catch(o){throw e({error:o instanceof Error?o.message:"Failed to create note"}),o}},updateNote:async(r,i,o)=>{try{const c=await nn.notes.update(r,i,o);e(d=>({notes:{...d.notes,[r]:(d.notes[r]||[]).map(f=>f.id===i?c:f)}}))}catch(c){throw e({error:c instanceof Error?c.message:"Failed to update note"}),c}},deleteNote:async(r,i)=>{try{await nn.notes.delete(r,i),e(o=>({notes:{...o.notes,[r]:(o.notes[r]||[]).filter(c=>c.id!==i)}}))}catch(o){throw e({error:o instanceof Error?o.message:"Failed to delete note"}),o}},loadTags:async r=>{try{const i=await nn.notes.getTags(r);e(o=>({allTags:{...o.allTags,[r]:i}}))}catch{}},loadStats:async r=>{e(i=>({loadingStats:{...i.loadingStats,[r]:!0}}));try{const i=await nn.stats(r);e(o=>({stats:{...o.stats,[r]:i},loadingStats:{...o.loadingStats,[r]:!1}}))}catch(i){e(o=>({loadingStats:{...o.loadingStats,[r]:!1},error:i instanceof Error?i.message:"Failed to load stats"}))}},searchKnowledge:async(r,i)=>{e({loadingSearch:!0,error:null});try{const o=await nn.search(r,i);e({searchResults:o,loadingSearch:!1})}catch(o){e({loadingSearch:!1,error:o instanceof Error?o.message:"Search failed"})}},clearError:()=>e({error:null}),clearSearchResults:()=>e({searchResults:[]})}),{name:"cachibot-knowledge",partialize:e=>({documents:e.documents,instructions:e.instructions,notes:e.notes})})),Fh=[".pdf",".txt",".md"],$h=10;function XM({botId:e}){const{uploadDocument:n,uploadingBots:r,error:i,clearError:o}=or(),[c,d]=S.useState(!1),f=r.has(e),m=S.useCallback(async y=>{var C;const k="."+((C=y.name.split(".").pop())==null?void 0:C.toLowerCase());if(!Fh.includes(k)){alert(`File type not allowed. Allowed: ${Fh.join(", ")}`);return}if(y.size>$h*1024*1024){alert(`File too large. Maximum: ${$h}MB`);return}o();try{await n(e,y)}catch{}},[e,n,o]),h=S.useCallback(y=>{y.preventDefault(),d(!1);const k=y.dataTransfer.files[0];k&&m(k)},[m]),b=S.useCallback(y=>{y.preventDefault(),d(!0)},[]),g=S.useCallback(y=>{y.preventDefault(),d(!1)},[]),v=S.useCallback(()=>{const y=document.createElement("input");y.type="file",y.accept=Fh.join(","),y.onchange=k=>{var z;const C=(z=k.target.files)==null?void 0:z[0];C&&m(C)},y.click()},[m]);return s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{onClick:f?void 0:v,onDrop:f?void 0:h,onDragOver:b,onDragLeave:g,className:`
          border-2 border-dashed rounded-lg p-6 text-center transition-colors
          ${c?"border-green-500 bg-green-500/10":"border-zinc-700"}
          ${f?"opacity-50 cursor-wait":"cursor-pointer hover:border-zinc-500"}
        `,children:f?s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-green-500 border-t-transparent"}),s.jsx("p",{className:"text-sm text-zinc-400",children:"Uploading..."})]}):s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx(Vu,{className:"h-8 w-8 text-zinc-500"}),s.jsx("p",{className:"text-sm text-zinc-300",children:c?"Drop file here":"Drag & drop or click to upload"}),s.jsxs("p",{className:"text-xs text-zinc-500",children:["PDF, TXT, or MD files up to ",$h,"MB"]})]})}),i&&s.jsxs("div",{className:"flex items-center gap-2 text-red-400 text-sm",children:[s.jsx(sr,{className:"h-4 w-4"}),i]})]})}function JM(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function KM(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function ZM({status:e}){switch(e){case"processing":return s.jsx(To,{className:"h-4 w-4 text-yellow-500 animate-pulse"});case"ready":return s.jsx(tl,{className:"h-4 w-4 text-green-500"});case"failed":return s.jsx(rr,{className:"h-4 w-4 text-red-500"})}}function WM({botId:e,onViewChunks:n}){const{loadDocuments:r,deleteDocument:i,refreshDocument:o,retryDocument:c,getDocuments:d,loadingDocuments:f}=or(),m=d(e),h=f[e],[b,g]=S.useState(null),[v,y]=S.useState(null);S.useEffect(()=>{r(e)},[e,r]),S.useEffect(()=>{const z=m.filter(E=>E.status==="processing");if(z.length===0)return;const j=setInterval(()=>{z.forEach(E=>{o(e,E.id)})},3e3);return()=>clearInterval(j)},[e,m,o]);const k=async z=>{await i(e,z),g(null)},C=async z=>{y(z);try{await c(e,z)}finally{y(null)}};return h&&m.length===0?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(gn,{className:"h-5 w-5 animate-spin text-zinc-500"})}):m.length===0?s.jsxs("div",{className:"text-center py-8 text-zinc-500",children:[s.jsx(bs,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),s.jsx("p",{children:"No documents uploaded yet"})]}):s.jsx("div",{className:"space-y-2",children:m.map(z=>s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-3 p-3 bg-zinc-800/50 rounded-lg",children:[s.jsx(bs,{className:"h-5 w-5 text-zinc-400 flex-shrink-0"}),s.jsxs("div",{className:`flex-1 min-w-0 ${z.status==="ready"&&n?"cursor-pointer hover:opacity-80":""}`,onClick:()=>{z.status==="ready"&&n&&n(z.id,z.filename)},children:[s.jsx("p",{className:"text-sm text-zinc-200 truncate",children:z.filename}),s.jsxs("p",{className:"text-xs text-zinc-500",children:[JM(z.file_size),z.chunk_count>0&&` - ${z.chunk_count} chunks`," - ",KM(z.uploaded_at)]})]}),s.jsx(ZM,{status:z.status}),z.status==="ready"&&n&&s.jsx("button",{onClick:()=>n(z.id,z.filename),className:"p-1.5 rounded hover:bg-zinc-700 text-zinc-400 hover:text-zinc-200 transition-colors",title:"View chunks",children:s.jsx(gs,{className:"h-4 w-4"})}),z.status==="failed"&&s.jsx("button",{onClick:()=>C(z.id),disabled:v===z.id,className:"p-1.5 rounded hover:bg-zinc-700 text-zinc-400 hover:text-yellow-400 transition-colors disabled:opacity-50",title:"Retry processing",children:s.jsx(vo,{className:`h-4 w-4 ${v===z.id?"animate-spin":""}`})}),s.jsx("button",{onClick:()=>g(z.id),className:"p-1.5 rounded hover:bg-zinc-700 text-zinc-400 hover:text-red-400 transition-colors",title:"Delete document",children:s.jsx(Pt,{className:"h-4 w-4"})})]}),b===z.id&&s.jsxs("div",{className:"flex items-center gap-2 mt-1 ml-8 p-2 bg-red-500/10 border border-red-500/30 rounded-lg",children:[s.jsxs("span",{className:"text-xs text-red-400 flex-1",children:['Delete "',z.filename,'"?']}),s.jsx("button",{onClick:()=>k(z.id),className:"px-2 py-1 text-xs rounded bg-red-600 text-white hover:bg-red-500",children:"Delete"}),s.jsx("button",{onClick:()=>g(null),className:"px-2 py-1 text-xs rounded border border-zinc-600 text-zinc-300 hover:bg-zinc-700",children:"Cancel"})]})]},z.id))})}function e7({botId:e}){const{loadInstructions:n,updateInstructions:r,getInstructions:i,loadingInstructions:o}=or(),c=i(e),d=o[e],[f,m]=S.useState(c),[h,b]=S.useState(!1),[g,v]=S.useState(null);S.useEffect(()=>{n(e)},[e,n]),S.useEffect(()=>{m(c)},[c]);const y=f!==c,k=S.useCallback(async()=>{if(y){b(!0);try{await r(e,f),v(new Date)}catch{}finally{b(!1)}}},[e,f,y,r]);return S.useEffect(()=>{if(!y)return;const C=setTimeout(()=>{k()},2e3);return()=>clearTimeout(C)},[f,y,k]),d&&!c?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(gn,{className:"h-5 w-5 animate-spin text-zinc-500"})}):s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"Custom Instructions"}),s.jsxs("div",{className:"flex items-center gap-2",children:[h&&s.jsx("span",{className:"text-xs text-zinc-500",children:"Saving..."}),!h&&g&&s.jsxs("span",{className:"text-xs text-zinc-500",children:["Saved ",g.toLocaleTimeString()]}),y&&!h&&s.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:[s.jsx(Do,{className:"h-3 w-3"}),"Save"]})]})]}),s.jsx("textarea",{value:f,onChange:C=>m(C.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}),s.jsxs("p",{className:"text-xs text-zinc-500",children:[f.length.toLocaleString()," / 10,000 characters"]})]})}function t7(e){const n=new Date(e),i=new Date().getTime()-n.getTime(),o=Math.floor(i/1e3),c=Math.floor(o/60),d=Math.floor(c/60),f=Math.floor(d/24);return o<60?"just now":c<60?`${c}m ago`:d<24?`${d}h ago`:f<7?`${f}d ago`:f<30?`${Math.floor(f/7)}w ago`:n.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function n7(e,n=150){return e.length<=n?e:e.slice(0,n).trimEnd()+"..."}const a1=["bg-blue-500/20 text-blue-400","bg-purple-500/20 text-purple-400","bg-emerald-500/20 text-emerald-400","bg-amber-500/20 text-amber-400","bg-rose-500/20 text-rose-400","bg-cyan-500/20 text-cyan-400","bg-orange-500/20 text-orange-400","bg-pink-500/20 text-pink-400"];function a7(e){let n=0;for(let r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r)|0;return a1[Math.abs(n)%a1.length]}function s7({source:e}){return e==="bot"?s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs rounded bg-cachi-500/20 text-cachi-400",children:[s.jsx(ya,{className:"h-3 w-3"}),"bot"]}):s.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs rounded bg-zinc-600/40 text-zinc-400",children:[s.jsx(Lo,{className:"h-3 w-3"}),"user"]})}function r7({botId:e,onEditNote:n,onNewNote:r}){const{notes:i,allTags:o,loadNotes:c,loadTags:d,deleteNote:f,loadingNotes:m}=or(),h=S.useMemo(()=>i[e]||[],[i,e]),b=S.useMemo(()=>o[e]||[],[o,e]),g=m[e],[v,y]=S.useState(""),[k,C]=S.useState(new Set),[z,j]=S.useState(null);S.useEffect(()=>{c(e),d(e)},[e,c,d]),S.useEffect(()=>{const R=k.size>0?Array.from(k).join(","):void 0,A=v.trim()||void 0,F=setTimeout(()=>{c(e,R,A)},A?300:0);return()=>clearTimeout(F)},[e,k,v,c]);const E=S.useCallback(R=>{C(A=>{const F=new Set(A);return F.has(R)?F.delete(R):F.add(R),F})},[]),N=S.useCallback(async R=>{try{await f(e,R)}catch{}finally{j(null)}},[e,f]),M=S.useMemo(()=>h,[h]);return g&&h.length===0?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(gn,{className:"h-5 w-5 animate-spin text-zinc-500"})}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(On,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),s.jsx("input",{type:"text",value:v,onChange:R=>y(R.target.value),placeholder:"Search notes...",className:"w-full pl-9 pr-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-cachi-500 transition-colors"})]}),s.jsxs("button",{onClick:r,className:"flex items-center gap-1.5 px-3 py-2 bg-cachi-600 hover:bg-cachi-500 text-white text-sm font-medium rounded-lg transition-colors whitespace-nowrap",children:[s.jsx(Dn,{className:"h-4 w-4"}),"New Note"]})]}),b.length>0&&s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(Nv,{className:"h-3.5 w-3.5 text-zinc-500 flex-shrink-0"}),b.map(R=>s.jsx("button",{onClick:()=>E(R),className:ne("px-2 py-0.5 text-xs rounded-full border transition-colors",k.has(R)?"bg-cachi-500/20 text-cachi-400 border-cachi-500/40":"bg-zinc-800 text-zinc-400 border-zinc-700 hover:border-zinc-600"),children:R},R)),k.size>0&&s.jsx("button",{onClick:()=>C(new Set),className:"px-2 py-0.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",children:"Clear"})]}),M.length===0?s.jsxs("div",{className:"text-center py-12 text-zinc-500",children:[s.jsx(Zm,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),s.jsx("p",{className:"text-sm",children:v||k.size>0?"No notes match your filters":"No notes yet"}),!v&&k.size===0&&s.jsx("button",{onClick:r,className:"mt-2 text-sm text-cachi-500 hover:text-cachi-400 transition-colors",children:"Create your first note"})]}):s.jsx("div",{className:"space-y-2",children:M.map(R=>s.jsxs("div",{className:"group p-3 bg-zinc-800/50 rounded-lg border border-zinc-800 hover:border-zinc-700 transition-colors",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("button",{onClick:()=>n(R.id),className:"text-sm font-medium text-zinc-200 hover:text-cachi-400 text-left transition-colors truncate flex-1",children:R.title}),s.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[s.jsx("button",{onClick:()=>n(R.id),className:"p-1 rounded hover:bg-zinc-700 text-zinc-400 hover:text-cachi-400 transition-colors",title:"Edit note",children:s.jsx(Qm,{className:"h-3.5 w-3.5"})}),z===R.id?s.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[s.jsx("span",{className:"text-zinc-400",children:"Are you sure?"}),s.jsx("button",{onClick:()=>N(R.id),className:"px-1.5 py-0.5 rounded bg-red-600 hover:bg-red-500 text-white transition-colors",children:"Confirm"}),s.jsx("button",{onClick:()=>j(null),className:"px-1.5 py-0.5 rounded bg-zinc-700 hover:bg-zinc-600 text-zinc-300 transition-colors",children:"Cancel"})]}):s.jsx("button",{onClick:()=>j(R.id),className:"p-1 rounded hover:bg-zinc-700 text-zinc-400 hover:text-red-400 transition-colors",title:"Delete note",children:s.jsx(Pt,{className:"h-3.5 w-3.5"})})]})]}),s.jsx("p",{className:"mt-1 text-xs text-zinc-400 leading-relaxed",children:n7(R.content)}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx("div",{className:"flex items-center gap-1.5 flex-wrap min-w-0",children:R.tags.map(A=>s.jsx("span",{className:ne("px-1.5 py-0.5 text-[10px] rounded-full",a7(A)),children:A},A))}),s.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[s.jsx(s7,{source:R.source}),s.jsx("span",{className:"text-[10px] text-zinc-500",children:t7(R.updated_at)})]})]})]},R.id))})]})}const i7={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-[90vw]"};function La({open:e,onClose:n,children:r,size:i="lg",className:o,closeOnBackdrop:c=!0,closeOnEscape:d=!0}){const f=S.useRef(null);if(S.useEffect(()=>{if(!e||!d)return;const h=b=>{b.key==="Escape"&&n()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,d,n]),S.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),!e)return null;const m=h=>{c&&h.target===h.currentTarget&&n()};return Bm.createPortal(s.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:m,children:s.jsx("div",{ref:f,className:ne("w-full rounded-2xl border border-zinc-800 bg-zinc-900 shadow-2xl animate-in zoom-in-95 duration-150",i7[i],o),role:"dialog","aria-modal":"true",children:r})}),document.body)}function Ba({title:e,subtitle:n,icon:r,iconClassName:i,onClose:o,className:c,children:d}){return s.jsxs("div",{className:ne("flex items-center justify-between border-b border-zinc-800 px-6 py-4",c),children:[s.jsxs("div",{className:"flex items-center gap-3",children:[r&&s.jsx("div",{className:ne("flex h-10 w-10 items-center justify-center rounded-xl bg-cachi-600/20",i),children:r}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-bold text-zinc-100",children:e}),n&&s.jsx("p",{className:"text-sm text-zinc-500",children:n})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[d,o&&s.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:s.jsx(bn,{className:"h-5 w-5"})})]})]})}function Ua({children:e,className:n,scrollable:r=!1,maxHeight:i="max-h-[60vh]"}){return s.jsx("div",{className:ne("p-6",r&&`overflow-y-auto ${i}`,n),children:e})}function Ji({children:e,className:n,leftContent:r}){return s.jsxs("div",{className:ne("flex items-center justify-between border-t border-zinc-800 px-6 py-4",n),children:[s.jsx("div",{children:r}),s.jsx("div",{className:"flex items-center gap-2",children:e})]})}const l7={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 Kt({onClick:e,disabled:n,children:r,variant:i="secondary",className:o,type:c="button"}){return s.jsx("button",{type:c,onClick:e,disabled:n,className:ne(l7[i],o),children:r})}function bj({steps:e,currentStep:n,completedSteps:r=[],onStepClick:i,variant:o="horizontal",className:c}){const d=e.findIndex(f=>f.id===n);return o==="compact"?s.jsx("div",{className:ne("flex items-center gap-1.5",c),children:e.map((f,m)=>{const h=r.includes(f.id),b=f.id===n,g=m<d;return s.jsx("button",{onClick:()=>i==null?void 0:i(f.id),disabled:!i||!h&&!g&&!b,className:ne("h-2 rounded-full transition-all",b?"w-8 bg-cachi-500":h||g?"w-2 bg-cachi-600":"w-2 bg-zinc-700",i&&(h||g||b)?"cursor-pointer hover:opacity-80":"cursor-default"),title:f.label},f.id)})}):o==="vertical"?s.jsx("nav",{className:ne("space-y-2",c),children:e.map((f,m)=>{const h=r.includes(f.id),b=f.id===n,g=m<d;return s.jsxs("button",{onClick:()=>i==null?void 0:i(f.id),disabled:!i||!h&&!g&&!b,className:ne("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left transition-colors",b?"bg-cachi-600/20 text-cachi-400":h||g?"text-zinc-400 hover:bg-zinc-800/50":"text-zinc-600",i&&(h||g||b)?"cursor-pointer":"cursor-default"),children:[s.jsx("div",{className:ne("flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium",b?"bg-cachi-600 text-white":h?"bg-cachi-600/30 text-cachi-400":"bg-zinc-800 text-zinc-500"),children:h?s.jsx(ln,{className:"h-3.5 w-3.5"}):m+1}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium",children:f.label}),f.description&&s.jsx("div",{className:"text-xs text-zinc-500",children:f.description})]})]},f.id)})}):s.jsx("nav",{className:ne("flex items-center justify-center gap-2",c),children:e.map((f,m)=>{const h=r.includes(f.id),b=f.id===n,g=m<d;return s.jsxs("div",{className:"flex items-center",children:[s.jsxs("button",{onClick:()=>i==null?void 0:i(f.id),disabled:!i||!h&&!g&&!b,className:ne("flex items-center gap-2 rounded-lg px-3 py-1.5 text-sm transition-colors",b?"bg-cachi-600/20 text-cachi-400":h||g?"text-zinc-400 hover:text-zinc-300":"text-zinc-600",i&&(h||g||b)?"cursor-pointer":"cursor-default"),children:[s.jsx("div",{className:ne("flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-medium",b?"bg-cachi-600 text-white":h?"bg-cachi-600/30 text-cachi-400":"bg-zinc-800 text-zinc-500"),children:h?s.jsx(ln,{className:"h-3 w-3"}):m+1}),s.jsx("span",{className:"hidden sm:inline",children:f.label})]}),m<e.length-1&&s.jsx("div",{className:ne("mx-1 h-px w-4",g?"bg-cachi-600/50":"bg-zinc-700")})]},f.id)})})}function o7({botId:e,noteId:n,open:r,onClose:i}){const{notes:o,allTags:c,createNote:d,updateNote:f,loadTags:m,loadNotes:h}=or(),[b,g]=S.useState(""),[v,y]=S.useState(""),[k,C]=S.useState([]),[z,j]=S.useState(""),[E,N]=S.useState(!1),M=S.useRef(null),R=n!==null,A=S.useMemo(()=>c[e]||[],[c,e]),F=S.useMemo(()=>o[e]||[],[o,e]),ee=A.filter(_=>!k.includes(_));S.useEffect(()=>{if(r){if(R){const _=F.find(q=>q.id===n);_&&(g(_.title),y(_.content),C([..._.tags]))}else g(""),y(""),C([]);j(""),N(!1),m(e)}},[r,n,R,e,F,m]);const Z=S.useCallback(_=>{const q=_.trim().toLowerCase();q&&!k.includes(q)&&C(B=>[...B,q]),j("")},[k]),L=S.useCallback(_=>{C(q=>q.filter(B=>B!==_))},[]),P=S.useCallback(_=>{_.key==="Enter"?(_.preventDefault(),z.trim()&&Z(z)):_.key==="Backspace"&&!z&&k.length>0&&L(k[k.length-1])},[z,k,Z,L]),Y=S.useCallback(async()=>{if(!(!b.trim()||!v.trim())){N(!0);try{R&&n?await f(e,n,{title:b.trim(),content:v.trim(),tags:k}):await d(e,{title:b.trim(),content:v.trim(),tags:k}),await Promise.all([h(e),m(e)]),i()}catch{}finally{N(!1)}}},[e,n,R,b,v,k,d,f,h,m,i]),me=b.trim().length>0&&v.trim().length>0&&!E;return s.jsxs(La,{open:r,onClose:i,size:"lg",children:[s.jsx(Ba,{title:R?"Edit Note":"New Note",onClose:i}),s.jsx(Ua,{scrollable:!0,maxHeight:"max-h-[70vh]",children:s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"Title"}),s.jsx("input",{type:"text",value:b,onChange:_=>g(_.target.value),placeholder:"Note title...",autoFocus:!0,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 placeholder-zinc-500 outline-none focus:border-cachi-500 transition-colors"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-sm font-medium text-zinc-300",children:"Content"}),s.jsx("textarea",{value:v,onChange:_=>y(_.target.value),placeholder:"Write your note content...",rows:8,className:"w-full rounded-lg border border-zinc-700 bg-zinc-800 px-3 py-2 text-sm text-zinc-100 placeholder-zinc-500 outline-none focus:border-cachi-500 transition-colors resize-y leading-relaxed"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"text-sm font-medium text-zinc-300 flex items-center gap-1.5",children:[s.jsx(Nv,{className:"h-3.5 w-3.5"}),"Tags"]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 rounded-lg border border-zinc-700 bg-zinc-800 px-2 py-2 focus-within:border-cachi-500 transition-colors cursor-text",onClick:()=>{var _;return(_=M.current)==null?void 0:_.focus()},children:[k.map(_=>s.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-cachi-600/20 px-2 py-0.5 text-xs text-cachi-400",children:[_,s.jsx("button",{type:"button",onClick:q=>{q.stopPropagation(),L(_)},className:"rounded-sm p-0.5 hover:bg-cachi-600/30 hover:text-cachi-300 transition-colors",children:s.jsx(bn,{className:"h-3 w-3"})})]},_)),s.jsx("input",{ref:M,type:"text",value:z,onChange:_=>j(_.target.value),onKeyDown:P,placeholder:k.length===0?"Type a tag and press Enter...":"Add tag...",className:"flex-1 min-w-[120px] bg-transparent text-sm text-zinc-100 placeholder-zinc-500 outline-none"})]}),ee.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx("span",{className:"text-xs text-zinc-500",children:"Suggestions:"}),ee.map(_=>s.jsxs("button",{type:"button",onClick:()=>Z(_),className:"inline-flex items-center gap-1 rounded-md border border-zinc-700 bg-zinc-900 px-2 py-0.5 text-xs text-zinc-400 hover:border-cachi-500/50 hover:text-cachi-400 transition-colors",children:[s.jsx(Dn,{className:"h-3 w-3"}),_]},_))]})]})]})}),s.jsxs(Ji,{children:[s.jsx(Kt,{variant:"ghost",onClick:i,children:"Cancel"}),s.jsx(Kt,{variant:"primary",onClick:Y,disabled:!me,children:E?"Saving...":R?"Save Changes":"Create Note"})]})]})}function uu(){return s.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 p-4 animate-pulse",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx("div",{className:"h-5 w-5 rounded bg-zinc-700"}),s.jsx("div",{className:"h-3 w-16 rounded bg-zinc-700"})]}),s.jsx("div",{className:"h-6 w-10 rounded bg-zinc-700"})]})}function du({icon:e,label:n,value:r,subtitle:i}){return s.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[s.jsx(e,{className:"h-5 w-5 text-zinc-400"}),s.jsx("span",{className:"text-xs font-medium text-zinc-400 uppercase tracking-wide",children:n})]}),s.jsx("div",{className:"text-2xl font-semibold text-zinc-100",children:r}),i&&s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:i})]})}function c7(e){const n=[];return e.documents_ready>0&&n.push(`${e.documents_ready} ready`),e.documents_processing>0&&n.push(`${e.documents_processing} processing`),e.documents_failed>0&&n.push(`${e.documents_failed} failed`),n.join(", ")}function u7({botId:e}){const{stats:n,loadingStats:r,loadStats:i}=or(),o=n[e],c=r[e];if(S.useEffect(()=>{i(e)},[e,i]),c&&!o)return s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[s.jsx(uu,{}),s.jsx(uu,{}),s.jsx(uu,{}),s.jsx(uu,{})]});if(!o)return null;const d=c7(o);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h3",{className:"text-sm font-medium text-zinc-300",children:"Knowledge Base"}),s.jsx("button",{onClick:()=>i(e),disabled:c,className:"p-1 rounded hover:bg-zinc-700 text-zinc-500 hover:text-zinc-300 transition-colors disabled:opacity-50",title:"Refresh stats",children:s.jsx(gn,{className:`h-3.5 w-3.5 ${c?"animate-spin":""}`})})]}),s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[s.jsx(du,{icon:bs,label:"Documents",value:o.total_documents,subtitle:d||void 0}),s.jsx(du,{icon:yv,label:"Chunks",value:o.total_chunks}),s.jsx(du,{icon:Zm,label:"Notes",value:o.total_notes}),s.jsx(du,{icon:J1,label:"Instructions",value:o.has_instructions?s.jsx("span",{className:"inline-flex items-center rounded-full bg-cachi-500/15 px-2.5 py-0.5 text-sm font-medium text-cachi-500",children:"Active"}):s.jsx("span",{className:"inline-flex items-center rounded-full bg-zinc-700/50 px-2.5 py-0.5 text-sm font-medium text-zinc-500",children:"Not set"})})]})]})}function d7({type:e}){return e==="document"?s.jsx(bs,{className:"h-4 w-4 text-blue-400 flex-shrink-0"}):s.jsx(Zm,{className:"h-4 w-4 text-amber-400 flex-shrink-0"})}function f7(e,n){return e.length<=n?e:e.slice(0,n).trimEnd()+"..."}function h7({botId:e}){const[n,r]=S.useState(""),i=S.useRef(void 0),o=S.useRef(null),{searchKnowledge:c,clearSearchResults:d,searchResults:f,loadingSearch:m}=or();S.useEffect(()=>{if(!n.trim()){d();return}return i.current=setTimeout(()=>{c(e,n)},300),()=>clearTimeout(i.current)},[n,e,c,d]),S.useEffect(()=>()=>{d(),clearTimeout(i.current)},[d]);const h=()=>{var g;r(""),d(),(g=o.current)==null||g.focus()},b=n.trim().length>0;return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),s.jsx("input",{ref:o,type:"text",value:n,onChange:g=>r(g.target.value),placeholder:"Search knowledge base...",className:`w-full pl-9 pr-9 py-2 bg-zinc-800 border border-zinc-700 rounded-lg
            text-sm text-zinc-200 placeholder:text-zinc-500
            focus:outline-none focus:ring-1 focus:ring-cachi-500 focus:border-cachi-500
            transition-colors`}),b&&s.jsx("button",{onClick:h,className:`absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded
              text-zinc-500 hover:text-zinc-300 hover:bg-zinc-700 transition-colors`,title:"Clear search",children:s.jsx(bn,{className:"h-4 w-4"})})]}),b&&s.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 overflow-hidden",children:[m&&s.jsxs("div",{className:"flex items-center justify-center gap-2 py-6",children:[s.jsx(gn,{className:"h-4 w-4 animate-spin text-cachi-500"}),s.jsx("span",{className:"text-sm text-zinc-400",children:"Searching..."})]}),!m&&f.length===0&&s.jsxs("div",{className:"text-center py-6",children:[s.jsx(On,{className:"h-6 w-6 mx-auto mb-2 text-zinc-600"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"No results found"})]}),!m&&f.length>0&&s.jsx("ul",{className:"divide-y divide-zinc-700/50",children:f.map(g=>s.jsx("li",{className:"px-4 py-3 hover:bg-zinc-700/30 transition-colors",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"mt-0.5",children:s.jsx(d7,{type:g.type})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("span",{className:"text-sm font-medium text-zinc-200 truncate",children:g.title}),g.score!==null&&s.jsx("span",{className:`flex-shrink-0 text-xs px-1.5 py-0.5 rounded
                              bg-cachi-500/15 text-cachi-400 font-mono`,children:g.score.toFixed(2)})]}),s.jsx("p",{className:"text-xs text-zinc-400 leading-relaxed",children:f7(g.content,200)}),g.source&&s.jsx("span",{className:"inline-block mt-1.5 text-xs text-zinc-500",children:g.source})]})]})},`${g.type}-${g.id}`))})]})]})}function m7({botId:e,documentId:n,filename:r,open:i,onClose:o}){const{documentChunks:c,loadingChunks:d,loadDocumentChunks:f}=or(),m=c[n]??[],h=d[n]??!1;return S.useEffect(()=>{i&&e&&n&&f(e,n)},[i,e,n,f]),s.jsxs(La,{open:i,onClose:o,size:"xl",children:[s.jsx(Ba,{title:`Chunks: ${r}`,onClose:o}),s.jsx(Ua,{className:"max-h-[60vh] overflow-y-auto",children:h?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-zinc-400",children:[s.jsx(gn,{className:"h-6 w-6 animate-spin"}),s.jsx("p",{className:"mt-3 text-sm",children:"Loading chunks..."})]}):m.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-zinc-500",children:[s.jsx(bs,{className:"h-8 w-8"}),s.jsx("p",{className:"mt-3 text-sm",children:"No chunks found for this document."})]}):s.jsx("div",{className:"space-y-3",children:m.map(b=>s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-4",children:[s.jsx("div",{className:"mb-2 flex items-center gap-2",children:s.jsxs("span",{className:"inline-flex items-center rounded-md bg-cachi-600/20 px-2 py-0.5 text-xs font-medium text-cachi-400",children:["#",b.chunk_index]})}),s.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-zinc-300",children:b.content})]},b.id))})})]})}const rl="/api/bots";function yj(){const{accessToken:e}=yn.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function il(e,n={},r=!0){const i=await fetch(e,{headers:{"Content-Type":"application/json",...yj(),...n.headers},...n});if(i.status===401&&r&&await Ia())return il(e,n,!1);if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.detail||`Request failed: ${i.statusText}`)}return i.json()}async function vj(e,n={},r=!0){const i=await fetch(e,{headers:{...yj(),...n.headers},...n});if(i.status===401&&r&&await Ia())return vj(e,n,!1);if(!i.ok){const o=await i.json().catch(()=>({}));throw new Error(o.detail||`Request failed: ${i.statusText}`)}}async function p7(e){return il(`${rl}/${e}/connections`)}async function x7(e,n){return il(`${rl}/${e}/connections`,{method:"POST",body:JSON.stringify(n)})}async function g7(e,n,r){return il(`${rl}/${e}/connections/${n}`,{method:"PATCH",body:JSON.stringify(r)})}async function b7(e,n){return vj(`${rl}/${e}/connections/${n}`,{method:"DELETE"})}async function y7(e,n){return il(`${rl}/${e}/connections/${n}/connect`,{method:"POST"})}async function v7(e,n){return il(`${rl}/${e}/connections/${n}/disconnect`,{method:"POST"})}const Di={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 j7({botId:e}){const[n,r]=S.useState([]),[i,o]=S.useState(!0),[c,d]=S.useState(null),[f,m]=S.useState(null),[h,b]=S.useState(!1),[g,v]=S.useState([]),[y,k]=S.useState(!1),[C,z]=S.useState(null),[j,E]=S.useState(!1),[N,M]=S.useState(null),[R,A]=S.useState("telegram"),[F,ee]=S.useState(""),[Z,L]=S.useState(""),[P,Y]=S.useState(!1);S.useEffect(()=>{(async()=>{o(!0);try{const de=await p7(e);r(de)}catch(de){d(de instanceof Error?de.message:"Failed to load connections")}finally{o(!1)}})()},[e]);const me=async()=>{if(!(!F.trim()||!Z.trim())){d(null);try{const W=await x7(e,{platform:R,name:F.trim(),config:{token:Z.trim(),strip_markdown:P?"true":"false"}});r(de=>[W,...de]),O()}catch(W){d(W instanceof Error?W.message:"Failed to create connection")}}},_=async W=>{if(F.trim()){d(null);try{const de={name:F.trim()},ke={strip_markdown:P?"true":"false"};Z.trim()&&(ke.token=Z.trim()),de.config=ke;const rt=await g7(e,W,de);r(yt=>yt.map(vn=>vn.id===W?rt:vn)),O()}catch(de){d(de instanceof Error?de.message:"Failed to update connection")}}},q=async W=>{d(null);try{await b7(e,W),r(de=>de.filter(ke=>ke.id!==W))}catch(de){d(de instanceof Error?de.message:"Failed to delete connection")}},B=async W=>{d(null),m(W);try{const de=Ot.getState().bots.find(rt=>rt.id===e);de&&de.systemPrompt&&await r0({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 ke=await y7(e,W);r(rt=>rt.map(yt=>yt.id===W?ke:yt))}catch(de){d(de instanceof Error?de.message:"Failed to connect")}finally{m(null)}},V=async W=>{d(null),m(W);try{const de=await v7(e,W);r(ke=>ke.map(rt=>rt.id===W?de:rt))}catch(de){d(de instanceof Error?de.message:"Failed to disconnect")}finally{m(null)}},oe=W=>{M(W.id),A(W.platform),ee(W.name),L(""),Y(W.strip_markdown??!1),E(!1)},ue=()=>{E(!0),M(null),A("telegram"),ee(""),L(""),Y(!1)},O=()=>{E(!1),M(null),ee(""),L(""),Y(!1)},U=W=>{switch(W){case"connected":return"text-green-400";case"connecting":return"text-yellow-400";case"error":return"text-red-400";default:return"text-zinc-500"}},Q=W=>{switch(W){case"connected":return"Connected";case"connecting":return"Connecting...";case"error":return"Error";default:return"Disconnected"}},D=async()=>{k(!0);try{const de=(await Gv(e)).filter(ke=>ke.archived&&ke.platform);v(de)}catch(W){console.error("Failed to load archived chats:",W)}finally{k(!1)}},G=()=>{const W=!h;b(W),W&&D()},be=async W=>{z(W);try{await i0(e,W),v(de=>de.filter(ke=>ke.id!==W)),mn.getState().syncPlatformChats(e)}catch(de){d(de instanceof Error?de.message:"Failed to unarchive chat")}finally{z(null)}},ye=async W=>{if(confirm("Permanently delete this chat and all its messages? This cannot be undone.")){z(W);try{await Fv(e,W),v(de=>de.filter(ke=>ke.id!==W))}catch(de){d(de instanceof Error?de.message:"Failed to delete chat")}finally{z(null)}}};return i?s.jsx("div",{className:"text-sm text-zinc-500",children:"Loading connections..."}):s.jsxs("div",{className:"space-y-4",children:[c&&s.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:c}),s.jsx("div",{className:"space-y-2",children:n.map(W=>s.jsx("div",{className:"rounded-lg border border-zinc-800 p-3",children:N===W.id?s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs text-zinc-500",children:"Name"}),s.jsx("input",{type:"text",value:F,onChange:de=>ee(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})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"block text-xs text-zinc-500",children:[Di[W.platform].tokenLabel," (leave blank to keep current)"]}),s.jsx("input",{type:"password",value:Z,onChange:de=>L(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"})]}),s.jsxs("label",{className:"flex cursor-pointer items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:P,onChange:de=>Y(de.target.checked),className:"h-4 w-4 rounded border-zinc-600 bg-zinc-800 text-cachi-500 focus:ring-cachi-500"}),s.jsxs("span",{className:"text-xs text-zinc-400",children:["Strip markdown formatting (send plain text to ",Di[W.platform].name,")"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:()=>_(W.id),className:"rounded bg-cachi-600 px-2 py-1 text-xs text-white hover:bg-cachi-500",children:s.jsx(ln,{className:"h-3 w-3"})}),s.jsx("button",{onClick:O,className:"rounded bg-zinc-700 px-2 py-1 text-xs text-zinc-300 hover:bg-zinc-600",children:s.jsx(bn,{className:"h-3 w-3"})})]})]}):s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-zinc-800",children:s.jsx(Ur,{className:"h-5 w-5 text-zinc-400"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-zinc-200",children:W.name}),s.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 text-xs text-zinc-400",children:Di[W.platform].name})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{className:U(W.status),children:Q(W.status)}),W.strip_markdown&&s.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-zinc-400",children:"Plain text"}),W.message_count>0&&s.jsxs("span",{className:"text-zinc-500",children:[W.message_count," messages"]})]}),W.error&&s.jsx("div",{className:"mt-1 text-xs text-red-400",children:W.error})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[f===W.id?s.jsx("div",{className:"p-2",children:s.jsx(Ge,{className:"h-4 w-4 animate-spin text-zinc-400"})}):W.status==="connected"?s.jsx("button",{onClick:()=>V(W.id),className:"rounded p-2 text-green-400 hover:bg-zinc-800 hover:text-red-400",title:"Disconnect",children:s.jsx(i4,{className:"h-4 w-4"})}):s.jsx("button",{onClick:()=>B(W.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-green-400",title:"Connect",children:s.jsx(r4,{className:"h-4 w-4"})}),s.jsx("button",{onClick:()=>oe(W),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-zinc-300",title:"Edit",children:s.jsx(Qm,{className:"h-4 w-4"})}),s.jsx("button",{onClick:()=>q(W.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-800 hover:text-red-400",title:"Delete",children:s.jsx(Pt,{className:"h-4 w-4"})})]})]})},W.id))}),j?s.jsxs("div",{className:"space-y-3 rounded-lg border border-zinc-700 bg-zinc-800/50 p-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs text-zinc-500",children:"Platform"}),s.jsx("select",{value:R,onChange:W=>A(W.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(Di).map(([W,de])=>s.jsxs("option",{value:W,children:[de.name," - ",de.description]},W))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs text-zinc-500",children:"Name"}),s.jsx("input",{type:"text",value:F,onChange:W=>ee(W.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"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs text-zinc-500",children:Di[R].tokenLabel}),s.jsx("input",{type:"password",value:Z,onChange:W=>L(W.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"})]}),s.jsxs("label",{className:"flex cursor-pointer items-center gap-2",children:[s.jsx("input",{type:"checkbox",checked:P,onChange:W=>Y(W.target.checked),className:"h-4 w-4 rounded border-zinc-600 bg-zinc-800 text-cachi-500 focus:ring-cachi-500"}),s.jsxs("span",{className:"text-xs text-zinc-400",children:["Strip markdown formatting (send plain text to ",Di[R].name,")"]})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("button",{onClick:me,disabled:!F.trim()||!Z.trim(),className:"rounded bg-cachi-600 px-3 py-1 text-xs text-white hover:bg-cachi-500 disabled:opacity-50",children:"Add Connection"}),s.jsx("button",{onClick:O,className:"rounded bg-zinc-700 px-3 py-1 text-xs text-zinc-300 hover:bg-zinc-600",children:"Cancel"})]})]}):s.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:[s.jsx(Dn,{className:"h-4 w-4"}),"Add Connection"]}),n.length===0&&!j&&s.jsx("p",{className:"text-center text-sm text-zinc-500",children:"No connections yet. Connect your bot to Telegram or Discord."}),n.length>0&&s.jsxs("div",{className:"mt-6 border-t border-zinc-800 pt-4",children:[s.jsxs("button",{onClick:G,className:"flex w-full items-center gap-2 text-sm text-zinc-400 hover:text-zinc-300",children:[h?s.jsx(el,{className:"h-4 w-4"}):s.jsx(Uu,{className:"h-4 w-4"}),s.jsx(sm,{className:"h-4 w-4"}),s.jsx("span",{children:"Archived Chats"}),g.length>0&&s.jsx("span",{className:"rounded-full bg-zinc-700 px-2 py-0.5 text-xs",children:g.length})]}),h&&s.jsx("div",{className:"mt-3 space-y-2",children:y?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-zinc-500",children:[s.jsx(Ge,{className:"h-4 w-4 animate-spin"}),"Loading archived chats..."]}):g.length===0?s.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.`}):s.jsxs(s.Fragment,{children:[s.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."}),g.map(W=>s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 bg-zinc-800/30 p-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-zinc-700",children:s.jsx(Ur,{className:"h-4 w-4 text-zinc-400"})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-zinc-300",children:W.title}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-zinc-500",children:[s.jsx("span",{className:"capitalize",children:W.platform}),s.jsx("span",{children:"·"}),s.jsx("span",{children:"Archived"})]})]})]}),s.jsx("div",{className:"flex items-center gap-1",children:C===W.id?s.jsx("div",{className:"p-2",children:s.jsx(Ge,{className:"h-4 w-4 animate-spin text-zinc-400"})}):s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>be(W.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-700 hover:text-green-400",title:"Unarchive (restore chat)",children:s.jsx(T5,{className:"h-4 w-4"})}),s.jsx("button",{onClick:()=>ye(W.id),className:"rounded p-2 text-zinc-500 hover:bg-zinc-700 hover:text-red-400",title:"Delete permanently",children:s.jsx(Pt,{className:"h-4 w-4"})})]})})]},W.id))]})})]})]})}const w7="/api";class z7 extends Error{constructor(n,r,i){super(n),this.status=r,this.data=i,this.name="ApiError"}}function N7(){const{accessToken:e}=yn.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function cr(e,n={},r=!0){const i=`${w7}${e}`,o=await fetch(i,{headers:{"Content-Type":"application/json",...N7(),...n.headers},...n});if(o.status===401&&r&&await Ia())return cr(e,n,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new z7(c.detail||`Request failed: ${o.statusText}`,o.status,c)}if(o.status!==204)return o.json()}async function k7(){return cr("/skills")}async function S7(e){return cr(`/skills/${e}`,{method:"DELETE"})}async function C7(e){return cr("/skills/install",{method:"POST",body:JSON.stringify({url:e})})}async function E7(){return cr("/skills/refresh",{method:"POST"})}async function T7(e){return cr(`/bots/${e}/skills/ids`)}async function A7(e,n){return cr(`/bots/${e}/skills`,{method:"POST",body:JSON.stringify({skillId:n})})}async function M7(e,n){return cr(`/bots/${e}/skills/${n}`,{method:"DELETE"})}const D7=["#22c55e","#3b82f6","#8b5cf6","#ec4899","#f59e0b","#ef4444","#06b6d4","#84cc16"];function O7(){const e=Rn(),{getActiveBot:n,updateBot:r,deleteBot:i}=Ot(),{settingsSection:o}=Rt(),[c,d]=S.useState(!1),[f,m]=S.useState(!1),h=n(),[b,g]=S.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(S.useEffect(()=>{h&&g({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=()=>{r(h.id,b),m(!0),setTimeout(()=>m(!1),2e3)},y=()=>{const C=h.id;d(!1),e("/dashboard"),i(C)},k={general:"General",knowledge:"Knowledge",skills:"Skills",connections:"Connections",advanced:"Advanced",danger:"Danger Zone"};return s.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 px-6 py-3",children:[s.jsx("h1",{className:"text-lg font-semibold text-zinc-100",children:k[o]}),o!=="danger"&&s.jsxs("button",{onClick:v,className:ne("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:[s.jsx(Do,{className:"h-4 w-4"}),f?"Saved!":"Save"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:s.jsxs("div",{className:"mx-auto max-w-2xl",children:[o==="general"&&s.jsx(R7,{form:b,setForm:g,onReset:()=>{g({name:Ar.name,description:Ar.description,icon:Ar.icon,color:Ar.color,model:Ar.model,systemPrompt:Ar.systemPrompt})}}),o==="knowledge"&&s.jsx(_7,{botId:h.id}),o==="skills"&&s.jsx(L7,{botId:h.id}),o==="connections"&&s.jsx(H7,{botId:h.id}),o==="advanced"&&s.jsx(q7,{}),o==="danger"&&s.jsx(I7,{botId:h.id,botName:h.name,isDefault:h.id==="default",onDelete:()=>d(!0)})]})}),c&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.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:[s.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[s.jsx(Hr,{className:"h-6 w-6"}),s.jsx("h2",{className:"text-lg font-bold",children:"Delete Bot"})]}),s.jsxs("p",{className:"mb-6 text-zinc-400",children:["Are you sure you want to delete ",s.jsx("strong",{className:"text-zinc-200",children:h.name}),"? This action cannot be undone."]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>d(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),s.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 R7({form:e,setForm:n,onReset:r}){const[i,o]=S.useState(!1);return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex justify-end",children:s.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:[s.jsx(vo,{className:"h-3 w-3"}),"Reset to Default"]})}),i&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.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:[s.jsxs("div",{className:"mb-4 flex items-center gap-3 text-amber-400",children:[s.jsx(vo,{className:"h-6 w-6"}),s.jsx("h2",{className:"text-lg font-bold",children:"Reset General Settings"})]}),s.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.",s.jsx("br",{}),s.jsx("br",{}),s.jsx("strong",{className:"text-zinc-200",children:"Connections will not be affected."})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>o(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),s.jsx("button",{onClick:()=>{r(),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"})]})]})}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Name"}),s.jsx("input",{type:"text",value:e.name,onChange:c=>n({...e,name:c.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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),s.jsx("textarea",{value:e.description,onChange:c=>n({...e,description:c.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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Model"}),s.jsx(qo,{value:e.model||"",onChange:c=>n({...e,model:c}),placeholder:"Use system default",className:"w-full"}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Leave empty to use the system default model"})]})]}),s.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[s.jsxs("h3",{className:"mb-4 flex items-center gap-2 text-sm font-medium text-zinc-200",children:[s.jsx(Mo,{className:"h-4 w-4 text-zinc-400"}),"Appearance"]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-xs text-zinc-500",children:"Icon"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:t2.map(c=>s.jsx("button",{onClick:()=>n({...e,icon:c.id}),title:c.label,className:ne("flex h-10 w-10 items-center justify-center rounded-lg border transition-all",e.icon===c.id?"border-cachi-500 bg-cachi-500/20":"border-zinc-700 bg-zinc-800 hover:border-zinc-600"),children:s.jsx(ca,{icon:c.id,size:20})},c.id))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-xs text-zinc-500",children:"Color"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:D7.map(c=>s.jsx("button",{onClick:()=>n({...e,color:c}),className:ne("h-8 w-8 rounded-lg border-2 transition-all",e.color===c?"border-white scale-110":"border-transparent hover:scale-105"),style:{backgroundColor:c}},c))})]})]})]}),s.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[s.jsxs("h3",{className:"mb-4 flex items-center gap-2 text-sm font-medium text-zinc-200",children:[s.jsx(Li,{className:"h-4 w-4 text-zinc-400"}),"System Prompt"]}),s.jsx("textarea",{value:e.systemPrompt,onChange:c=>n({...e,systemPrompt:c.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 _7({botId:e}){const[n,r]=S.useState(null),[i,o]=S.useState(!1),[c,d]=S.useState(null),f=b=>{r(b),o(!0)},m=()=>{r(null),o(!0)},h=()=>{o(!1),r(null)};return s.jsxs("div",{className:"space-y-6",children:[s.jsx(u7,{botId:e}),s.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[s.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-200",children:"Notes & Memory"}),s.jsx("p",{className:"mb-4 text-xs text-zinc-500",children:"Save notes for your bot to remember. The bot can also create notes during conversations."}),s.jsx(r7,{botId:e,onEditNote:f,onNewNote:m})]}),s.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[s.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-200",children:"Search Knowledge"}),s.jsx("p",{className:"mb-4 text-xs text-zinc-500",children:"Test search across documents and notes."}),s.jsx(h7,{botId:e})]}),s.jsxs("div",{className:"border-t border-zinc-800 pt-6",children:[s.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-200",children:"Documents"}),s.jsx("p",{className:"mb-4 text-xs text-zinc-500",children:"Upload documents to give your bot specialized knowledge."}),s.jsx(XM,{botId:e}),s.jsx("div",{className:"mt-4",children:s.jsx(WM,{botId:e,onViewChunks:(b,g)=>d({id:b,filename:g})})})]}),s.jsx("div",{className:"border-t border-zinc-800 pt-6",children:s.jsx(e7,{botId:e})}),s.jsx(o7,{botId:e,noteId:n,open:i,onClose:h}),c&&s.jsx(m7,{botId:e,documentId:c.id,filename:c.filename,open:!!c,onClose:()=>d(null)})]})}function L7({botId:e}){const[n,r]=S.useState([]),[i,o]=S.useState(new Set),[c,d]=S.useState(!0),[f,m]=S.useState(!1),[h,b]=S.useState(null),[g,v]=S.useState(""),[y,k]=S.useState(!1),C=S.useCallback(async()=>{try{b(null);const[A,F]=await Promise.all([k7(),T7(e)]);r(A),o(new Set(F))}catch(A){b(A instanceof Error?A.message:"Failed to load skills")}finally{d(!1)}},[e]);S.useEffect(()=>{C()},[C]);const z=async()=>{m(!0);try{const A=await E7();r(A),b(null)}catch(A){b(A instanceof Error?A.message:"Failed to refresh skills")}finally{m(!1)}},j=async(A,F)=>{try{F?(await A7(e,A),o(ee=>new Set([...ee,A]))):(await M7(e,A),o(ee=>{const Z=new Set(ee);return Z.delete(A),Z}))}catch(ee){b(ee instanceof Error?ee.message:"Failed to toggle skill")}},E=async A=>{if(confirm("Are you sure you want to delete this skill?"))try{await S7(A),r(F=>F.filter(ee=>ee.id!==A)),o(F=>{const ee=new Set(F);return ee.delete(A),ee})}catch(F){b(F instanceof Error?F.message:"Failed to delete skill")}},N=A=>{r(F=>[...F,A]),k(!1)},R=[...n.filter(A=>{if(!g)return!0;const F=g.toLowerCase();return A.name.toLowerCase().includes(F)||A.description.toLowerCase().includes(F)||A.tags.some(ee=>ee.toLowerCase().includes(F))})].sort((A,F)=>{const ee=i.has(A.id),Z=i.has(F.id);return ee&&!Z?-1:!ee&&Z?1:A.name.localeCompare(F.name)});return c?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("div",{className:"text-sm text-zinc-500",children:"Loading skills..."})}):s.jsxs("div",{className:"space-y-6",children:[h&&s.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:h}),s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsx("p",{className:"text-sm text-zinc-400",children:"Activate skills to give your bot specialized behaviors and capabilities."}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("button",{onClick:z,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:[s.jsx(gn,{className:ne("h-3.5 w-3.5",f&&"animate-spin")}),"Refresh"]}),s.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:[s.jsx(Ha,{className:"h-3.5 w-3.5"}),"Install"]})]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),s.jsx("input",{type:"text",value:g,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"})]}),R.length>0?s.jsx("div",{className:"space-y-3",children:R.map(A=>s.jsx(B7,{skill:A,isActive:i.has(A.id),onToggle:j,onDelete:E,showDelete:A.source==="local"||A.source==="installed"},A.id))}):g?s.jsx("div",{className:"rounded-lg border border-dashed border-zinc-700 p-8 text-center",children:s.jsx("p",{className:"text-sm text-zinc-500",children:"No skills match your search."})}):s.jsxs("div",{className:"rounded-lg border border-dashed border-zinc-700 p-8 text-center",children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-zinc-800",children:s.jsx(xn,{className:"h-6 w-6 text-zinc-500"})}),s.jsx("h3",{className:"mb-2 font-medium text-zinc-300",children:"No skills available"}),s.jsxs("p",{className:"mb-4 text-sm text-zinc-500",children:["Create SKILL.md files in ",s.jsx("code",{className:"text-zinc-400",children:"~/.claude/skills/"})," ","or install from a URL."]}),s.jsxs("div",{className:"flex justify-center gap-3",children:[s.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:[s.jsx(Ha,{className:"h-4 w-4"}),"Install Skill"]}),s.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:[s.jsx(Hu,{className:"h-4 w-4"}),"Browse skills.sh"]})]})]}),i.size>0&&s.jsxs("div",{className:"text-center text-xs text-zinc-500",children:[i.size," skill",i.size!==1?"s":""," active"]}),y&&s.jsx(U7,{onClose:()=>k(!1),onInstalled:N})]})}function B7({skill:e,isActive:n,onToggle:r,onDelete:i,showDelete:o}){return s.jsx("div",{className:ne("rounded-lg border p-4 transition-colors",n?"border-cachi-500/50 bg-cachi-500/5":"border-zinc-700 bg-zinc-800/30"),children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"font-medium text-zinc-200",children:e.name}),e.version&&s.jsxs("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-400",children:["v",e.version]}),s.jsx("span",{className:"rounded bg-zinc-700 px-1.5 py-0.5 text-xs text-zinc-500",children:e.source})]}),s.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:e.description}),e.tags.length>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:e.tags.map(c=>s.jsx("span",{className:"rounded bg-zinc-800 px-1.5 py-0.5 text-xs text-zinc-500",children:c},c))}),e.requiresTools.length>0&&s.jsxs("div",{className:"mt-2 text-xs text-zinc-500",children:["Requires: ",e.requiresTools.join(", ")]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[o&&s.jsx("button",{onClick:()=>i(e.id),className:"rounded p-1 text-zinc-500 hover:bg-zinc-700 hover:text-red-400",title:"Delete skill",children:s.jsx(bn,{className:"h-4 w-4"})}),s.jsx("button",{onClick:()=>r(e.id,!n),className:n?"text-cachi-500":"text-zinc-600",children:n?s.jsx(_o,{className:"h-8 w-8"}):s.jsx(Ro,{className:"h-8 w-8"})})]})]})})}function U7({onClose:e,onInstalled:n}){const[r,i]=S.useState(""),[o,c]=S.useState(!1),[d,f]=S.useState(null),m=async()=>{if(r.trim()){c(!0),f(null);try{const h=await C7(r.trim());n(h)}catch(h){f(h instanceof Error?h.message:"Failed to install skill")}finally{c(!1)}}};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"w-full max-w-md rounded-xl bg-zinc-900 shadow-xl",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-800 p-4",children:[s.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Install Skill"}),s.jsx("button",{onClick:e,className:"rounded-lg p-2 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200",children:s.jsx(bn,{className:"h-5 w-5"})})]}),s.jsxs("div",{className:"p-4 space-y-4",children:[d&&s.jsx("div",{className:"rounded-lg border border-red-500/50 bg-red-500/10 p-3 text-sm text-red-400",children:d}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Skill URL or skills.sh identifier"}),s.jsx("input",{type:"text",value:r,onChange:h=>i(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"}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Enter a URL to a skill markdown file or a skills.sh identifier."})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 border-t border-zinc-800 p-4",children:[s.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"}),s.jsx("button",{onClick:m,disabled:!r.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?s.jsxs(s.Fragment,{children:[s.jsx(gn,{className:"h-4 w-4 animate-spin"}),"Installing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ha,{className:"h-4 w-4"}),"Install"]})})]})]})})}function H7({botId:e}){return s.jsx("div",{className:"space-y-6",children:s.jsxs("div",{children:[s.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."}),s.jsx(j7,{botId:e})]})})}function q7(){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Temperature"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",defaultValue:"0.7",className:"flex-1"}),s.jsx("span",{className:"w-12 text-center text-sm text-zinc-400",children:"0.7"})]}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Lower = focused, higher = creative"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Max Iterations"}),s.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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Approval Mode"}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"radio",name:"approval",defaultChecked:!0,className:"text-cachi-500"}),s.jsx("span",{className:"text-sm text-zinc-300",children:"Auto-approve safe actions"})]}),s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"radio",name:"approval",className:"text-cachi-500"}),s.jsx("span",{className:"text-sm text-zinc-300",children:"Approve all actions"})]})]})]})]})}function I7({botId:e,botName:n,isDefault:r,onDelete:i}){const[o,c]=S.useState(!1),[d,f]=S.useState(null),m=async()=>{c(!0),f(null);try{const{exportBot:h}=await km(async()=>{const{exportBot:k}=await Promise.resolve().then(()=>cm);return{exportBot:k}},[]),b=await h(e),g=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),v=URL.createObjectURL(g),y=document.createElement("a");y.href=v,y.download=`${n.toLowerCase().replace(/\s+/g,"-")}-export.json`,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(v)}catch(h){f(h instanceof Error?h.message:"Failed to export bot")}finally{c(!1)}};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-900/50 p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-zinc-200",children:"Export Bot"}),s.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."}),d&&s.jsx("p",{className:"mt-2 text-sm text-red-400",children:d}),s.jsxs("button",{onClick:m,disabled:o,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:[s.jsx(Ha,{className:"h-4 w-4"}),o?"Exporting...":"Export Configuration"]})]}),r?s.jsxs("div",{className:"rounded-lg border border-zinc-700 bg-zinc-900/50 p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-zinc-400",children:"Delete this bot"}),s.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:"The default bot cannot be deleted."})]}):s.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-6",children:[s.jsx("h3",{className:"text-lg font-semibold text-red-400",children:"Delete this bot"}),s.jsxs("p",{className:"mt-2 text-sm text-zinc-400",children:["Once you delete ",s.jsx("strong",{className:"text-zinc-200",children:n}),", there is no going back. All chats, jobs, and tasks will be permanently deleted."]}),s.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:[s.jsx(Pt,{className:"h-4 w-4"}),"Delete Bot"]})]})]})}function P7(){var k,C;const[e,n]=S.useState("7d"),{bots:r}=Ot(),{chats:i,messages:o}=mn(),{jobs:c}=um(),{tasks:d}=Qi(),{stats:f}=Mu(),m=Object.values(o).reduce((z,j)=>z+j.length,0),h=c.filter(z=>z.status==="running").length,b=d.filter(z=>z.status==="done").length,g=d.filter(z=>z.status==="todo").length,v=i.length,y=r.map(z=>{const j=i.filter(A=>A.botId===z.id),E=j.reduce((A,F)=>{var ee;return A+(((ee=o[F.id])==null?void 0:ee.length)||0)},0),N=c.filter(A=>A.botId===z.id),M=d.filter(A=>A.botId===z.id),R=f.byBot[z.id]||{tokens:0,cost:0};return{bot:z,chats:j.length,messages:E,jobs:N.length,activeJobs:N.filter(A=>A.status==="running").length,tasks:M.length,completedTasks:M.filter(A=>A.status==="done").length,connections:j.length,tokens:R.tokens,cost:R.cost}});return s.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-zinc-200 dark:border-zinc-800 px-6 py-4",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-zinc-900 dark:text-zinc-100",children:"Dashboard"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"Overview of your bots and activity"})]}),s.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(z=>s.jsx("button",{onClick:()=>n(z),className:ne("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",e===z?"bg-cachi-600 text-white":"text-zinc-400 hover:text-zinc-200"),children:z==="all"?"All Time":z},z))})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:s.jsxs("div",{className:"mx-auto max-w-6xl space-y-6",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(Tr,{icon:ya,label:"Active Bots",value:r.length,trend:"+0",trendUp:!0,color:"green"}),s.jsx(Tr,{icon:ir,label:"Total Messages",value:m.toLocaleString(),subValue:`${i.length} chats`,color:"blue"}),s.jsx(Tr,{icon:Pr,label:"Tokens Used",value:ju(f.totalTokens),subValue:`${f.totalMessages} API calls`,color:"purple"}),s.jsx(Tr,{icon:U5,label:"Total Cost",value:`$${f.totalCost.toFixed(4)}`,subValue:"estimated",color:"amber"})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(Tr,{icon:Q1,label:"Active Jobs",value:h,subValue:`${c.length} total`,color:"blue",small:!0}),s.jsx(Tr,{icon:Wm,label:"Tasks Completed",value:b,subValue:`${g} pending`,color:"green",small:!0}),s.jsx(Tr,{icon:Xm,label:"Connections",value:v,subValue:`${r.length} bots`,color:"cyan",small:!0})]}),s.jsxs("section",{children:[s.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[s.jsx(ya,{className:"h-5 w-5 text-zinc-400"}),"Bot Performance"]}),s.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:y.map(({bot:z,chats:j,messages:E,activeJobs:N,completedTasks:M,tokens:R,cost:A,connections:F})=>s.jsx(F7,{bot:z,chats:j,messages:E,activeJobs:N,completedTasks:M,tokens:R,cost:A,connections:F},z.id))})]}),s.jsxs("section",{children:[s.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[s.jsx(ku,{className:"h-5 w-5 text-zinc-400"}),"Usage Over Time"]}),s.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?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-end gap-1",style:{height:120},children:f.daily.slice(-14).map(z=>{const j=Math.max(...f.daily.map(N=>N.tokens)),E=j>0?Math.max(z.tokens/j*120,5):5;return s.jsxs("div",{className:"group relative h-full flex-1",children:[s.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-t bg-green-600 transition-all hover:bg-green-500",style:{height:E}}),s.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:[ju(z.tokens)," tokens"]})]},z.date)})}),s.jsxs("div",{className:"flex justify-between text-xs text-zinc-600",children:[s.jsx("span",{children:(k=f.daily[Math.max(0,f.daily.length-14)])==null?void 0:k.date}),s.jsx("span",{children:(C=f.daily[f.daily.length-1])==null?void 0:C.date})]})]}):s.jsx("div",{className:"flex h-32 items-center justify-center text-zinc-500",children:s.jsxs("div",{className:"text-center",children:[s.jsx(ku,{className:"mx-auto mb-2 h-8 w-8 text-zinc-600"}),s.jsx("p",{children:"No usage data yet"}),s.jsx("p",{className:"text-xs text-zinc-600",children:"Start chatting to see analytics"})]})})})]}),Object.keys(f.byModel).length>0&&s.jsxs("section",{children:[s.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-lg font-semibold text-zinc-200",children:[s.jsx(W1,{className:"h-5 w-5 text-zinc-400"}),"Model Usage"]}),s.jsx("div",{className:"rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",children:s.jsx("div",{className:"divide-y divide-zinc-800",children:Object.entries(f.byModel).sort((z,j)=>j[1].tokens-z[1].tokens).map(([z,j])=>s.jsxs("div",{className:"flex items-center justify-between px-5 py-3",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-zinc-200",children:z}),s.jsxs("p",{className:"text-xs text-zinc-500",children:[j.messages," messages"]})]}),s.jsxs("div",{className:"text-right",children:[s.jsx("p",{className:"font-mono text-sm text-zinc-200",children:ju(j.tokens)}),s.jsxs("p",{className:"text-xs text-zinc-500",children:["$",j.cost.toFixed(4)]})]})]},z))})})]})]})})]})}function Tr({icon:e,label:n,value:r,subValue:i,trend:o,trendUp:c,color:d,small:f}){const m={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 s.jsxs("div",{className:ne("rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50",f?"p-4":"p-5"),children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsx("div",{className:ne("flex items-center justify-center rounded-lg",m[d],f?"h-9 w-9":"h-10 w-10"),children:s.jsx(e,{className:f?"h-4 w-4":"h-5 w-5"})}),o&&s.jsxs("div",{className:ne("flex items-center gap-0.5 text-xs font-medium",c?"text-green-400":"text-red-400"),children:[o,s.jsx(M5,{className:ne("h-3 w-3",!c&&"rotate-90")})]})]}),s.jsxs("div",{className:f?"mt-3":"mt-4",children:[s.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-zinc-500",children:n}),s.jsx("p",{className:ne("font-bold text-zinc-100",f?"mt-0.5 text-xl":"mt-1 text-2xl"),children:r}),i&&s.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:i})]})]})}function F7({bot:e,chats:n,messages:r,activeJobs:i,completedTasks:o,tokens:c,cost:d,connections:f}){return s.jsxs("div",{className:"rounded-xl border border-zinc-200 bg-white dark:border-zinc-800 dark:bg-zinc-900/50 p-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:s.jsx(ca,{icon:e.icon,size:22,color:e.color})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"truncate font-semibold text-zinc-100",children:e.name}),s.jsx("p",{className:"truncate text-xs text-zinc-500",children:e.model})]})]}),s.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[s.jsx(fu,{icon:ir,value:r,label:"messages"}),s.jsx(fu,{icon:Pr,value:ju(c),label:"tokens"}),s.jsx(fu,{icon:Q1,value:i,label:"active jobs"}),s.jsx(fu,{icon:Wm,value:o,label:"completed"})]}),s.jsxs("div",{className:"mt-3 flex items-center justify-between border-t border-zinc-800 pt-3",children:[s.jsxs("div",{className:"flex items-center gap-3 text-xs text-zinc-500",children:[s.jsxs("span",{children:[n," chats"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Xm,{className:"h-3 w-3"}),f]})]}),s.jsxs("div",{className:"text-xs font-medium text-zinc-400",children:["$",d.toFixed(4)]})]})]})}function fu({icon:e,value:n,label:r}){return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(e,{className:"h-3.5 w-3.5 text-zinc-600"}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-zinc-200",children:n}),s.jsx("span",{className:"ml-1 text-xs text-zinc-600",children:r})]})]})}function ju(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}const Cm=["welcome","api-key","model","preferences","complete"],Du=zt()(Ft(e=>({isOpen:!1,currentStep:0,hasCompletedOnboarding:!1,open:()=>e({isOpen:!0,currentStep:0}),close:()=>e({isOpen:!1}),nextStep:()=>e(n=>({currentStep:Math.min(n.currentStep+1,Cm.length-1)})),prevStep:()=>e(n=>({currentStep:Math.max(n.currentStep-1,0)})),completeOnboarding:()=>e({isOpen:!1,hasCompletedOnboarding:!0,currentStep:0}),skipOnboarding:()=>e({isOpen:!1,hasCompletedOnboarding:!0,currentStep:0})}),{name:"cachibot-onboarding",partialize:e=>({hasCompletedOnboarding:e.hasCompletedOnboarding})})),A0=zt(e=>({config:null,setConfig:n=>e({config:n}),updateConfig:n=>e(r=>r.config?{config:{...r.config,agent:{...r.config.agent,...n.model!==void 0&&{model:n.model},...n.maxIterations!==void 0&&{maxIterations:n.maxIterations},...n.approveActions!==void 0&&{approveActions:n.approveActions},...n.temperature!==void 0&&{temperature:n.temperature}},display:{...r.config.display,...n.showThinking!==void 0&&{showThinking:n.showThinking},...n.showCost!==void 0&&{showCost:n.showCost}}}}:r)})),$7="/api";function V7(){const{accessToken:e}=yn.getState();return e?{Authorization:`Bearer ${e}`}:{}}async function Wu(e,n={},r=!0){const i=`${$7}${e}`,o=await fetch(i,{headers:{"Content-Type":"application/json",...V7(),...n.headers},...n});if(o.status===401&&r&&await Ia())return Wu(e,n,!1);if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.detail||`Request failed: ${o.statusText}`)}return o.json()}async function Vh(){return(await Wu("/providers")).providers}async function G7(e,n){await Wu(`/providers/${e}`,{method:"PUT",body:JSON.stringify({value:n})})}async function Y7(e){await Wu(`/providers/${e}`,{method:"DELETE"})}const Io=zt(e=>({providers:[],loading:!1,error:null,refresh:async()=>{e({loading:!0,error:null});try{const n=await Vh();e({providers:n,loading:!1})}catch(n){e({error:n instanceof Error?n.message:"Failed to load providers",loading:!1})}},update:async(n,r)=>{try{await G7(n,r);const i=await Vh();e({providers:i})}catch(i){throw e({error:i instanceof Error?i.message:"Failed to update provider"}),i}},remove:async n=>{try{await Y7(n);const r=await Vh();e({providers:r})}catch(r){throw e({error:r instanceof Error?r.message:"Failed to remove provider"}),r}}})),Q7=36e5,ed=zt()(Ft((e,n)=>({checkResult:null,updateResult:null,isChecking:!1,isUpdating:!1,isRestarting:!1,showBanner:!1,showDialog:!1,lastCheckAt:0,skippedVersions:[],optIntoBeta:!1,checkForUpdate:async(r=!1)=>{const i=n();if(!(!r&&Date.now()-i.lastCheckAt<Q7)&&!i.isChecking){e({isChecking:!0});try{const o=await Kv(r),c=o.latest_stable||o.latest_prerelease,d=c?i.skippedVersions.includes(c):!1;e({checkResult:o,lastCheckAt:Date.now(),showBanner:(o.update_available||o.prerelease_available)&&!d})}catch(o){console.warn("Update check failed:",o)}finally{e({isChecking:!1})}}},performUpdate:async r=>{var o,c;const i=n();if(!i.isUpdating){e({isUpdating:!0});try{const d=await Zv({target_version:r,include_prerelease:i.optIntoBeta});e({updateResult:d})}catch(d){e({updateResult:{success:!1,old_version:((o=i.checkResult)==null?void 0:o.current_version)||"unknown",new_version:((c=i.checkResult)==null?void 0:c.current_version)||"unknown",message:d instanceof Error?d.message:"Update failed",restart_required:!1,pip_output:""}})}finally{e({isUpdating:!1})}}},skipVersion:r=>{e(i=>({skippedVersions:[...i.skippedVersions,r],showBanner:!1,showDialog:!1}))},restartServer:async()=>{e({isRestarting:!0});try{await Wv()}catch{}const r=30;for(let i=0;i<r;i++){await new Promise(o=>setTimeout(o,2e3));try{await s0(),window.location.reload();return}catch{}}e({isRestarting:!1})},dismissBanner:()=>e({showBanner:!1}),openDialog:()=>e({showDialog:!0}),closeDialog:()=>e({showDialog:!1,updateResult:null}),setOptIntoBeta:r=>e({optIntoBeta:r})}),{name:"cachibot-update",partialize:e=>({skippedVersions:e.skippedVersions,optIntoBeta:e.optIntoBeta,lastCheckAt:e.lastCheckAt})})),sn=S.forwardRef(({className:e,variant:n="primary",size:r="md",disabled:i,...o},c)=>s.jsx("button",{ref:c,disabled:i,className:ne("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":n==="primary","bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700":n==="secondary","hover:bg-zinc-100 dark:hover:bg-zinc-800":n==="ghost","bg-red-600 text-white hover:bg-red-700 active:bg-red-800":n==="danger"},{"h-8 px-3 text-sm":r==="sm","h-10 px-4 text-sm":r==="md","h-12 px-6 text-base":r==="lg"},e),...o}));sn.displayName="Button";const X7=["general","appearance","models","keys","advanced","data","users"];function J7(){const{settingsTab:e}=D1(),n=Rn(),{theme:r,setTheme:i,accentColor:o,setAccentColor:c,showThinking:d,setShowThinking:f,showCost:m,setShowCost:h,sidebarCollapsed:b,setSidebarCollapsed:g}=Rt(),{config:v}=A0(),{user:y}=yn(),k=(y==null?void 0:y.role)==="admin",[C,z]=S.useState(null);S.useEffect(()=>{s0().then(z).catch(()=>{})},[]);const E=!e||!X7.includes(e)||e==="users"&&!k?"general":e;S.useEffect(()=>{e&&E!==e&&n("/settings/general",{replace:!0})},[e,E,n]);const N=R=>{n(`/settings/${R}`)},M=[{id:"general",label:"General",icon:Oo},{id:"appearance",label:"Appearance",icon:Mo},{id:"models",label:"Models",icon:Li},{id:"keys",label:"API Keys",icon:fv},{id:"advanced",label:"Advanced",icon:Fu},{id:"data",label:"Data & Privacy",icon:Ao},...k?[{id:"users",label:"Users",icon:t0}]:[]];return s.jsxs("div",{className:"flex h-full flex-col bg-zinc-50 dark:bg-zinc-950",children:[s.jsx("div",{className:"flex items-center justify-between border-b border-zinc-300 px-6 py-4 dark:border-zinc-800",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-zinc-900 dark:text-zinc-100",children:"Settings"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"Configure CachiBot preferences"})]})}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsx("nav",{className:"w-56 border-r border-zinc-300 p-4 dark:border-zinc-800",children:s.jsx("div",{className:"space-y-1",children:M.map(R=>s.jsxs("button",{onClick:()=>N(R.id),className:ne("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",E===R.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:[s.jsx(R.icon,{className:"h-4 w-4"}),R.label]},R.id))})}),s.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:s.jsxs("div",{className:"mx-auto max-w-2xl space-y-8",children:[E==="general"&&s.jsx(K7,{showThinking:d,setShowThinking:f,showCost:m,setShowCost:h,config:v,healthInfo:C}),E==="appearance"&&s.jsx(eD,{theme:r,setTheme:i,accentColor:o,setAccentColor:c,sidebarCollapsed:b,setSidebarCollapsed:g}),E==="models"&&s.jsx(sD,{}),E==="keys"&&s.jsx(rD,{}),E==="advanced"&&s.jsx(iD,{config:v}),E==="data"&&s.jsx(lD,{}),E==="users"&&k&&s.jsx(cD,{currentUser:y})]})})]})]})}function K7({showThinking:e,setShowThinking:n,showCost:r,setShowCost:i,config:o,healthInfo:c}){return s.jsxs(s.Fragment,{children:[s.jsx(St,{icon:gs,title:"Display Options",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(ar,{label:"Show Thinking Process",description:"Display the AI's reasoning and thought process",checked:e,onChange:n}),s.jsx(ar,{label:"Show Token Costs",description:"Display estimated costs for API calls",checked:r,onChange:i})]})}),s.jsx(St,{icon:D5,title:"Notifications",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(ar,{label:"Desktop Notifications",description:"Get notified when tasks complete",checked:!1,onChange:()=>{}}),s.jsx(ar,{label:"Sound Effects",description:"Play sounds for important events",checked:!1,onChange:()=>{}})]})}),s.jsx(St,{icon:qu,title:"Workspace",children:s.jsx("div",{className:"space-y-4",children:s.jsxs(hs,{label:"Workspace Path",children:[s.jsxs("div",{className:"flex gap-2",children:[s.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"}),s.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"})]}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Directory where bots can read and write files"})]})})}),s.jsx(St,{icon:Gm,title:"About",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Version"}),s.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:(c==null?void 0:c.version)??"..."})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Build"}),s.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:(c==null?void 0:c.build)??"..."})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Python"}),s.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:(c==null?void 0:c.python)??"..."})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Platform"}),s.jsx("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:(c==null?void 0:c.platform)??"..."})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Documentation"}),s.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",s.jsx(Hu,{className:"h-3 w-3"})]})]})]})}),s.jsx(Z7,{}),s.jsx(W7,{healthInfo:c})]})}function Z7(){const{open:e}=Du(),n=()=>{e()};return s.jsx(St,{icon:gn,title:"Setup",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Run Setup Wizard"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"Re-run the initial setup to configure API keys, models, and preferences"})]}),s.jsxs("button",{onClick:n,className:"flex items-center gap-2 rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-500",children:[s.jsx(gn,{className:"h-4 w-4"}),"Run Wizard"]})]})})}function W7({healthInfo:e}){const{checkResult:n,isChecking:r,optIntoBeta:i,setOptIntoBeta:o,checkForUpdate:c,openDialog:d,lastCheckAt:f}=ed();S.useEffect(()=>{c()},[c]);const m=(n==null?void 0:n.current_version)||(e==null?void 0:e.version)||"...",h=n==null?void 0:n.latest_stable,b=n==null?void 0:n.latest_prerelease,g=(n==null?void 0:n.update_available)||(n==null?void 0:n.prerelease_available),v=k=>{if(!k)return"Never";const C=Math.floor((Date.now()-k)/1e3);if(C<60)return"Just now";const z=Math.floor(C/60);if(z<60)return`${z}m ago`;const j=Math.floor(z/60);return j<24?`${j}h ago`:`${Math.floor(j/24)}d ago`},y=e!=null&&e.build?s.jsx("span",{className:ne("ml-2 rounded-full px-2 py-0.5 text-xs font-medium",e.build==="release"?"bg-green-500/20 text-green-400":e.build==="dev"?"bg-amber-500/20 text-amber-400":"bg-zinc-500/20 text-zinc-400"),children:e.build}):null;return s.jsx(St,{icon:Ha,title:"Updates",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Current Version"}),s.jsxs("span",{className:"font-mono text-zinc-800 dark:text-zinc-200",children:[m,y]})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Latest Version"}),h?s.jsxs("span",{className:ne("font-mono",n!=null&&n.update_available?"text-accent-500":"text-green-400"),children:[h,!(n!=null&&n.update_available)&&" (up to date)"]}):s.jsx("span",{className:"text-zinc-500",children:"—"})]}),b&&i&&s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:"Latest Pre-release"}),s.jsx("span",{className:"font-mono text-amber-400",children:b})]}),s.jsx(ar,{label:"Include Pre-release Versions",description:"Opt into beta and development builds",checked:i,onChange:o}),s.jsx("div",{className:"flex items-center justify-between",children:s.jsxs("span",{className:"text-sm text-zinc-500",children:["Last checked: ",v(f)]})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("button",{onClick:()=>c(!0),disabled:r,className:"flex items-center gap-2 rounded-lg border border-zinc-300 px-4 py-2 text-sm font-medium text-zinc-700 transition-colors hover:bg-zinc-100 disabled:opacity-50 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800",children:[r?s.jsx(Ge,{className:"h-4 w-4 animate-spin"}):s.jsx(gn,{className:"h-4 w-4"}),"Check Now"]}),g&&s.jsxs("button",{onClick:d,className:"flex items-center gap-2 rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-accent-500",children:[s.jsx(Ha,{className:"h-4 w-4"}),"Update Available — View Details"]})]})]})})}function eD({theme:e,setTheme:n,accentColor:r,setAccentColor:i,sidebarCollapsed:o,setSidebarCollapsed:c}){const d=[{value:"light",label:"Light",icon:wv},{value:"dark",label:"Dark",icon:xv},{value:"system",label:"System",icon:pv}],f=Object.entries(Gu);return s.jsxs(s.Fragment,{children:[s.jsx(St,{icon:Mo,title:"Theme",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(hs,{label:"Color Theme",children:s.jsx("div",{className:"flex gap-2",children:d.map(m=>s.jsxs("button",{onClick:()=>n(m.value),className:ne("flex flex-1 items-center justify-center gap-2 rounded-lg border py-3 transition-all",e===m.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:[s.jsx(m.icon,{className:"h-4 w-4"}),m.label]},m.value))})}),s.jsx(hs,{label:"Accent Color",children:s.jsx("div",{className:"grid grid-cols-4 gap-2",children:f.map(([m,{name:h,palette:b}])=>s.jsxs("button",{onClick:()=>i(m),className:ne("flex items-center gap-2 rounded-lg border p-3 transition-all",r===m?"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:r===m?b[500]:void 0,"--tw-ring-color":r===m?b[500]:void 0},children:[s.jsx("div",{className:"h-5 w-5 rounded-full",style:{backgroundColor:b[500]}}),s.jsx("span",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:h})]},m))})})]})}),s.jsx(St,{icon:Fu,title:"Layout",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(ar,{label:"Collapse Sidebar by Default",description:"Start with sidebar in compact mode",checked:o,onChange:c}),s.jsx(hs,{label:"Chat Message Style",children:s.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:[s.jsx("option",{value:"detailed",children:"Detailed (with metadata)"}),s.jsx("option",{value:"compact",children:"Compact"}),s.jsx("option",{value:"minimal",children:"Minimal"})]})})]})}),s.jsx(St,{icon:qa,title:"Code Display",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(hs,{label:"Code Font",children:s.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:[s.jsx("option",{value:"jetbrains-mono",children:"JetBrains Mono"}),s.jsx("option",{value:"fira-code",children:"Fira Code"}),s.jsx("option",{value:"monaco",children:"Monaco"}),s.jsx("option",{value:"consolas",children:"Consolas"})]})}),s.jsx(ar,{label:"Enable Ligatures",description:"Display programming ligatures in code",checked:!0,onChange:()=>{}})]})})]})}const tD={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"},nD={openai:"bg-green-500",anthropic:"bg-orange-500",google:"bg-blue-500",groq:"bg-purple-500",grok:"bg-red-500",openrouter:"bg-indigo-500",moonshot:"bg-cyan-500",ollama:"bg-zinc-500",lmstudio:"bg-yellow-500",azure:"bg-sky-500",zai:"bg-emerald-500",modelscope:"bg-pink-500",local_http:"bg-zinc-600"};function aD(e){return e?e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:e.toString():"—"}function s1(e){return e==null?"—":e===0?"Free":e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(4)}`.replace(/0+$/,"")}function sD(){const{groups:e,defaultModel:n,loading:r,updateDefaultModel:i,refresh:o}=js(),[c,d]=S.useState(""),[f,m]=S.useState({});S.useEffect(()=>{o()},[o]);const h=async z=>{z&&await i(z)},b={};for(const[z,j]of Object.entries(e)){const E=c?j.filter(N=>N.id.toLowerCase().includes(c.toLowerCase())):j;E.length>0&&(b[z]=E)}const g=Object.values(e).reduce((z,j)=>z+j.length,0),v=Object.values(b).reduce((z,j)=>z+j.length,0),y=Object.keys(b).length,k=z=>m(j=>({...j,[z]:!j[z]})),C=c.length>0;return s.jsxs(s.Fragment,{children:[s.jsx(St,{icon:Li,title:"Default Model",children:s.jsx("div",{className:"space-y-4",children:s.jsxs(hs,{label:"System Default Model",children:[s.jsx(qo,{value:n,onChange:h,placeholder:"Select default model...",className:"w-full"}),s.jsx("p",{className:"mt-2 text-xs text-zinc-500",children:"Used when no specific model is configured for a bot."})]})})}),s.jsx(St,{icon:Li,title:"Available Models",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),s.jsx("input",{type:"text",placeholder:"Search models...",value:c,onChange:z=>d(z.target.value),className:"h-9 w-full rounded-lg border border-zinc-300 bg-zinc-100 pl-10 pr-8 text-sm text-zinc-900 placeholder-zinc-500 outline-none focus:border-accent-500 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder-zinc-500"}),c&&s.jsx("button",{onClick:()=>d(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300",children:s.jsx(bn,{className:"h-3.5 w-3.5"})})]}),s.jsx("p",{className:"text-xs text-zinc-500",children:C?`${v} result${v!==1?"s":""} across ${y} provider${y!==1?"s":""}`:`${g} model${g!==1?"s":""} from ${y} provider${y!==1?"s":""}`}),r&&s.jsxs("div",{className:"flex items-center justify-center gap-2 py-6 text-zinc-500",children:[s.jsx(Ge,{className:"h-4 w-4 animate-spin"}),"Discovering models..."]}),!r&&g===0&&s.jsxs("div",{className:"text-center py-6",children:[s.jsx(Li,{className:"h-7 w-7 text-zinc-400 dark:text-zinc-600 mx-auto mb-2"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"No models available"}),s.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-600 mt-1",children:"Configure API keys to discover models."})]}),!r&&g>0&&v===0&&s.jsx("div",{className:"text-center py-6 text-zinc-500 text-sm",children:"No models match your search"}),!r&&s.jsx("div",{className:"space-y-1.5",children:Object.entries(b).sort(([z],[j])=>z.localeCompare(j)).map(([z,j])=>{const E=tD[z]||z.charAt(0).toUpperCase()+z.slice(1),N=nD[z]||"bg-zinc-500",M=C||f[z];return s.jsxs("div",{className:"rounded-lg border border-zinc-200 overflow-hidden dark:border-zinc-700",children:[s.jsxs("button",{onClick:()=>k(z),className:"flex w-full items-center gap-2.5 px-3 py-2 hover:bg-zinc-100/50 transition-colors dark:hover:bg-zinc-800/50",children:[s.jsx(Uu,{className:ne("h-3.5 w-3.5 text-zinc-400 transition-transform",M&&"rotate-90")}),s.jsx("span",{className:ne("h-2 w-2 rounded-full shrink-0",N)}),s.jsx("span",{className:"text-sm font-medium text-zinc-700 dark:text-zinc-300",children:E}),s.jsx("span",{className:"ml-auto text-xs text-zinc-400 dark:text-zinc-500",children:j.length})]}),M&&s.jsx("div",{className:"border-t border-zinc-200 dark:border-zinc-700 max-h-64 overflow-y-auto",children:j.map(R=>{const A=R.id===n;return s.jsxs("div",{className:ne("group flex items-center gap-2 px-3 py-1.5 border-b border-zinc-100 last:border-b-0 hover:bg-zinc-50 transition-colors dark:border-zinc-800 dark:hover:bg-zinc-800/40",A&&"bg-accent-500/5"),children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-[13px] text-zinc-800 dark:text-zinc-200 truncate",title:R.id,children:R.id}),A&&s.jsx(Yi,{className:"h-3 w-3 shrink-0 fill-current text-accent-500"}),R.is_reasoning&&s.jsx(xn,{className:"h-3 w-3 shrink-0 text-purple-400"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-zinc-400 dark:text-zinc-500",children:[s.jsxs("span",{children:[aD(R.context_window)," ctx"]}),R.pricing&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"text-zinc-300 dark:text-zinc-700",children:"/"}),s.jsx("span",{className:"text-emerald-600 dark:text-emerald-400",children:s1(R.pricing.input)}),s.jsx("span",{className:"text-zinc-300 dark:text-zinc-700",children:"·"}),s.jsx("span",{className:"text-amber-600 dark:text-amber-400",children:s1(R.pricing.output)})]})]})]}),!A&&s.jsx("button",{onClick:()=>h(R.id),className:"shrink-0 rounded p-1 text-zinc-300 opacity-0 transition-all hover:text-accent-500 group-hover:opacity-100 dark:text-zinc-600 dark:hover:text-accent-400",title:"Set as default",children:s.jsx(Yi,{className:"h-3.5 w-3.5"})})]},R.id)})})]},z)})})]})})]})}const r1=new Set(["openai","claude","google","groq","grok","openrouter","moonshot","zai","modelscope","azure"]),lo={openai:"OpenAI",claude:"Anthropic / Claude",google:"Google AI",groq:"Groq",grok:"Grok (xAI)",openrouter:"OpenRouter",moonshot:"Moonshot",zai:"Zhipu AI",modelscope:"ModelScope",azure:"Azure OpenAI",ollama:"Ollama",lmstudio:"LM Studio",local_http:"Local HTTP"};function rD(){const{providers:e,loading:n,refresh:r,update:i,remove:o}=Io(),{refresh:c}=js(),[d,f]=S.useState({}),[m,h]=S.useState(new Set),[b,g]=S.useState(null);S.useEffect(()=>{r()},[r]);const v=e.filter(E=>r1.has(E.name)),y=e.filter(E=>!r1.has(E.name)),k=async E=>{const N=d[E];if(N!=null&&N.trim()){g(E);try{await i(E,N.trim()),f(M=>{const R={...M};return delete R[E],R}),h(M=>{const R=new Set(M);return R.delete(E),R}),c(),Re.success(`${lo[E]||E} key saved`)}catch{Re.error(`Failed to save ${lo[E]||E} key`)}finally{g(null)}}},C=async E=>{try{await o(E),f(N=>{const M={...N};return delete M[E],M}),c(),Re.success(`${lo[E]||E} key removed`)}catch{Re.error(`Failed to remove ${lo[E]||E} key`)}},z=E=>{h(N=>{const M=new Set(N);return M.has(E)?M.delete(E):M.add(E),M})},j=E=>{const N=E.name in d,M=d[E.name]??"",R=m.has(E.name),A=b===E.name,F=lo[E.name]||E.name,ee=E.type==="endpoint";return s.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-zinc-300 bg-zinc-100/50 p-4 dark:border-zinc-700 dark:bg-zinc-800/50",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:F}),s.jsx("span",{className:ne("inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium",E.configured?"bg-green-500/20 text-green-600 dark:text-green-400":"bg-zinc-300 text-zinc-600 dark:bg-zinc-700 dark:text-zinc-400"),children:E.configured?"Active":"Not set"})]}),E.configured&&s.jsx("button",{onClick:()=>C(E.name),className:"rounded p-1 text-zinc-400 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Remove key",children:s.jsx(Pt,{className:"h-4 w-4"})})]}),s.jsxs("p",{className:"text-xs text-zinc-500",children:[ee?"Endpoint URL":"API Key",": ",s.jsx("code",{className:"text-zinc-400",children:E.env_key}),E.default&&s.jsxs("span",{className:"ml-1 text-zinc-500",children:["(default: ",E.default,")"]})]}),E.configured&&!N&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex-1 rounded-lg border border-zinc-300 bg-zinc-200/50 px-3 py-2 font-mono text-sm text-zinc-500 dark:border-zinc-600 dark:bg-zinc-700/50 dark:text-zinc-400",children:R?E.masked_value:E.masked_value.replace(/./g,"*").slice(0,20)+"****"}),s.jsx("button",{onClick:()=>z(E.name),className:"rounded p-2 text-zinc-400 transition-colors hover:bg-zinc-200 hover:text-zinc-600 dark:hover:bg-zinc-700 dark:hover:text-zinc-300",title:R?"Hide":"Show",children:R?s.jsx(Br,{className:"h-4 w-4"}):s.jsx(gs,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:R||ee?"text":"password",value:M,onChange:Z=>f(L=>({...L,[E.name]:Z.target.value})),placeholder:ee?E.default||"Enter endpoint URL...":"Enter API key...",className:"h-10 flex-1 rounded-lg border border-zinc-300 bg-white px-3 font-mono text-sm text-zinc-900 outline-none transition-colors focus:border-accent-500 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100"}),!ee&&s.jsx("button",{onClick:()=>z(E.name),className:"rounded-lg border border-zinc-300 px-3 text-zinc-400 transition-colors hover:bg-zinc-200 hover:text-zinc-600 dark:border-zinc-600 dark:hover:bg-zinc-700 dark:hover:text-zinc-300",title:R?"Hide":"Show",children:R?s.jsx(Br,{className:"h-4 w-4"}):s.jsx(gs,{className:"h-4 w-4"})}),s.jsxs("button",{onClick:()=>k(E.name),disabled:!M.trim()||A,className:"flex items-center gap-1.5 rounded-lg bg-accent-600 px-4 text-sm font-medium text-white transition-colors hover:bg-accent-500 disabled:opacity-50 disabled:cursor-not-allowed",children:[A?s.jsx(Ge,{className:"h-4 w-4 animate-spin"}):s.jsx(Do,{className:"h-4 w-4"}),"Save"]})]})]},E.name)};return n&&e.length===0?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-accent-500"})}):s.jsxs(s.Fragment,{children:[s.jsx(St,{icon:L5,title:"Cloud Providers",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-zinc-500",children:"Configure API keys for cloud-based AI providers. Models will be automatically discovered once a valid key is saved."}),v.map(j)]})}),s.jsx(St,{icon:l4,title:"Local Providers",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-zinc-500",children:"Configure endpoints for locally-running model servers."}),y.map(j)]})})]})}function iD({config:e}){return s.jsxs(s.Fragment,{children:[s.jsx(St,{icon:Na,title:"Security",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(ar,{label:"Require Approval for Actions",description:"Ask before executing potentially dangerous operations",checked:(e==null?void 0:e.agent.approveActions)??!0,onChange:()=>{}}),s.jsx(hs,{label:"Sandbox Timeout",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.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"}),s.jsx("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"seconds"})]})})]})}),s.jsx(St,{icon:Fu,title:"AI Configuration",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs(hs,{label:"Default Temperature",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("input",{type:"range",min:"0",max:"1",step:"0.1",defaultValue:(e==null?void 0:e.agent.temperature)??.7,className:"flex-1"}),s.jsx("span",{className:"w-12 text-center text-sm text-zinc-400",children:(e==null?void 0:e.agent.temperature)??.7})]}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Controls randomness in responses (0 = deterministic, 1 = creative)"})]}),s.jsxs(hs,{label:"Max Iterations",children:[s.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"}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"Maximum tool calls per conversation turn"})]})]})}),s.jsx(St,{icon:Q5,title:"Keyboard Shortcuts",children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(Oi,{label:"New Chat",shortcut:"Ctrl + N"}),s.jsx(Oi,{label:"Toggle Sidebar",shortcut:"Ctrl + B"}),s.jsx(Oi,{label:"Command Palette",shortcut:"Ctrl + K"}),s.jsx(Oi,{label:"Settings",shortcut:"Ctrl + ,"}),s.jsx(Oi,{label:"Send Message",shortcut:"Enter"}),s.jsx(Oi,{label:"New Line",shortcut:"Shift + Enter"})]})})]})}function lD(){const[e,n]=S.useState(!1),r=()=>{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()},c=new Blob([JSON.stringify(o,null,2)],{type:"application/json"}),d=URL.createObjectURL(c),f=document.createElement("a");f.href=d,f.download=`cachibot-backup-${new Date().toISOString().split("T")[0]}.json`,f.click(),URL.revokeObjectURL(d)},i=()=>{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 s.jsxs(s.Fragment,{children:[s.jsx(St,{icon:Ao,title:"Data Management",children:s.jsxs("div",{className:"space-y-4",children:[s.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:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Export Data"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"Download all your data as a JSON file"})]}),s.jsxs("button",{onClick:r,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:[s.jsx(Ha,{className:"h-4 w-4"}),"Export"]})]}),s.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:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Import Data"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"Restore from a previous backup"})]}),s.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:[s.jsx(Vu,{className:"h-4 w-4"}),"Import"]})]})]})}),s.jsx(oD,{}),s.jsx(St,{icon:gn,title:"Cache",children:s.jsx("div",{className:"space-y-4",children:s.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:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:"Clear Cache"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"Remove cached responses and temporary data"})]}),s.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:[s.jsx(gn,{className:"h-4 w-4"}),"Clear"]})]})})}),s.jsx(St,{icon:Hr,title:"Danger Zone",danger:!0,children:s.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-4",children:[s.jsx("h4",{className:"font-medium text-red-400",children:"Delete All Data"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Permanently delete all bots, chats, jobs, tasks, and settings. This cannot be undone."}),s.jsxs("button",{onClick:()=>n(!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:[s.jsx(Pt,{className:"h-4 w-4"}),"Delete Everything"]})]})}),e&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.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:[s.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[s.jsx(Hr,{className:"h-6 w-6"}),s.jsx("h2",{className:"text-lg font-bold",children:"Delete All Data"})]}),s.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."}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx("button",{onClick:()=>n(!1),className:"rounded-lg px-4 py-2 text-sm text-zinc-400 hover:bg-zinc-800",children:"Cancel"}),s.jsx("button",{onClick:i,className:"rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-500",children:"Delete Everything"})]})]})})]})}function oD(){const{bots:e}=Ot(),{chats:n,messages:r}=mn(),{jobs:i}=um(),{tasks:o}=Qi(),{connections:c}=XA(),{stats:d,clearBotStats:f}=Mu(),[m,h]=S.useState(new Set),[b,g]=S.useState(new Map),[v,y]=S.useState(!1),[k,C]=S.useState(!1),[z,j]=S.useState({}),[E,N]=S.useState(!1);S.useEffect(()=>{(async()=>{N(!0);const q={};for(const B of e)try{const{getPlatformChats:V}=await km(async()=>{const{getPlatformChats:ue}=await Promise.resolve().then(()=>cm);return{getPlatformChats:ue}},void 0),oe=await V(B.id);q[B.id]=oe.length}catch{q[B.id]=0}j(q),N(!1)})()},[e]);const M=S.useMemo(()=>e.map(_=>{const q=n.filter(G=>G.botId===_.id),B=q.filter(G=>!G.platform),V=q.filter(G=>G.platform),oe=B.reduce((G,be)=>{var ye;return G+(((ye=r[be.id])==null?void 0:ye.length)||0)},0),ue=i.filter(G=>G.botId===_.id),O=o.filter(G=>G.botId===_.id),U=!!d.byBot[_.id],Q=z[_.id]||0,D=Math.max(Q,V.length);return{botId:_.id,botName:_.name,botColor:_.color||"#22c55e",chatsCount:B.length,messagesCount:oe,jobsCount:ue.length,tasksCount:O.length,hasUsageData:U,platformChatsCount:D}}),[e,n,r,i,o,d.byBot,z]),R=_=>c.filter(q=>q.botId===_).length,A=_=>{h(q=>{const B=new Set(q);return B.has(_)?B.delete(_):B.add(_),B})},F=(_,q)=>{g(B=>{const V=new Map(B),oe=V.get(_)||new Set,ue=new Set(oe);return ue.has(q)?ue.delete(q):ue.add(q),ue.size===0?V.delete(_):V.set(_,ue),V})},ee=(_,q)=>{g(B=>{const V=new Map(B),oe=new Set;return q.chatsCount>0&&oe.add("chats"),q.jobsCount>0&&oe.add("jobs"),q.tasksCount>0&&oe.add("tasks"),q.hasUsageData&&oe.add("usage"),q.platformChatsCount>0&&oe.add("platform"),oe.size>0&&V.set(_,oe),V})},Z=_=>{g(q=>{const B=new Map(q);return B.delete(_),B})},L=b.size>0,P=()=>{let _=0;return b.forEach((q,B)=>{const V=M.find(oe=>oe.botId===B);V&&(q.has("chats")&&(_+=V.chatsCount),q.has("jobs")&&(_+=V.jobsCount),q.has("tasks")&&(_+=V.tasksCount),q.has("usage")&&(_+=1),q.has("platform")&&(_+=V.platformChatsCount))}),_},Y=async()=>{C(!0);const _=mn.getState(),q=um.getState(),B=Qi.getState();for(const[V,oe]of b)if(oe.has("chats")&&n.filter(O=>O.botId===V&&!O.platform).forEach(O=>{_.deleteChat(O.id)}),oe.has("jobs")&&i.filter(O=>O.botId===V).forEach(O=>{q.deleteJob(O.id)}),oe.has("tasks")&&o.filter(O=>O.botId===V).forEach(O=>{B.deleteTask(O.id)}),oe.has("usage")&&f(V),oe.has("platform")){n.filter(O=>O.botId===V&&O.platform).forEach(O=>{_.deleteChat(O.id)});try{const{clearBotPlatformData:O}=await km(async()=>{const{clearBotPlatformData:U}=await Promise.resolve().then(()=>cm);return{clearBotPlatformData:U}},void 0);await O(V),j(U=>({...U,[V]:0}))}catch(O){console.error("Failed to clear platform data:",O),Re.error("Failed to clear platform data for bot")}}await new Promise(V=>setTimeout(V,300)),C(!1),y(!1),g(new Map),Re.success("Selected data cleared successfully")},me={chats:{icon:ir,label:"Local Chats",color:"text-blue-400"},jobs:{icon:qm,label:"Jobs",color:"text-purple-400"},tasks:{icon:jv,label:"Tasks",color:"text-green-400"},usage:{icon:ku,label:"Usage Stats",color:"text-amber-400"},platform:{icon:ir,label:"Platform Messages",color:"text-cyan-400"}};return s.jsxs(St,{icon:ya,title:"Bot Data Manager",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("p",{className:"text-sm text-zinc-500",children:["Clear specific data for each bot while keeping bot settings and connections intact.",E&&s.jsxs("span",{className:"ml-2 text-zinc-400",children:[s.jsx(Ge,{className:"inline h-3 w-3 animate-spin mr-1"}),"Loading platform data..."]})]}),s.jsx("div",{className:"space-y-2",children:M.map(_=>{const q=m.has(_.botId),B=b.get(_.botId),V=R(_.botId),oe=_.chatsCount>0||_.jobsCount>0||_.tasksCount>0||_.hasUsageData||_.platformChatsCount>0;return s.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:[s.jsxs("button",{onClick:()=>A(_.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:[q?s.jsx(el,{className:"h-4 w-4 text-zinc-500"}):s.jsx(Uu,{className:"h-4 w-4 text-zinc-500"}),s.jsx("div",{className:"h-8 w-8 rounded-lg flex items-center justify-center",style:{backgroundColor:_.botColor+"20"},children:s.jsx(ya,{className:"h-4 w-4",style:{color:_.botColor}})}),s.jsxs("div",{className:"flex-1 text-left",children:[s.jsx("div",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:_.botName}),s.jsxs("div",{className:"text-xs text-zinc-500",children:[_.chatsCount," local chats · ",_.jobsCount," jobs · ",_.tasksCount," tasks",_.platformChatsCount>0&&s.jsxs("span",{className:"text-cyan-400",children:[" · ",_.platformChatsCount," platform chats"]}),V>0&&s.jsxs("span",{className:"text-green-400",children:[" · ",V," connections (preserved)"]})]})]}),B&&B.size>0&&s.jsxs("span",{className:"rounded-full bg-red-500/20 px-2 py-0.5 text-xs text-red-400",children:[B.size," selected"]})]}),q&&s.jsx("div",{className:"border-t border-zinc-300 p-3 dark:border-zinc-700",children:oe?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex gap-2 mb-3",children:[s.jsx("button",{onClick:()=>ee(_.botId,_),className:"text-xs text-zinc-500 hover:text-zinc-800 transition-colors dark:text-zinc-400 dark:hover:text-zinc-200",children:"Select all"}),s.jsx("span",{className:"text-zinc-400 dark:text-zinc-600",children:"·"}),s.jsx("button",{onClick:()=>Z(_.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"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[_.chatsCount>0&&s.jsx(oo,{category:"chats",config:me.chats,count:_.chatsCount,detail:`${_.messagesCount} messages`,selected:(B==null?void 0:B.has("chats"))||!1,onToggle:()=>F(_.botId,"chats")}),_.jobsCount>0&&s.jsx(oo,{category:"jobs",config:me.jobs,count:_.jobsCount,selected:(B==null?void 0:B.has("jobs"))||!1,onToggle:()=>F(_.botId,"jobs")}),_.tasksCount>0&&s.jsx(oo,{category:"tasks",config:me.tasks,count:_.tasksCount,selected:(B==null?void 0:B.has("tasks"))||!1,onToggle:()=>F(_.botId,"tasks")}),_.hasUsageData&&s.jsx(oo,{category:"usage",config:me.usage,count:1,detail:"statistics",selected:(B==null?void 0:B.has("usage"))||!1,onToggle:()=>F(_.botId,"usage")}),_.platformChatsCount>0&&s.jsx(oo,{category:"platform",config:me.platform,count:_.platformChatsCount,detail:"Telegram/Discord",selected:(B==null?void 0:B.has("platform"))||!1,onToggle:()=>F(_.botId,"platform")})]}),V>0&&s.jsxs("div",{className:"mt-3 flex items-center gap-2 text-xs text-green-400/80",children:[s.jsx(Na,{className:"h-3 w-3"}),s.jsxs("span",{children:[V," connection",V!==1?"s":""," will be preserved"]})]})]}):s.jsx("p",{className:"text-sm text-zinc-500 text-center py-2",children:"No data to clear for this bot"})})]},_.botId)})}),L&&s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-red-500/30 bg-red-500/5 p-3",children:[s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"text-red-400 font-medium",children:P()}),s.jsx("span",{className:"text-zinc-400",children:" items selected for deletion"})]}),s.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:[s.jsx(Pt,{className:"h-4 w-4"}),"Clear Selected"]})]})]}),v&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.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:[s.jsxs("div",{className:"mb-4 flex items-center gap-3 text-red-400",children:[s.jsx(Hr,{className:"h-6 w-6"}),s.jsx("h2",{className:"text-lg font-bold",children:"Clear Bot Data"})]}),s.jsx("p",{className:"mb-4 text-zinc-400",children:"Are you sure you want to clear the selected data? This action cannot be undone."}),s.jsx("div",{className:"mb-6 rounded-lg border border-zinc-700 bg-zinc-800/50 p-3 space-y-2",children:Array.from(b.entries()).map(([_,q])=>{const B=M.find(V=>V.botId===_);return B?s.jsxs("div",{className:"text-sm",children:[s.jsxs("span",{className:"font-medium text-zinc-200",children:[B.botName,":"]}),s.jsx("span",{className:"text-zinc-400 ml-2",children:Array.from(q).map(V=>me[V].label).join(", ")})]},_):null})}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.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"}),s.jsx("button",{onClick:Y,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?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"h-4 w-4 animate-spin"}),"Clearing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Pt,{className:"h-4 w-4"}),"Clear Data"]})})]})]})})]})}function oo({config:e,count:n,detail:r,selected:i,onToggle:o}){const c=e.icon;return s.jsxs("button",{onClick:o,className:ne("flex items-center gap-2 rounded-lg border p-2 transition-all text-left",i?"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:[s.jsx("div",{className:ne("h-6 w-6 rounded flex items-center justify-center transition-colors",i?"bg-red-500/20":"bg-zinc-300 dark:bg-zinc-700"),children:i?s.jsx(ln,{className:"h-3.5 w-3.5 text-red-400"}):s.jsx(c,{className:ne("h-3.5 w-3.5",e.color)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:ne("text-sm font-medium",i?"text-red-400":"text-zinc-800 dark:text-zinc-200"),children:e.label}),s.jsxs("div",{className:"text-xs text-zinc-500",children:[n," ",r||(n===1?"item":"items")]})]})]})}function cD({currentUser:e}){const[n,r]=S.useState([]),[i,o]=S.useState(!0),[c,d]=S.useState(0),[f,m]=S.useState(!1),[h,b]=S.useState({email:"",username:"",password:"",role:"user"}),[g,v]=S.useState(!1),[y,k]=S.useState(null),[C,z]=S.useState({email:"",username:"",role:"user"}),[j,E]=S.useState(!1),[N,M]=S.useState(null);S.useEffect(()=>{R()},[]);const R=async()=>{try{const L=await Sv();r(L.users),d(L.total)}catch{Re.error("Failed to load users")}finally{o(!1)}},A=async L=>{if(L.preventDefault(),!h.email||!h.username||!h.password){Re.error("All fields are required");return}if(h.password.length<8){Re.error("Password must be at least 8 characters");return}v(!0);try{const P=await Cv(h);r([P,...n]),d(c+1),m(!1),b({email:"",username:"",password:"",role:"user"}),Re.success("User created successfully")}catch(P){const Y=P instanceof Error?P.message:"Failed to create user";Re.error(Y)}finally{v(!1)}},F=async L=>{if(L.preventDefault(),!!y){E(!0);try{const P=await Ev(y.id,C);r(n.map(Y=>Y.id===P.id?P:Y)),k(null),Re.success("User updated successfully")}catch(P){const Y=P instanceof Error?P.message:"Failed to update user";Re.error(Y)}finally{E(!1)}}},ee=async L=>{if(confirm("Are you sure you want to deactivate this user?")){try{await Tv(L),r(n.map(P=>P.id===L?{...P,is_active:!1}:P)),Re.success("User deactivated")}catch(P){const Y=P instanceof Error?P.message:"Failed to deactivate user";Re.error(Y)}M(null)}},Z=L=>{k(L),z({email:L.email,username:L.username,role:L.role}),M(null)};return i?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-cachi-500"})}):s.jsxs(s.Fragment,{children:[s.jsx(St,{icon:t0,title:"User Management",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("p",{className:"text-sm text-zinc-400",children:[c," user",c!==1?"s":""," total"]}),s.jsxs(sn,{onClick:()=>m(!0),size:"sm",children:[s.jsx(e0,{className:"h-4 w-4 mr-2"}),"Add User"]})]}),s.jsxs("div",{className:"rounded-lg border border-zinc-300 overflow-hidden dark:border-zinc-700",children:[s.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:[s.jsx("div",{children:"User"}),s.jsx("div",{children:"Email"}),s.jsx("div",{children:"Role"}),s.jsx("div",{children:"Status"}),s.jsx("div",{})]}),n.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-zinc-500 text-sm",children:"No users found"}):n.map(L=>s.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:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.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:s.jsx(Nu,{className:"h-3.5 w-3.5 text-zinc-500 dark:text-zinc-400"})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-medium text-sm truncate text-zinc-800 dark:text-zinc-100",children:L.username}),L.id===(e==null?void 0:e.id)&&s.jsx("div",{className:"text-xs text-cachi-600 dark:text-cachi-400",children:"You"})]})]}),s.jsx("div",{className:"text-zinc-500 text-sm truncate dark:text-zinc-400",children:L.email}),s.jsx("div",{children:s.jsxs("span",{className:ne("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",L.role==="admin"?"bg-purple-500/20 text-purple-300":"bg-zinc-700 text-zinc-300"),children:[L.role==="admin"?s.jsx(Na,{className:"h-3 w-3"}):s.jsx(Lo,{className:"h-3 w-3"}),L.role]})}),s.jsx("div",{children:s.jsxs("span",{className:ne("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",L.is_active?"bg-green-500/20 text-green-300":"bg-red-500/20 text-red-300"),children:[L.is_active?s.jsx(ln,{className:"h-3 w-3"}):s.jsx(bn,{className:"h-3 w-3"}),L.is_active?"Active":"Off"]})}),s.jsxs("div",{className:"relative",children:[s.jsx("button",{onClick:()=>M(N===L.id?null:L.id),className:"p-1 hover:bg-zinc-200 rounded transition-colors disabled:opacity-50 dark:hover:bg-zinc-700",disabled:L.id===(e==null?void 0:e.id),children:s.jsx(nv,{className:"h-4 w-4 text-zinc-500 dark:text-zinc-400"})}),N===L.id&&s.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:[s.jsx("button",{onClick:()=>Z(L),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"}),L.is_active&&s.jsx("button",{onClick:()=>ee(L.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"})]})]})]},L.id))]})]})}),f&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.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:[s.jsx("h2",{className:"text-lg font-semibold mb-4 text-zinc-900 dark:text-zinc-100",children:"Create New User"}),s.jsxs("form",{onSubmit:A,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Email"}),s.jsxs("div",{className:"relative",children:[s.jsx(mv,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),s.jsx("input",{type:"email",value:h.email,onChange:L=>b({...h,email:L.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})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Username"}),s.jsxs("div",{className:"relative",children:[s.jsx(Nu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),s.jsx("input",{type:"text",value:h.username,onChange:L=>b({...h,username:L.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})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Password"}),s.jsx("input",{type:"password",value:h.password,onChange:L=>b({...h,password:L.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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Role"}),s.jsxs("select",{value:h.role,onChange:L=>b({...h,role:L.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:[s.jsx("option",{value:"user",children:"User"}),s.jsx("option",{value:"admin",children:"Admin"})]})]}),s.jsxs("div",{className:"flex gap-3 pt-2",children:[s.jsx(sn,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>m(!1),children:"Cancel"}),s.jsx(sn,{type:"submit",className:"flex-1",disabled:g,children:g?s.jsx(Ge,{className:"h-4 w-4 animate-spin"}):"Create User"})]})]})]})}),y&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.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:[s.jsx("h2",{className:"text-lg font-semibold mb-4 text-zinc-900 dark:text-zinc-100",children:"Edit User"}),s.jsxs("form",{onSubmit:F,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Email"}),s.jsx("input",{type:"email",value:C.email,onChange:L=>z({...C,email:L.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})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Username"}),s.jsx("input",{type:"text",value:C.username,onChange:L=>z({...C,username:L.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})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-700 mb-1.5 dark:text-zinc-300",children:"Role"}),s.jsxs("select",{value:C.role,onChange:L=>z({...C,role:L.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:[s.jsx("option",{value:"user",children:"User"}),s.jsx("option",{value:"admin",children:"Admin"})]})]}),s.jsxs("div",{className:"flex gap-3 pt-2",children:[s.jsx(sn,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>k(null),children:"Cancel"}),s.jsx(sn,{type:"submit",className:"flex-1",disabled:j,children:j?s.jsx(Ge,{className:"h-4 w-4 animate-spin"}):"Save Changes"})]})]})]})}),N&&s.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>M(null)})]})}function St({icon:e,title:n,danger:r,children:i}){return s.jsxs("div",{className:"rounded-xl border border-zinc-300 bg-white dark:border-zinc-800 dark:bg-zinc-900/30",children:[s.jsxs("div",{className:ne("flex items-center gap-2 border-b px-5 py-4",r?"border-red-500/30":"border-zinc-300 dark:border-zinc-800"),children:[s.jsx(e,{className:ne("h-5 w-5",r?"text-red-400":"text-zinc-500 dark:text-zinc-400")}),s.jsx("h3",{className:ne("font-semibold",r?"text-red-400":"text-zinc-800 dark:text-zinc-200"),children:n})]}),s.jsx("div",{className:"p-5",children:i})]})}function hs({label:e,children:n}){return s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:e}),n]})}function ar({label:e,description:n,checked:r,onChange:i}){return s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h4",{className:"font-medium text-zinc-800 dark:text-zinc-200",children:e}),s.jsx("p",{className:"text-sm text-zinc-500",children:n})]}),s.jsx("button",{onClick:()=>i(!r),className:ne("relative h-6 w-11 rounded-full transition-colors",r?"bg-accent-600":"bg-zinc-300 dark:bg-zinc-700"),children:s.jsx("span",{className:ne("absolute top-1 h-4 w-4 rounded-full bg-white transition-transform",r?"left-6":"left-1")})})]})}function Oi({label:e,shortcut:n}){return s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-zinc-700 dark:text-zinc-300",children:e}),s.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:n})]})}function uD(){const{getActiveBot:e}=Ot(),{workSection:n}=Rt(),r=e();return r?s.jsxs("div",{className:"flex h-full flex-col bg-zinc-100 dark:bg-zinc-950",children:[n==="overview"&&s.jsx(dD,{botId:r.id}),n==="active"&&s.jsx(Gh,{botId:r.id,filter:"active"}),n==="completed"&&s.jsx(Gh,{botId:r.id,filter:"completed"}),n==="history"&&s.jsx(Gh,{botId:r.id,filter:"all"})]}):null}function dD({botId:e}){const{getWorkByBot:n,getActiveWork:r}=o0(),i=n(e),o=r(e),c={total:i.length,active:o.length,pending:i.filter(d=>d.status==="pending").length,completed:i.filter(d=>d.status==="completed").length,failed:i.filter(d=>d.status==="failed").length};return s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[s.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Work Overview"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"Manage your work items, tasks, and jobs"})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[s.jsxs("div",{className:"mb-8 grid grid-cols-2 gap-4 lg:grid-cols-5",children:[s.jsx(co,{label:"Total",value:c.total,color:"zinc"}),s.jsx(co,{label:"Active",value:c.active,color:"blue",pulse:!0}),s.jsx(co,{label:"Pending",value:c.pending,color:"yellow"}),s.jsx(co,{label:"Completed",value:c.completed,color:"green"}),s.jsx(co,{label:"Failed",value:c.failed,color:"red"})]}),o.length>0&&s.jsxs("div",{className:"mb-8",children:[s.jsx("h2",{className:"mb-4 text-lg font-semibold text-zinc-200",children:"Active Work"}),s.jsx("div",{className:"space-y-3",children:o.slice(0,5).map(d=>s.jsx(jj,{work:d},d.id))})]}),i.length===0&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[s.jsx("div",{className:"mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-zinc-800",children:s.jsx(Fm,{className:"h-8 w-8 text-zinc-500"})}),s.jsx("h3",{className:"mb-2 text-lg font-medium text-zinc-300",children:"No work items yet"}),s.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 Gh({botId:e,filter:n}){const r=Rn(),{getWorkByBot:i,activeWorkId:o,setActiveWork:c}=o0(),[d,f]=S.useState(""),h=i(e).filter(k=>!(n==="active"&&!["pending","in_progress","paused"].includes(k.status)||n==="completed"&&k.status!=="completed"||d&&!k.title.toLowerCase().includes(d.toLowerCase()))),b=h.find(k=>k.id===o),g={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=>{c(k.id),r(`/${e}/work/${k.id}`)};return s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[s.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:g[n]}),s.jsx("p",{className:"text-sm text-zinc-500",children:v[n]})]}),s.jsx("div",{className:"border-b border-zinc-800 px-6 py-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),s.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"})]})}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsx("div",{className:"w-96 flex-shrink-0 overflow-y-auto border-r border-zinc-800 p-4",children:h.length===0?s.jsxs("div",{className:"py-12 text-center",children:[s.jsx(sr,{className:"mx-auto mb-3 h-8 w-8 text-zinc-600"}),s.jsx("p",{className:"text-sm text-zinc-500",children:d?"No work items match your search":"No work items"})]}):s.jsx("div",{className:"space-y-2",children:h.map(k=>s.jsx(jj,{work:k,selected:o===k.id,onClick:()=>y(k),compact:!0},k.id))})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:b?s.jsx(fD,{work:b}):s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx("p",{className:"text-zinc-500",children:"Select a work item to view details"})})})]})]})}function co({label:e,value:n,color:r,pulse:i}){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 s.jsxs("div",{className:ne("rounded-xl border p-4",o[r]),children:[s.jsx("div",{className:ne("text-3xl font-bold",i&&n>0&&"animate-pulse"),children:n}),s.jsx("div",{className:"mt-1 text-sm opacity-80",children:e})]})}function jj({work:e,selected:n,onClick:r,compact:i}){const o=f=>{switch(f){case"pending":return s.jsx(To,{className:"h-4 w-4 text-zinc-400"});case"in_progress":return s.jsx(Iu,{className:"h-4 w-4 text-blue-400"});case"completed":return s.jsx(xs,{className:"h-4 w-4 text-green-400"});case"failed":return s.jsx(rr,{className:"h-4 w-4 text-red-400"});case"cancelled":return s.jsx(rr,{className:"h-4 w-4 text-zinc-500"});case"paused":return s.jsx(bv,{className:"h-4 w-4 text-yellow-400"})}},c=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 m={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 m[f]||m.normal};return s.jsx("button",{onClick:r,className:ne("w-full rounded-xl border p-4 text-left transition-all",n&&"ring-1 ring-blue-500",c(e.status),r&&"hover:border-zinc-600"),children:s.jsxs("div",{className:"flex items-start gap-3",children:[o(e.status),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate font-medium text-zinc-200",children:e.title}),e.priority!=="normal"&&s.jsx("span",{className:ne("rounded px-1.5 py-0.5 text-[10px] font-medium uppercase",d(e.priority)),children:e.priority})]}),e.description&&!i&&s.jsx("p",{className:"mt-1 truncate text-sm text-zinc-500",children:e.description}),e.status==="in_progress"&&e.progress>0&&s.jsxs("div",{className:"mt-3",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-zinc-500",children:[s.jsx("span",{children:"Progress"}),s.jsxs("span",{children:[e.progress,"%"]})]}),s.jsx("div",{className:"mt-1 h-1.5 overflow-hidden rounded-full bg-zinc-700",children:s.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&&s.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-zinc-500",children:[s.jsx(xs,{className:"h-3 w-3"}),e.completedTaskCount||0,"/",e.taskCount," tasks"]})]}),r&&s.jsx(Uu,{className:"h-4 w-4 text-zinc-600"})]})})}function fD({work:e}){const n=r=>new Date(r).toLocaleString();return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"mb-6",children:[s.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.title}),e.description&&s.jsx("p",{className:"mt-1 text-zinc-400",children:e.description}),e.goal&&s.jsxs("div",{className:"mt-3 rounded-lg border border-blue-500/30 bg-blue-500/10 p-3",children:[s.jsx("div",{className:"text-xs font-medium uppercase text-blue-400",children:"Goal"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-300",children:e.goal})]})]}),s.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4 lg:grid-cols-4",children:[s.jsx(hu,{label:"Status",value:e.status.replace("_"," ")}),s.jsx(hu,{label:"Priority",value:e.priority}),s.jsx(hu,{label:"Progress",value:`${e.progress}%`}),s.jsx(hu,{label:"Created",value:n(e.createdAt)})]}),e.status==="in_progress"&&s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Progress"}),s.jsxs("span",{className:"font-mono text-zinc-300",children:[e.progress,"%"]})]}),s.jsx("div",{className:"h-3 overflow-hidden rounded-full bg-zinc-800",children:s.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&&s.jsxs("div",{className:"mb-6 rounded-xl border border-red-500/30 bg-red-500/10 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-red-400",children:[s.jsx(rr,{className:"h-5 w-5"}),s.jsx("span",{className:"font-medium",children:"Error"})]}),s.jsx("pre",{className:"mt-2 overflow-x-auto text-sm text-red-300",children:e.error})]}),e.result!==void 0&&e.result!==null&&s.jsxs("div",{className:"mb-6 rounded-xl border border-green-500/30 bg-green-500/10 p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[s.jsx(xs,{className:"h-5 w-5"}),s.jsx("span",{className:"font-medium",children:"Result"})]}),s.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&&s.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(r=>s.jsx("span",{className:"rounded-full bg-zinc-800 px-3 py-1 text-sm text-zinc-400",children:r},r))})]})}function hu({label:e,value:n}){return s.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-3",children:[s.jsx("div",{className:"text-xs text-zinc-500",children:e}),s.jsx("div",{className:"mt-1 font-medium capitalize text-zinc-200",children:n})]})}function hD(){const{getActiveBot:e}=Ot(),{scheduleSection:n}=Rt(),r=e();return r?s.jsxs("div",{className:"flex h-full flex-col bg-zinc-950",children:[n==="all"&&s.jsx(Yh,{botId:r.id,filter:"all"}),n==="enabled"&&s.jsx(Yh,{botId:r.id,filter:"enabled"}),n==="disabled"&&s.jsx(Yh,{botId:r.id,filter:"disabled"}),n==="create"&&s.jsx(mD,{botId:r.id})]}):null}function Yh({botId:e,filter:n}){const r=Rn(),{getSchedulesByBot:i,activeScheduleId:o,setActiveSchedule:c,toggleEnabled:d}=e2(),[f,m]=S.useState(""),h=i(e),b=h.filter(z=>!(n==="enabled"&&!z.enabled||n==="disabled"&&z.enabled||f&&!z.name.toLowerCase().includes(f.toLowerCase()))),g=b.find(z=>z.id===o),v={total:h.length,enabled:h.filter(z=>z.enabled).length,disabled:h.filter(z=>!z.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"},C=z=>{c(z.id),r(`/${e}/schedules/${z.id}`)};return s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx("div",{className:"border-b border-zinc-800 px-6 py-4",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:y[n]}),s.jsx("p",{className:"text-sm text-zinc-500",children:k[n]})]}),n==="all"&&s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(Qh,{label:"Total",value:v.total,color:"zinc"}),s.jsx(Qh,{label:"Enabled",value:v.enabled,color:"green"}),s.jsx(Qh,{label:"Disabled",value:v.disabled,color:"zinc"})]})]})}),s.jsx("div",{className:"border-b border-zinc-800 px-6 py-3",children:s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),s.jsx("input",{type:"text",placeholder:"Search schedules...",value:f,onChange:z=>m(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-purple-500"})]})}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsx("div",{className:"w-96 flex-shrink-0 overflow-y-auto border-r border-zinc-800 p-4",children:b.length===0?s.jsxs("div",{className:"py-12 text-center",children:[s.jsx(sr,{className:"mx-auto mb-3 h-8 w-8 text-zinc-600"}),s.jsx("p",{className:"text-sm text-zinc-500",children:f?"No schedules match your search":"No schedules yet"})]}):s.jsx("div",{className:"space-y-2",children:b.map(z=>s.jsx(pD,{schedule:z,selected:o===z.id,onClick:()=>C(z),onToggle:()=>d(z.id)},z.id))})}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:g?s.jsx(xD,{schedule:g}):s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx("p",{className:"text-zinc-500",children:"Select a schedule to view details"})})})]})]})}function mD({botId:e}){const{setScheduleSection:n}=Rt(),[r,i]=S.useState({name:"",description:"",scheduleType:"interval",cronExpression:"",intervalSeconds:3600,runAt:"",eventTrigger:"",enabled:!0}),o=c=>{c.preventDefault(),console.log("Create schedule:",r),n("all")};return s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsxs("div",{className:"border-b border-zinc-800 px-6 py-4",children:[s.jsx("h1",{className:"text-xl font-bold text-zinc-100",children:"Create Schedule"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"Set up a new automated trigger"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:s.jsxs("form",{onSubmit:o,className:"mx-auto max-w-2xl space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Name"}),s.jsx("input",{type:"text",value:r.name,onChange:c=>i({...r,name:c.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})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),s.jsx("textarea",{value:r.description,onChange:c=>i({...r,description:c.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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Schedule Type"}),s.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:["cron","interval","once","event"].map(c=>s.jsxs("button",{type:"button",onClick:()=>i({...r,scheduleType:c}),className:ne("flex flex-col items-center gap-2 rounded-lg border p-4 transition-all",r.scheduleType===c?"border-purple-500 bg-purple-500/10":"border-zinc-700 bg-zinc-800/50 hover:border-zinc-600"),children:[c==="cron"&&s.jsx(Pm,{className:"h-5 w-5 text-purple-400"}),c==="interval"&&s.jsx(kv,{className:"h-5 w-5 text-blue-400"}),c==="once"&&s.jsx(To,{className:"h-5 w-5 text-orange-400"}),c==="event"&&s.jsx(Pr,{className:"h-5 w-5 text-yellow-400"}),s.jsx("span",{className:"text-sm capitalize text-zinc-300",children:c})]},c))})]}),r.scheduleType==="cron"&&s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Cron Expression"}),s.jsx("input",{type:"text",value:r.cronExpression,onChange:c=>i({...r,cronExpression:c.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"}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:'Format: minute hour day month weekday (e.g., "0 2 * * *" = 2am daily)'})]}),r.scheduleType==="interval"&&s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Interval"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"number",value:r.intervalSeconds/60,onChange:c=>i({...r,intervalSeconds:parseInt(c.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"}),s.jsx("span",{className:"text-zinc-400",children:"minutes"})]})]}),r.scheduleType==="once"&&s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Run At"}),s.jsx("input",{type:"datetime-local",value:r.runAt,onChange:c=>i({...r,runAt:c.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"})]}),r.scheduleType==="event"&&s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Event Trigger"}),s.jsx("input",{type:"text",value:r.eventTrigger,onChange:c=>i({...r,eventTrigger:c.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"})]}),s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-700 bg-zinc-800/50 p-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"font-medium text-zinc-200",children:"Enable immediately"}),s.jsx("div",{className:"text-sm text-zinc-500",children:"Start running this schedule right away"})]}),s.jsx("button",{type:"button",onClick:()=>i({...r,enabled:!r.enabled}),className:r.enabled?"text-purple-400":"text-zinc-600",children:r.enabled?s.jsx(_o,{className:"h-8 w-8"}):s.jsx(Ro,{className:"h-8 w-8"})})]}),s.jsxs("div",{className:"flex justify-end gap-3 pt-4",children:[s.jsx("button",{type:"button",onClick:()=>n("all"),className:"rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-800",children:"Cancel"}),s.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:[s.jsx(Dn,{className:"h-4 w-4"}),"Create Schedule"]})]})]})})]})}function Qh({label:e,value:n,color:r}){const i={green:"bg-green-500/20 text-green-400",zinc:"bg-zinc-700 text-zinc-400"};return s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:ne("flex h-8 min-w-[2rem] items-center justify-center rounded-lg px-2 text-sm font-bold",i[r]),children:n}),s.jsx("span",{className:"text-xs text-zinc-500",children:e})]})}function pD({schedule:e,selected:n,onClick:r,onToggle:i}){const o=d=>{switch(d){case"cron":return s.jsx(Pm,{className:"h-4 w-4 text-purple-400"});case"interval":return s.jsx(kv,{className:"h-4 w-4 text-blue-400"});case"once":return s.jsx(To,{className:"h-4 w-4 text-orange-400"});case"event":return s.jsx(Pr,{className:"h-4 w-4 text-yellow-400"})}},c=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 s.jsx("button",{onClick:r,className:ne("w-full rounded-xl border p-4 text-left transition-all",n&&"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:s.jsxs("div",{className:"flex items-start gap-3",children:[o(e.scheduleType),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"font-medium text-zinc-200",children:e.name}),e.description&&s.jsx("p",{className:"mt-0.5 truncate text-sm text-zinc-500",children:e.description}),s.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs text-zinc-500",children:s.jsx("span",{className:"rounded bg-zinc-700/50 px-1.5 py-0.5 font-mono",children:c(e)})}),e.runCount>0&&s.jsx("div",{className:"mt-2 flex items-center gap-2 text-xs text-zinc-500",children:s.jsxs("span",{children:[e.runCount," runs"]})})]}),s.jsx("button",{onClick:d=>{d.stopPropagation(),i==null||i()},className:ne("flex-shrink-0 transition-colors",e.enabled?"text-purple-400":"text-zinc-600"),title:e.enabled?"Disable":"Enable",children:e.enabled?s.jsx(_o,{className:"h-6 w-6"}):s.jsx(Ro,{className:"h-6 w-6"})})]})})}function xD({schedule:e}){const n=i=>i?new Date(i).toLocaleString():"-",r=i=>{switch(i){case"cron":return"Cron Schedule";case"interval":return"Interval Timer";case"once":return"One-Time";case"event":return"Event Trigger"}};return s.jsxs("div",{className:"p-6",children:[s.jsxs("div",{className:"mb-6 flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.name}),s.jsx("span",{className:ne("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&&s.jsx("p",{className:"mt-1 text-zinc-400",children:e.description})]}),s.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:[s.jsx(Pt,{className:"h-4 w-4"}),"Delete"]})]}),s.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4 lg:grid-cols-4",children:[s.jsx(mu,{label:"Type",value:r(e.scheduleType)}),s.jsx(mu,{label:"Timezone",value:e.timezone}),s.jsx(mu,{label:"Run Count",value:String(e.runCount)}),s.jsx(mu,{label:"Max Concurrent",value:String(e.maxConcurrent)})]}),s.jsxs("div",{className:"mb-6 rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[s.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Schedule"}),s.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"&&n(e.runAt),e.scheduleType==="event"&&e.eventTrigger]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[s.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Next Run"}),s.jsx("div",{className:"mt-2 text-zinc-200",children:e.nextRunAt?n(e.nextRunAt):"Not scheduled"})]}),s.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-4",children:[s.jsx("div",{className:"text-xs font-medium uppercase text-zinc-500",children:"Last Run"}),s.jsx("div",{className:"mt-2 text-zinc-200",children:e.lastRunAt?n(e.lastRunAt):"Never"})]})]})]})}function mu({label:e,value:n}){return s.jsxs("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-3",children:[s.jsx("div",{className:"text-xs text-zinc-500",children:e}),s.jsx("div",{className:"mt-1 font-medium text-zinc-200",children:n})]})}const ll=[{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"}],M0=[{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"}],i1={method:null,purposeCategory:"",purposeDescription:"",nameSuggestions:[],selectedNameMeaning:"",followUpQuestions:[],communicationStyle:"friendly",useEmojis:"sometimes",generatedPrompt:"",suggestedName:"",suggestedDescription:"",userContext:"",suggestedTodos:[],suggestedSchedules:[],name:"",description:"",icon:"bot",color:"#3b82f6",model:"",systemPrompt:"",tools:["file_read","file_write","file_list","file_edit","file_info","python_execute","task_complete"]},wj={template:["method-select","template-select","appearance","confirm"],"ai-assisted":["method-select","purpose","name-picker","details","personality","prompt-review","setup","preview","appearance","confirm"],blank:["method-select","appearance","confirm"],import:["method-select","import","appearance","confirm"]};function gD(e,n){if(!e)return null;const r=wj[e],i=r.indexOf(n);return i===-1||i===r.length-1?null:r[i+1]}function bD(e,n){if(!e)return null;const r=wj[e],i=r.indexOf(n);return i<=0?null:r[i-1]}const Ut=zt((e,n)=>({isOpen:!1,currentStep:"method-select",completedSteps:[],form:{...i1},isGenerating:!1,generationError:null,excludedNames:[],previewMessages:[],isPreviewLoading:!1,open:()=>e({isOpen:!0}),close:()=>e({isOpen:!1}),reset:()=>e({isOpen:!1,currentStep:"method-select",completedSteps:[],form:{...i1},isGenerating:!1,generationError:null,excludedNames:[],previewMessages:[],isPreviewLoading:!1}),setStep:r=>e({currentStep:r}),nextStep:()=>{const{form:r,currentStep:i}=n(),o=gD(r.method,i);o&&e(c=>({currentStep:o,completedSteps:c.completedSteps.includes(i)?c.completedSteps:[...c.completedSteps,i]}))},prevStep:()=>{const{form:r,currentStep:i}=n(),o=bD(r.method,i);o&&e({currentStep:o})},markStepCompleted:r=>e(i=>({completedSteps:i.completedSteps.includes(r)?i.completedSteps:[...i.completedSteps,r]})),setMethod:r=>e(i=>({form:{...i.form,method:r}})),updateForm:r=>e(i=>({form:{...i.form,...r}})),setGenerating:r=>e({isGenerating:r}),setGenerationError:r=>e({generationError:r}),setGeneratedContent:(r,i,o)=>e(c=>({form:{...c.form,generatedPrompt:r,suggestedName:i,suggestedDescription:o,systemPrompt:r,name:c.form.name||i,description:c.form.description||o}})),setNameSuggestions:r=>e(i=>{const o=i.form.nameSuggestions.map(d=>d.name);return{excludedNames:[...new Set([...i.excludedNames,...o])],form:{...i.form,nameSuggestions:r}}}),selectName:(r,i)=>e(o=>({form:{...o.form,name:r,selectedNameMeaning:i}})),getExcludedNames:()=>{const r=n(),i=r.form.nameSuggestions.map(o=>o.name);return[...new Set([...r.excludedNames,...i])]},setFollowUpQuestions:r=>e(i=>({form:{...i.form,followUpQuestions:r}})),updateFollowUpAnswer:(r,i)=>e(o=>({form:{...o.form,followUpQuestions:o.form.followUpQuestions.map(c=>c.id===r?{...c,answer:i}:c)}})),addPreviewMessage:(r,i)=>e(o=>({previewMessages:[...o.previewMessages,{role:r,content:i}]})),clearPreviewMessages:()=>e({previewMessages:[]}),setPreviewLoading:r=>e({isPreviewLoading:r})}));function yD(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function zj({template:e,onClick:n}){return s.jsxs("button",{onClick:n,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:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:s.jsx(ca,{icon:e.icon,size:24,color:e.color})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h3",{className:"font-semibold text-zinc-100 truncate",children:e.name}),s.jsx("p",{className:"text-xs text-zinc-500 capitalize",children:e.category})]})]}),s.jsx("p",{className:"mt-3 text-sm text-zinc-400 line-clamp-2",children:e.description}),s.jsxs("div",{className:"mt-3 flex flex-wrap gap-1",children:[e.tags.slice(0,3).map(r=>s.jsx("span",{className:"rounded-full bg-zinc-800 px-2 py-0.5 text-[10px] text-zinc-500",children:r},r)),e.tags.length>3&&s.jsxs("span",{className:"text-[10px] text-zinc-600",children:["+",e.tags.length-3]})]}),s.jsxs("div",{className:"mt-4 flex items-center justify-between border-t border-zinc-800 pt-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-amber-400",children:[s.jsx(Yi,{className:"h-3.5 w-3.5 fill-current"}),s.jsx("span",{className:"text-xs font-medium",children:e.rating.toFixed(1)})]}),s.jsxs("div",{className:"flex items-center gap-1 text-zinc-500",children:[s.jsx(Ha,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"text-xs",children:yD(e.downloads)})]})]})]})}function vD(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function jD({template:e,onClose:n,onInstalled:r}){const{addBot:i,setActiveBot:o}=Ot(),[c,d]=S.useState(!1),[f,m]=S.useState(null),h=async()=>{if(e){d(!0),m(null);try{const b=await Xv(e.id),g={id:b.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()};i(g),o(b.bot_id),r(b.bot_id)}catch(b){m(b instanceof Error?b.message:"Failed to install template")}finally{d(!1)}}};return e?s.jsxs(La,{open:!!e,onClose:n,size:"lg",children:[s.jsx(Ba,{title:e.name,subtitle:e.description,icon:s.jsx(ca,{icon:e.icon,size:20,color:e.color}),iconClassName:`bg-[${e.color}20]`,onClose:n}),s.jsx(Ua,{scrollable:!0,children:s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-6",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-amber-400",children:[s.jsx(Yi,{className:"h-4 w-4 fill-current"}),s.jsx("span",{className:"text-sm font-medium",children:e.rating.toFixed(1)}),s.jsx("span",{className:"text-xs text-zinc-500",children:"rating"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-zinc-400",children:[s.jsx(Ha,{className:"h-4 w-4"}),s.jsx("span",{className:"text-sm font-medium",children:vD(e.downloads)}),s.jsx("span",{className:"text-xs text-zinc-500",children:"installs"})]}),s.jsx("span",{className:"rounded-full bg-zinc-800 px-2.5 py-1 text-xs text-zinc-400 capitalize",children:e.category})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Tags"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:e.tags.map(b=>s.jsx("span",{className:"rounded-full bg-zinc-800 px-3 py-1 text-xs text-zinc-400",children:b},b))})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[s.jsx(qr,{className:"h-4 w-4 text-zinc-500"}),"Enabled Tools"]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:e.tools.map(b=>s.jsx("span",{className:"rounded-lg border border-zinc-700 bg-zinc-800/50 px-2.5 py-1 text-xs text-zinc-300",children:b.replace(/_/g," ")},b))})]}),s.jsxs("div",{children:[s.jsxs("h3",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[s.jsx(ir,{className:"h-4 w-4 text-zinc-500"}),"System Prompt"]}),s.jsx("div",{className:"max-h-48 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:s.jsx("p",{className:"whitespace-pre-wrap text-sm text-zinc-400",children:e.system_prompt})})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Recommended Model"}),s.jsx("span",{className:"rounded-lg bg-zinc-800 px-3 py-1.5 font-mono text-xs text-zinc-300",children:e.model})]}),f&&s.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:s.jsx("p",{className:"text-sm text-red-400",children:f})})]})}),s.jsxs(Ji,{children:[s.jsx(Kt,{variant:"ghost",onClick:n,children:"Cancel"}),s.jsx(Kt,{variant:"primary",onClick:h,disabled:c,children:c?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"h-4 w-4 animate-spin mr-2"}),"Installing..."]}):s.jsxs(s.Fragment,{children:[s.jsx(Ha,{className:"h-4 w-4 mr-2"}),"Install Template"]})})]})]}):null}function Nj({open:e,onClose:n,onInstalled:r}){const[i,o]=S.useState([]),[c,d]=S.useState([]),[f,m]=S.useState(null),[h,b]=S.useState(""),[g,v]=S.useState(!0),[y,k]=S.useState(null),[C,z]=S.useState(null);S.useEffect(()=>{e&&(j(),E())},[e]),S.useEffect(()=>{e&&E()},[f,h]);const j=async()=>{try{const M=await Jv();d(M)}catch(M){console.error("Failed to load categories:",M)}},E=async()=>{v(!0),k(null);try{const M=await l0(f||void 0,h||void 0);o(M.templates)}catch(M){k(M instanceof Error?M.message:"Failed to load templates")}finally{v(!1)}},N=M=>{z(null),r==null||r(M),n()};return s.jsxs(s.Fragment,{children:[s.jsxs(La,{open:e,onClose:n,size:"xl",children:[s.jsx(Ba,{title:"Bot Marketplace",subtitle:"Discover and install bot templates",icon:s.jsx(Su,{className:"h-5 w-5 text-cachi-500"}),onClose:n}),s.jsx(Ua,{className:"p-0",children:s.jsxs("div",{className:"flex h-[500px]",children:[s.jsx("div",{className:"w-56 shrink-0 border-r border-zinc-800 p-4",children:s.jsxs("nav",{className:"space-y-1",children:[s.jsx("button",{onClick:()=>m(null),className:ne("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"}),c.map(M=>s.jsxs("button",{onClick:()=>m(M.id),className:ne("w-full rounded-lg px-3 py-2 text-left text-sm transition-colors",f===M.id?"bg-cachi-600/20 text-cachi-400":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"),children:[s.jsx("span",{children:M.name}),s.jsxs("span",{className:"ml-2 text-xs text-zinc-600",children:["(",M.count,")"]})]},M.id))]})}),s.jsxs("div",{className:"flex-1 overflow-hidden",children:[s.jsx("div",{className:"border-b border-zinc-800 p-4",children:s.jsxs("div",{className:"relative",children:[s.jsx(On,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-500"}),s.jsx("input",{type:"text",value:h,onChange:M=>b(M.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&&s.jsx("button",{onClick:()=>b(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300",children:s.jsx(bn,{className:"h-4 w-4"})})]})}),s.jsx("div",{className:"h-[calc(100%-68px)] overflow-y-auto p-4",children:g?s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-zinc-500"})}):y?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[s.jsx("p",{className:"text-sm text-red-400",children:y}),s.jsx("button",{onClick:E,className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Try again"})]}):i.length===0?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[s.jsx(Su,{className:"mb-3 h-10 w-10 text-zinc-600"}),s.jsx("p",{className:"text-sm text-zinc-500",children:"No templates found"}),h&&s.jsx("button",{onClick:()=>b(""),className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Clear search"})]}):s.jsx("div",{className:"grid grid-cols-2 gap-4",children:i.map(M=>s.jsx(zj,{template:M,onClick:()=>z(M)},M.id))})})]})]})})]}),s.jsx(jD,{template:C,onClose:()=>z(null),onInstalled:N})]})}const wD=[{id:"ai-assisted",name:"AI-Assisted",description:"Describe what you want and let AI generate the perfect system prompt",icon:im,color:"#8b5cf6",badge:"Recommended"},{id:"template",name:"Use Template",description:"Start with a pre-configured template and customize it",icon:Z5,color:"#3b82f6"},{id:"blank",name:"Start Blank",description:"Build everything from scratch with full control",icon:q5,color:"#22c55e"},{id:"import",name:"Import",description:"Import a bot configuration from a JSON file",icon:Vu,color:"#f59e0b"}];function l1(){const{form:e,setMethod:n,nextStep:r,close:i,reset:o}=Ut(),[c,d]=S.useState(!1),f=h=>{n(h),setTimeout(r,150)},m=()=>{i(),setTimeout(o,200)};return s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"grid grid-cols-2 gap-4",children:wD.map(h=>{const b=h.icon,g=e.method===h.id;return s.jsxs("button",{onClick:()=>f(h.id),className:ne("relative flex flex-col items-start gap-3 rounded-xl border p-5 text-left transition-all",g?"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&&s.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}),s.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl",style:{backgroundColor:h.color+"20"},children:s.jsx(b,{className:"h-6 w-6",style:{color:h.color}})}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-zinc-200",children:h.name}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:h.description})]})]},h.id)})}),s.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:[s.jsx(Su,{className:"h-4 w-4"}),"Browse Bot Marketplace"]}),s.jsx(Nj,{open:c,onClose:()=>d(!1),onInstalled:m})]})}function zD(){const{updateForm:e,nextStep:n,close:r,reset:i}=Ut(),[o,c]=S.useState([]),[d,f]=S.useState(!0),[m,h]=S.useState(null),[b,g]=S.useState(!1);S.useEffect(()=>{v()},[]);const v=async()=>{f(!0),h(null);try{const z=[...(await l0()).templates].sort((j,E)=>E.downloads-j.downloads);c(z.slice(0,6))}catch(C){h(C instanceof Error?C.message:"Failed to load templates")}finally{f(!1)}},y=C=>{e({name:C.name,description:C.description,icon:C.icon,color:C.color,model:C.model,systemPrompt:C.system_prompt,tools:C.tools}),n()},k=()=>{r(),setTimeout(i,200)};return d?s.jsx("div",{className:"flex h-64 items-center justify-center",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-zinc-500"})}):m?s.jsxs("div",{className:"flex h-64 flex-col items-center justify-center text-center",children:[s.jsx("p",{className:"text-sm text-red-400",children:m}),s.jsx("button",{onClick:v,className:"mt-2 text-sm text-cachi-400 hover:underline",children:"Try again"})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-zinc-500",children:"Select a template to customize, or browse the full marketplace."}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:o.map(C=>s.jsx(zj,{template:C,onClick:()=>y(C)},C.id))}),s.jsxs("button",{onClick:()=>g(!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:[s.jsx(Su,{className:"h-4 w-4"}),"Browse All Templates"]}),s.jsx(Nj,{open:b,onClose:()=>g(!1),onInstalled:k})]})}const ND={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 kD(){const{form:e,updateForm:n}=Ut(),r=ND[e.purposeCategory]||"Describe what you want your bot to help you with...";return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"What's your bot for?"}),s.jsx("div",{className:"grid grid-cols-3 gap-2",children:ll.map(i=>s.jsxs("button",{onClick:()=>n({purposeCategory:i.id}),className:ne("flex flex-col items-start rounded-lg border p-3 text-left transition-all",e.purposeCategory===i.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[s.jsx("span",{className:"text-sm font-medium text-zinc-200",children:i.label}),s.jsx("span",{className:"text-xs text-zinc-500 line-clamp-1",children:i.description})]},i.id))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"What do you want your bot to do?"}),s.jsx("textarea",{value:e.purposeDescription,onChange:i=>n({purposeDescription:i.target.value}),placeholder:r,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"}),s.jsx("p",{className:"mt-2 text-xs text-zinc-500",children:"The more specific you are, the better we can personalize your bot."})]})]})}function SD(){const{form:e,updateForm:n,isGenerating:r,setGenerating:i,setGenerationError:o,selectName:c,getExcludedNames:d}=Ut(),f=S.useRef(!1),m=S.useRef(null);S.useEffect(()=>(e.nameSuggestions.length===0&&!r&&!f.current&&(f.current=!0,h()),()=>{var v;(v=m.current)==null||v.abort()}),[]);const h=async()=>{var z,j;(z=m.current)==null||z.abort();const v=new AbortController;m.current=v,i(!0),o(null);const y=Ut.getState(),k=[];let C=!0;try{const E=((j=ll.find(N=>N.id===e.purposeCategory))==null?void 0:j.label)||e.purposeCategory;await Rv({count:4,exclude:d(),purpose:`${E}: ${e.purposeDescription}`},{onName:N=>{k.push(N),Ut.setState(M=>({form:{...M.form,nameSuggestions:[...M.form.nameSuggestions,{name:N.name,meaning:N.meaning}]}})),C&&!y.form.name&&(c(N.name,N.meaning),C=!1)},onDone:()=>{i(!1)},onError:N=>{o(N),i(!1)}},v.signal)}catch(E){E.name!=="AbortError"&&(o(E instanceof Error?E.message:"Failed to generate names"),i(!1))}},b=()=>{const v=Ut.getState().form.nameSuggestions;Ut.setState(y=>({excludedNames:[...new Set([...y.excludedNames,...v.map(k=>k.name)])],form:{...y.form,nameSuggestions:[]}})),h()},g=(v,y)=>{c(v,y)};return r&&e.nameSuggestions.length===0?s.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:s.jsx(xn,{className:"h-8 w-8 text-cachi-400"})})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg font-medium text-zinc-200",children:"Finding the perfect name..."}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Each name has a special meaning"})]}),s.jsx(Ge,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xn,{className:"h-4 w-4 text-cachi-400"}),s.jsx("span",{className:"text-sm font-medium text-zinc-300",children:"Pick a name that resonates with you"})]}),s.jsxs("button",{onClick:b,disabled:r,className:"flex items-center gap-1.5 text-xs text-cachi-400 hover:text-cachi-300 disabled:opacity-50",children:[s.jsx(gn,{className:ne("h-3 w-3",r&&"animate-spin")}),"New suggestions"]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.nameSuggestions.map((v,y)=>s.jsxs("button",{onClick:()=>g(v.name,v.meaning),disabled:r&&e.nameSuggestions.length<4,className:ne("group relative rounded-xl border p-4 text-left transition-all","animate-in fade-in slide-in-from-bottom-2 duration-300",e.name===v.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"),style:{animationDelay:`${y*100}ms`,animationFillMode:"backwards"},children:[e.name===v.name&&s.jsx("div",{className:"absolute right-3 top-3",children:s.jsx("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-cachi-500",children:s.jsx(ln,{className:"h-3 w-3 text-white"})})}),s.jsx("h4",{className:ne("mb-2 text-xl font-bold",e.name===v.name?"text-cachi-300":"text-zinc-100"),children:v.name}),s.jsx("p",{className:"text-xs leading-relaxed text-zinc-400",children:v.meaning})]},v.name)),r&&e.nameSuggestions.length<4&&Array.from({length:4-e.nameSuggestions.length}).map((v,y)=>s.jsx("div",{className:"flex items-center justify-center rounded-xl border border-zinc-800 bg-zinc-800/30 p-4",style:{minHeight:"100px"},children:s.jsx(Ge,{className:"h-5 w-5 animate-spin text-zinc-600"})},`placeholder-${y}`))]}),s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 flex items-center",children:s.jsx("div",{className:"w-full border-t border-zinc-800"})}),s.jsx("div",{className:"relative flex justify-center",children:s.jsx("span",{className:"bg-zinc-900 px-3 text-xs text-zinc-600",children:"or use your own"})})]}),s.jsx("input",{type:"text",value:e.name,onChange:v=>n({name:v.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&&s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4 text-center",children:[s.jsx("p",{className:"text-sm text-zinc-500",children:"Your bot will be called"}),s.jsx("p",{className:"mt-1 text-2xl font-bold text-cachi-400",children:e.name}),e.selectedNameMeaning&&s.jsxs("p",{className:"mt-2 text-xs text-zinc-500 italic",children:['"',e.selectedNameMeaning,'"']})]})]})}function CD(){const{form:e,isGenerating:n,setGenerating:r,setGenerationError:i,updateFollowUpAnswer:o}=Ut(),c=S.useRef(!1),d=S.useRef(null);S.useEffect(()=>(e.followUpQuestions.length===0&&!n&&!c.current&&(c.current=!0,f()),()=>{var m;(m=d.current)==null||m.abort()}),[]);const f=async()=>{var h,b;(h=d.current)==null||h.abort();const m=new AbortController;d.current=m,r(!0),i(null);try{const g=((b=ll.find(v=>v.id===e.purposeCategory))==null?void 0:b.label)||e.purposeCategory;await _v({category:g,description:e.purposeDescription},{onQuestion:v=>{Ut.setState(y=>({form:{...y.form,followUpQuestions:[...y.form.followUpQuestions,{...v,answer:""}]}}))},onDone:()=>{r(!1)},onError:v=>{i(v),r(!1)}},m.signal)}catch(g){g.name!=="AbortError"&&(i(g instanceof Error?g.message:"Failed to generate questions"),r(!1))}};return n&&e.followUpQuestions.length===0?s.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:s.jsx(xn,{className:"h-8 w-8 text-cachi-400"})})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg font-medium text-zinc-200",children:"Getting to know you better..."}),s.jsxs("p",{className:"mt-1 text-sm text-zinc-500",children:["Creating personalized questions for ",e.name]})]}),s.jsx(Ge,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"rounded-lg border border-cachi-500/20 bg-cachi-500/5 p-4",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(O5,{className:"mt-0.5 h-5 w-5 shrink-0 text-cachi-400"}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-sm font-medium text-zinc-200",children:["Help ",e.name," understand you better"]}),s.jsx("p",{className:"mt-1 text-xs text-zinc-500",children:"These answers will help create a personalized assistant just for you."})]})]})}),s.jsxs("div",{className:"space-y-5",children:[e.followUpQuestions.map((m,h)=>s.jsxs("div",{className:"group animate-in fade-in slide-in-from-bottom-2 duration-300",style:{animationDelay:`${h*100}ms`,animationFillMode:"backwards"},children:[s.jsxs("label",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-zinc-300",children:[s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-cachi-600/20 text-xs text-cachi-400",children:h+1}),m.question]}),s.jsx("textarea",{value:m.answer,onChange:b=>o(m.id,b.target.value),placeholder:m.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"})]},m.id)),n&&e.followUpQuestions.length<3&&s.jsx("div",{className:"flex items-center justify-center py-4",children:s.jsx(Ge,{className:"h-5 w-5 animate-spin text-zinc-600"})})]}),s.jsx("p",{className:"text-center text-xs text-zinc-600",children:"Don't worry, you can always refine your bot later"})]})}const ED=[{id:"yes",label:"Yes, often",description:"Use emojis freely",icon:o4},{id:"sometimes",label:"Sometimes",description:"Use sparingly",icon:n4},{id:"no",label:"No emojis",description:"Keep it professional",icon:rr}];function TD(){const{form:e,updateForm:n}=Ut();return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"How should your bot communicate?"}),s.jsx("div",{className:"grid grid-cols-3 gap-2",children:M0.map(r=>s.jsxs("button",{onClick:()=>n({communicationStyle:r.id}),className:ne("flex flex-col items-start rounded-lg border p-3 text-left transition-all",e.communicationStyle===r.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[s.jsx("span",{className:"font-medium text-zinc-200",children:r.label}),s.jsx("span",{className:"text-xs text-zinc-500",children:r.description})]},r.id))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-3 block text-sm font-medium text-zinc-300",children:"Should your bot use emojis?"}),s.jsx("div",{className:"flex gap-3",children:ED.map(r=>{const i=r.icon;return s.jsxs("button",{onClick:()=>n({useEmojis:r.id}),className:ne("flex flex-1 flex-col items-center gap-2 rounded-lg border p-4 transition-all",e.useEmojis===r.id?"border-cachi-500 bg-cachi-500/10":"border-zinc-800 bg-zinc-800/30 hover:border-zinc-700"),children:[s.jsx(i,{className:ne("h-6 w-6",e.useEmojis===r.id?"text-cachi-400":"text-zinc-500")}),s.jsxs("div",{className:"text-center",children:[s.jsx("span",{className:"block font-medium text-zinc-200",children:r.label}),s.jsx("span",{className:"text-xs text-zinc-500",children:r.description})]})]},r.id)})})]})]})}function AD(){const{form:e,updateForm:n,isGenerating:r,generationError:i,setGenerating:o,setGenerationError:c,setGeneratedContent:d}=Ut(),[f,m]=S.useState(""),[h,b]=S.useState(!1);S.useEffect(()=>{!e.generatedPrompt&&!r&&g()},[]);const g=async()=>{var y,k;o(!0),c(null);try{const C=((y=ll.find(E=>E.id===e.purposeCategory))==null?void 0:y.label)||e.purposeCategory,z=((k=M0.find(E=>E.id===e.communicationStyle))==null?void 0:k.label)||e.communicationStyle,j=await Lv({name:e.name,name_meaning:e.selectedNameMeaning,purpose_category:C,purpose_description:e.purposeDescription,follow_up_answers:e.followUpQuestions.filter(E=>E.answer.trim()).map(E=>({question:E.question,answer:E.answer})),communication_style:z,use_emojis:e.useEmojis});d(j.system_prompt,j.suggested_name,j.suggested_description)}catch(C){c(C instanceof Error?C.message:"Failed to generate prompt")}finally{o(!1)}},v=async()=>{if(f.trim()){b(!0),c(null);try{const y=await Bv({current_prompt:e.systemPrompt,feedback:f});n({systemPrompt:y.system_prompt}),m("")}catch(y){c(y instanceof Error?y.message:"Failed to refine prompt")}finally{b(!1)}}};return r?s.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:s.jsx(xn,{className:"h-8 w-8 text-cachi-400"})})]}),s.jsxs("div",{className:"text-center",children:[s.jsxs("p",{className:"text-lg font-medium text-zinc-200",children:["Creating ",e.name,"'s personality..."]}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Crafting a unique system prompt just for you"})]}),s.jsx(Ge,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):s.jsxs("div",{className:"space-y-4",children:[i&&s.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[s.jsx(sr,{className:"h-5 w-5 text-red-400"}),s.jsx("span",{className:"text-sm text-red-400",children:i}),s.jsx("button",{onClick:g,className:"ml-auto text-sm text-red-400 underline hover:text-red-300",children:"Try again"})]}),s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 bg-zinc-900/50 px-4 py-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-zinc-500",children:"Personality for"}),s.jsx("p",{className:"text-lg font-bold text-cachi-400",children:e.name})]}),s.jsxs("button",{onClick:g,className:"flex items-center gap-1.5 text-xs text-cachi-400 hover:text-cachi-300",children:[s.jsx(gn,{className:"h-3 w-3"}),"Regenerate"]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"System Prompt"}),s.jsx("textarea",{value:e.systemPrompt,onChange:y=>n({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"})]}),s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsx(im,{className:"h-4 w-4 text-cachi-400"}),s.jsx("span",{className:"text-sm font-medium text-zinc-300",children:"Refine with AI"})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",value:f,onChange:y=>m(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"}),s.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?s.jsx(Ge,{className:"h-4 w-4 animate-spin"}):s.jsxs(s.Fragment,{children:[s.jsx(im,{className:"h-4 w-4"}),"Refine"]})})]})]})]})}function MD(){const{form:e,isGenerating:n,setGenerating:r,setGenerationError:i,updateForm:o}=Ut(),c=S.useRef(!1);S.useEffect(()=>{!c.current&&!e.userContext&&!n&&(c.current=!0,d())},[]);const d=async()=>{r(!0),i(null);try{const h=await Hv({purpose_category:e.purposeCategory,purpose_description:e.purposeDescription,follow_up_answers:e.followUpQuestions.filter(b=>b.answer.trim()).map(b=>({question:b.question,answer:b.answer})),system_prompt:e.systemPrompt,bot_name:e.name});o({userContext:h.user_context,suggestedTodos:h.suggested_todos.map(b=>({...b,enabled:!0})),suggestedSchedules:h.suggested_schedules.map(b=>({...b,enabled:!0}))})}catch(h){i(h instanceof Error?h.message:"Failed to analyze context")}finally{r(!1)}},f=h=>{const b=e.suggestedTodos.map((g,v)=>v===h?{...g,enabled:!g.enabled}:g);o({suggestedTodos:b})},m=h=>{const b=e.suggestedSchedules.map((g,v)=>v===h?{...g,enabled:!g.enabled}:g);o({suggestedSchedules:b})};return n?s.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-4",children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute inset-0 animate-ping rounded-full bg-cachi-500/20"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full bg-cachi-500/10",children:s.jsx(xn,{className:"h-8 w-8 text-cachi-400"})})]}),s.jsxs("div",{className:"text-center",children:[s.jsx("p",{className:"text-lg font-medium text-zinc-200",children:"Analyzing your answers..."}),s.jsxs("p",{className:"mt-1 text-sm text-zinc-500",children:["Extracting what ",e.name," should know about you"]})]}),s.jsx(Ge,{className:"h-5 w-5 animate-spin text-cachi-400"})]}):s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-zinc-200",children:[s.jsx(R5,{className:"h-4 w-4 text-cachi-400"}),"What ",e.name," knows about you"]}),s.jsx("textarea",{value:e.userContext,onChange:h=>o({userContext:h.target.value}),rows:5,placeholder:"Information about you that the bot should always remember...",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"}),s.jsx("p",{className:"text-xs text-zinc-600",children:"This will be saved as Custom Instructions — your bot will always have this context."})]}),e.suggestedTodos.length>0&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-zinc-200",children:[s.jsx(Ym,{className:"h-4 w-4 text-cachi-400"}),"Suggested todos"]}),s.jsx("div",{className:"space-y-2",children:e.suggestedTodos.map((h,b)=>s.jsxs("button",{type:"button",onClick:()=>f(b),className:"flex w-full items-start gap-3 rounded-lg border border-zinc-700 bg-zinc-800/50 p-3 text-left transition-colors hover:border-zinc-600",children:[s.jsx("div",{className:`mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded border transition-colors ${h.enabled?"border-cachi-500 bg-cachi-500 text-white":"border-zinc-600 bg-zinc-800"}`,children:h.enabled&&s.jsx(ln,{className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-sm font-medium ${h.enabled?"text-zinc-200":"text-zinc-500 line-through"}`,children:h.title}),h.notes&&s.jsx("p",{className:"mt-0.5 text-xs text-zinc-500",children:h.notes})]})]},b))}),s.jsx("p",{className:"text-xs text-zinc-600",children:"Checked items will be created as todos for your bot."})]}),e.suggestedSchedules.length>0&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-zinc-200",children:[s.jsx(Im,{className:"h-4 w-4 text-cachi-400"}),"Suggested recurring tasks"]}),s.jsx("div",{className:"space-y-2",children:e.suggestedSchedules.map((h,b)=>s.jsxs("button",{type:"button",onClick:()=>m(b),className:"flex w-full items-start gap-3 rounded-lg border border-zinc-700 bg-zinc-800/50 p-3 text-left transition-colors hover:border-zinc-600",children:[s.jsx("div",{className:`mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded border transition-colors ${h.enabled?"border-cachi-500 bg-cachi-500 text-white":"border-zinc-600 bg-zinc-800"}`,children:h.enabled&&s.jsx(ln,{className:"h-3 w-3"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:`text-sm font-medium ${h.enabled?"text-zinc-200":"text-zinc-500 line-through"}`,children:h.name}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-xs text-zinc-500",children:[s.jsx("span",{className:"rounded bg-zinc-700/50 px-1.5 py-0.5",children:h.frequency}),h.description&&s.jsx("span",{children:h.description})]})]})]},b))}),s.jsx("p",{className:"text-xs text-zinc-600",children:"Checked items will be created as scheduled tasks."})]}),!e.userContext&&e.suggestedTodos.length===0&&e.suggestedSchedules.length===0&&s.jsx("div",{className:"rounded-lg border border-zinc-700/50 bg-zinc-800/30 p-6 text-center",children:s.jsx("p",{className:"text-sm text-zinc-400",children:"No additional context was extracted. You can add custom instructions manually after creating the bot."})})]})}function DD(){var v;const{form:e,previewMessages:n,isPreviewLoading:r,addPreviewMessage:i,clearPreviewMessages:o,setPreviewLoading:c}=Ut(),[d,f]=S.useState(""),m=((v=ll.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 ${m.toLowerCase()}`],b=async y=>{if(!(!y.trim()||r)){i("user",y),f(""),c(!0);try{const k=await Uv({system_prompt:e.systemPrompt,test_message:y});i("assistant",k.response)}catch{i("assistant",`Hey! I'm ${e.name}. How can I help you today?`)}finally{c(!1)}}},g=y=>{y.preventDefault(),b(d)};return s.jsxs("div",{className:"flex h-[400px] flex-col",children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsx(Ur,{className:"h-4 w-4 text-cachi-400"}),s.jsxs("span",{className:"text-sm font-medium text-zinc-300",children:["Chat with ",e.name]})]}),s.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[n.length===0?s.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[s.jsx("div",{className:"mb-3 flex h-14 w-14 items-center justify-center rounded-full bg-cachi-500/10",children:s.jsx(ya,{className:"h-7 w-7 text-cachi-400"})}),s.jsx("p",{className:"text-lg font-medium text-zinc-300",children:e.name}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"See how your bot responds before creating it"})]}):n.map((y,k)=>s.jsxs("div",{className:ne("flex gap-3",y.role==="user"?"justify-end":"justify-start"),children:[y.role==="assistant"&&s.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-cachi-600/20",children:s.jsx(ya,{className:"h-4 w-4 text-cachi-400"})}),s.jsx("div",{className:ne("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:s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:y.content})}),y.role==="user"&&s.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-zinc-700",children:s.jsx(Lo,{className:"h-4 w-4 text-zinc-300"})})]},k)),r&&s.jsxs("div",{className:"flex gap-3",children:[s.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-cachi-600/20",children:s.jsx(ya,{className:"h-4 w-4 text-cachi-400"})}),s.jsx("div",{className:"rounded-2xl bg-zinc-800 px-4 py-2.5",children:s.jsx(Ge,{className:"h-5 w-5 animate-spin text-zinc-400"})})]})]}),n.length===0&&s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:h.map((y,k)=>s.jsx("button",{onClick:()=>b(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))}),s.jsxs("form",{onSubmit:g,className:"mt-3 flex gap-2",children:[s.jsx("input",{type:"text",value:d,onChange:y=>f(y.target.value),placeholder:`Message ${e.name}...`,disabled:r,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"}),s.jsx("button",{type:"submit",disabled:r||!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:s.jsx(jo,{className:"h-4 w-4"})})]}),n.length>0&&s.jsx("button",{onClick:o,className:"mt-2 text-xs text-zinc-500 hover:text-zinc-400",children:"Clear conversation"})]})}const OD=["#22c55e","#3b82f6","#8b5cf6","#ec4899","#f59e0b","#ef4444","#06b6d4","#84cc16"];function RD(){const{form:e,updateForm:n}=Ut();return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Bot Name"}),s.jsx("input",{type:"text",value:e.name,onChange:r=>n({name:r.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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Description"}),s.jsx("input",{type:"text",value:e.description,onChange:r=>n({description:r.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"})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Icon"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:t2.map(r=>s.jsx("button",{onClick:()=>n({icon:r.id}),title:r.label,className:ne("flex h-10 w-10 items-center justify-center rounded-lg border transition-all",e.icon===r.id?"border-cachi-500 bg-cachi-500/20":"border-zinc-700 bg-zinc-800 hover:border-zinc-600"),children:s.jsx(ca,{icon:r.id,size:20})},r.id))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"Color"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:OD.map(r=>s.jsx("button",{onClick:()=>n({color:r}),className:ne("h-10 w-10 rounded-lg border-2 transition-all",e.color===r?"border-white scale-110":"border-transparent hover:scale-105"),style:{backgroundColor:r}},r))})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"AI Model"}),s.jsx(qo,{value:e.model,onChange:r=>n({model:r}),placeholder:"Select AI Model"})]}),(e.method==="blank"||!e.generatedPrompt)&&s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium text-zinc-300",children:"System Prompt"}),s.jsx("textarea",{value:e.systemPrompt,onChange:r=>n({systemPrompt:r.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"})]}),s.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[s.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:s.jsx(ca,{icon:e.icon,size:28,color:e.color})}),s.jsxs("div",{children:[s.jsx("h3",{className:"font-semibold text-zinc-100",children:e.name||"Bot Name"}),s.jsx("p",{className:"text-sm text-zinc-500",children:e.description||"Bot description"})]})]})]})}function _D(){var i,o;const{form:e}=Ut(),n=(i=ll.find(c=>c.id===e.purposeCategory))==null?void 0:i.label,r=(o=M0.find(c=>c.id===e.communicationStyle))==null?void 0:o.label;return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"rounded-xl border border-zinc-800 bg-zinc-900/50 p-6",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-xl",style:{backgroundColor:e.color+"20"},children:s.jsx(ca,{icon:e.icon,size:32,color:e.color})}),s.jsxs("div",{className:"flex-1",children:[s.jsx("h2",{className:"text-xl font-bold text-zinc-100",children:e.name||"New Bot"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:e.description||"A new AI assistant"}),s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.model&&s.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&&s.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-zinc-800 px-2.5 py-1 text-xs text-zinc-400",children:[s.jsx(qr,{className:"h-3 w-3"}),e.tools.length," tools"]})]})]})]})}),e.method==="ai-assisted"&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[s.jsx(xn,{className:"h-4 w-4 text-cachi-400"}),"AI-Generated Configuration"]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n&&s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/30 p-3",children:[s.jsx("span",{className:"text-xs text-zinc-500",children:"Purpose"}),s.jsx("p",{className:"mt-0.5 text-sm text-zinc-200",children:n})]}),r&&s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/30 p-3",children:[s.jsx("span",{className:"text-xs text-zinc-500",children:"Style"}),s.jsx("p",{className:"mt-0.5 text-sm text-zinc-200",children:r})]})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[s.jsx(ir,{className:"h-4 w-4 text-zinc-500"}),"System Prompt"]}),s.jsx("div",{className:"max-h-40 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900/30 p-4",children:s.jsx("p",{className:"whitespace-pre-wrap text-sm text-zinc-400",children:e.systemPrompt||"(No system prompt configured)"})})]}),e.tools.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("h3",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[s.jsx(qr,{className:"h-4 w-4 text-zinc-500"}),"Enabled Tools"]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:e.tools.map(c=>s.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-zinc-800 px-3 py-1 text-xs text-zinc-300",children:[s.jsx(ln,{className:"h-3 w-3 text-cachi-400"}),c.replace(/_/g," ")]},c))})]}),s.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-cachi-500/30 bg-cachi-500/10 px-4 py-3",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-cachi-600",children:s.jsx(ln,{className:"h-4 w-4 text-white"})}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-cachi-400",children:"Ready to create"}),s.jsx("p",{className:"text-xs text-cachi-400/70",children:'Click "Create Bot" to add this bot to your collection'})]})]})]})}function LD(e){const n=[],r=[];if(!e||typeof e!="object")return{valid:!1,errors:["Invalid file format"],warnings:[]};const i=e;if(i.version?i.version!=="1.0"&&n.push(`Unsupported version: ${i.version}`):n.push("Missing version field"),!i.bot||typeof i.bot!="object")return n.push("Missing or invalid bot data"),{valid:!1,errors:n,warnings:r};const o=i.bot;return(!o.name||typeof o.name!="string")&&n.push("Missing bot name"),(!o.model||typeof o.model!="string")&&n.push("Missing model"),(!o.systemPrompt||typeof o.systemPrompt!="string")&&n.push("Missing system prompt"),o.description||r.push("No description provided"),o.icon||r.push("Using default icon"),o.color||r.push("Using default color"),n.length>0?{valid:!1,errors:n,warnings:r}:{valid:!0,errors:[],warnings:r,bot:{name:o.name,description:o.description,icon:o.icon,color:o.color,model:o.model,systemPrompt:o.systemPrompt,tools:o.tools||[]}}}function BD(){const{updateForm:e}=Ut(),n=S.useRef(null),[r,i]=S.useState(!1),[o,c]=S.useState(null),[d,f]=S.useState(null),m=async k=>{if(!k.name.endsWith(".json")){c({valid:!1,errors:["Please select a JSON file"],warnings:[]});return}f(k.name);try{const C=await k.text(),z=JSON.parse(C),j=LD(z);c(j),j.valid&&j.bot&&e({name:j.bot.name,description:j.bot.description||"",icon:j.bot.icon||"bot",color:j.bot.color||"#3b82f6",model:j.bot.model,systemPrompt:j.bot.systemPrompt,tools:j.bot.tools||[]})}catch{c({valid:!1,errors:["Failed to parse JSON file"],warnings:[]})}},h=k=>{var z;const C=(z=k.target.files)==null?void 0:z[0];C&&m(C)},b=k=>{k.preventDefault(),i(!1);const C=k.dataTransfer.files[0];C&&m(C)},g=k=>{k.preventDefault(),i(!0)},v=()=>{i(!1)},y=()=>{c(null),f(null),n.current&&(n.current.value="")};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{onDrop:b,onDragOver:g,onDragLeave:v,onClick:()=>{var k;return(k=n.current)==null?void 0:k.click()},className:ne("flex cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-8 transition-colors",r?"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:[s.jsx("input",{ref:n,type:"file",accept:".json",onChange:h,className:"hidden"}),o!=null&&o.valid?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-green-500/20",children:s.jsx(ln,{className:"h-7 w-7 text-green-400"})}),s.jsx("p",{className:"mt-4 font-medium text-green-400",children:"File validated successfully"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:d})]}):o&&!o.valid?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-red-500/20",children:s.jsx(sr,{className:"h-7 w-7 text-red-400"})}),s.jsx("p",{className:"mt-4 font-medium text-red-400",children:"Invalid file"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:d})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-zinc-800",children:s.jsx(Vu,{className:"h-7 w-7 text-zinc-500"})}),s.jsx("p",{className:"mt-4 font-medium text-zinc-300",children:"Drop a bot file here or click to browse"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-500",children:"Supports .json export files"})]})]}),o&&s.jsxs("div",{className:"space-y-3",children:[o.errors.length>0&&s.jsxs("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-4",children:[s.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-red-400",children:[s.jsx(bn,{className:"h-4 w-4"}),"Errors"]}),s.jsx("ul",{className:"mt-2 space-y-1",children:o.errors.map((k,C)=>s.jsx("li",{className:"text-sm text-red-300",children:k},C))})]}),o.warnings.length>0&&s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-4",children:[s.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-amber-400",children:[s.jsx(sr,{className:"h-4 w-4"}),"Warnings"]}),s.jsx("ul",{className:"mt-2 space-y-1",children:o.warnings.map((k,C)=>s.jsx("li",{className:"text-sm text-amber-300",children:k},C))})]})]}),(o==null?void 0:o.valid)&&o.bot&&s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/50 p-4",children:[s.jsxs("h4",{className:"flex items-center gap-2 text-sm font-medium text-zinc-300",children:[s.jsx(I5,{className:"h-4 w-4 text-zinc-500"}),"Imported Bot Preview"]}),s.jsxs("div",{className:"mt-3 space-y-2",children:[s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-zinc-500",children:"Name:"}),s.jsx("span",{className:"text-sm text-zinc-200",children:o.bot.name})]}),s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-zinc-500",children:"Model:"}),s.jsx("span",{className:"font-mono text-xs text-zinc-200",children:o.bot.model})]}),o.bot.tools&&o.bot.tools.length>0&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"text-sm text-zinc-500",children:"Tools:"}),s.jsx("span",{className:"text-sm text-zinc-200",children:o.bot.tools.length})]})]})]}),o&&s.jsx("button",{onClick:y,className:"text-sm text-zinc-500 hover:text-zinc-400",children:"Clear and try again"})]})}const o1={"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:"setup",label:"Setup"},{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 UD(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",setup:"Review what your bot knows about you",preview:"Chat with your bot before creating",appearance:"Customize the look",confirm:"Ready to create your bot",import:"Import a bot configuration"}[e]||""}function HD(){const{setCreateBotOpen:e}=Rt(),{addBot:n,setActiveBot:r}=Ot(),{isOpen:i,currentStep:o,completedSteps:c,form:d,isGenerating:f,close:m,reset:h,nextStep:b,prevStep:g}=Ut(),v=()=>{m(),e(!1),setTimeout(h,200)},y=async()=>{const N=crypto.randomUUID(),M={id:N,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()};if(n(M),r(M.id),d.method==="ai-assisted"){d.userContext.trim()&&gj(N,d.userContext).catch(R=>console.warn("Failed to save custom instructions:",R));for(const R of d.suggestedTodos)R.enabled&&Qv(N,{title:R.title,notes:R.notes||void 0}).catch(A=>console.warn("Failed to create todo:",A));for(const R of d.suggestedSchedules)R.enabled&&Yv(N,{name:R.name,description:R.description||void 0}).catch(A=>console.warn("Failed to create schedule:",A))}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}},C=d.method?o1[d.method]:o1["ai-assisted"],z=()=>{switch(o){case"method-select":return s.jsx(l1,{});case"template-select":return s.jsx(zD,{});case"purpose":return s.jsx(kD,{});case"name-picker":return s.jsx(SD,{});case"details":return s.jsx(CD,{});case"personality":return s.jsx(TD,{});case"prompt-review":return s.jsx(AD,{});case"setup":return s.jsx(MD,{});case"preview":return s.jsx(DD,{});case"appearance":return s.jsx(RD,{});case"confirm":return s.jsx(_D,{});case"import":return s.jsx(BD,{});default:return s.jsx(l1,{})}},j=o!=="method-select",E=o==="confirm";return s.jsxs(La,{open:i,onClose:v,size:"xl",children:[s.jsx(Ba,{title:"Create New Bot",subtitle:UD(o),icon:s.jsx(xn,{className:"h-5 w-5 text-cachi-500"}),onClose:v,children:d.method&&s.jsx(bj,{steps:C,currentStep:o,completedSteps:c,variant:"compact",className:"mr-4"})}),s.jsx(Ua,{scrollable:!0,maxHeight:"max-h-[65vh]",children:z()}),s.jsxs(Ji,{leftContent:j?s.jsx(Kt,{variant:"ghost",onClick:g,children:"Back"}):null,children:[s.jsx(Kt,{variant:"ghost",onClick:v,children:"Cancel"}),E?s.jsx(Kt,{variant:"primary",onClick:y,disabled:!k()||f,children:"Create Bot"}):s.jsx(Kt,{variant:"primary",onClick:b,disabled:!k()||f,children:f?"Generating...":"Continue"})]})]})}function qD(){const{createBotOpen:e,setCreateBotOpen:n}=Rt(),{isOpen:r,open:i,close:o,reset:c}=Ut(),d=S.useRef(r);return S.useEffect(()=>{e&&!r?i():!e&&r&&(o(),setTimeout(c,200))},[e,r,i,o,c]),S.useEffect(()=>{d.current&&!r&&e&&n(!1),d.current=r},[r,e,n]),s.jsx(HD,{})}function ID(){const{settingsOpen:e,setSettingsOpen:n,showThinking:r,setShowThinking:i,showCost:o,setShowCost:c}=Rt(),{config:d,updateConfig:f}=A0(),{defaultModel:m,updateDefaultModel:h}=js();if(!e)return null;const b=async y=>{await h(y);try{await bu({model:y})}catch(k){console.error("Failed to update model:",k)}},g=async(y,k)=>{y==="showThinking"?i(k):c(k);try{await bu({[y==="showThinking"?"show_thinking":"show_cost"]:k})}catch(C){console.error("Failed to update setting:",C)}},v=async y=>{f({approveActions:y});try{await bu({approve_actions:y})}catch(k){console.error("Failed to update setting:",k)}};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:s.jsxs("div",{className:"w-full max-w-md rounded-xl bg-white p-6 shadow-xl dark:bg-zinc-900",children:[s.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Settings"}),s.jsx(sn,{variant:"ghost",size:"sm",onClick:()=>n(!1),children:s.jsx(bn,{className:"h-5 w-5"})})]}),s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Default Model"}),s.jsx(qo,{value:m,onChange:b,placeholder:"Select a model...",className:"w-full"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx(Xh,{label:"Show thinking",description:"Display the agent's reasoning process",checked:r,onChange:y=>g("showThinking",y)}),s.jsx(Xh,{label:"Show cost",description:"Display token usage and cost information",checked:o,onChange:y=>g("showCost",y)}),s.jsx(Xh,{label:"Require approval",description:"Ask for approval before executing risky operations",checked:(d==null?void 0:d.agent.approveActions)??!1,onChange:v})]}),d&&s.jsxs("div",{children:[s.jsx("label",{className:"mb-1 block text-sm font-medium",children:"Workspace"}),s.jsx("p",{className:"truncate text-sm text-zinc-500 dark:text-zinc-400",children:d.workspacePath})]})]})]})})}function Xh({label:e,description:n,checked:r,onChange:i}){return s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:e}),s.jsx("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:n})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>i(!r),className:ne("relative h-6 w-11 rounded-full transition-colors",r?"bg-cachi-600":"bg-zinc-200 dark:bg-zinc-700"),children:s.jsx("span",{className:ne("absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-white transition-transform",r&&"translate-x-5")})})]})}function PD({onApprove:e}){const[n,r]=S.useState(JA());if(S.useEffect(()=>KA(r),[]),!n)return null;const{id:i,tool:o,action:c,details:d}=n,f=d.riskLevel||"UNKNOWN",m=d.reasons||[],h=d.code,b=f==="HIGH"||f==="CRITICAL";return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"w-full max-w-lg rounded-xl bg-white shadow-xl dark:bg-zinc-900",children:[s.jsxs("div",{className:ne("flex items-center gap-3 rounded-t-xl px-6 py-4",b?"bg-red-50 dark:bg-red-900/20":"bg-amber-50 dark:bg-amber-900/20"),children:[s.jsx("div",{className:ne("flex h-10 w-10 items-center justify-center rounded-full",b?"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:s.jsx(Pu,{className:"h-5 w-5"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-semibold",children:"Approval Required"}),s.jsx("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:c})]})]}),s.jsxs("div",{className:"max-h-[60vh] overflow-y-auto p-6",children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"Tool"}),s.jsx("p",{className:"font-medium",children:o})]}),s.jsxs("div",{className:"mb-4",children:[s.jsx("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"Risk Level"}),s.jsxs("span",{className:ne("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:[s.jsx(Hr,{className:"h-3 w-3"}),f]})]}),m.length>0&&s.jsxs("div",{className:"mb-4",children:[s.jsx("p",{className:"mb-2 text-sm text-zinc-500 dark:text-zinc-400",children:"Risk Factors"}),s.jsx("ul",{className:"space-y-1",children:m.map((g,v)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[s.jsx("span",{className:"mt-1 h-1.5 w-1.5 flex-shrink-0 rounded-full bg-amber-500"}),g]},v))})]}),h&&s.jsxs("div",{children:[s.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-sm text-zinc-500 dark:text-zinc-400",children:[s.jsx(qa,{className:"h-4 w-4"}),"Code to Execute"]}),s.jsx("pre",{className:"max-h-48 overflow-auto rounded-lg bg-zinc-900 p-4 text-sm text-zinc-100",children:s.jsx("code",{children:h})})]})]}),s.jsxs("div",{className:"flex justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-800",children:[s.jsx(sn,{variant:"secondary",onClick:()=>e(i,!1),children:"Deny"}),s.jsx(sn,{variant:b?"danger":"primary",onClick:()=>e(i,!0),children:b?"Allow Anyway":"Approve"})]})]})})}function c1(){return s.jsxs("div",{className:"flex flex-col items-center py-8 text-center",children:[s.jsx("div",{className:"mb-6 flex h-20 w-20 items-center justify-center rounded-2xl bg-accent-600/20",children:s.jsx(ya,{className:"h-10 w-10 text-accent-500"})}),s.jsx("h2",{className:"text-2xl font-bold text-zinc-100",children:"Welcome to CachiBot"}),s.jsx("p",{className:"mt-2 max-w-md text-zinc-400",children:"Your security-focused AI agent platform. Let's get you set up in a few quick steps."}),s.jsxs("div",{className:"mt-8 grid w-full max-w-sm gap-3",children:[s.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-800 bg-zinc-800/50 p-3 text-left",children:[s.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-blue-500/20",children:s.jsx(fv,{className:"h-4 w-4 text-blue-400"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-zinc-200",children:"Connect a Provider"}),s.jsx("p",{className:"text-xs text-zinc-500",children:"Add an API key to get started"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-800 bg-zinc-800/50 p-3 text-left",children:[s.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-purple-500/20",children:s.jsx(xn,{className:"h-4 w-4 text-purple-400"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-zinc-200",children:"Pick a Model"}),s.jsx("p",{className:"text-xs text-zinc-500",children:"Choose your default AI model"})]})]}),s.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-zinc-800 bg-zinc-800/50 p-3 text-left",children:[s.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-orange-500/20",children:s.jsx(Mo,{className:"h-4 w-4 text-orange-400"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-zinc-200",children:"Personalize"}),s.jsx("p",{className:"text-xs text-zinc-500",children:"Set your theme and preferences"})]})]})]})]})}const FD=["openai","claude","google","groq"],uo={openai:"OpenAI",claude:"Anthropic / Claude",google:"Google AI",groq:"Groq"};function $D(){const{providers:e,refresh:n,update:r,remove:i}=Io(),{refresh:o}=js(),[c,d]=S.useState({}),[f,m]=S.useState(new Set),[h,b]=S.useState(null);S.useEffect(()=>{n()},[n]);const g=e.filter(z=>FD.includes(z.name)),v=g.filter(z=>z.configured).length,y=async z=>{const j=c[z];if(j!=null&&j.trim()){b(z);try{await r(z,j.trim()),d(E=>{const N={...E};return delete N[z],N}),m(E=>{const N=new Set(E);return N.delete(z),N}),o(),Re.success(`${uo[z]||z} key saved`)}catch{Re.error(`Failed to save ${uo[z]||z} key`)}finally{b(null)}}},k=async z=>{try{await i(z),d(j=>{const E={...j};return delete E[z],E}),o(),Re.success(`${uo[z]||z} key removed`)}catch{Re.error(`Failed to remove ${uo[z]||z} key`)}},C=z=>{m(j=>{const E=new Set(j);return E.has(z)?E.delete(z):E.add(z),E})};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-zinc-100",children:"Connect an AI Provider"}),s.jsxs("p",{className:"mt-1 text-sm text-zinc-400",children:["You need at least one API key to use CachiBot.",v>0&&s.jsxs("span",{className:"ml-1 text-green-400",children:[v," provider",v>1?"s":""," configured."]})]})]}),s.jsx("div",{className:"space-y-3",children:g.map(z=>{const j=c[z.name]??"",E=f.has(z.name),N=h===z.name,M=uo[z.name]||z.name;return s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h4",{className:"font-medium text-zinc-200",children:M}),s.jsx("span",{className:ne("inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium",z.configured?"bg-green-500/20 text-green-400":"bg-zinc-700 text-zinc-400"),children:z.configured?"Active":"Not set"})]}),z.configured&&s.jsx("button",{onClick:()=>k(z.name),className:"rounded p-1 text-zinc-400 transition-colors hover:bg-red-500/10 hover:text-red-400",title:"Remove key",children:s.jsx(Pt,{className:"h-4 w-4"})})]}),z.configured&&!(z.name in c)&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex-1 rounded-lg border border-zinc-700 bg-zinc-700/50 px-3 py-2 font-mono text-sm text-zinc-400",children:E?z.masked_value:z.masked_value.replace(/./g,"*").slice(0,20)+"****"}),s.jsx("button",{onClick:()=>C(z.name),className:"rounded p-2 text-zinc-400 transition-colors hover:bg-zinc-700 hover:text-zinc-300",children:E?s.jsx(Br,{className:"h-4 w-4"}):s.jsx(gs,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:E?"text":"password",value:j,onChange:R=>d(A=>({...A,[z.name]:R.target.value})),placeholder:z.configured?"Update API key...":"Enter API key...",className:"h-10 flex-1 rounded-lg border border-zinc-700 bg-zinc-800 px-3 font-mono text-sm text-zinc-100 outline-none transition-colors focus:border-accent-500"}),s.jsx("button",{onClick:()=>C(z.name),className:"rounded-lg border border-zinc-700 px-3 text-zinc-400 transition-colors hover:bg-zinc-700 hover:text-zinc-300",children:E?s.jsx(Br,{className:"h-4 w-4"}):s.jsx(gs,{className:"h-4 w-4"})}),s.jsxs("button",{onClick:()=>y(z.name),disabled:!j.trim()||N,className:"flex items-center gap-1.5 rounded-lg bg-accent-600 px-4 text-sm font-medium text-white transition-colors hover:bg-accent-500 disabled:cursor-not-allowed disabled:opacity-50",children:[N?s.jsx(Ge,{className:"h-4 w-4 animate-spin"}):s.jsx(Do,{className:"h-4 w-4"}),"Save"]})]})]},z.name)})}),s.jsx("p",{className:"text-xs text-zinc-500",children:"More providers available in Settings > API Keys after setup."})]})}function VD(){const{defaultModel:e,updateDefaultModel:n,refresh:r}=js();S.useEffect(()=>{r()},[r]);const i=async o=>{o&&await n(o)};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-zinc-100",children:"Choose a Default Model"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"This model will be used for new bots unless you specify a different one."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300",children:"Default Model"}),s.jsx(qo,{value:e,onChange:i,placeholder:"Select a model...",className:"w-full"})]}),e&&s.jsx("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 p-3",children:s.jsxs("p",{className:"text-sm text-green-400",children:["Selected: ",s.jsx("span",{className:"font-mono text-xs",children:e})]})}),s.jsx("p",{className:"text-xs text-zinc-500",children:"You can change this anytime in Settings > Models."})]})}const GD=[{value:"light",label:"Light",icon:wv},{value:"dark",label:"Dark",icon:xv},{value:"system",label:"System",icon:pv}],YD=Object.entries(Gu);function QD(){const{theme:e,setTheme:n,accentColor:r,setAccentColor:i,showThinking:o,setShowThinking:c,showCost:d,setShowCost:f}=Rt();return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-semibold text-zinc-100",children:"Personalize Your Experience"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-400",children:"Customize how CachiBot looks and feels."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300",children:"Color Theme"}),s.jsx("div",{className:"flex gap-2",children:GD.map(m=>s.jsxs("button",{onClick:()=>n(m.value),className:ne("flex flex-1 items-center justify-center gap-2 rounded-lg border py-3 transition-all",e===m.value?"border-accent-500 bg-accent-500/20 text-accent-400":"border-zinc-700 bg-zinc-800 text-zinc-300 hover:border-zinc-600"),children:[s.jsx(m.icon,{className:"h-4 w-4"}),m.label]},m.value))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300",children:"Accent Color"}),s.jsx("div",{className:"grid grid-cols-4 gap-2",children:YD.map(([m,{name:h,palette:b}])=>s.jsxs("button",{onClick:()=>i(m),className:ne("flex items-center gap-2 rounded-lg border p-3 transition-all",r===m?"border-2 ring-1 ring-offset-1 ring-offset-zinc-900":"border-zinc-700 hover:border-zinc-600"),style:{borderColor:r===m?b[500]:void 0,"--tw-ring-color":r===m?b[500]:void 0},children:[s.jsx("div",{className:"h-5 w-5 rounded-full",style:{backgroundColor:b[500]}}),s.jsx("span",{className:"text-sm text-zinc-300",children:h})]},m))})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300",children:"Display Options"}),s.jsx(u1,{label:"Show Thinking Process",description:"Display the AI's reasoning and thought process",checked:o,onChange:c}),s.jsx(u1,{label:"Show Token Costs",description:"Display estimated costs for API calls",checked:d,onChange:f})]})]})}function u1({label:e,description:n,checked:r,onChange:i}){return s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-zinc-800 bg-zinc-800/50 p-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium text-zinc-200",children:e}),s.jsx("p",{className:"text-xs text-zinc-500",children:n})]}),s.jsx("button",{onClick:()=>i(!r),className:ne("relative h-6 w-11 rounded-full transition-colors",r?"bg-accent-600":"bg-zinc-700"),children:s.jsx("span",{className:ne("absolute top-1 h-4 w-4 rounded-full bg-white transition-transform",r?"left-6":"left-1")})})]})}const XD={openai:"OpenAI",claude:"Anthropic / Claude",google:"Google AI",groq:"Groq",grok:"Grok (xAI)",openrouter:"OpenRouter",moonshot:"Moonshot",ollama:"Ollama",lmstudio:"LM Studio"};function JD(){const{providers:e}=Io(),{defaultModel:n}=js(),{theme:r,accentColor:i}=Rt(),o=e.filter(c=>c.configured).map(c=>XD[c.name]||c.name);return s.jsxs("div",{className:"flex flex-col items-center py-8 text-center",children:[s.jsx("div",{className:"mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-green-500/20",children:s.jsx(ln,{className:"h-10 w-10 text-green-400"})}),s.jsx("h2",{className:"text-2xl font-bold text-zinc-100",children:"You're All Set!"}),s.jsx("p",{className:"mt-2 max-w-md text-zinc-400",children:"CachiBot is configured and ready to use. Here's a summary of your setup:"}),s.jsxs("div",{className:"mt-6 w-full max-w-sm space-y-3 text-left",children:[o.length>0&&s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-3",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Providers"}),s.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:o.join(", ")})]}),n&&s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-3",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Default Model"}),s.jsx("p",{className:"mt-1 font-mono text-sm text-zinc-200",children:n})]}),s.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-800/50 p-3",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-zinc-500",children:"Appearance"}),s.jsxs("p",{className:"mt-1 text-sm text-zinc-200",children:[r.charAt(0).toUpperCase()+r.slice(1)," theme, ",i," accent"]})]})]}),s.jsxs("a",{href:"https://github.com/jhd3197/CachiBot",target:"_blank",rel:"noopener noreferrer",className:"mt-6 flex w-full max-w-sm items-center gap-3 rounded-lg border border-amber-500/20 bg-amber-500/10 p-3 transition-colors hover:bg-amber-500/20",children:[s.jsx(Yi,{className:"h-5 w-5 shrink-0 text-amber-400"}),s.jsxs("div",{className:"flex-1 text-left",children:[s.jsx("p",{className:"text-sm font-medium text-zinc-200",children:"Enjoying CachiBot?"}),s.jsx("p",{className:"text-xs text-zinc-400",children:"Star us on GitHub to show your support!"})]}),s.jsx(Hu,{className:"h-4 w-4 shrink-0 text-zinc-500"})]})]})}const KD=[{id:"welcome",label:"Welcome"},{id:"api-key",label:"API Key"},{id:"model",label:"Model"},{id:"preferences",label:"Style"},{id:"complete",label:"Done"}];function ZD(e){return{welcome:"Get started with CachiBot","api-key":"Connect an AI provider",model:"Choose your default model",preferences:"Personalize your experience",complete:"Setup complete"}[e]||""}function WD(){const{isOpen:e,currentStep:n,nextStep:r,prevStep:i,completeOnboarding:o,skipOnboarding:c}=Du(),{providers:d}=Io(),{defaultModel:f}=js(),m=Cm[n],h=Cm.slice(0,n),b=()=>{switch(m){case"api-key":return d.some(C=>C.configured);case"model":return f!=="";default:return!0}},g=()=>{switch(m){case"welcome":return s.jsx(c1,{});case"api-key":return s.jsx($D,{});case"model":return s.jsx(VD,{});case"preferences":return s.jsx(QD,{});case"complete":return s.jsx(JD,{});default:return s.jsx(c1,{})}},v=n===0,y=m==="complete",k=()=>{};return s.jsxs(La,{open:e,onClose:k,size:"xl",closeOnBackdrop:!1,closeOnEscape:!1,children:[s.jsx(Ba,{title:"Setup Wizard",subtitle:ZD(m),icon:s.jsx(vv,{className:"h-5 w-5 text-accent-500"}),onClose:k,children:s.jsx(bj,{steps:KD,currentStep:m,completedSteps:h,variant:"compact",className:"mr-4"})}),s.jsx(Ua,{scrollable:!0,maxHeight:"max-h-[65vh]",children:g()}),s.jsx(Ji,{leftContent:v?s.jsx("button",{onClick:c,className:"text-sm text-zinc-500 transition-colors hover:text-zinc-300",children:"Skip for now"}):s.jsx(Kt,{variant:"ghost",onClick:i,children:"Back"}),children:y?s.jsx(Kt,{variant:"primary",onClick:o,children:"Get Started"}):s.jsx(Kt,{variant:"primary",onClick:r,disabled:!b(),children:"Continue"})})]})}function d1({size:e="md",className:n}){return s.jsx("div",{className:ne("animate-spin rounded-full border-2 border-current border-t-transparent",{"h-4 w-4":e==="sm","h-6 w-6":e==="md","h-8 w-8":e==="lg"},n),children:s.jsx("span",{className:"sr-only",children:"Loading..."})})}function e9(){const{showDialog:e,closeDialog:n,checkResult:r,updateResult:i,isUpdating:o,isRestarting:c,optIntoBeta:d,performUpdate:f,restartServer:m,skipVersion:h,setOptIntoBeta:b}=ed();if(!e||!r)return null;const g=r.latest_stable||r.latest_prerelease;return c?s.jsxs(La,{open:!0,onClose:()=>{},closeOnBackdrop:!1,closeOnEscape:!1,size:"md",children:[s.jsx(Ba,{title:"Restarting CachiBot"}),s.jsx(Ua,{children:s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(d1,{size:"lg",className:"text-accent-500"}),s.jsx("p",{className:"text-sm text-zinc-400",children:"Waiting for the new server to come online..."})]})})]}):o?s.jsxs(La,{open:!0,onClose:()=>{},closeOnBackdrop:!1,closeOnEscape:!1,size:"md",children:[s.jsx(Ba,{title:"Updating CachiBot",icon:s.jsx(rm,{className:"h-5 w-5 text-accent-500"})}),s.jsx(Ua,{children:s.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[s.jsx(d1,{size:"lg",className:"text-accent-500"}),s.jsxs("p",{className:"text-sm text-zinc-400",children:["Installing CachiBot v",g,"..."]})]})})]}):i?s.jsxs(La,{open:!0,onClose:n,size:"md",children:[s.jsx(Ba,{title:i.success?"Update Complete":"Update Failed",icon:i.success?s.jsx(xs,{className:"h-5 w-5 text-green-500"}):s.jsx(rr,{className:"h-5 w-5 text-red-500"}),onClose:n}),s.jsx(Ua,{children:s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-sm text-zinc-300",children:i.message}),i.success&&s.jsxs("p",{className:"text-sm text-zinc-400",children:[i.old_version," → ",i.new_version]}),i.pip_output&&s.jsxs("details",{className:"mt-3",children:[s.jsx("summary",{className:"cursor-pointer text-xs text-zinc-500 hover:text-zinc-400",children:"Show pip output"}),s.jsx("pre",{className:"mt-2 max-h-40 overflow-auto rounded-lg bg-zinc-950 p-3 text-xs text-zinc-400",children:i.pip_output})]})]})}),s.jsx(Ji,{children:i.success?s.jsxs(s.Fragment,{children:[s.jsx(Kt,{variant:"secondary",onClick:n,children:"Later"}),s.jsx(Kt,{variant:"primary",onClick:m,children:"Restart now"})]}):s.jsx(Kt,{variant:"secondary",onClick:n,children:"Close"})})]}):s.jsxs(La,{open:!0,onClose:n,size:"lg",children:[s.jsx(Ba,{title:"Update Available",subtitle:`v${r.current_version} → v${g}`,icon:s.jsx(rm,{className:"h-5 w-5 text-accent-500"}),onClose:n}),s.jsx(Ua,{scrollable:!0,maxHeight:"max-h-[50vh]",children:s.jsxs("div",{className:"space-y-4",children:[r.is_docker&&s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-yellow-800/50 bg-yellow-900/20 p-3",children:[s.jsx(Hr,{className:"mt-0.5 h-4 w-4 shrink-0 text-yellow-500"}),s.jsx("p",{className:"text-sm text-yellow-300",children:"Running inside Docker. Auto-update is disabled — rebuild the container to update."})]}),r.release_notes&&s.jsxs("div",{children:[s.jsx("h3",{className:"mb-2 text-sm font-medium text-zinc-300",children:"Release Notes"}),s.jsx("div",{className:"rounded-lg border border-zinc-800 bg-zinc-950 p-4",children:s.jsx(fj,{content:r.release_notes})})]}),r.release_url&&s.jsxs("a",{href:r.release_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm text-accent-400 hover:text-accent-300",children:[s.jsx(Hu,{className:"h-3.5 w-3.5"}),"View on GitHub"]}),r.prerelease_available&&s.jsxs("label",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[s.jsx("input",{type:"checkbox",checked:d,onChange:v=>b(v.target.checked),className:"rounded border-zinc-600 bg-zinc-800 text-accent-600 focus:ring-accent-500"}),"Include pre-release / beta versions"]})]})}),s.jsxs(Ji,{leftContent:g&&s.jsx(Kt,{variant:"ghost",onClick:()=>h(g),children:"Skip this version"}),children:[s.jsx(Kt,{variant:"secondary",onClick:n,children:"Not now"}),s.jsx(Kt,{variant:"primary",onClick:()=>f(),disabled:r.is_docker,children:"Update now"})]})]})}function t9(){const{showBanner:e,checkResult:n,dismissBanner:r,openDialog:i}=ed();if(!e||!n)return null;const o=n.latest_stable||n.latest_prerelease;return s.jsxs("div",{className:"flex items-center justify-between gap-3 bg-accent-600/10 border-b border-accent-600/20 px-4 py-2 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2 text-accent-400",children:[s.jsx(rm,{className:"h-4 w-4 shrink-0"}),s.jsxs("span",{children:["CachiBot ",s.jsxs("strong",{children:["v",o]})," is available"," ",s.jsxs("span",{className:"text-zinc-400",children:["(current: v",n.current_version,")"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:i,className:"rounded-md bg-accent-600 px-3 py-1 text-xs font-medium text-white hover:bg-accent-500 transition-colors",children:"View update"}),s.jsx("button",{onClick:r,className:"rounded-md p-1 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200 transition-colors","aria-label":"Dismiss",children:s.jsx(bn,{className:"h-3.5 w-3.5"})})]})]})}const Jh={"/dashboard":"dashboard","/settings":"settings"};function n9(e){if(Jh[e])return Jh[e];for(const[n,r]of Object.entries(Jh))if(e.startsWith(n+"/"))return r;return null}function Tn(){const e=za(),n=Rn(),{botId:r,chatId:i,taskId:o}=D1(),{activeView:c,activeBotId:d,bots:f,setActiveBot:m,setActiveView:h}=Ot(),{activeChatId:b,chats:g,setActiveChat:v}=mn(),{setActiveTask:y}=Qi(),{theme:k,accentColor:C,mobileMenuOpen:z,setMobileMenuOpen:j}=Rt(),{setConfig:E}=A0(),{refresh:N}=js(),{providers:M,refresh:R}=Io(),{hasCompletedOnboarding:A,open:F}=Du(),ee=n9(e.pathname),L=e.pathname.split("/").filter(Boolean)[1],Y=L?{chats:"chats",tasks:"tasks",work:"work",schedules:"schedules",tools:"tools",settings:"settings"}[L]:null;S.useEffect(()=>{if(r&&r!==d)if(f.some(q=>q.id===r))m(r);else{n("/",{replace:!0});return}if(Y&&Y!==c&&h(Y),i&&i!==b){let _=g.find(q=>q.id===i);!_&&(i==="telegram"||i==="discord")&&(_=g.find(q=>q.platform===i&&q.botId===r)),_&&_.botId===r&&v(_.id)}o&&y(o)},[r,Y,i,o,f,g,d,b,c,m,h,v,y,n]),S.useEffect(()=>{const _=q=>{q?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")};if(k==="system"){const q=window.matchMedia("(prefers-color-scheme: dark)");_(q.matches);const B=V=>_(V.matches);return q.addEventListener("change",B),()=>q.removeEventListener("change",B)}else _(k==="dark")},[k]),S.useEffect(()=>{var q;const _=(q=Gu[C])==null?void 0:q.palette;if(_){const B=document.documentElement;Object.entries(_).forEach(([V,oe])=>{B.style.setProperty(`--accent-${V}`,oe)})}},[C]),S.useEffect(()=>{async function _(){try{const q=await Mv(),B={agent:{model:q.agent.model,maxIterations:q.agent.max_iterations,approveActions:q.agent.approve_actions,temperature:q.agent.temperature},sandbox:{allowedImports:q.sandbox.allowed_imports,timeoutSeconds:q.sandbox.timeout_seconds,maxOutputLength:q.sandbox.max_output_length},display:{showThinking:q.display.show_thinking,showCost:q.display.show_cost,style:q.display.style},workspacePath:q.workspace_path};E(B)}catch(q){console.error("Failed to load config:",q)}}_(),N(),R()},[E,N,R]),S.useEffect(()=>{if(A||M.length===0)return;M.some(q=>q.configured)?Du.getState().completeOnboarding():F()},[A,M,F]),S.useEffect(()=>{ed.getState().checkForUpdate()},[]);const me=()=>{if(ee)switch(ee){case"dashboard":return s.jsx(P7,{});case"settings":return s.jsx(J7,{})}switch(Y||c){case"chats":return s.jsx(t1,{});case"tasks":return s.jsx(oM,{});case"work":return s.jsx(uD,{});case"schedules":return s.jsx(hD,{});case"tools":return s.jsx(vM,{});case"settings":return s.jsx(O7,{});default:return s.jsx(t1,{})}};return s.jsxs("div",{className:"flex h-screen bg-zinc-100 text-zinc-900 dark:bg-zinc-950 dark:text-zinc-100",children:[z&&s.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>j(!1)}),s.jsx("div",{className:`
          fixed inset-y-0 left-0 z-50 transition-transform duration-300 lg:static lg:translate-x-0
          ${z?"translate-x-0":"-translate-x-full"}
        `,children:s.jsx(s3,{onNavigate:()=>j(!1)})}),!ee&&s.jsx("div",{className:`
            fixed inset-y-0 left-[72px] z-50 transition-transform duration-300 lg:static lg:translate-x-0
            ${z?"translate-x-0":"-translate-x-[calc(100%+72px)]"}
          `,children:s.jsx(c3,{onNavigate:()=>j(!1)})}),s.jsxs("main",{className:"flex flex-1 flex-col overflow-hidden",children:[s.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:[s.jsx("button",{onClick:()=>j(!z),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:z?s.jsx(bn,{className:"h-5 w-5"}):s.jsx(a4,{className:"h-5 w-5"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-accent-600",children:s.jsx("span",{className:"text-sm font-bold text-white",children:"C"})}),s.jsx("span",{className:"font-semibold text-zinc-900 dark:text-zinc-100",children:"CachiBot"})]})]}),s.jsx(t9,{}),me()]}),s.jsx(qD,{}),s.jsx(ID,{}),s.jsx(PD,{onApprove:()=>{}}),s.jsx(WD,{}),s.jsx(e9,{})]})}function a9(){const e=Rn(),{login:n,setSetupRequired:r,isLoading:i,setLoading:o}=yn(),[c,d]=S.useState(""),[f,m]=S.useState(""),[h,b]=S.useState(!1),[g,v]=S.useState(!1);S.useEffect(()=>{(async()=>{try{const{setup_required:C}=await n0();r(C),C&&e("/setup",{replace:!0})}catch(C){console.error("Failed to check setup status:",C)}finally{o(!1)}})()},[r,o,e]);const y=async k=>{if(k.preventDefault(),!c.trim()||!f){Re.error("Please enter your credentials");return}v(!0);try{const C=await b4({identifier:c.trim(),password:f});n(C.user,C.access_token,C.refresh_token),Re.success(`Welcome back, ${C.user.username}!`),e("/")}catch(C){const z=C instanceof Error?C.message:"Login failed";Re.error(z)}finally{v(!1)}};return i?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-accent-500"})}):s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950 px-4",children:s.jsxs("div",{className:"w-full max-w-md",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.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:s.jsx(Na,{className:"h-8 w-8 text-white"})}),s.jsx("h1",{className:"text-2xl font-bold text-zinc-900 dark:text-white",children:"CachiBot"}),s.jsx("p",{className:"text-zinc-500 dark:text-zinc-400 mt-1",children:"Sign in to continue"})]}),s.jsx("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-6 shadow-sm",children:s.jsxs("form",{onSubmit:y,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"identifier",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Email or Username"}),s.jsx("input",{id:"identifier",type:"text",value:c,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})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"loginPassword",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Password"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{id:"loginPassword",type:h?"text":"password",value:f,onChange:k=>m(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}),s.jsx("button",{type:"button",onClick:()=>b(!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?s.jsx(Br,{className:"h-4 w-4"}):s.jsx(gs,{className:"h-4 w-4"})})]})]}),s.jsx(sn,{type:"submit",className:"w-full justify-center",disabled:g,children:g?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"h-4 w-4 animate-spin mr-2"}),"Signing in..."]}):"Sign In"})]})}),s.jsx("p",{className:"text-center text-zinc-500 text-sm mt-6",children:"The Armored AI Agent"})]})})}function s9(){const e=Rn(),{login:n,setSetupRequired:r,isLoading:i,setLoading:o}=yn(),[c,d]=S.useState(""),[f,m]=S.useState(""),[h,b]=S.useState(""),[g,v]=S.useState(""),[y,k]=S.useState(!1),[C,z]=S.useState(!1),[j,E]=S.useState(null);S.useEffect(()=>{(async()=>{try{const{setup_required:R}=await n0();r(R),E(R),R||e("/login",{replace:!0})}catch(R){console.error("Failed to check setup status:",R),Re.error("Failed to check setup status")}finally{o(!1)}})()},[r,o,e]);const N=async M=>{if(M.preventDefault(),!c.trim()||!f.trim()||!h){Re.error("Please fill in all fields");return}if(h!==g){Re.error("Passwords do not match");return}if(h.length<8){Re.error("Password must be at least 8 characters");return}if(f.length<3){Re.error("Username must be at least 3 characters");return}z(!0);try{const R=await g4({email:c.trim().toLowerCase(),username:f.trim().toLowerCase(),password:h});n(R.user,R.access_token,R.refresh_token),Re.success("Admin account created successfully!"),e("/")}catch(R){const A=R instanceof Error?R.message:"Setup failed";Re.error(A)}finally{z(!1)}};return i||j===null?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-accent-500"})}):s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950 px-4",children:s.jsxs("div",{className:"w-full max-w-md",children:[s.jsxs("div",{className:"text-center mb-8",children:[s.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:s.jsx(Na,{className:"h-8 w-8 text-white"})}),s.jsx("h1",{className:"text-2xl font-bold text-zinc-900 dark:text-white",children:"CachiBot Setup"}),s.jsx("p",{className:"text-zinc-500 dark:text-zinc-400 mt-1",children:"Create your admin account to get started"})]}),s.jsx("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-6 shadow-sm",children:s.jsxs("form",{onSubmit:N,className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4 p-3 bg-blue-500/10 rounded-lg border border-blue-500/20",children:[s.jsx(e0,{className:"h-5 w-5 text-blue-400 flex-shrink-0"}),s.jsx("p",{className:"text-sm text-blue-300",children:"Welcome! Set up your admin account to start using CachiBot."})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),s.jsx("input",{id:"email",type:"email",value:c,onChange:M=>d(M.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})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),s.jsx("input",{id:"username",type:"text",value:f,onChange:M=>m(M.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})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Password"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{id:"password",type:y?"text":"password",value:h,onChange:M=>b(M.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}),s.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?s.jsx(Br,{className:"h-4 w-4"}):s.jsx(gs,{className:"h-4 w-4"})})]})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Confirm Password"}),s.jsx("input",{id:"confirmPassword",type:y?"text":"password",value:g,onChange:M=>v(M.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})]}),s.jsx(sn,{type:"submit",className:"w-full justify-center",disabled:C,children:C?s.jsxs(s.Fragment,{children:[s.jsx(Ge,{className:"h-4 w-4 animate-spin mr-2"}),"Creating account..."]}):s.jsxs(s.Fragment,{children:["Create Admin Account",s.jsx(X1,{className:"h-4 w-4 ml-2"})]})})]})}),s.jsx("p",{className:"text-center text-zinc-500 text-sm mt-6",children:"The Armored AI Agent"})]})})}function fn({children:e,requireAdmin:n=!1}){const r=za(),{isAuthenticated:i,isLoading:o,user:c,setupRequired:d,setUser:f,setSetupRequired:m,setLoading:h,logout:b}=yn(),[g,v]=S.useState(!1);return S.useEffect(()=>{(async()=>{if(d===null)try{const{setup_required:k}=await n0();if(m(k),k){h(!1),v(!0);return}}catch{m(!1)}if(i)try{const k=await v4();f(k)}catch{b()}h(!1),v(!0)})()},[i,d,f,m,h,b]),o||!g?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-100 dark:bg-zinc-950",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-accent-500"})}):d?s.jsx(pu,{to:"/setup",state:{from:r},replace:!0}):i?n&&(c==null?void 0:c.role)!=="admin"?s.jsx(pu,{to:"/",replace:!0}):s.jsx(s.Fragment,{children:e}):s.jsx(pu,{to:"/login",state:{from:r},replace:!0})}function r9(){const e=Rn(),{user:n}=yn(),[r,i]=S.useState([]),[o,c]=S.useState(!0),[d,f]=S.useState(0),[m,h]=S.useState(!1),[b,g]=S.useState({email:"",username:"",password:"",role:"user"}),[v,y]=S.useState(!1),[k,C]=S.useState(null),[z,j]=S.useState({email:"",username:"",role:"user"}),[E,N]=S.useState(!1),[M,R]=S.useState(null);S.useEffect(()=>{A()},[]);const A=async()=>{try{const P=await Sv();i(P.users),f(P.total)}catch{Re.error("Failed to load users")}finally{c(!1)}},F=async P=>{if(P.preventDefault(),!b.email||!b.username||!b.password){Re.error("All fields are required");return}if(b.password.length<8){Re.error("Password must be at least 8 characters");return}y(!0);try{const Y=await Cv(b);i([Y,...r]),f(d+1),h(!1),g({email:"",username:"",password:"",role:"user"}),Re.success("User created successfully")}catch(Y){const me=Y instanceof Error?Y.message:"Failed to create user";Re.error(me)}finally{y(!1)}},ee=async P=>{if(P.preventDefault(),!!k){N(!0);try{const Y=await Ev(k.id,z);i(r.map(me=>me.id===Y.id?Y:me)),C(null),Re.success("User updated successfully")}catch(Y){const me=Y instanceof Error?Y.message:"Failed to update user";Re.error(me)}finally{N(!1)}}},Z=async P=>{if(confirm("Are you sure you want to deactivate this user?")){try{await Tv(P),i(r.map(Y=>Y.id===P?{...Y,is_active:!1}:Y)),Re.success("User deactivated")}catch(Y){const me=Y instanceof Error?Y.message:"Failed to deactivate user";Re.error(me)}R(null)}},L=P=>{C(P),j({email:P.email,username:P.username,role:P.role}),R(null)};return o?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-zinc-950",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-blue-500"})}):s.jsxs("div",{className:"min-h-screen bg-zinc-950 text-white",children:[s.jsx("header",{className:"sticky top-0 z-10 bg-zinc-950/80 backdrop-blur-sm border-b border-zinc-800",children:s.jsxs("div",{className:"max-w-5xl mx-auto px-4 py-4 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{onClick:()=>e("/"),className:"p-2 hover:bg-zinc-800 rounded-lg transition-colors",children:s.jsx(A5,{className:"h-5 w-5"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(t0,{className:"h-5 w-5 text-blue-400"}),s.jsx("h1",{className:"text-lg font-semibold",children:"User Management"})]})]}),s.jsxs(sn,{onClick:()=>h(!0),children:[s.jsx(e0,{className:"h-4 w-4 mr-2"}),"Add User"]})]})}),s.jsxs("main",{className:"max-w-5xl mx-auto px-4 py-6",children:[s.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 overflow-hidden",children:[s.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:[s.jsx("div",{children:"User"}),s.jsx("div",{children:"Email"}),s.jsx("div",{children:"Role"}),s.jsx("div",{children:"Status"}),s.jsx("div",{})]}),r.length===0?s.jsx("div",{className:"px-4 py-8 text-center text-zinc-500",children:"No users found"}):r.map(P=>s.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:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-zinc-700 flex items-center justify-center",children:s.jsx(Nu,{className:"h-4 w-4 text-zinc-400"})}),s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:P.username}),P.id===(n==null?void 0:n.id)&&s.jsx("div",{className:"text-xs text-blue-400",children:"You"})]})]}),s.jsx("div",{className:"text-zinc-400 truncate",children:P.email}),s.jsx("div",{children:s.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${P.role==="admin"?"bg-purple-500/20 text-purple-300":"bg-zinc-700 text-zinc-300"}`,children:[P.role==="admin"?s.jsx(Na,{className:"h-3 w-3"}):s.jsx(Lo,{className:"h-3 w-3"}),P.role]})}),s.jsx("div",{children:s.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${P.is_active?"bg-green-500/20 text-green-300":"bg-red-500/20 text-red-300"}`,children:[P.is_active?s.jsx(ln,{className:"h-3 w-3"}):s.jsx(bn,{className:"h-3 w-3"}),P.is_active?"Active":"Inactive"]})}),s.jsxs("div",{className:"relative",children:[s.jsx("button",{onClick:()=>R(M===P.id?null:P.id),className:"p-1.5 hover:bg-zinc-700 rounded transition-colors",disabled:P.id===(n==null?void 0:n.id),children:s.jsx(nv,{className:"h-4 w-4 text-zinc-400"})}),M===P.id&&s.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:[s.jsx("button",{onClick:()=>L(P),className:"w-full px-3 py-2 text-left text-sm hover:bg-zinc-700 transition-colors",children:"Edit User"}),P.is_active&&s.jsx("button",{onClick:()=>Z(P.id),className:"w-full px-3 py-2 text-left text-sm text-red-400 hover:bg-zinc-700 transition-colors",children:"Deactivate"})]})]})]},P.id))]}),s.jsxs("p",{className:"text-sm text-zinc-500 mt-4 text-center",children:[d," user",d!==1?"s":""," total"]})]}),m&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 p-6 w-full max-w-md mx-4",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Create New User"}),s.jsxs("form",{onSubmit:F,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),s.jsxs("div",{className:"relative",children:[s.jsx(mv,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),s.jsx("input",{type:"email",value:b.email,onChange:P=>g({...b,email:P.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})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),s.jsxs("div",{className:"relative",children:[s.jsx(Nu,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-500"}),s.jsx("input",{type:"text",value:b.username,onChange:P=>g({...b,username:P.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})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Password"}),s.jsx("input",{type:"password",value:b.password,onChange:P=>g({...b,password:P.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"})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Role"}),s.jsxs("select",{value:b.role,onChange:P=>g({...b,role:P.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:[s.jsx("option",{value:"user",children:"User"}),s.jsx("option",{value:"admin",children:"Admin"})]})]}),s.jsxs("div",{className:"flex gap-3 pt-2",children:[s.jsx(sn,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>h(!1),children:"Cancel"}),s.jsx(sn,{type:"submit",className:"flex-1",disabled:v,children:v?s.jsx(Ge,{className:"h-4 w-4 animate-spin"}):"Create User"})]})]})]})}),k&&s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:s.jsxs("div",{className:"bg-zinc-900 rounded-xl border border-zinc-800 p-6 w-full max-w-md mx-4",children:[s.jsx("h2",{className:"text-lg font-semibold mb-4",children:"Edit User"}),s.jsxs("form",{onSubmit:ee,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Email"}),s.jsx("input",{type:"email",value:z.email,onChange:P=>j({...z,email:P.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})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Username"}),s.jsx("input",{type:"text",value:z.username,onChange:P=>j({...z,username:P.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})]}),s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-zinc-300 mb-1.5",children:"Role"}),s.jsxs("select",{value:z.role,onChange:P=>j({...z,role:P.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:[s.jsx("option",{value:"user",children:"User"}),s.jsx("option",{value:"admin",children:"Admin"})]})]}),s.jsxs("div",{className:"flex gap-3 pt-2",children:[s.jsx(sn,{type:"button",variant:"ghost",className:"flex-1",onClick:()=>C(null),children:"Cancel"}),s.jsx(sn,{type:"submit",className:"flex-1",disabled:E,children:E?s.jsx(Ge,{className:"h-4 w-4 animate-spin"}):"Save Changes"})]})]})]})}),M&&s.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>R(null)})]})}function i9(){const{theme:e}=Rt();return S.useEffect(()=>{const n=document.documentElement;e==="dark"||e==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches?n.classList.add("dark"):n.classList.remove("dark")},[e]),s.jsxs(FN,{children:[s.jsx(Bt,{path:"/login",element:s.jsx(a9,{})}),s.jsx(Bt,{path:"/setup",element:s.jsx(s9,{})}),s.jsx(Bt,{path:"/dashboard",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/settings",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/settings/:settingsTab",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/users",element:s.jsx(fn,{requireAdmin:!0,children:s.jsx(r9,{})})}),s.jsx(Bt,{path:"/:botId/chats",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/chats/:chatId",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/tasks",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/tasks/:taskId",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/work",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/work/:workId",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/schedules",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/schedules/:scheduleId",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/tools",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/:botId/settings",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"/",element:s.jsx(fn,{children:s.jsx(Tn,{})})}),s.jsx(Bt,{path:"*",element:s.jsx(pu,{to:"/",replace:!0})})]})}const l9=new Jk({defaultOptions:{queries:{staleTime:1e3*60,retry:1}}});Gz.createRoot(document.getElementById("root")).render(s.jsx(S.StrictMode,{children:s.jsx(hk,{children:s.jsxs(Zk,{client:l9,children:[s.jsx(i9,{}),s.jsx(k5,{position:"bottom-right",richColors:!0})]})})}));
